mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[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
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user