Friday, 18 September 2015

Invoice number into the pdf file name in odoo | OpenERP

You can give 'name': 'Invoice ' + 'today date' in return from wizard to print report.

for example: this is function is call from print button in wizard.
def print_report(self,cr, uid, ids, context=None):
        if context is None:
           context = {}
        data = self.read(cr, uid, ids)[0]
        self_browse = self.browse(cr, uid, ids)
     
        datas = {
            'ids': [data.get('id')],
            'model': 'sale.order',
            'form': data
            }
        return {
            'type': 'ir.actions.report.xml',
            'report_name': 'custom.invvoice.report',
            'datas': datas,
            'name': 'Invoice ' + self_browse[0].start_date + ' To ' + self_browse[0].end_date
            }