Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
5897 Weergaven

In the manufacturing bill of materials (mrp.bom model) form view, There is a list of components that make up a product. I want to add a button to the list view that opens the product component in a pop up.

I have tried this code but the button is opening the wrong product item. Please help me resolve what I am doing wrong.

class mrp_bom_line(osv.osv):
    _inherit = ['mrp.bom.line']
    def open_full_record(self, cr, uid, ids, context=None):
        return {
            'type': 'ir.actions.act_window',
            'view_type': 'form',
            'view_mode': 'form',
            'res_model': 'product.template',#self._name,
            'res_id': ids[0],
            'target': 'new',
            'context': context,  # May want to modify depending on the source/destination
            }

 

Avatar
Annuleer
Beste antwoord

use "active_id"

Avatar
Annuleer
Auteur

I have specified that but it soesnt seem to work. This is how I added it. data = self.browse(cr, uid, ids[0], context=context) context['active_id'] = data.product_id.id above the return statement.

what is the lite

'res_id': ids[0],
for?

res_id (optional) if the default view is form, specifies the record to load (otherwise a new record should be created)

Gerelateerde posts Antwoorden Weergaven Activiteit
1
mrt. 15
4970
0
sep. 21
2375
0
jan. 22
2059
1
sep. 21
3187
3
jan. 20
7031