From b963cc17ee7a05acb4b90e153df06ec92940488f Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Fri, 29 May 2015 08:02:10 +0200 Subject: [PATCH] [IMP][account_asset_management] Define a list of move's fields that can't be modified if a move is linked with a depriciation line [IMP][account_asset_management] Define FIELDS_AFFETCS_ASSET_MOVE as a set directly --- account_asset_management/README.rst | 64 ++++++++++++++++++++++++ account_asset_management/__openerp__.py | 30 ----------- account_asset_management/account_move.py | 6 ++- 3 files changed, 69 insertions(+), 31 deletions(-) create mode 100644 account_asset_management/README.rst diff --git a/account_asset_management/README.rst b/account_asset_management/README.rst new file mode 100644 index 00000000..6d9bc3a4 --- /dev/null +++ b/account_asset_management/README.rst @@ -0,0 +1,64 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Financial asset management. +=========================== + +This Module manages the assets owned by a company. It will keep +track of depreciation's occurred on those assets. And it allows to create +accounting entries from the depreciation lines. + +The full asset life-cycle is managed (from asset creation to asset removal). + +Assets can be created manually as well as automatically +(via the creation of an accounting entry on the asset account). + +Excel based reporting is available via the 'account_asset_management_xls' module. + +The module contains a large number of functional enhancements compared to +the standard account_asset module from Odoo. + +Configuration +============= + +It is recommended to configure your Purchase Journal with "Group Invoice Lines" to avoid the +creation of separate assets per Supplier Invoice Line. + +Known issues +============ + +The module in NOT compatible with the standard account_asset module. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + +Credits +======= + +Contributors +------------ +- OpenERP SA +- Luc De Meyer (Noviat) +- Frédéric Clementi (camptocamp) +- Florian Dacosta (Akretion) +- Stéphane Bidoul (Acsone) + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. \ No newline at end of file diff --git a/account_asset_management/__openerp__.py b/account_asset_management/__openerp__.py index 16920f52..28ee6ddd 100644 --- a/account_asset_management/__openerp__.py +++ b/account_asset_management/__openerp__.py @@ -26,35 +26,6 @@ 'depends': ['account'], 'conflicts': ['account_asset'], 'author': "OpenERP & Noviat,Odoo Community Association (OCA)", - 'description': """ -Financial asset management. -=========================== - -This Module manages the assets owned by a company. It will keep -track of depreciation's occurred on those assets. And it allows to create -accounting entries from the depreciation lines. - -The full asset life-cycle is managed (from asset creation to asset removal). - -Assets can be created manually as well as automatically -(via the creation of an accounting entry on the asset account). - -Excel based reporting is available via the 'account_asset_management_xls' -module (cf. http://odoo.apps.com). - -The module contains a large number of functional enhancements compared to -the standard account_asset module from OpenERP/Odoo. - -The module in NOT compatible with the standard account_asset module. - -Contributors ------------- -- OpenERP SA -- Luc De Meyer (Noviat) -- Frédéric Clementi (camptocamp) -- Florian Dacosta (Akretion) -- Stéphane Bidoul (Acsone) - """, 'website': 'http://www.noviat.com', 'category': 'Accounting & Finance', 'sequence': 32, @@ -79,4 +50,3 @@ Contributors 'installable': True, 'application': True, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/account_asset_management/account_move.py b/account_asset_management/account_move.py index db85fc71..4fbc7fe1 100644 --- a/account_asset_management/account_move.py +++ b/account_asset_management/account_move.py @@ -26,6 +26,10 @@ from openerp.tools.translate import _ import logging _logger = logging.getLogger(__name__) +# List of move's fields that can't be modified if move is linked +# with a depreciation line +FIELDS_AFFECTS_ASSET_MOVE = set(['period_id', 'journal_id', 'date']) + class account_move(orm.Model): _inherit = 'account.move' @@ -51,7 +55,7 @@ class account_move(orm.Model): cr, uid, ids, context=context, check=check) def write(self, cr, uid, ids, vals, context=None): - if vals: + if set(vals).intersection(FIELDS_AFFECTS_ASSET_MOVE): if isinstance(ids, (int, long)): ids = [ids] depr_obj = self.pool.get('account.asset.depreciation.line')