[MERGE] sync with latest trunk
[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     address_contact_id: base.res_partner_address_zen
20     address_invoice_id: base.res_partner_address_zen
21     company_id: base.main_company
22     currency_id: base.EUR
23     invoice_line:
24       - account_id: account.a_sale
25         name: '[PC3] Medium PC'
26         price_unit: 900.0
27         quantity: 10.0
28         product_id: product.product_product_pc3
29         uos_id: product.product_uom_unit
30     journal_id: account.sales_journal
31     partner_id: base.res_partner_3
32     reference_type: none
33     period_id: period_1
34     
35 - I create the invoice, as I clicked on the "Create" button
36 - !workflow {model: account.invoice, action: invoice_open, ref: invoice_seq_test}
37
38 - I check that the invoice state is "Open"
39 - !assert {model: account.invoice, id: invoice_seq_test}:
40     - state == 'open'
41     
42 - I check that the invoice got the right number using our sequence
43   # This used to fail because of bug #602188
44 - !assert {model: account.invoice, id: invoice_seq_test}:
45     - number == 'FY-042-TEST'