Config: setting for booking-wizard - 'fixate'
This commit is contained in:
parent
f0cfc479fe
commit
a33901fe7c
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.',
|
help='Cash book available in selection dialog.',
|
||||||
model_name='cashbook.book', ondelete='SET NULL',
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
domain=[('btype', '!=', None), ('state', '=', 'open')]))
|
domain=[('btype', '!=', None), ('state', '=', 'open')]))
|
||||||
|
fixate = fields.MultiValue(fields.Boolean(
|
||||||
|
string='Fixate', help='Fixating of the booking is activated.'))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def multivalue_model(cls, field):
|
def multivalue_model(cls, field):
|
||||||
|
@ -81,7 +83,7 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
||||||
if field in [
|
if field in [
|
||||||
'date_from', 'date_to', 'checked', 'done',
|
'date_from', 'date_to', 'checked', 'done',
|
||||||
'catnamelong', 'defbook', 'book1', 'book2',
|
'catnamelong', 'defbook', 'book1', 'book2',
|
||||||
'book3', 'book4', 'book5']:
|
'book3', 'book4', 'book5', 'fixate']:
|
||||||
return pool.get('cashbook.configuration_user')
|
return pool.get('cashbook.configuration_user')
|
||||||
return super(Configuration, cls).multivalue_model(field)
|
return super(Configuration, cls).multivalue_model(field)
|
||||||
|
|
||||||
|
@ -97,6 +99,10 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
||||||
def default_catnamelong(cls, **pattern):
|
def default_catnamelong(cls, **pattern):
|
||||||
return cls.multivalue_model('catnamelong').default_catnamelong()
|
return cls.multivalue_model('catnamelong').default_catnamelong()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_fixate(cls, **pattern):
|
||||||
|
return cls.multivalue_model('fixate').default_fixate()
|
||||||
|
|
||||||
# end Configuration
|
# end Configuration
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,6 +181,9 @@ class UserConfiguration(ModelSQL, UserValueMixin):
|
||||||
('owner.id', '=', Eval('iduser', -1))
|
('owner.id', '=', Eval('iduser', -1))
|
||||||
], depends=['iduser'])
|
], depends=['iduser'])
|
||||||
|
|
||||||
|
fixate = fields.Boolean(
|
||||||
|
string='Fixate', help='Fixating of the booking is activated.')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_checked(cls):
|
def default_checked(cls):
|
||||||
return True
|
return True
|
||||||
|
@ -187,4 +196,8 @@ class UserConfiguration(ModelSQL, UserValueMixin):
|
||||||
def default_done(cls):
|
def default_done(cls):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_fixate(cls):
|
||||||
|
return False
|
||||||
|
|
||||||
# end UserConfiguration
|
# end UserConfiguration
|
||||||
|
|
16
locale/de.po
16
locale/de.po
|
@ -1270,6 +1270,14 @@ msgctxt "help:cashbook.configuration,book5:"
|
||||||
msgid "Cash book available in selection dialog."
|
msgid "Cash book available in selection dialog."
|
||||||
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
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:"
|
msgctxt "field:cashbook.configuration,date_from:"
|
||||||
msgid "Start Date"
|
msgid "Start Date"
|
||||||
msgstr "Beginndatum"
|
msgstr "Beginndatum"
|
||||||
|
@ -1390,6 +1398,14 @@ msgctxt "help:cashbook.configuration_user,book5:"
|
||||||
msgid "Cash book available in selection dialog."
|
msgid "Cash book available in selection dialog."
|
||||||
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
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 #
|
# cashbook.recon #
|
||||||
|
|
16
locale/en.po
16
locale/en.po
|
@ -1198,6 +1198,14 @@ msgctxt "help:cashbook.configuration,book5:"
|
||||||
msgid "Cash book available in selection dialog."
|
msgid "Cash book available in selection dialog."
|
||||||
msgstr "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:"
|
msgctxt "field:cashbook.configuration,date_from:"
|
||||||
msgid "Start Date"
|
msgid "Start Date"
|
||||||
msgstr "Start Date"
|
msgstr "Start Date"
|
||||||
|
@ -1314,6 +1322,14 @@ msgctxt "help:cashbook.configuration_user,book5:"
|
||||||
msgid "Cash book available in selection dialog."
|
msgid "Cash book available in selection dialog."
|
||||||
msgstr "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:"
|
msgctxt "model:cashbook.recon,name:"
|
||||||
msgid "Cashbook Reconciliation"
|
msgid "Cashbook Reconciliation"
|
||||||
msgstr "Cashbook Reconciliation"
|
msgstr "Cashbook Reconciliation"
|
||||||
|
|
|
@ -24,6 +24,7 @@ class BookingWizardTestCase(object):
|
||||||
Category = pool.get('cashbook.category')
|
Category = pool.get('cashbook.category')
|
||||||
Party = pool.get('party.party')
|
Party = pool.get('party.party')
|
||||||
IrDate = pool.get('ir.date')
|
IrDate = pool.get('ir.date')
|
||||||
|
Config = pool.get('cashbook.configuration')
|
||||||
|
|
||||||
company = self.prep_company()
|
company = self.prep_company()
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
|
@ -51,6 +52,10 @@ class BookingWizardTestCase(object):
|
||||||
'cattype': 'out',
|
'cattype': 'out',
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
cfg1 = Config()
|
||||||
|
cfg1.fixate = True
|
||||||
|
cfg1.save()
|
||||||
|
|
||||||
(sess_id, start_state, end_state) = BookingWiz.create()
|
(sess_id, start_state, end_state) = BookingWiz.create()
|
||||||
w_obj = BookingWiz(sess_id)
|
w_obj = BookingWiz(sess_id)
|
||||||
self.assertEqual(start_state, 'start')
|
self.assertEqual(start_state, 'start')
|
||||||
|
@ -65,7 +70,7 @@ class BookingWizardTestCase(object):
|
||||||
self.assertEqual(result['view']['defaults']['booktransf'], None)
|
self.assertEqual(result['view']['defaults']['booktransf'], None)
|
||||||
self.assertEqual(result['view']['defaults']['description'], None)
|
self.assertEqual(result['view']['defaults']['description'], None)
|
||||||
self.assertEqual(result['view']['defaults']['category'], 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)
|
self.assertEqual(len(book.lines), 0)
|
||||||
|
|
||||||
|
|
|
@ -178,10 +178,12 @@ class ConfigTestCase(object):
|
||||||
self.assertEqual(cfg2.date_to, None)
|
self.assertEqual(cfg2.date_to, None)
|
||||||
self.assertEqual(cfg2.checked, True)
|
self.assertEqual(cfg2.checked, True)
|
||||||
self.assertEqual(cfg2.done, False)
|
self.assertEqual(cfg2.done, False)
|
||||||
|
self.assertEqual(cfg2.fixate, False)
|
||||||
|
|
||||||
cfg2.date_from = date(2022, 4, 1)
|
cfg2.date_from = date(2022, 4, 1)
|
||||||
cfg2.date_to = date(2022, 5, 30)
|
cfg2.date_to = date(2022, 5, 30)
|
||||||
cfg2.checked = False
|
cfg2.checked = False
|
||||||
|
cfg2.fixate = True
|
||||||
cfg2.save()
|
cfg2.save()
|
||||||
|
|
||||||
# change to user 'diego'
|
# change to user 'diego'
|
||||||
|
@ -194,6 +196,7 @@ class ConfigTestCase(object):
|
||||||
self.assertEqual(cfg2.date_to, None)
|
self.assertEqual(cfg2.date_to, None)
|
||||||
self.assertEqual(cfg2.checked, True)
|
self.assertEqual(cfg2.checked, True)
|
||||||
self.assertEqual(cfg2.done, False)
|
self.assertEqual(cfg2.done, False)
|
||||||
|
self.assertEqual(cfg2.fixate, False)
|
||||||
|
|
||||||
cfg2.date_from = date(2022, 4, 15)
|
cfg2.date_from = date(2022, 4, 15)
|
||||||
cfg2.date_to = date(2022, 5, 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.date_to, date(2022, 5, 30))
|
||||||
self.assertEqual(cfg2.checked, False)
|
self.assertEqual(cfg2.checked, False)
|
||||||
self.assertEqual(cfg2.done, False)
|
self.assertEqual(cfg2.done, False)
|
||||||
|
self.assertEqual(cfg2.fixate, True)
|
||||||
|
|
||||||
# end ConfigTestCase
|
# end ConfigTestCase
|
||||||
|
|
|
@ -28,6 +28,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<label name="book5"/>
|
<label name="book5"/>
|
||||||
<field name="book5"/>
|
<field name="book5"/>
|
||||||
|
|
||||||
|
<label name="fixate"/>
|
||||||
|
<field name="fixate"/>
|
||||||
|
<newline/>
|
||||||
|
|
||||||
<separator id="sepcb" colspan="4" string="Cashbook"/>
|
<separator id="sepcb" colspan="4" string="Cashbook"/>
|
||||||
<label name="catnamelong"/>
|
<label name="catnamelong"/>
|
||||||
<field name="catnamelong"/>
|
<field name="catnamelong"/>
|
||||||
|
|
|
@ -157,7 +157,8 @@ class EnterBookingWizard(Wizard):
|
||||||
book_ids.append(getattr(cfg1, x, None).id)
|
book_ids.append(getattr(cfg1, x, None).id)
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
'fixate': False,
|
'fixate': cfg1.fixate
|
||||||
|
if cfg1 and cfg1.fixate is not None else False,
|
||||||
'cashbooks': [x.id for x in Cashbook.search([
|
'cashbooks': [x.id for x in Cashbook.search([
|
||||||
('state', '=', 'open'),
|
('state', '=', 'open'),
|
||||||
('btype', '!=', None),
|
('btype', '!=', None),
|
||||||
|
|
Loading…
Reference in a new issue