add field 'bookingtype', optimize form/list
This commit is contained in:
parent
d800b17561
commit
69b2a387ee
7 changed files with 148 additions and 30 deletions
44
locale/de.po
44
locale/de.po
|
@ -94,6 +94,14 @@ msgctxt "view:cashbook.planner:"
|
|||
msgid "Result of the recurrence rule"
|
||||
msgstr "Ergebnis der Wiederholregel"
|
||||
|
||||
msgctxt "view:cashbook.planner:"
|
||||
msgid "Description"
|
||||
msgstr "Beschreibung"
|
||||
|
||||
msgctxt "view:cashbook.planner:"
|
||||
msgid "Booking"
|
||||
msgstr "Buchung"
|
||||
|
||||
msgctxt "field:cashbook.planner,company:"
|
||||
msgid "Company"
|
||||
msgstr "Unternehmen"
|
||||
|
@ -214,6 +222,42 @@ msgctxt "field:cashbook.planner,nextrun:"
|
|||
msgid "Next Execution Date"
|
||||
msgstr "Nächster Ausführungstermin"
|
||||
|
||||
msgctxt "field:cashbook.planner,nextrun_link:"
|
||||
msgid "Next Execution Date"
|
||||
msgstr "Nächster Ausführungstermin"
|
||||
|
||||
msgctxt "field:cashbook.planner,bookingtype:"
|
||||
msgid "Type"
|
||||
msgstr "Typ"
|
||||
|
||||
msgctxt "help:cashbook.planner,bookingtype:"
|
||||
msgid "Type of Booking"
|
||||
msgstr "Buchungstyp"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Revenue"
|
||||
msgstr "Einnahme"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Revenue Splitbooking"
|
||||
msgstr "Einnahme Splitbuchung"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Expense"
|
||||
msgstr "Ausgabe"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Expense Splitbooking"
|
||||
msgstr "Ausgabe Splitbuchung"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Transfer from"
|
||||
msgstr "Umbuchung von"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Transfer to"
|
||||
msgstr "Umbuchung nach"
|
||||
|
||||
|
||||
############################
|
||||
# cashbook.planner.nextrun #
|
||||
|
|
44
locale/en.po
44
locale/en.po
|
@ -70,6 +70,14 @@ msgctxt "view:cashbook.planner:"
|
|||
msgid "Result of the recurrence rule"
|
||||
msgstr "Result of the recurrence rule"
|
||||
|
||||
msgctxt "view:cashbook.planner:"
|
||||
msgid "Description"
|
||||
msgstr "Description"
|
||||
|
||||
msgctxt "view:cashbook.planner:"
|
||||
msgid "Booking"
|
||||
msgstr "Booking"
|
||||
|
||||
msgctxt "field:cashbook.planner,company:"
|
||||
msgid "Company"
|
||||
msgstr "Company"
|
||||
|
@ -190,6 +198,42 @@ msgctxt "field:cashbook.planner,nextrun:"
|
|||
msgid "Next Execution Date"
|
||||
msgstr "Next Execution Date"
|
||||
|
||||
msgctxt "field:cashbook.planner,nextrun_link:"
|
||||
msgid "Next Execution Date"
|
||||
msgstr "Next Execution Date"
|
||||
|
||||
msgctxt "field:cashbook.planner,bookingtype:"
|
||||
msgid "Type"
|
||||
msgstr "Type"
|
||||
|
||||
msgctxt "help:cashbook.planner,bookingtype:"
|
||||
msgid "Type of Booking"
|
||||
msgstr "Type of Booking"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Revenue"
|
||||
msgstr "Revenue"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Revenue Splitbooking"
|
||||
msgstr "Revenue Splitbooking"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Expense"
|
||||
msgstr "Expense"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Expense Splitbooking"
|
||||
msgstr "Expense Splitbooking"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Transfer from"
|
||||
msgstr "Transfer from"
|
||||
|
||||
msgctxt "selection:cashbook.planner,bookingtype:"
|
||||
msgid "Transfer to"
|
||||
msgstr "Transfer to"
|
||||
|
||||
msgctxt "model:cashbook.planner.nextrun,name:"
|
||||
msgid "Next Execution Date"
|
||||
msgstr "Next Execution Date"
|
||||
|
|
|
@ -13,8 +13,8 @@ class NextRun(ModelSQL, ModelView):
|
|||
|
||||
planner = fields.Many2One(
|
||||
string='Planner', required=True, ondelete='CASCADE',
|
||||
model_name='cashbook.planner')
|
||||
date = fields.Date(string='Date', required=True)
|
||||
model_name='cashbook.planner', readonly=True)
|
||||
date = fields.Date(string='Date', required=True, readonly=True)
|
||||
|
||||
def get_rec_name(self, name):
|
||||
""" get date for record name
|
||||
|
|
24
planner.py
24
planner.py
|
@ -11,6 +11,8 @@ from trytond.transaction import Transaction
|
|||
from trytond.pool import Pool
|
||||
from trytond.report import Report
|
||||
from trytond.pyson import Eval, Bool, If, And
|
||||
from trytond.modules.cashbook.line import sel_bookingtype
|
||||
|
||||
|
||||
DEF_NONE = None
|
||||
SEL_FREQU = [
|
||||
|
@ -87,6 +89,14 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
|||
nextrun = fields.One2Many(
|
||||
string='Next Execution Date', size=1, field='planner',
|
||||
model_name='cashbook.planner.nextrun')
|
||||
nextrun_link = fields.Function(fields.Many2One(
|
||||
string='Next Execution Date', readonly=True,
|
||||
model_name='cashbook.planner.nextrun'),
|
||||
'on_change_with_nextrun_link')
|
||||
|
||||
bookingtype = fields.Selection(
|
||||
string='Type', selection=sel_bookingtype, required=True,
|
||||
help='Type of Booking')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -167,6 +177,20 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
|||
break
|
||||
return result
|
||||
|
||||
@fields.depends('nextrun')
|
||||
def on_change_with_nextrun_link(self, name=None):
|
||||
""" get nextrun-record if exist
|
||||
|
||||
Args:
|
||||
name (str, optional): field name. Defaults to None.
|
||||
|
||||
Returns:
|
||||
int: id of nextrun-record or None
|
||||
"""
|
||||
if self.nextrun:
|
||||
return self.nextrun[0].id
|
||||
return None
|
||||
|
||||
@fields.depends(
|
||||
'start_date', 'end_date', 'frequ', 'weekday', 'monthday',
|
||||
'interval', 'setpos')
|
||||
|
|
|
@ -39,7 +39,8 @@ class PlannerTestCase(object):
|
|||
job, = Planner.create([{
|
||||
'cashbook': book.id,
|
||||
'name': name,
|
||||
'start_date': date(2022, 5, 1)}])
|
||||
'start_date': date(2022, 5, 1),
|
||||
'bookingtype': 'out'}])
|
||||
# check applied defaults
|
||||
self.assertEqual(job.rec_name, 'Job 1')
|
||||
self.assertEqual(job.start_date, date(2022, 5, 1))
|
||||
|
|
|
@ -9,16 +9,20 @@ full copyright notices and license terms. -->
|
|||
|
||||
<label name="name"/>
|
||||
<field name="name" colspan="3"/>
|
||||
<newline/>
|
||||
<label name="active"/>
|
||||
<field name="active"/>
|
||||
|
||||
<label name="nextrun_link" colspan="5"/>
|
||||
<field name="nextrun_link"/>
|
||||
|
||||
<notebook colspan="6">
|
||||
<page id="rrule" col="6" string="Recurrence Rule">
|
||||
<label name="start_date"/>
|
||||
<field name="start_date"/>
|
||||
<label name="end_date"/>
|
||||
<field name="end_date"/>
|
||||
<label name="active"/>
|
||||
<field name="active"/>
|
||||
<newline/>
|
||||
|
||||
<separator id="sep1" colspan="6" string="Recurrence Rule"/>
|
||||
<label name="frequ"/>
|
||||
<field name="frequ"/>
|
||||
<label name="interval"/>
|
||||
|
@ -30,18 +34,18 @@ full copyright notices and license terms. -->
|
|||
<field name="weekday"/>
|
||||
<label name="monthday"/>
|
||||
<field name="monthday"/>
|
||||
<newline/>
|
||||
|
||||
<separator id="sep2" colspan="6" string="Result of the recurrence rule"/>
|
||||
<field name="nextdates" colspan="6"/>
|
||||
|
||||
<label name="nextrun"/>
|
||||
<field name="nextrun"/>
|
||||
<newline/>
|
||||
|
||||
<label name="description"/>
|
||||
<newline/>
|
||||
<field name="description" colspan="6"/>
|
||||
</page>
|
||||
<page id="booking" col="4" string="Booking">
|
||||
<label name="bookingtype"/>
|
||||
<field name="bookingtype"/>
|
||||
</page>
|
||||
<page name="description" col="1" string="Description">
|
||||
<field name="description"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
|
||||
</form>
|
||||
|
|
|
@ -6,5 +6,6 @@ full copyright notices and license terms. -->
|
|||
<field name="active"/>
|
||||
<field name="name"/>
|
||||
<field name="cashbook"/>
|
||||
<field name="nextrun"/>
|
||||
<field name="nextrun_link"/>
|
||||
<field name="bookingtype"/>
|
||||
</tree>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue