# -*- coding: utf-8 -*- # This file is part of the cashbook-module from m-ds for Tryton. # The COPYRIGHT file at the top level of this repository contains the # full copyright notices and license terms. from trytond.report import Report from trytond.i18n import gettext from slugify import slugify class CashbookReport(Report): __name__ = 'cashbook.repbook' @classmethod def execute(cls, ids, data): """ edit filename """ pool = Pool() IrDate = pool.get('ir.date') ExpObj = pool.get(data['model'])(data['id']) (ext1, cont1, dirprint, title) = super(CashbookReport, cls).execute(ids, data) return ( ext1, cont1, dirprint, slugify('%(date)s-%(book)s-%(descr)s' % { 'date': IrDate.today().isoformat().replace('-', ''), 'book': gettext('cashbook.msg_name_cashbook'), 'descr': ExpObj.name[:15], }, max_length=75, word_boundary=True, save_order=True), ) # end CashbookReport