[IMP] sale_stock: display quantity available in other warehouses
When we are creating a sale order line of a product that doesn't have sufficient quantity in stock, we get a warning saying that you don't have the quantity entered in stock. We improved this warnig by showing the remaining quantities in the other warehouses of the company.
This commit is contained in:
committed by
Pierre Masereel
parent
d8714effc5
commit
0a8c5c12e5
@@ -176,9 +176,12 @@ class SaleOrderLine(models.Model):
|
||||
(self.product_uom_qty, self.product_uom.name, product.virtual_available, product.uom_id.name, self.order_id.warehouse_id.name)
|
||||
# We check if some products are available in other warehouses.
|
||||
if float_compare(product.virtual_available, self.product_id.virtual_available, precision_digits=precision) == -1:
|
||||
message += _('\nThere are %s %s available accross all warehouses.') % \
|
||||
message += _('\nThere are %s %s available across all warehouses.\n\n') % \
|
||||
(self.product_id.virtual_available, product.uom_id.name)
|
||||
|
||||
for warehouse in self.env['stock.warehouse'].search([]):
|
||||
quantity = self.product_id.with_context(warehouse=warehouse.id).virtual_available
|
||||
if quantity > 0:
|
||||
message += "%s: %s %s\n" % (warehouse.name, quantity, self.product_id.uom_id.name)
|
||||
warning_mess = {
|
||||
'title': _('Not enough inventory!'),
|
||||
'message' : message
|
||||
|
||||
Reference in New Issue
Block a user