From 252d6dee7bf7f0ce3ceed355a3c3b4131afca1d1 Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Thu, 10 Sep 2015 14:14:37 +0200 Subject: [PATCH] [IMP][account_constraints] Add a method that returns a list of fields that can be written directly on journal items instead of have a static list in _authorized_reconcile method --- account_constraints/model/account_move_line.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/account_constraints/model/account_move_line.py b/account_constraints/model/account_move_line.py index 78ed280f1..278289d3d 100644 --- a/account_constraints/model/account_move_line.py +++ b/account_constraints/model/account_move_line.py @@ -24,6 +24,12 @@ from openerp import models, api, exceptions, _ class AccountMoveLine(models.Model): _inherit = 'account.move.line' + @api.model + def _get_write_authorized_fields(self): + """ This method can be overrride to add some field that can be written + directly on account move line """ + return ["reconcile_id", "reconcile_partial_id"] + @api.multi def _authorized_reconcile(self, vals): """ Check if only reconcile_id and/or reconcile_partial_id are altered. @@ -33,7 +39,7 @@ class AccountMoveLine(models.Model): """ if not vals: return False - rec_keys = set(["reconcile_id", "reconcile_partial_id"]) + rec_keys = set(self._get_write_authorized_fields()) write_keys = set(vals) return rec_keys.issuperset(write_keys)