changeset 72bbecdfb56d in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=72bbecdfb56d
description:
        Add digits to cost value of location

        issue9877
        review320451002
diffstat:

 location.py |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 6620112cccc4 -r 72bbecdfb56d location.py
--- a/location.py       Fri Dec 04 18:39:12 2020 +0100
+++ b/location.py       Sat Dec 05 11:51:29 2020 +0100
@@ -16,6 +16,8 @@
 from trytond.tools import grouped_slice
 from trytond.tools.multivalue import migrate_property
 
+from trytond.modules.product import price_digits, round_price
+
 from .exceptions import LocationValidationError
 
 
@@ -164,8 +166,9 @@
         fields.Float('Forecast Quantity',
         help="The amount of stock expected to be in the location."),
         'get_quantity', searcher='search_quantity')
-    cost_value = fields.Function(fields.Numeric('Cost Value',
-        help="The value of the stock in the location."),
+    cost_value = fields.Function(fields.Numeric(
+            "Cost Value", digits=price_digits,
+            help="The value of the stock in the location."),
         'get_cost_value')
 
     @classmethod
@@ -471,7 +474,7 @@
         # The template may have more than one product
         if cost_price is not None:
             for location in locations:
-                cost_values[location.id] = (
+                cost_values[location.id] = round_price(
                     Decimal(str(location.quantity)) * cost_price)
         return cost_values
 

Reply via email to