From a33901fe7c10ae6f6f0d1a82ff3e8b8bbff1815e Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Sat, 1 Jun 2024 11:13:47 +0200 Subject: [PATCH] Config: setting for booking-wizard - 'fixate' --- configuration.py | 15 ++++++++++++++- locale/de.po | 16 ++++++++++++++++ locale/en.po | 16 ++++++++++++++++ tests/bookingwiz.py | 7 ++++++- tests/config.py | 4 ++++ view/configuration_form.xml | 4 ++++ wizard_booking.py | 3 ++- 7 files changed, 62 insertions(+), 3 deletions(-) diff --git a/configuration.py b/configuration.py index 2f2f5db..5f3fdf3 100644 --- a/configuration.py +++ b/configuration.py @@ -71,6 +71,8 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin): help='Cash book available in selection dialog.', model_name='cashbook.book', ondelete='SET NULL', domain=[('btype', '!=', None), ('state', '=', 'open')])) + fixate = fields.MultiValue(fields.Boolean( + string='Fixate', help='Fixating of the booking is activated.')) @classmethod def multivalue_model(cls, field): @@ -81,7 +83,7 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin): if field in [ 'date_from', 'date_to', 'checked', 'done', 'catnamelong', 'defbook', 'book1', 'book2', - 'book3', 'book4', 'book5']: + 'book3', 'book4', 'book5', 'fixate']: return pool.get('cashbook.configuration_user') return super(Configuration, cls).multivalue_model(field) @@ -97,6 +99,10 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin): def default_catnamelong(cls, **pattern): return cls.multivalue_model('catnamelong').default_catnamelong() + @classmethod + def default_fixate(cls, **pattern): + return cls.multivalue_model('fixate').default_fixate() + # end Configuration @@ -175,6 +181,9 @@ class UserConfiguration(ModelSQL, UserValueMixin): ('owner.id', '=', Eval('iduser', -1)) ], depends=['iduser']) + fixate = fields.Boolean( + string='Fixate', help='Fixating of the booking is activated.') + @classmethod def default_checked(cls): return True @@ -187,4 +196,8 @@ class UserConfiguration(ModelSQL, UserValueMixin): def default_done(cls): return False + @classmethod + def default_fixate(cls): + return False + # end UserConfiguration diff --git a/locale/de.po b/locale/de.po index f74615d..d882c09 100644 --- a/locale/de.po +++ b/locale/de.po @@ -1270,6 +1270,14 @@ msgctxt "help:cashbook.configuration,book5:" msgid "Cash book available in selection dialog." msgstr "in Auswahldialog verfügbares Kassenbuch." +msgctxt "field:cashbook.configuration,fixate:" +msgid "Fixate" +msgstr "Festschreiben" + +msgctxt "help:cashbook.configuration,fixate:" +msgid "Fixating of the booking is activated." +msgstr "Die Festschreiben der Buchung ist aktiviert." + msgctxt "field:cashbook.configuration,date_from:" msgid "Start Date" msgstr "Beginndatum" @@ -1390,6 +1398,14 @@ msgctxt "help:cashbook.configuration_user,book5:" msgid "Cash book available in selection dialog." msgstr "in Auswahldialog verfügbares Kassenbuch." +msgctxt "field:cashbook.configuration_user,fixate:" +msgid "Fixate" +msgstr "Festschreiben" + +msgctxt "help:cashbook.configuration_user,fixate:" +msgid "Fixating of the booking is activated." +msgstr "Die Festschreiben der Buchung ist aktiviert." + ################## # cashbook.recon # diff --git a/locale/en.po b/locale/en.po index 0286c5a..87d80cc 100644 --- a/locale/en.po +++ b/locale/en.po @@ -1198,6 +1198,14 @@ msgctxt "help:cashbook.configuration,book5:" msgid "Cash book available in selection dialog." msgstr "Cash book available in selection dialog." +msgctxt "field:cashbook.configuration,fixate:" +msgid "Fixate" +msgstr "Fixate" + +msgctxt "help:cashbook.configuration,fixate:" +msgid "Fixating of the booking is activated." +msgstr "Fixating of the booking is activated." + msgctxt "field:cashbook.configuration,date_from:" msgid "Start Date" msgstr "Start Date" @@ -1314,6 +1322,14 @@ msgctxt "help:cashbook.configuration_user,book5:" msgid "Cash book available in selection dialog." msgstr "Cash book available in selection dialog." +msgctxt "field:cashbook.configuration_user,fixate:" +msgid "Fixate" +msgstr "Fixate" + +msgctxt "help:cashbook.configuration_user,fixate:" +msgid "Fixating of the booking is activated." +msgstr "Fixating of the booking is activated." + msgctxt "model:cashbook.recon,name:" msgid "Cashbook Reconciliation" msgstr "Cashbook Reconciliation" diff --git a/tests/bookingwiz.py b/tests/bookingwiz.py index f1def0d..97b99ee 100644 --- a/tests/bookingwiz.py +++ b/tests/bookingwiz.py @@ -24,6 +24,7 @@ class BookingWizardTestCase(object): Category = pool.get('cashbook.category') Party = pool.get('party.party') IrDate = pool.get('ir.date') + Config = pool.get('cashbook.configuration') company = self.prep_company() with Transaction().set_context({ @@ -51,6 +52,10 @@ class BookingWizardTestCase(object): 'cattype': 'out', }]) + cfg1 = Config() + cfg1.fixate = True + cfg1.save() + (sess_id, start_state, end_state) = BookingWiz.create() w_obj = BookingWiz(sess_id) self.assertEqual(start_state, 'start') @@ -65,7 +70,7 @@ class BookingWizardTestCase(object): self.assertEqual(result['view']['defaults']['booktransf'], None) self.assertEqual(result['view']['defaults']['description'], None) self.assertEqual(result['view']['defaults']['category'], None) - self.assertEqual(result['view']['defaults']['fixate'], False) + self.assertEqual(result['view']['defaults']['fixate'], True) self.assertEqual(len(book.lines), 0) diff --git a/tests/config.py b/tests/config.py index a1eb701..f623e7b 100644 --- a/tests/config.py +++ b/tests/config.py @@ -178,10 +178,12 @@ class ConfigTestCase(object): self.assertEqual(cfg2.date_to, None) self.assertEqual(cfg2.checked, True) self.assertEqual(cfg2.done, False) + self.assertEqual(cfg2.fixate, False) cfg2.date_from = date(2022, 4, 1) cfg2.date_to = date(2022, 5, 30) cfg2.checked = False + cfg2.fixate = True cfg2.save() # change to user 'diego' @@ -194,6 +196,7 @@ class ConfigTestCase(object): self.assertEqual(cfg2.date_to, None) self.assertEqual(cfg2.checked, True) self.assertEqual(cfg2.done, False) + self.assertEqual(cfg2.fixate, False) cfg2.date_from = date(2022, 4, 15) cfg2.date_to = date(2022, 5, 15) @@ -209,5 +212,6 @@ class ConfigTestCase(object): self.assertEqual(cfg2.date_to, date(2022, 5, 30)) self.assertEqual(cfg2.checked, False) self.assertEqual(cfg2.done, False) + self.assertEqual(cfg2.fixate, True) # end ConfigTestCase diff --git a/view/configuration_form.xml b/view/configuration_form.xml index aa870e4..dd55d2c 100644 --- a/view/configuration_form.xml +++ b/view/configuration_form.xml @@ -28,6 +28,10 @@ this repository contains the full copyright notices and license terms. -->