[FIX] stock: Set default product on update qty wizard from variant
Currently, when we update the Quantity from the 'Update quantity' button on a variant formview the product_id is not set due to reset of the context for product template. so in this commit, set the default product_id on update quantity wizard when open through the product form view and also keep default behaviour when called from product template. closes odoo/odoo#63141 Taskid: 2387310 X-original-commit: 49b8f1bfde1792079c0fd9cdb218eab20f344be3 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -751,7 +751,7 @@ class ProductTemplate(models.Model):
|
||||
if (self.env.user.user_has_groups(','.join(advanced_option_groups))):
|
||||
return self.action_open_quants()
|
||||
else:
|
||||
default_product_id = len(self.product_variant_ids) == 1 and self.product_variant_id.id
|
||||
default_product_id = self.env.context.get('default_product_id', len(self.product_variant_ids) == 1 and self.product_variant_id.id)
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("stock.action_change_product_quantity")
|
||||
action['context'] = dict(
|
||||
self.env.context,
|
||||
|
||||
Reference in New Issue
Block a user