Merge lp:~openerp-dev/openobject-addons/6.1-opw-584326-han into lp:openobject-addons/6.1

Proposed by Xavier ALT
Status: Merged
Approved by: Xavier ALT
Approved revision: no longer in the source branch.
Merged at revision: 7165
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-584326-han
Merge into: lp:openobject-addons/6.1
Diff against target: 45 lines (+17/-4)
2 files modified
point_of_sale/point_of_sale.py (+2/-2)
point_of_sale/test/01_order_to_payment.yml (+15/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-584326-han
Reviewer Review Type Date Requested Status
Xavier ALT (community) Approve
Review via email: mp+150806@code.launchpad.net

Description of the change

Hi,

When a product has multiple default taxes (for different companies) when computing taxes for point-of-sale we should only consider taxes belonging to the company of the current POS Order - not child companies.

Example:
- You Company (EUR)
  - Your Company - Shop0 (EUR)

- Product CPU1:
  - Tax 5% (company: Your Company)
  - Tax 7% (company: Your Company - Shop0)

When creating a POS Order with a session configure on company "Your Company", a line for "CPU1" should only get "Tax 5%", not "Tax 7%" which belongs to another company.

Regards,
Xavier

To post a comment you must log in.
Revision history for this message
Xavier ALT (dex-phx) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'point_of_sale/point_of_sale.py'
2--- point_of_sale/point_of_sale.py 2012-11-16 15:15:09 +0000
3+++ point_of_sale/point_of_sale.py 2013-02-27 14:30:34 +0000
4@@ -653,9 +653,9 @@
5 account_tax_obj = self.pool.get('account.tax')
6 cur_obj = self.pool.get('res.currency')
7 for line in self.browse(cr, uid, ids, context=context):
8- taxes = line.product_id.taxes_id
9+ taxes_ids = [ tax for tax in line.product_id.taxes_id if tax.company_id.id == line.order_id.company_id.id ]
10 price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
11- taxes = account_tax_obj.compute_all(cr, uid, line.product_id.taxes_id, price, line.qty, product=line.product_id, partner=line.order_id.partner_id or False)
12+ taxes = account_tax_obj.compute_all(cr, uid, taxes_ids, price, line.qty, product=line.product_id, partner=line.order_id.partner_id or False)
13
14 cur = line.order_id.pricelist_id.currency_id
15 res[line.id]['price_subtotal'] = cur_obj.round(cr, uid, cur, taxes['total'])
16
17=== modified file 'point_of_sale/test/01_order_to_payment.yml'
18--- point_of_sale/test/01_order_to_payment.yml 2011-11-17 10:05:44 +0000
19+++ point_of_sale/test/01_order_to_payment.yml 2013-02-27 14:30:34 +0000
20@@ -27,10 +27,23 @@
21 account_collected_id: account.iva
22 price_include: 0
23 -
24- I assign this 5 percent tax on the PC2 product as a sale tax
25+ I will create a second VAT tax of 5% but this time for a child company, to
26+ ensure that only product taxes of the current session's company are considered
27+ (this tax should be ignore when computing order's taxes in following tests)
28+-
29+ !record {model: account.tax, id: account_tax_05_incl_shop0}:
30+ name: VAT 05 perc Excl (Shop0)
31+ type: percent
32+ amount: 0.05
33+ account_paid_id: account.iva
34+ account_collected_id: account.iva
35+ price_include: 0
36+ company_id: stock.res_company_shop0
37+-
38+ I assign those 5 percent taxes on the PC2 product as a sale taxes
39 -
40 !record {model: product.product, id: product.product_product_pc2}:
41- taxes_id: [account_tax_05_incl]
42+ taxes_id: [account_tax_05_incl, account_tax_05_incl_shop0]
43 -
44 I create a PoS order with 2 units of PC1 at 450 EUR (Tax Incl) and 3 units of PC2 at 300 EUR. (Tax Excl)
45 -