[TEST] add unit test to ensure POS only considere product taxes from current session...
authorXavier ALT <xal@openerp.com>
Wed, 27 Feb 2013 13:31:51 +0000 (14:31 +0100)
committerXavier ALT <xal@openerp.com>
Wed, 27 Feb 2013 13:31:51 +0000 (14:31 +0100)
bzr revid: xal@openerp.com-20130227133151-gc8bneebgjweo6kr

addons/point_of_sale/point_of_sale.py
addons/point_of_sale/test/01_order_to_payment.yml

index d896c56..eb1a0c9 100644 (file)
@@ -653,7 +653,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)
+            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)
 
index 7c6b481..32e5b6f 100644 (file)
     account_collected_id: account.iva
     price_include: 0
 -
-  I assign this 5 percent tax on the PC2 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 PC2 product as a sale taxes
 -
   !record {model: product.product, id: product.product_product_pc2}:
-    taxes_id: [account_tax_05_incl]
+    taxes_id: [account_tax_05_incl, account_tax_05_incl_chicago]
 -
   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)
 -