hi,
I want to open a wizard, a new form when I click on this button in my purchase.order tree view:
My Code looks like this:
<button name="this_test" string="test Button" type="object"/>
<record id="purchase_order_addon_form" model="ir.ui.view"> <field name="name">purchase.order.addon.form</field> <field name="model">purchase.order</field> <field name="arch" type="xml"> <form string="testing"> <sheet> <div class="oe_title"> <h1> <!--<field name="name" readonly="1"/>--> </h1> </div> </sheet>
</form> </field> </record>
@api.multi def this_test(self): view_id = self.env.ref('my_module.purchase_order_addon_form').id context = self._context.copy() return { 'name':'test123', 'view_type':'form', 'view_mode':'form', 'views' : [(view_id,'form')], 'res_model':'purchase.order', 'view_id':view_id, 'type':'ir.actions.act_window', 'res_id':self.id, 'target':'new', 'context':context, }
Now when I click the button, the wizard popups with my designed xml view.
My problem is, when I click not on the button, but on the record, the same view is called, and I don't understand why...
Do I need a new model for that, or is that another way to handle this issue?
Thank you