def get_defaults(self): '''specifies the defaults for this sobject''' # use the naming the generate the next code from naming import AssetCodeNaming naming = AssetCodeNaming() asset_code = naming.get_next_code(self) defaults = super(Asset, self).get_defaults() defaults.update({"asset_type": "asset", 'code': asset_code}) return defaults
def get_defaults(my): '''specifies the defaults for this sobject''' # use the naming the generate the next code from naming import AssetCodeNaming naming = AssetCodeNaming() asset_code = naming.get_next_code(my) defaults = super(Asset, my).get_defaults() defaults.update({ "asset_type": "asset", 'code': asset_code }) return defaults
def create_with_autocode(cls, name, asset_library, description, asset_type="asset"): # create the new asset asset = SObjectFactory.create( cls.SEARCH_TYPE ) asset.set_value("name",name) asset.set_value("asset_library",asset_library) asset.set_value("description",description) asset.set_value("asset_type",asset_type) # use the naming the generate the next code from naming import AssetCodeNaming naming = AssetCodeNaming() asset_code = naming.get_next_code(asset) asset.set_value("code",asset_code) asset.commit() return asset
def create_with_autocode(cls, name, asset_library, description, asset_type="asset"): # create the new asset asset = SObjectFactory.create(cls.SEARCH_TYPE) asset.set_value("name", name) asset.set_value("asset_library", asset_library) asset.set_value("description", description) asset.set_value("asset_type", asset_type) # use the naming the generate the next code from naming import AssetCodeNaming naming = AssetCodeNaming() asset_code = naming.get_next_code(asset) asset.set_value("code", asset_code) asset.commit() return asset