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 28bebac..c028703 100644
--- a/locale/de.po
+++ b/locale/de.po
@@ -1258,6 +1258,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"
@@ -1378,6 +1386,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 84c7947..af4bc7a 100644
--- a/locale/en.po
+++ b/locale/en.po
@@ -1186,6 +1186,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"
@@ -1302,6 +1310,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. -->
+
+
+
+
diff --git a/wizard_booking.py b/wizard_booking.py
index 9be9f69..c5f348e 100644
--- a/wizard_booking.py
+++ b/wizard_booking.py
@@ -157,7 +157,8 @@ class EnterBookingWizard(Wizard):
book_ids.append(getattr(cfg1, x, None).id)
result = {
- 'fixate': False,
+ 'fixate': cfg1.fixate
+ if cfg1 and cfg1.fixate is not None else False,
'cashbooks': [x.id for x in Cashbook.search([
('state', '=', 'open'),
('btype', '!=', None),