From 7622c48223b7a39e05c654df61c41f7939042a4e Mon Sep 17 00:00:00 2001 From: Vishal Thacker Date: Thu, 21 Oct 2021 09:01:42 +0000 Subject: [PATCH] [IMP] stock: default product replenish quantity The product replenish wizard quantity will be set to the selected `product_id` forecast quantity if it's a negative value (otherwise, it will be set to 1). task-2581265 Part-of: odoo/odoo#74695 --- addons/stock/wizard/product_replenish.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/stock/wizard/product_replenish.py b/addons/stock/wizard/product_replenish.py index fa1d338dbbf..4137ed47d67 100644 --- a/addons/stock/wizard/product_replenish.py +++ b/addons/stock/wizard/product_replenish.py @@ -28,6 +28,10 @@ class ProductReplenish(models.TransientModel): domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]") company_id = fields.Many2one('res.company') + @api.onchange('product_id') + def _onchange_product_id(self): + self.quantity = abs(self.product_id.virtual_available) if self.product_id.virtual_available < 0 else 1 + @api.model def default_get(self, fields): res = super(ProductReplenish, self).default_get(fields)