Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to edit a record when user press the print button

By
willie ho
on 1/14/15, 4:31 AM 509 views

I want to add a printing time to the record when the user print the document

what should I do?

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?

Yenthe
on 1/14/15, 4:52 AM
0

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3918
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 1/14/15, 5:14 AM

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)

0

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 1/14/15, 5:04 AM

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..

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 1/14/15, 4:31 AM
Seen: 509 times
Last updated: 3/16/15, 8:10 AM