changeset f96c96c62f50 in modules/account:6.2
details: https://hg.tryton.org/modules/account?cmd=changeset&node=f96c96c62f50
description:
        Do not reset period or date if changed fill is empty

        issue11035
        review370401002
        (grafted from d471d45ddc0596f28cbefcf4830db73c60b918cd)
diffstat:

 account.py |  26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diffs (54 lines):

diff -r a00817d3e156 -r f96c96c62f50 account.py
--- a/account.py        Thu Dec 16 22:35:46 2021 +0100
+++ b/account.py        Thu Dec 16 22:39:44 2021 +0100
@@ -1826,7 +1826,7 @@
                 ()),
             ],
         states={
-            'invisible': (Eval('start_period', 'False')
+            'invisible': (Eval('start_period', False)
                 | Eval('end_period', False)),
             },
         depends=['to_date', 'start_period', 'end_period'])
@@ -1837,7 +1837,7 @@
                 ()),
             ],
         states={
-            'invisible': (Eval('start_period', 'False')
+            'invisible': (Eval('start_period', False)
                 | Eval('end_period', False)),
             },
         depends=['from_date', 'start_period', 'end_period'])
@@ -1897,17 +1897,25 @@
                 and self.end_period.fiscalyear != self.fiscalyear):
             self.end_period = None
 
+    @fields.depends('start_period')
     def on_change_start_period(self):
-        self.from_date = self.to_date = None
-
+        if self.start_period:
+            self.from_date = self.to_date = None
+
+    @fields.depends('end_period')
     def on_change_end_period(self):
-        self.from_date = self.to_date = None
-
+        if self.end_period:
+            self.from_date = self.to_date = None
+
+    @fields.depends('from_date')
     def on_change_from_date(self):
-        self.start_period = self.end_period = None
-
+        if self.from_date:
+            self.start_period = self.end_period = None
+
+    @fields.depends('to_date')
     def on_change_to_date(self):
-        self.start_period = self.end_period = None
+        if self.to_date:
+            self.start_period = self.end_period = None
 
 
 class GeneralLedgerAccountParty(_GeneralLedgerAccount):

Reply via email to