From 07ece3d6f717e27a045fe38a719764326c8a5c49 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 --- account_asset_management/account_move.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/account_asset_management/account_move.py b/account_asset_management/account_move.py index db85fc71e..1c65de728 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_AFFETCS_ASSET_MOVE = ['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(set(FIELDS_AFFETCS_ASSET_MOVE)): if isinstance(ids, (int, long)): ids = [ids] depr_obj = self.pool.get('account.asset.depreciation.line')