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

Best way to automatically create and add a product to purchase.order.line ?

By
PY
on 12/12/13, 11:49 AM 1,454 views

Hi !

I'm creating a shipping module for purchase order.

Now that i've created the config part, I want to create and add automatically a line to a po when the po is generated, either by hand, or by purchase requisition.

This line must be a product, with description and price based on the config part and the supplier who will receive the po.

My idea is to create a function to do the stuff, but I don't know where to call this function, and if it's possible to create and add the "shipping" product.

I know that's an unusual question, but thanks for guiding me.

1
aharoen
On 12/13/13, 4:14 AM

You can inherit the purchase.order object and define create method that will be triggered when po generated.

from openerp.osv import fields, osv
class purchase_order(osv.osv):
   _inherit='purchase.order'
   create(cr, user, vals, context=None)
           super(purchase_order,self).create((cr, user, vals, context)
           #--------------TODO-----------------
           #Here are  your code  for  inserting  record  to *purchase.order.line object
           #------------END TODO-------------


Thanks for your answer, now I know where to start ^^

PY
on 12/13/13, 10:06 AM
0
fadmawaty marbun
On 4/29/15, 12:08 AM

hai py.. Can you tell me about your new module, its interesting,

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: 12/12/13, 11:49 AM
Seen: 1454 times
Last updated: 4/29/15, 12:08 AM