I work with Odoo (v9). I have custom: form (for model 1), action and popup with a form (for model 2). Here is an example of the main form:
<record id="my_id_form" model="ir.ui.view"> <field name="name">my_name_form</field> <field name="model">my_model_one</field> <field name="arch" type="xml"> <form string="Name"> <sheet> <group> <field name="partner_id"/> <button string="Open popup" name="%(my_module.action_open_popup)d" type="action" class="btn-link"/> </group> </sheet> </form> </field> </record>
Window action for the Open popup window button:
<record id="action_open_popup" model="ir.actions.act_window"> <field name="name">action name</field> <field name="res_model">my_model_two</field> <field name="view_id" ref="model_two_form_popup"/> <field name="target">new</field> </record>
My_model_one example
class MyModelOne(models.Model): _name = 'my_model_one' partner_id = fields.Many2one('res.partner', string='Partner')
Popup form:
<record id="model_two_form_popup" model="ir.ui.view"> <field name="name">Popup name</field> <field name="model">my_model_two</field> <field name="arch" type="xml"> <form string="Popup text"> <sheet> <group> <field name="partner_id" invisible="1"/> <group> </sheet> </form> </field> </record>
My question is: how can I send a value from a field in the main form to a popup form? (partner_id)
I saw how the code uses the values ββof active_id, string or integer. But I did not find how to send field values ββor how to register a method for user logic. Can someone give a small example? Thanks in advance.
source share