[FIX] sale_stock: warning only if quantity decreased

This commit is contained in:
Nicolas Martinelli
2015-09-23 19:33:24 +02:00
parent b460f9a2aa
commit ed5eecf59a
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -142,7 +142,7 @@ msgstr ""
#. module: sale_stock
#: code:addons/sale_stock/sale_stock.py:148
#, python-format
msgid "Ordered quantity changed!"
msgid "Ordered quantity decreased!"
msgstr ""
#. module: sale_stock
@@ -262,7 +262,7 @@ msgstr ""
#. module: sale_stock
#: code:addons/sale_stock/sale_stock.py:149
#, python-format
msgid "You have changed the quantity ordered! If the quantity was decreased, you need to modify manually the delivery order."
msgid "You are decreasing the ordered quantity! Do not forget to manually update the delivery order if needed."
msgstr ""
#. module: sale_stock
+3 -3
View File
@@ -148,10 +148,10 @@ class SaleOrderLine(models.Model):
@api.onchange('product_uom_qty')
def _onchange_product_uom_qty(self):
if self.state == 'sale' and self.product_id.type != 'service':
if self.state == 'sale' and self.product_id.type != 'service' and self.product_uom_qty < self._origin.product_uom_qty:
warning_mess = {
'title': _('Ordered quantity changed!'),
'message' : _('You are changing the ordered quantity! If you decreased the initial quantity, do not forget to manually update the delivery order if needed.'),
'title': _('Ordered quantity decreased!'),
'message' : _('You are decreasing the ordered quantity! Do not forget to manually update the delivery order if needed.'),
}
return {'warning': warning_mess}
return {}