Hey guys, I'm creating a button that opens a popup , but the view you want to open has different functions and the only way to differentiate is with the active_id attribute that appears in the URL. I mean, I want to open the stock.picking.form view, but this view has 3 different functions. It is the same view for three different functions. As shown in the figure below :
http://es.zimagez.com/zimage/inventario0.php
This is a URL of stock.picking.form active_id=2: http://localhost:8069/web?&debug=#view_type=form&model=stock.picking&action=250&active_id=2
I want to open the view that has active_id = 2 . How I can open this view popup ?
This is the code of the function of the button:
@api.multi
def action_stock_picking(self):
self.ensure_one()
picking_form = self.env.ref('stock.view_picking_form', False)
ctx = dict(
default_model='stock.picking',
default_res_id=self.id,
default_composition_mode='comment',
mark_invoice_as_sent=True,
)
return {
'name': _('Formulario de Inventario: Recepciones'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.picking',
'views': [(picking_form.id, 'form')],
'view_id': picking_form.id,
'target': 'new',
'context': ctx,
}
And this button code in the view.xml:
<button name="action_stock_picking" string="Inventario" type="object" icon="fa-arrow-right"/>
Thanks for all , I appreciate any help to solve this problem. Thanks.