0
votes

I'm relatively new to OpenERP development but I think I can gain much understanding if I could get a rough example of how to do the following (in OpenERP version 7):

I created a wizard. In a view I have a button to open the wizard form:

This opens up correctly the window (dialog) and I can call methods to do stuff from buttons within this wizard form defined in the wizard object.

I want to be able to populate the form view dynamically using records from another model (and then do other stuff upon saving form).

For example in "purchase orders" and for a specific purchase order, I want to get all the products linked to this purchase order (that would be displayed in the tree view).

If I have the button (to launch window/dialog form) placed within the view of the purchase order, the main thing I would like to be able to do is populate the form for the given purchase order with the products for this purchase order.

My question is how do I instantiate the wizard form with the id of the current purchase order, then access the product items for this purchase order.

I've looked into other examples but with older version of OpenERP.

Any help/pointers is appreciated!

2

2 Answers

1
votes

if you button is of type action, then you will be able to get the id of the purchase order(model from where the button action is calling) from context['active_id']. if your button is of type object, then in the button function specify the context['active_id']= id of the purchase order. then use the default_get() to populate the data to your wizard.

1
votes

A simple pointer would be buttons on partner screen like Quotation, Invoice, Meeting etc.