Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I want to inherit Receive product button and complete functionality in purchase order into my new custom form. What are the functions i needs to call there??
I created a custom form same like purchase order. I just want to implement receive invoice or incoming shipment only in that form.
What are steps i need to follow?
Function for Recieve Product button is given below:-
def view_picking(self, cr, uid, ids, context=None):
This function returns an action that display existing pîcking orders of given purchase order ids.
mod_obj = self.pool.get('ir.model.data')
pick_ids = 
for po in self.browse(cr, uid, ids, context=context):
pick_ids += [picking.id for picking in po.picking_ids]
action_model, action_id = tuple(mod_obj.get_object_reference(cr, uid, 'stock', 'action_picking_tree4'))
action = self.pool.get(action_model).read(cr, uid, action_id, context=context)
ctx = eval(action['context'])
if pick_ids and len(pick_ids) == 1:
form_view_ids = [view_id for view_id, view in action['views'] if view == 'form']
view_id = form_view_ids and form_view_ids or False
Check out the code for stock. Use the debug tool in your web client to find the method this button uses (normally the ssame as the name) and find it in the code.
Chances are you will find it in the stock.picking class. Once you found that method, override it and see what variables are provided (I think values and perhaps a browse object).
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 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/10/14, 2:01 AM|
|Seen: 544 times|
|Last updated: 3/16/15, 8:10 AM|