planner: add formatted rec_name
This commit is contained in:
parent
2e8f81bd99
commit
42aeefaa19
2 changed files with 53 additions and 14 deletions
22
planner.py
22
planner.py
|
@ -11,6 +11,7 @@ from trytond.model import ModelSQL, ModelView, fields, Index, DeactivableMixin
|
|||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.report import Report
|
||||
from trytond.i18n import gettext
|
||||
from trytond.pyson import Eval, Bool, If, And
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
from trytond.modules.cashbook.book import sel_state_book
|
||||
|
@ -164,6 +165,27 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
|||
where=t.end_date != DEF_NONE),
|
||||
})
|
||||
|
||||
def get_rec_name(self, name=None):
|
||||
""" get formatted name of record
|
||||
|
||||
Args:
|
||||
name (str, optional): name of field. Defaults to None.
|
||||
|
||||
Returns:
|
||||
str: formatted description of record
|
||||
"""
|
||||
return '|'.join([
|
||||
self.name,
|
||||
self.cashbook.name,
|
||||
gettext('cashbook.msg_line_bookingtype_%s' % self.bookingtype),
|
||||
self.booktransf.name
|
||||
if self.booktransf
|
||||
else self.category.rec_name if self.category else '-',
|
||||
self.nextrun_link.rec_name if self.nextrun_link else '-',
|
||||
Report.format_currency(
|
||||
self.amount, lang=None, currency=self.cashbook.currency)
|
||||
])
|
||||
|
||||
def _compute_dates_by_rrule(self, query_date=None, count=5, params={}):
|
||||
""" run rrule with values from record or from 'params'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue