From a9a8c13e68a3a8d75a61d625cc783e523de054db Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Tue, 13 Jul 2010 17:53:13 +0200 Subject: [PATCH] [REF] account: rewrite the sequence test in YAML bzr revid: ls@numerigraphe.fr-20100713155313-cw7e9l5gjhfkba70 --- addons/account/__openerp__.py | 2 +- addons/account/test/account_sequence_test.yml | 45 ++++++++++++++++ .../account/test/sequence_bug602188_test.xml | 53 ------------------- 3 files changed, 46 insertions(+), 54 deletions(-) create mode 100644 addons/account/test/account_sequence_test.yml delete mode 100644 addons/account/test/sequence_bug602188_test.xml diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index c663ed29e06..09e51486ad2 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -124,10 +124,10 @@ module named account_vouchers 'project/analytic_account_demo.xml', 'demo/account_minimal.xml', 'account_unit_test.xml', - 'test/sequence_bug602188_test.xml', 'board_account_demo.xml', ], 'test': [ + 'test/account_sequence_test.yml', 'test/account_customer_invoice.yml', 'test/account_supplier_invoice.yml', 'test/account_change_currency.yml', diff --git a/addons/account/test/account_sequence_test.yml b/addons/account/test/account_sequence_test.yml new file mode 100644 index 00000000000..3be824d2ca0 --- /dev/null +++ b/addons/account/test/account_sequence_test.yml @@ -0,0 +1,45 @@ +- In order to test the invoice numbering, I create a sequence for out invoices. +- !record {model: ir.sequence, id: seq_out_invoice_test}: + name: Account Invoice Out for the demonstration Fiscal Year # XXX indicate the name of the fiscal year + code: account.invoice.out_invoice + padding: 3 + prefix: FY- + suffix: -TEST + number_next: 42 + +- I link the new sequence to the demo sequence and the demo fiscal years. +- !record {model: account.sequence.fiscalyear, id: seq_out_invoice_test_fy}: + sequence_id: seq_out_invoice_test + sequence_main_id: seq_out_invoice + fiscalyear_id: data_fiscalyear + +- I create a draft customer invoice in a period of the demo fiscal year +- !record {model: account.invoice, id: invoice_seq_test}: + account_id: account.a_recv + address_contact_id: base.res_partner_address_zen + address_invoice_id: base.res_partner_address_zen + company_id: base.main_company + currency_id: base.EUR + invoice_line: + - account_id: account.a_sale + name: '[PC3] Medium PC' + price_unit: 900.0 + quantity: 10.0 + product_id: product.product_product_pc3 + uos_id: product.product_uom_unit + journal_id: account.sales_journal + partner_id: base.res_partner_3 + reference_type: none + period_id: period_1 + +- I create the invoice, as is I clicked on the "Create" button +- !workflow {model: account.invoice, action: invoice_open, ref: invoice_seq_test} + +- I check that the invoice state is "Open" +- !assert {model: account.invoice, id: invoice_seq_test}: + - state == 'open' + +- I check that the invoice got the right number using our sequence + # This used to fail because of bug #602188 +- !assert {model: account.invoice, id: invoice_seq_test}: + - number == 'FY-042-TEST' diff --git a/addons/account/test/sequence_bug602188_test.xml b/addons/account/test/sequence_bug602188_test.xml deleted file mode 100644 index 3a9200b98e6..00000000000 --- a/addons/account/test/sequence_bug602188_test.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - account.invoice.out_invoice - - TEST- - -bug602188 - - - - - - - - - - - - - - - - - draft - out_invoice - - lp:602188 - - - - - - open - TEST-042-bug602188 - - - - - - - -