I want to add a printing time to the record when the user print the document
what should I do?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I want to add a printing time to the record when the user print the document
what should I do?
You can call the button using type="object" and do your function then return the print format.
There is a similar scenario @ Sales module (https://github.com/odoo/odoo/blob/8.0/addons/sale/sale.py#L439).
def print_quotation(self, cr, uid, ids, context=None):
'''
This function prints the sales order and mark it as sent, so that we can see more easily the next step of the workflow
'''
assert len(ids) == 1, 'This option should only be used for a single id at a time'
self.signal_workflow(cr, uid, ids, 'quotation_sent')
return self.pool['report'].get_action(cr, uid, ids, 'sale.report_saleorder', context=context)
Hi willie ho,
If that is mako report means,use " ${time.strftime(time.ctime())} "in the code or if it is rml report ,use [[ time.strftime(time.ctime())]] in the code.The answer is in this format "Wed Jan 14 09:55:57 2015.
To get the cuttent time value in the code,you can use "DATETIME.DATETIME.NOW()" function in the method. (Note: It calls the __init__ method first when we click print button.You can write a method for the field in that)
I hope it should work..
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
Registrati
You don't have to modify any record? Just modify the QWeb report to print a date with time in place of just the date for example?