This question has been flagged

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.

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

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.

see above modification is your code like this

Author

Solved, Thanks for your help!