Odoo Help


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.


How to get the code sequence easily

Tarek Mohamed Ibrahim
on 5/28/15, 1:31 AM 354 views

This is not a question, it is a hint I found useful to share.

I needed to customize the confirm button functionality in a Purchase Order by saving a special account # in the account_id field. My first problem was that I don't know the sequence of the of methods called to know where to put my update. I tried the idea to inherit the account_invoice class and put a breakpoint on the 'create' and 'write' methods, just to stop the calling flow and examine the code sequence.

I added this peice of code just to put a breakpoint to enable me do the trace

class account_invoice(osv.osv):
    _inherit = "account.invoice"
    def create(self, cr, uid, vals, context=None):
        return super(account_invoice, self).create(cr, uid, vals, context=context)

    def write(self, cr, uid, ids, vals, context=None):
        res = super(account_invoice, self).write(cr, uid, ids, vals, context=context)
        return res

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

1 follower(s)


Asked: 5/28/15, 1:31 AM
Seen: 354 times
Last updated: 6/4/15, 6:46 AM