[TEST] add unit test to ensure POS only considere product taxes from current session's company

bzr revid: xal@openerp.com-20130227104505-9ndnub6zs8sjfhzj
This commit is contained in:
Xavier ALT 2013-02-27 11:45:05 +01:00
parent 4074305819
commit 41ea6e7ccd
2 changed files with 16 additions and 4 deletions

View File

@ -1121,8 +1121,7 @@ class pos_order_line(osv.osv):
account_tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
for line in self.browse(cr, uid, ids, context=context):
taxes_ids = filter(lambda t: t.company_id.id == line.order_id.company_id.id, line.product_id.taxes_id)
price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
taxes_ids = [ tax for tax in line.product_id.taxes_id if tax.company_id.id == line.order_id.company_id.id ]
price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
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)

View File

@ -27,10 +27,23 @@
account_collected_id: account.iva
price_include: 0
-
I assign this 5 percent tax on the PCSC349 product as a sale tax
I will create a second VAT tax of 5% but this time for a child company, to
ensure that only product taxes of the current session's company are considered
(this tax should be ignore when computing order's taxes in following tests)
-
!record {model: account.tax, id: account_tax_05_incl_chicago}:
name: VAT 05 perc Excl (US)
type: percent
amount: 0.05
account_paid_id: account.iva
account_collected_id: account.iva
price_include: 0
company_id: stock.res_company_1
-
I assign those 5 percent taxes on the PCSC349 product as a sale taxes
-
!record {model: product.product, id: product.product_product_4}:
taxes_id: [account_tax_05_incl]
taxes_id: [account_tax_05_incl, account_tax_05_incl_chicago]
-
I create a new session
-