test: correct some try/except test
[odoo/odoo.git] / addons / account / test / account_sequence_test.yml
1 - In order to test the invoice numbering, I create a sequence for out invoices.
2 - !record {model: ir.sequence, id: seq_out_invoice_test}:
3     name: Account Invoice Out for the demonstration Fiscal Year # XXX indicate the name of the fiscal year
4     code: account.invoice.out_invoice
5     padding: 3
6     prefix: FY-
7     suffix: -TEST
8     number_next: 42
9
10 - I link the new sequence to the demo sequence and the demo fiscal years.
11 - !record {model: account.sequence.fiscalyear, id: seq_out_invoice_test_fy}:
12     sequence_id: seq_out_invoice_test
13     sequence_main_id: seq_out_invoice
14     fiscalyear_id: data_fiscalyear
15
16 - I create a draft customer invoice in a period of the demo fiscal year
17 - !record {model: account.invoice, id: invoice_seq_test}:
18     account_id: account.a_recv
19     company_id: base.main_company
20     currency_id: base.EUR
21     invoice_line:
22       - account_id: account.a_sale
23         name: '[PC-DEM] PC on Demand'
24         price_unit: 900.0
25         quantity: 10.0
26         product_id: product.product_product_5
27         uos_id: product.product_uom_unit
28     journal_id: account.sales_journal
29     partner_id: base.res_partner_3
30     reference_type: none
31     period_id: period_1
32     
33 - I create the invoice, as I clicked on the "Create" button
34 - !workflow {model: account.invoice, action: invoice_open, ref: invoice_seq_test}
35
36 - I check that the invoice state is "Open"
37 - !assert {model: account.invoice, id: invoice_seq_test}:
38     - state == 'open'
39     
40 - I check that the invoice got the right number using our sequence
41   # This used to fail because of bug #602188
42 - !assert {model: account.invoice, id: invoice_seq_test}:
43     - number == 'FY-042-TEST'