← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/margin-analysis/7.0-fix-product_historical_margin-no-product-yvr into lp:margin-analysis

 

Yannick Vaucher @ Camptocamp has proposed merging lp:~camptocamp/margin-analysis/7.0-fix-product_historical_margin-no-product-yvr into lp:margin-analysis.

Requested reviews:
  Margin Analysis Core Editors (margin-analysis-core-editors)
Related bugs:
  Bug #1293612 in Financial controlling and costing: "Cannot enter a supplier invoice without product on an invoice line"
  https://bugs.launchpad.net/margin-analysis/+bug/1293612

For more details, see:
https://code.launchpad.net/~camptocamp/margin-analysis/7.0-fix-product_historical_margin-no-product-yvr/+merge/211354

Make sure we don't read a product of invoice line without product.
-- 
https://code.launchpad.net/~camptocamp/margin-analysis/7.0-fix-product_historical_margin-no-product-yvr/+merge/211354
Your team Margin Analysis Core Editors is requested to review the proposed merge of lp:~camptocamp/margin-analysis/7.0-fix-product_historical_margin-no-product-yvr into lp:margin-analysis.
=== modified file 'product_historical_margin/invoice.py'
--- product_historical_margin/invoice.py	2013-11-29 15:38:55 +0000
+++ product_historical_margin/invoice.py	2014-03-17 16:13:09 +0000
@@ -98,10 +98,10 @@
                 company = company_obj.browse(cr, uid, company_id, context=context)
             company_currency_id = company.currency_id.id
             ctx['company_id'] = company.id
+            if not obj.product_id:
+                continue
             product = product_obj.read(cr, uid, obj.product_id.id,
                                        ['id','cost_price'], context=ctx)
-            if not product:
-                continue
             if obj.invoice_id.currency_id is None:
                 currency_id = company_currency_id
             else:


Follow ups