← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-715470-ara into lp:openobject-addons

 

Ashvin Rathod (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-715470-ara into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  #715470 [PS] sale margin module :  wrong computation
  https://bugs.launchpad.net/bugs/715470

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-715470-ara/+merge/51288

Hello,

fixed the bug:ale margin module : wrong computation 
https://bugs.launchpad.net/openobject-addons/+bug/715470

Thanks,
ara
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-715470-ara/+merge/51288
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-715470-ara.
=== modified file 'sale_margin/sale_margin.py'
--- sale_margin/sale_margin.py	2011-01-14 00:11:01 +0000
+++ sale_margin/sale_margin.py	2011-02-25 12:46:58 +0000
@@ -48,8 +48,18 @@
                     res[line.id] = round((line.price_unit*line.product_uos_qty*(100.0-line.discount)/100.0) -(line.product_id.standard_price*line.product_uos_qty), 2)
         return res
 
+    def _get_sale_order(self, cr, uid, ids, context=None):
+        list_order_line = []
+        for line in self.pool.get('sale.order').browse(cr, uid, ids, context=context):
+            for i in line.order_line:
+                list_order_line.append(i.id)
+        return list_order_line
+
     _columns = {
-        'margin': fields.function(_product_margin, method=True, string='Margin', store=True),
+        'margin': fields.function(_product_margin, method=True, string='Margin',
+              store = {
+                        'sale.order': (_get_sale_order, None, 6),
+              }),
         'purchase_price': fields.float('Cost Price', digits=(16,2))
     }
 


Follow ups