2 In order to test account invoice I create a new customer invoice
4 !record {model: account.invoice, id: account_invoice_customer0}:
5 account_id: account.a_recv
6 address_contact_id: base.res_partner_address_zen
7 address_invoice_id: base.res_partner_address_zen
8 company_id: base.main_company
10 date_invoice: !eval time.strftime('%Y-%m-%d')
12 - account_id: account.a_sale
13 name: '[PC3] Medium PC'
16 product_id: product.product_product_pc3
17 uos_id: product.product_uom_unit
18 journal_id: account.sales_journal
19 partner_id: base.res_partner_3
22 I check that Initially customer invoice is in the "Draft" state
24 !assert {model: account.invoice, id: account_invoice_customer0}:
27 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
29 !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_customer0}
31 I check that the invoice state is now "Proforma2"
33 !assert {model: account.invoice, id: account_invoice_customer0}:
34 - state == 'proforma2'
36 I check that there is no move attached to the invoice
38 !python {model: account.invoice}: |
39 acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
40 assert (not acc_id.move_id), "Move falsely created at pro-forma"
42 I create invoice by clicking on Create button
44 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0}
46 I check that the invoice state is "Open"
48 !assert {model: account.invoice, id: account_invoice_customer0}:
52 I check that now there is a move attached to the invoice
54 !python {model: account.invoice}: |
55 acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
56 assert acc_id.move_id, "Move not created for open invoice"
58 I refund the invoice Using Refund Button
60 !record {model: account.invoice.refund, id: account_invoice_refund_0}:
61 description: Refund To China Export
62 period: account.period_5
65 I clicked on refund button
67 !python {model: account.invoice.refund}: |
68 self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US', "tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account.account_invoice_customer0"), })
70 I checked that a new entry with state "Draft" created in account move line