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
=== modified file 'hr_expense/hr_expense.py'
--- hr_expense/hr_expense.py 2013-09-09 08:02:09 +0000
+++ hr_expense/hr_expense.py 2013-11-21 14:42:04 +0000
@@ -297,6 +297,7 @@
297 if not mres:297 if not mres:
298 continue298 continue
299 res.append(mres)299 res.append(mres)
300 current_product_line_pos = len(res) - 1
300 tax_code_found= False301 tax_code_found= False
301 302
302 #Calculate tax according to default tax on product303 #Calculate tax according to default tax on product
@@ -340,18 +341,20 @@
340 is_price_include = tax_obj.read(cr,uid,tax['id'],['price_include'],context)['price_include']341 is_price_include = tax_obj.read(cr,uid,tax['id'],['price_include'],context)['price_include']
341 if is_price_include:342 if is_price_include:
342 ## We need to deduce the price for the tax343 ## We need to deduce the price for the tax
343 res[-1]['price'] = res[-1]['price'] - (tax['amount'] * tax['base_sign'] or 0.0)344 res[current_product_line_pos]['price'] = res[current_product_line_pos]['price'] - (-(tax['amount'] * tax['base_sign'] or 0.0))
344 assoc_tax = {345 #Will create the tax here as we don't have the access
345 'type':'tax',346 if (tax['amount'] * tax['base_sign'] or 0.0) or (tax['tax_code_id'] != False ):
346 'name':tax['name'],347 assoc_tax = {
347 'price_unit': tax['price_unit'],348 'type':'tax',
348 'quantity': 1,349 'name':tax['name'],
349 'price': tax['amount'] * tax['base_sign'] or 0.0,350 'price_unit': tax['price_unit'],
350 'account_id': tax['account_collected_id'] or mres['account_id'],351 'quantity': 1,
351 'tax_code_id': tax['tax_code_id'],352 'price': -(tax['amount'] * tax['base_sign'] or 0.0),
352 'tax_amount': tax['amount'] * tax['base_sign'],353 'account_id': tax['account_collected_id'] or mres['account_id'],
353 }354 'tax_code_id': tax['tax_code_id'],
354 res.append(assoc_tax)355 'tax_amount': tax['amount'] * tax['base_sign'],
356 }
357 res.append(assoc_tax)
355 return res358 return res
356359
357 def move_line_get_item(self, cr, uid, line, context=None):360 def move_line_get_item(self, cr, uid, line, context=None):