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

        issue11035
        review370401002
        (grafted from d471d45ddc0596f28cbefcf4830db73c60b918cd)
diffstat:

 account.py |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r 9a3f7878f6fd -r 39b64965a4cf account.py
--- a/account.py        Thu Dec 16 22:35:46 2021 +0100
+++ b/account.py        Thu Dec 16 22:39:44 2021 +0100
@@ -1514,7 +1514,7 @@
                 ()),
             ],
         states={
-            'invisible': (Eval('start_period', 'False')
+            'invisible': (Eval('start_period', False)
                 | Eval('end_period', False)),
             },
         depends=['to_date', 'start_period', 'end_period'])
@@ -1525,7 +1525,7 @@
                 ()),
             ],
         states={
-            'invisible': (Eval('start_period', 'False')
+            'invisible': (Eval('start_period', False)
                 | Eval('end_period', False)),
             },
         depends=['from_date', 'start_period', 'end_period'])
@@ -1574,17 +1574,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 GeneralLedgerLine(ModelSQL, ModelView):

Reply via email to