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

        issue9287
        review327081002
diffstat:

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

diffs (16 lines):

diff -r adbc49a52b91 -r 8f96dfee5fa8 account.py
--- a/account.py        Sat May 02 10:29:23 2020 +0200
+++ b/account.py        Sun May 03 14:37:58 2020 +0200
@@ -149,9 +149,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