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

Howto modify Purchase module by inheritage

By
Mikko Leppimaa
on 6/12/13, 4:56 PM 1,763 views

Hi,

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.

3

Sandeep

--Sandeep--
6083
| 6 5 8
Delhi, India
--Sandeep--
Python OpenERP Developer http://in.linkedin.com/pub/sandeep-rana/3b/a16/786/
Sandeep
On 6/13/13, 3:36 AM

Hi

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):
                 name="purchase.order.ine"
                 inherit="purchase.order.ine"

                #your coloumn may here
           purchase_order_line()

Thanks
Sandeep

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

Sandeep
on 6/13/13, 4:50 AM

Solved, Thanks for your help!

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

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

0 follower(s)

Stats

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