[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
This commit is contained in:
Vishal Thacker
2021-11-26 15:10:26 +00:00
committed by svs-odoo
parent e71a9e4494
commit 7622c48223
+4
View File
@@ -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)