Hello,
I'm trying to open wizard using onchange, I have a button named =" Cross sell", by clicking this button I opened on the wizard, now I want open wizard with @api.onchange. actually, onchanges called but wizard not open.
Can someone please help me?
Here my code:
@api.onchange('product_id')
def action_cross_sell(self):
"""
Open wizard for cross product
:return: cross product wizard
"""
view_id = self.env.ref('product_cross_sell.product_cross_sell_wizard_form_view')
ctx = {
'default_cross_product_ids': self.product_id.product_tmpl_id.cross_product_ids.ids,
'order_id': self.order_id.id
}
return {
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'product.cross.sell',
'views': [(view_id.id, 'form')],
'view_id': view_id.id,
'target': 'new',
'context': ctx,
}
Not possible