Merge lp:~openerp-dev/openobject-addons/7.0-opw-599529-pna into lp:openobject-addons/7.0

Proposed by Pinakin Nayi (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-599529-pna
Merge into: lp:openobject-addons/7.0
Diff against target: 17 lines (+4/-4)
1 file modified
sale_margin/sale_margin.py (+4/-4)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-599529-pna
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+192461@code.launchpad.net

Description of the change

Hello,

I improved sale_margin to calculate margin without product.

Steps to reproduce :
create a sale order, add a line with a selling price and a cost price, without making a link to a product, there is no margin calculated.

Thanks,
pna

To post a comment you must log in.

Unmerged revisions

9541. By Pinakin Nayi (OpenERP)

[IMP]sale_margin : allow margin to calculate without product also

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 2012-12-19 01:25:10 +0000
3+++ sale_margin/sale_margin.py 2013-10-24 05:32:10 +0000
4@@ -43,10 +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+ if line.purchase_price:
13+ 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)
14+ else:
15+ if 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