changeset 7eb1044c5f15 in modules/analytic_account:5.0
details: 
https://hg.tryton.org/modules/analytic_account?cmd=changeset;node=7eb1044c5f15
description:
        Ensure to set a stored account as root

        issue9287
        review327081002
        (grafted from 8f96dfee5fa8cbe064e3b6e732f79ec0b1963a9a)
diffstat:

 account.py |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (16 lines):

diff -r dcfc2ba3fe9e -r 7eb1044c5f15 account.py
--- a/account.py        Sat Apr 04 17:50:05 2020 +0200
+++ b/account.py        Sun May 03 14:37:58 2020 +0200
@@ -169,9 +169,10 @@
         return 2
 
     @fields.depends('parent', 'type',
-        '_parent_parent.root', '_parent_parent.type')
+        '_parent_parent.id', '_parent_parent.root', '_parent_parent.type')
     def on_change_parent(self):
-        if self.parent and self.type != 'root':
+        if (self.parent and self.parent.id is not None and self.parent.id > 0
+                and self.type != 'root'):
             if self.parent.type == 'root':
                 self.root = self.parent
             else:

Reply via email to