changeset 10cfc59613e8 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset;node=10cfc59613e8
description:
        Use selection list from move for move state on line

        issue10110
        review347561002
diffstat:

 move.py |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (31 lines):

diff -r 03b0175f1598 -r 10cfc59613e8 move.py
--- a/move.py   Sun Feb 21 19:19:26 2021 +0100
+++ b/move.py   Thu Feb 25 21:17:23 2021 +0100
@@ -677,11 +677,9 @@
         '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 @@
             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:

Reply via email to