report ok, auf book und line
berechtigungen optimiert
This commit is contained in:
parent
70038eb15e
commit
ab43044f64
21 changed files with 1339 additions and 115 deletions
45
cbreport.py
45
cbreport.py
|
@ -5,11 +5,24 @@
|
|||
|
||||
from trytond.report import Report
|
||||
from trytond.i18n import gettext
|
||||
from trytond.pool import Pool
|
||||
from trytond.transaction import Transaction
|
||||
from slugify import slugify
|
||||
|
||||
|
||||
class CashbookReport(Report):
|
||||
__name__ = 'cashbook.repbook'
|
||||
class ReconciliationReport(Report):
|
||||
__name__ = 'cashbook.reprecon'
|
||||
|
||||
@classmethod
|
||||
def get_context(cls, records, header, data):
|
||||
""" update context
|
||||
"""
|
||||
Company = Pool().get('company.company')
|
||||
context2 = Transaction().context
|
||||
|
||||
context = super(ReconciliationReport, cls).get_context(records, header, data)
|
||||
context['company'] = Company(context2['company'])
|
||||
return context
|
||||
|
||||
@classmethod
|
||||
def execute(cls, ids, data):
|
||||
|
@ -17,9 +30,25 @@ class CashbookReport(Report):
|
|||
"""
|
||||
pool = Pool()
|
||||
IrDate = pool.get('ir.date')
|
||||
ExpObj = pool.get(data['model'])(data['id'])
|
||||
|
||||
(ext1, cont1, dirprint, title) = super(CashbookReport, cls).execute(ids, data)
|
||||
if data['model'] == 'cashbook.book':
|
||||
ExpObj = pool.get(data['model'])(data['id'])
|
||||
rep_name = ExpObj.rec_name[:50]
|
||||
elif data['model'] == 'cashbook.line':
|
||||
line_obj = pool.get(data['model'])(data['id'])
|
||||
rep_name = line_obj.cashbook.rec_name[:50]
|
||||
elif data['model'] == 'cashbook.recon':
|
||||
recon_obj = pool.get(data['model'])(data['id'])
|
||||
rep_name = gettext(
|
||||
'cashbook.msg_rep_reconciliation_fname',
|
||||
recname = recon_obj.cashbook.rec_name[:50],
|
||||
date_from = recon_obj.date_from.isoformat(),
|
||||
date_to = recon_obj.date_to.isoformat(),
|
||||
)
|
||||
else :
|
||||
raise ValueError('invalid model')
|
||||
|
||||
(ext1, cont1, dirprint, title) = super(ReconciliationReport, cls).execute(ids, data)
|
||||
|
||||
return (
|
||||
ext1,
|
||||
|
@ -28,9 +57,11 @@ class CashbookReport(Report):
|
|||
slugify('%(date)s-%(book)s-%(descr)s' % {
|
||||
'date': IrDate.today().isoformat().replace('-', ''),
|
||||
'book': gettext('cashbook.msg_name_cashbook'),
|
||||
'descr': ExpObj.name[:15],
|
||||
'descr': rep_name,
|
||||
},
|
||||
max_length=75, word_boundary=True, save_order=True),
|
||||
max_length=100, word_boundary=True, save_order=True),
|
||||
)
|
||||
|
||||
# end CashbookReport
|
||||
# end ReconciliationReport
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue