Odoo Help


Howto modify Purchase module by inheritage

Mikko Leppimaa
on 6/12/13, 4:56 PM 2,235 views


My goal is to have product-codes from our suppliers listed in the PO instead of our own product code which is used by default when creating a PO. (PO with only our own product codes is useless to us) I need to make modification to Purchase-module (purchase.py) in 'purchase_order_line'-class python code in this section:

     if product.description_purchase:
         name += '\n' + product.description_purchase
     res['value'].update({'name': name})

to this:

if product.partner_ref:
    name = product.partner_ref
res['value'].update({'name': name})

(Thanks to Saeed for this code!)

I wouldn't want to just edit the existing module directly, but to make a custom-module for the changes. Please can anyone help me out how to do this.. I know how to add new fields to a class by inheritage, but I'm out of ides on how to change the actual class code.



there is same a question for inheritance plz see this one How to inherit OSV (openerp object) (so that mean you can do PO to)

        class purchase_order_line(osv.osv):

                #your coloumn may here


Thanks for the info. It gives a little more information on the subject, but unfortunately there is no solution on that question either. I tried the method described in the question you linked, when I try to install my module I get error message:

"TypeError: The model "purchase.order.line" specifies an unexisting parent class "purchase_order_line" You may need to add a dependency on the parent class' module."

I have following dependencies in my-module __openerp__.py: purchase, stock, process, procurement.

Mikko Leppimaa
on 6/13/13, 4:09 AM

see above modification is your code like this

ClueLogics Technologies Pvt. Ltd.
on 6/13/13, 4:50 AM

Solved, Thanks for your help!

Mikko Leppimaa
on 6/13/13, 7:20 AM

About This Community

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


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 6/12/13, 4:56 PM
Seen: 2235 times
Last updated: 3/16/15, 8:10 AM