merged with trunk
[odoo/odoo.git] / addons / account / test / price_accuracy00.yml
old mode 100644 (file)
new mode 100755 (executable)
index 48b5cec..135dcf1
@@ -14,8 +14,6 @@
     !record {model: account.tax, id: tax196}:
       name: Tax 19.6%
       amount: &tax 0.196
-      account_collected_id: account.a_recv
-      account_paid_id: account.a_recv
 -  
     And we define an invoice with one invoice line with a tax of *tax
 -  
@@ -49,7 +47,7 @@
 -  
     # This is not working, find a way to do that in YAML, *qty is not
     # interpreted because it's not a node.
-    And this account entry must have a credit equals to 163.70€ which is
+    And this account entry must have a credit equals to 163.97€ which is
     equal to *qty x *price x (1 + *tax)
 -  
     !assert {model: account.invoice, id: invoice1}:
 -  
     !python {model: account.invoice}: |
         self.action_move_create(cr, uid, [ref("invoice2")])  
--  
-    !python {model: account.invoice}: |
-        invoice = self.browse(cr, uid, ref("invoice2"))  
-        log(sum(x.credit for x in invoice.move_id.line_id))
-        assert (sum(x.credit for x in invoice.move_id.line_id) - 163.968) < 0.000001, "Pas bon !!!"
--  
-    !assert {model: account.invoice, id: invoice2}:
-        test:
-            - abs(sum(x.credit for x in move_id.line_id) - 163.968) < 0.000001
+-    
+    Then this account entry must have a credit equals to the debit
 -  
     !assert {model: account.invoice, id: invoice2}:
         test:
             - abs(sum(x.credit - x.debit for x in move_id.line_id)) < 0.000001
+-
+    And this account entry must have a credit equals to 163.968€ which is
+    equal to *qty x *price x (1 + *tax)
+-  
+    !python {model: account.invoice}: |
+        xid = "invoice2"
+        invoice = self.browse(cr, uid, ref(xid))
+        sum_of_credits = sum(x.credit for x in invoice.move_id.line_id)
+        log("The sum of credits for %s is %f", xid, sum_of_credits)
+        expected_value = 163.968
+        assert (sum_of_credits - expected_value) < 0.000001, "Wrong sum of credits: %f <> %f" % (sum_of_credits, expected_value)