changeset 31fdcdd723b3 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset&node=31fdcdd723b3
description:
        Use data res_id instead of modifying action domain

        issue10471
        review358151003
diffstat:

 fiscalyear.py    |  11 ++++-------
 move.py          |   3 +--
 move_template.py |   3 +--
 3 files changed, 6 insertions(+), 11 deletions(-)

diffs (52 lines):

diff -r bcd7f3137a32 -r 31fdcdd723b3 fiscalyear.py
--- a/fiscalyear.py     Fri May 21 00:26:44 2021 +0200
+++ b/fiscalyear.py     Sun Jun 06 09:37:26 2021 +0200
@@ -460,11 +460,9 @@
         return move
 
     def do_balance(self, action):
-        self.create_move()
-        action['pyson_domain'] = PYSONEncoder().encode([
-                ('move.origin', '=', str(self.start.fiscalyear)),
-                ])
-        return action, {}
+        move = self.create_move()
+        action['views'].reverse()
+        return action, {'res_id': move.id}
 
 
 class CreatePeriodsStart(ModelView):
@@ -635,6 +633,5 @@
 
     def do_create_(self, action):
         fiscalyear = self.create_fiscalyear()
-        action['res_id'] = [fiscalyear.id]
         action['views'].reverse()
-        return action, {}
+        return action, {'res_id': fiscalyear.id}
diff -r bcd7f3137a32 -r 31fdcdd723b3 move.py
--- a/move.py   Fri May 21 00:26:44 2021 +0200
+++ b/move.py   Sun Jun 06 09:37:26 2021 +0200
@@ -1963,8 +1963,7 @@
 
     def do_group(self, action):
         move, balance_line = self._group_lines(self.records)
-        action['res_id'] = [move.id]
-        return action, {}
+        return action, {'res_id': move.id}
 
     def _group_lines(self, lines, date=None):
         move, balance_line = self.group_lines(lines, self.start.journal, date)
diff -r bcd7f3137a32 -r 31fdcdd723b3 move_template.py
--- a/move_template.py  Fri May 21 00:26:44 2021 +0200
+++ b/move_template.py  Sun Jun 06 09:37:26 2021 +0200
@@ -342,8 +342,7 @@
 
     def do_open_(self, action):
         move = self.create_move()
-        action['res_id'] = [move.id]
-        return action, {}
+        return action, {'res_id': move.id}
 
     def end(self):
         if self.model and self.model.__name__ == 'account.move.line':

Reply via email to