← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-722961-ksa into lp:openobject-addons

 

Kirti Savalia(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-722961-ksa into lp:openobject-addons.

Requested reviews:
  Mustufa Rangwala (Open ERP) (mra-tinyerp)
Related bugs:
  #722961 Stock Input account record only a cost price
  https://bugs.launchpad.net/bugs/722961

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-722961-ksa/+merge/50742

do changes as per your suggestion.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-722961-ksa/+merge/50742
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-722961-ksa.
=== modified file 'purchase/stock.py'
--- purchase/stock.py	2011-01-19 01:17:24 +0000
+++ purchase/stock.py	2011-02-22 13:27:08 +0000
@@ -35,13 +35,17 @@
         on the purchase order in case the valuation data was not directly specified during picking
         confirmation.
         """
+        product_uom_obj = self.pool.get('product.uom')
+
         reference_amount, reference_currency_id = super(stock_move, self)._get_reference_accounting_values_for_valuation(cr, uid, move, context=context)
+        default_uom = move.product_id.uom_id.id
+        qty = product_uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, default_uom)
         if move.product_id.cost_method != 'average' or not move.price_unit:
             # no average price costing or cost not specified during picking validation, we will
             # plug the purchase line values if they are found.
             if move.purchase_line_id and move.picking_id.purchase_id.pricelist_id:
-                reference_amount, reference_currency_id = move.purchase_line_id.price_unit, move.picking_id.purchase_id.pricelist_id.currency_id.id
-        return reference_amount, reference_currency_id
+                reference_amount, reference_currency_id = move.purchase_line_id.price_unit * qty, move.picking_id.purchase_id.pricelist_id.currency_id.id
+        return reference_amount , reference_currency_id
 
 stock_move()
 

=== modified file 'stock/stock.py'
--- stock/stock.py	2011-01-24 16:13:46 +0000
+++ stock/stock.py	2011-02-22 13:27:08 +0000
@@ -1463,7 +1463,7 @@
     _description = "Stock Move"
     _order = 'date_expected desc, id'
     _log_create = False
-    
+
     def action_partial_move(self, cr, uid, ids, context=None):
         if context is None: context = {}
         partial_id = self.pool.get("stock.partial.move").create(
@@ -1481,7 +1481,7 @@
             'domain': '[]',
             'context': context
         }
-        
+
 
     def name_get(self, cr, uid, ids, context=None):
         res = []


Follow ups