From 6b356fd516dd1b7a67eec27cbd84aaad770869d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 25 Feb 2021 21:17:23 +0100 Subject: [PATCH] Use selection list from move for move state on line issue10110 review347561002 --- move.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/move.py b/move.py index fefc135005..b29351b7cb 100644 --- a/move.py +++ b/move.py @@ -677,11 +677,9 @@ class Line(ModelSQL, ModelView): 'account.move.reconciliation', 'delegate_to', "Reconciliations Delegated", readonly=True) tax_lines = fields.One2Many('account.tax.line', 'move_line', 'Tax Lines') - move_state = fields.Function(fields.Selection([ - ('draft', 'Draft'), - ('posted', 'Posted'), - ], 'Move State'), 'on_change_with_move_state', - searcher='search_move_field') + move_state = fields.Function( + fields.Selection('get_move_states', "Move State"), + 'on_change_with_move_state', searcher='search_move_field') currency = fields.Function(fields.Many2One( 'currency.currency', "Currency"), 'on_change_with_currency') currency_digits = fields.Function(fields.Integer('Currency Digits'), @@ -910,6 +908,12 @@ class Line(ModelSQL, ModelView): name = name[5:] return [('move.' + name + nested,) + tuple(clause[1:])] + @classmethod + def get_move_states(cls): + pool = Pool() + Move = pool.get('account.move') + return Move.fields_get(['state'])['state']['selection'] + @fields.depends('move', '_parent_move.state') def on_change_with_move_state(self, name=None): if self.move: