changeset 05b503f6fc11 in modules/analytic_account:5.4
details: 
https://hg.tryton.org/modules/analytic_account?cmd=changeset;node=05b503f6fc11
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 4fd8afdc72fe -r 05b503f6fc11 account.py
--- a/account.py        Sat Apr 04 16:33:20 2020 +0200
+++ b/account.py        Sun May 03 14:37:58 2020 +0200
@@ -153,9 +153,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