Merge lp:~openerp-dev/openobject-addons/trunk-bug-1218212-ypa into lp:openobject-addons

Proposed by Yogesh Parekh(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1218212-ypa
Merge into: lp:openobject-addons
Diff against target: 26 lines (+5/-6)
1 file modified
sale_margin/sale_margin.py (+5/-6)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1218212-ypa
Reviewer Review Type Date Requested Status
Amit Parik (community) Approve
OpenERP Core Team Pending
Review via email: mp+183616@code.launchpad.net

Description of the change

Hello,

        Set the Product_id in _product_margin function for compute the margin in sale line.

Thanks,
Yogesh Parekh.

To post a comment you must log in.
Revision history for this message
Amit Parik (amit-parik) wrote :

Not valid bug please see my comment on bug, Aslo I have marked bug as a invaild.

Thank You!

review: Disapprove
Revision history for this message
Amit Parik (amit-parik) wrote :

After the comment#4 of Andrius on bug this issue is valid and we need to fix.
Let me approve the Andrius.

@Andrius: Thanks for the fix!

review: Approve

Unmerged revisions

8876. By Yogesh Parekh(OpenERP)

[FIX] Margin not computed in sale line when product is not selected in sale order

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale_margin/sale_margin.py'
2--- sale_margin/sale_margin.py 2013-04-15 10:23:49 +0000
3+++ sale_margin/sale_margin.py 2013-09-03 10:08:25 +0000
4@@ -43,11 +43,10 @@
5 res = {}
6 for line in self.browse(cr, uid, ids, context=context):
7 res[line.id] = 0
8- if line.product_id:
9- if line.purchase_price:
10- res[line.id] = round((line.price_unit*line.product_uos_qty*(100.0-line.discount)/100.0) -(line.purchase_price*line.product_uos_qty), 2)
11- else:
12- 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)
13+ if line.purchase_price:
14+ res[line.id] = round((line.price_unit*line.product_uos_qty*(100.0-line.discount)/100.0) -(line.purchase_price*line.product_uos_qty), 2)
15+ elif line.product_id:
16+ 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)
17 return res
18
19 _columns = {
20@@ -82,4 +81,4 @@
21 }
22
23
24-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
25\ No newline at end of file
26+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Subscribers

People subscribed via source and target branches

to all changes: