예제 #1
0
    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
예제 #2
0
파일: asset.py 프로젝트: 0-T-0/TACTIC
    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
예제 #3
0
파일: asset.py 프로젝트: 0-T-0/TACTIC
    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
예제 #4
0
    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