Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
1ec1d885 by Cédric Krier at 2023-07-19T18:15:18+02:00
Post delegated move at the end of the action

Other modules may want to alter the delegated move so we must post it once it
is no more accessible to other modules.

Closes #12416
- - - - -


1 changed file:

- modules/account/move.py


Changes:

=====================================
modules/account/move.py
=====================================
@@ -2987,6 +2987,8 @@
 
     def do_delegate(self, action):
         move = self._delegate_lines(self.records, self.start.party)
+        if all(l.move.state == 'posted' for l in self.records):
+            move.post()
         return action, {'res_id': move.id}
 
     def _delegate_lines(self, lines, party, date=None):
@@ -3004,9 +3006,6 @@
             lines, party, journal, date=date)
         move.save()
         Line.save(counterpart + delegated)
-        if all(l.move.state == 'posted' for l in lines):
-            move.post()
-
         for line, cline, dline in zip(lines, counterpart, delegated):
             Line.reconcile([line, cline], delegate_to=dline)
         return move



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/1ec1d88500c5efd047a828e6e9c24e79ff025489

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/1ec1d88500c5efd047a828e6e9c24e79ff025489
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to