Use selection list from move for move state on line

issue10110
review347561002
This commit is contained in:
Cédric Krier committed 2021-02-25 21:17:23 +01:00
1 parent 090bd71989
commit 6b356fd516
1 file changed
+9 -5
+9 -5
View File
@@ -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: