Use format_number_symbol for quantity in error message
issue11376 review395651002
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_sale_stock_quantity">
|
||||
<field name="text">The forcast quantity (%(forecast_quantity)s%(default_uom)s) for line "%(line)s" is lower than its quantity (%(quantity)s%(unit)s).</field>
|
||||
<field name="text">The forcast quantity (%(forecast_quantity)s) for line "%(line)s" is lower than its quantity (%(quantity)s).</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_product_forecast_quantity_lower">
|
||||
<field name="text">The forecast quantity (%(forecast_quantity)s) of product "%(product)s" is lower than the quantity (%(quantity)s).</field>
|
||||
|
||||
@@ -64,6 +64,7 @@ class Sale(metaclass=PoolMeta):
|
||||
Group = pool.get('res.group')
|
||||
User = pool.get('res.user')
|
||||
ModelData = pool.get('ir.model.data')
|
||||
Lang = pool.get('ir.lang')
|
||||
Line = pool.get('sale.line')
|
||||
Warning = pool.get('res.user.warning')
|
||||
|
||||
@@ -123,6 +124,7 @@ class Sale(metaclass=PoolMeta):
|
||||
|
||||
with Transaction().set_context(company=self.company.id):
|
||||
today = Date.today()
|
||||
lang = Lang.get()
|
||||
sale_date = self.sale_date or today
|
||||
product_ids = {l.product.id for l in filter(filter_line, self.lines)}
|
||||
product_ids = list(product_ids)
|
||||
@@ -169,10 +171,11 @@ class Sale(metaclass=PoolMeta):
|
||||
next_supply_date = self._stock_quantity_next_supply_date(product)
|
||||
message_values = {
|
||||
'line': line.rec_name,
|
||||
'forecast_quantity': quantities[product],
|
||||
'default_uom': product.default_uom.symbol,
|
||||
'quantity': line.quantity,
|
||||
'unit': line.unit.symbol,
|
||||
'forecast_quantity': lang.format_number_symbol(
|
||||
quantities[product], product.default_uom,
|
||||
product.default_uom.digits),
|
||||
'quantity': lang.format_number_symbol(
|
||||
line.quantity, line.unit, line.unit.digits),
|
||||
}
|
||||
if (quantities[product] < quantity
|
||||
and sale_date < next_supply_date):
|
||||
|
||||
Reference in New Issue
Block a user