diff options
| author | Dhaval Panchal <dpa@odoo.com> | 2017-08-03 18:34:34 +0530 |
|---|---|---|
| committer | Pierre Masereel <pim@odoo.com> | 2017-11-07 10:44:56 +0100 |
| commit | 0a8c5c12e522fe69d3784281fb6f0af1f77b87d0 (patch) | |
| tree | 276bf3ad148bac47bb47f4e31d599969001fc70c | |
| parent | d8714effc599edba28c6ad798ea8c77f8a4d8393 (diff) | |
[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.
| -rw-r--r-- | addons/sale_stock/models/sale_order.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index e61adb554b1..b7d06ae056a 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -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 |
