← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~credativ/ocb-addons/7.0-rounding-fix-average-price into lp:ocb-addons

 

Jacob Hicks (credativ) has proposed merging lp:~credativ/ocb-addons/7.0-rounding-fix-average-price into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1183999 in OpenERP Addons: "Difference in accounting and inventory analysis due to rounding"
  https://bugs.launchpad.net/openobject-addons/+bug/1183999

For more details, see:
https://code.launchpad.net/~credativ/ocb-addons/7.0-rounding-fix-average-price/+merge/212195
-- 
https://code.launchpad.net/~credativ/ocb-addons/7.0-rounding-fix-average-price/+merge/212195
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~credativ/ocb-addons/7.0-rounding-fix-average-price into lp:ocb-addons.
=== modified file 'product/product.py'
--- product/product.py	2014-03-14 17:09:35 +0000
+++ product/product.py	2014-03-21 16:58:01 +0000
@@ -692,7 +692,7 @@
     #
     # Could be overrided for variants matrices prices
     #
-    def price_get(self, cr, uid, ids, ptype='list_price', context=None):
+    def price_get(self, cr, uid, ids, ptype='list_price', context=None, round=True):
         if context is None:
             context = {}
 
@@ -717,7 +717,7 @@
                 # Take the price_type currency from the product field
                 # This is right cause a field cannot be in more than one currency
                 res[product.id] = self.pool.get('res.currency').compute(cr, uid, price_type_currency_id,
-                    context['currency_id'], res[product.id],context=context)
+                    context['currency_id'], res[product.id], round=round, context=context)
 
         return res
 

=== modified file 'stock/stock.py'
--- stock/stock.py	2014-03-14 16:09:38 +0000
+++ stock/stock.py	2014-03-21 16:58:01 +0000
@@ -315,7 +315,7 @@
 
                     # Compute based on pricetype
                     # Choose the right filed standard_price to read
-                    amount_unit = product.price_get('standard_price', context=context)[product.id]
+                    amount_unit = product.price_get('standard_price', context=context, round=False)[product.id]
                     price = qty[product_id] * amount_unit
 
                     total_price += price
@@ -1300,7 +1300,7 @@
                             new_std_price = new_price
                         else:
                             # Get the standard price
-                            amount_unit = product.price_get('standard_price', context=context)[product.id]
+                            amount_unit = product.price_get('standard_price', context=context, round=False)[product.id]
                             # Here we must convert the new price computed in the currency of the price_type
                             # of the product (e.g. company currency: EUR, price_type: USD)
                             # The current value is still in company currency at this stage
@@ -2358,7 +2358,7 @@
             if context is None:
                 context = {}
             currency_ctx = dict(context, currency_id = move.company_id.currency_id.id)
-            amount_unit = move.product_id.price_get('standard_price', context=currency_ctx)[move.product_id.id]
+            amount_unit = move.product_id.price_get('standard_price', context=currency_ctx, round=False)[move.product_id.id]
             reference_amount = amount_unit * qty
 
         return reference_amount, reference_currency_id
@@ -2756,7 +2756,7 @@
                         new_std_price = new_price
                     else:
                         # Get the standard price
-                        amount_unit = product.price_get('standard_price', context=context)[product.id]
+                        amount_unit = product.price_get('standard_price', context=context, round=False)[product.id]
                         # Here we must convert the new price computed in the currency of the price_type
                         # of the product (e.g. company currency: EUR, price_type: USD)
                         # The current value is still in company currency at this stage


Follow ups