Config: setting for booking-wizard - 'fixate'
This commit is contained in:
parent
865a2c7fa6
commit
400ebed692
7 changed files with 62 additions and 3 deletions
|
@ -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
|
||||
|
|
16
locale/de.po
16
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 #
|
||||
|
|
16
locale/en.po
16
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"
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -28,6 +28,10 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<label name="book5"/>
|
||||
<field name="book5"/>
|
||||
|
||||
<label name="fixate"/>
|
||||
<field name="fixate"/>
|
||||
<newline/>
|
||||
|
||||
<separator id="sepcb" colspan="4" string="Cashbook"/>
|
||||
<label name="catnamelong"/>
|
||||
<field name="catnamelong"/>
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue