From 63c42428a2bb0d08ad06558170452f13d2d6056b Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 7 Mar 2010 20:45:23 +0100 Subject: [PATCH] [IMP] test scenario account invoice bzr revid: fp@tinyerp.com-20100307194523-8kkkou1dq4y7pzw4 --- addons/account/test/price_accuracy00.yaml | 62 +++++++++++++---------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/addons/account/test/price_accuracy00.yaml b/addons/account/test/price_accuracy00.yaml index b8d44befc97..3bf8ee7968b 100644 --- a/addons/account/test/price_accuracy00.yaml +++ b/addons/account/test/price_accuracy00.yaml @@ -1,47 +1,53 @@ -- +- Tax Scenario In order to check that the accounting entries and tax engine works efficiently with all kind of price accuracies we run this test scenario. -- +- Given the price accuracy for the account module is configured with two - digits (0.12€) -- - !record {model: decimal.precision, id: product.decimal_account} + digits +- + !record {model: decimal.precision, id: product.decimal_account}: digits: 2 -- - And we have a tax of 19.6% defined -- - !record {model: account.tax, id: tax196} +- + And we have a tax defined +- + !record {model: account.tax, id: tax196}: name: Tax 19.6% - amount: 0.196 -- - And we define an invoice with 12.32 pieces at a unit price of 11.11€ and - a tax of 19.6% -- - !record {model: account.invoice, id: invoice1} + amount: &tax 0.196 +- + And we define an invoice with one invoice line with a tax of *tax +- + !record {model: account.invoice, id: invoice1}: name: Precision Test type: out_invoice partner_id: address_contact_id: address_invoice_id: account_id: - invoice_line: - - -- + invoice_lines: + - product_qty: &qty 11.11 + product_uom: product.product_unit + price_unit: &price 12.34 +- When I press on the CREATE button on the invoice to open it. -- - ???? +- + # to be completed - Then I should see an account entry linked to this invoice. - - !record {model: account.invoice, id: invoice1} + !record {model: account.invoice, id: invoice1}: test: bool(move_id) - - And this account entry must have a credit equals to 163.70€ - which is equal to 12.32 x 11.11 x 1.196 €, with nearest rounding. -- - !record {model: account.invoice, id: invoice1} - test: (move_id.credit - 163.70) < 0.000001 - - + # 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 + equal to *qty x *price x (1 + *tax) +- + !record {model: account.invoice, id: invoice1}: + test: abs(move_id.credit - 163.70) < 0.000001 +- + And this account entry must have a credit equals to the debit +- + !record {model: account.invoice, id: invoice1}: + test: abs(move_id.debit - move_id.credit) < 0.000001