Merge lp:~camptocamp/ocb-addons/ocb-addons-hr_expense-tax_vre into lp:ocb-addons

Proposed by Vincent Renaville@camptocamp
Status: Merged
Approved by: Yannick Vaucher @ Camptocamp
Approved revision: no longer in the source branch.
Merged at revision: 10002
Proposed branch: lp:~camptocamp/ocb-addons/ocb-addons-hr_expense-tax_vre
Merge into: lp:ocb-addons
Diff against target: 44 lines (+15/-12)
1 file modified
hr_expense/hr_expense.py (+15/-12)
To merge this branch: bzr merge lp:~camptocamp/ocb-addons/ocb-addons-hr_expense-tax_vre
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp Approve
Holger Brunn (Therp) code review Approve
Review via email: mp+196122@code.launchpad.net

This proposal supersedes a proposal from 2013-09-04.

To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote : Posted in a previous version of this proposal

I had difficulty reading #9
Is this the same as to say

if tax['amount'] * tax['base_sign'] or tax['tax_code_id']:

If yes, I'd propose to change it that way for readability.

review: Needs Information
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : Posted in a previous version of this proposal

Thanks for the review Holger

Plus it differs from OPW
https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-opw-596243-han/+merge/182269

So I put it in need fixing and work in progress

I'll see with Vincent to fix this.

review: Needs Fixing (differ from opw)
Revision history for this message
Vincent Renaville@camptocamp (vrenaville-c2c) wrote : Posted in a previous version of this proposal

Hello,

I have put a comment on the related merge proposal in V7.

It doesn't take care of Taxe included if one it set on a product.

So I do a resubmit with an improved patch

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

please also link the bug report to this branch

review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_expense/hr_expense.py'
2--- hr_expense/hr_expense.py 2013-09-09 08:02:09 +0000
3+++ hr_expense/hr_expense.py 2013-11-21 14:42:04 +0000
4@@ -297,6 +297,7 @@
5 if not mres:
6 continue
7 res.append(mres)
8+ current_product_line_pos = len(res) - 1
9 tax_code_found= False
10
11 #Calculate tax according to default tax on product
12@@ -340,18 +341,20 @@
13 is_price_include = tax_obj.read(cr,uid,tax['id'],['price_include'],context)['price_include']
14 if is_price_include:
15 ## We need to deduce the price for the tax
16- res[-1]['price'] = res[-1]['price'] - (tax['amount'] * tax['base_sign'] or 0.0)
17- assoc_tax = {
18- 'type':'tax',
19- 'name':tax['name'],
20- 'price_unit': tax['price_unit'],
21- 'quantity': 1,
22- 'price': tax['amount'] * tax['base_sign'] or 0.0,
23- 'account_id': tax['account_collected_id'] or mres['account_id'],
24- 'tax_code_id': tax['tax_code_id'],
25- 'tax_amount': tax['amount'] * tax['base_sign'],
26- }
27- res.append(assoc_tax)
28+ res[current_product_line_pos]['price'] = res[current_product_line_pos]['price'] - (-(tax['amount'] * tax['base_sign'] or 0.0))
29+ #Will create the tax here as we don't have the access
30+ if (tax['amount'] * tax['base_sign'] or 0.0) or (tax['tax_code_id'] != False ):
31+ assoc_tax = {
32+ 'type':'tax',
33+ 'name':tax['name'],
34+ 'price_unit': tax['price_unit'],
35+ 'quantity': 1,
36+ 'price': -(tax['amount'] * tax['base_sign'] or 0.0),
37+ 'account_id': tax['account_collected_id'] or mres['account_id'],
38+ 'tax_code_id': tax['tax_code_id'],
39+ 'tax_amount': tax['amount'] * tax['base_sign'],
40+ }
41+ res.append(assoc_tax)
42 return res
43
44 def move_line_get_item(self, cr, uid, line, context=None):