2 In order to test account invoice i create a new customer invoice
4 Creating a account.invoice record
6 !record {model: account.invoice, id: account_invoice_0}:
7 account_id: account.a_recv
8 address_contact_id: base.res_partner_address_zen
9 address_invoice_id: base.res_partner_address_zen
10 company_id: base.main_company
12 date_invoice: '2010-05-26'
14 - account_id: account.a_sale
15 name: '[PC3] Medium PC'
18 product_id: product.product_product_pc3
19 uos_id: product.product_uom_unit
20 journal_id: account.sales_journal
21 partner_id: base.res_partner_3
24 I check that Initially customer invoice is in the draft state
26 !assert {model: account.invoice, id: account_invoice_0}:
29 I change the state of invoice to proforma2 by clicking PRO-FORMA button
31 Performing a workflow action invoice_proforma2 on module account.invoice
33 !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_0}
35 I check that the invoice state is now proforma2
37 !assert {model: account.invoice, id: account_invoice_0}:
38 - state == 'proforma2'
40 I create invoice by clicking on Create button
42 Performing a workflow action invoice_open on module account.invoice
44 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_0}
46 I check that the invoice state is now open
48 !assert {model: account.invoice, id: account_invoice_0}:
51 I make a partial payment of 1000 by clicking on Pay Invoice button
53 Creating a account.invoice.pay record
55 !record {model: account.invoice.pay, id: account_invoice_pay_first0}:
58 journal_id: account.sales_journal
59 name: First payment for [PC3] Medium PC to Distrib PC
60 period_id: account.period_5
64 Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
66 !python {model: account.invoice.pay}: |
67 self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_first0")], {"lang":
68 'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
69 [ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
72 I check that the invoice state is still open
74 !assert {model: account.invoice, id: account_invoice_0}:
77 I make second partial payment of 6000 by clicking on Pay Invoice button
79 Creating a account.invoice.pay record
81 !record {model: account.invoice.pay, id: account_invoice_pay_second0}:
84 journal_id: account.sales_journal
85 name: Second payment for [PC3] Medium PC to Distrib PC
86 period_id: account.period_5
89 Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
91 !python {model: account.invoice.pay}: |
92 self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_second0")], {"lang":
93 'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
94 [ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
97 I make final partial payment of 2000 by clicking on Pay Invoice button
99 Creating a account.invoice.pay record
101 !record {model: account.invoice.pay, id: account_invoice_pay_final0}:
104 journal_id: account.sales_journal
105 name: Final payment for [PC3] Medium PC to Distrib PC
106 period_id: account.period_5
110 Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
112 !python {model: account.invoice.pay}: |
113 self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_final0")], {"lang":
114 'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
115 [ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
119 I check that the invoice state is now Done
121 !assert {model: account.invoice, id: account_invoice_0}:
124 I check that an payment entry gets created in the account.move.line
126 !python {model: account.invoice}: |
127 acc_id=self.browse(cr, uid, ref("account_invoice_0"))
128 assert(acc_id.move_id)
130 # I refund the invoice
132 # Creating a account.invoice.refund record
134 # !record {model: account.invoice.refund, id: account_invoice_refund_0}:
135 # description: Refund
138 # Performing an osv_memory action invoice_refund on module account.invoice.refund
140 # !python {model: account.invoice.refund}: |
141 # self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US',
142 # "tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_0")],
143 # "type": "out_invoice", "active_id": ref("account.account_invoice_0"), })