In the wizard I added a field product_id, and button. When choosing the product and clicking on button I want to get the stock.quant tree view of the product. How to pass value in context ?
product_id
stock.quant
class Wizard(models.TransientModel): _name = 'wizard.wizard' product_id = fields.Many2one('product.product', string="Product") @api.model def my_button(self): return { 'name': _('Products'), 'view_type': 'tree', 'view_mode': 'list', 'res_model': 'stock.quant', 'context': {}, 'type': 'ir.actions.act_window', 'target': 'new', }
self represent current recordset. We can pass value with self.product_id
self
self.product_id
For example:
"context": {"default_product_id": self.product_id.id, "search_default_product_id": self.product_id.id},
2.1m questions
2.1m answers
60 comments
57.0k users