[IMP] account: changes in YAML test cases for invoices
[odoo/odoo.git] / addons / account / test / account_supplier_invoice.yml
1 -
2   In order to test account invoice i create a new supplier invoice
3 -
4   Creating a account.invoice record
5 -
6   !record {model: account.invoice, id: account_invoice_1}:
7     account_id: account.a_pay
8     address_contact_id: base.res_partner_address_3000
9     address_invoice_id: base.res_partner_address_3000
10     check_total: 3000.0
11     company_id: base.main_company
12     currency_id: base.EUR
13     invoice_line:
14       - account_id: account.a_expense
15         name: '[PC1] Basic PC'
16         price_unit: 300.0
17         product_id: product.product_product_pc1
18         quantity: 10.0
19         uos_id: product.product_uom_unit
20     journal_id: account.expenses_journal
21     partner_id: base.res_partner_desertic_hispafuentes
22     reference_type: none
23     type: in_invoice
24 -
25   I check that Initially supplier invoice is in the draft state
26 -
27   !assert {model: account.invoice, id: account_invoice_1}:
28     - state == 'draft'
29 -
30   I change the state of invoice to open by clicking Validate button
31 -
32   Performing a workflow action invoice_open on module account.invoice
33 -
34   !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_1}
35 -
36   I check that the invoice state is now open
37 -
38   !assert {model: account.invoice, id: account_invoice_1}:
39     - state == 'open'
40 -
41   I make a partial payment of 2000 by clicking on Pay Invoice button
42 -
43   Creating a account.invoice.pay record
44 -
45   !record {model: account.invoice.pay, id: account_invoice_pay_firstpaymenttoaxelorforbasicpc0}:
46     amount: 2000.0
47     date: '2010-05-29'
48     journal_id: account.sales_journal
49     name: First Payment to Axelor for Basic PC
50     period_id: account.period_5
51
52 -
53   Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
54 -
55   !python {model: account.invoice.pay}: |
56     self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_firstpaymenttoaxelorforbasicpc0")],
57       {"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id":
58       25, "active_ids": [ref("account_invoice_1")], "type": "in_invoice", "active_id":
59       ref("account_invoice_1"), })
60 -
61   I check that the invoice state is still open
62 -
63   !assert {model: account.invoice, id: account_invoice_1}:
64     - state == 'open'
65 -
66   I make final partial payment of 1000 by clicking on Pay Invoice button
67 -
68   Creating a account.invoice.pay record
69 -
70   !record {model: account.invoice.pay, id: account_invoice_pay_finalpaymenttoaxelorforbasicpc0}:
71     amount: 1000.0
72     date: '2010-06-17'
73     journal_id: account.sales_journal
74     name: Final Payment to Axelor for Basic PC
75     period_id: account.period_5
76
77
78 -
79   Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
80 -
81   !python {model: account.invoice.pay}: |
82     self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_finalpaymenttoaxelorforbasicpc0")],
83       {"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id":
84       25, "active_ids": [ref("account_invoice_1")], "type": "in_invoice", "active_id":
85       ref("account_invoice_1"), })
86
87 -
88   I check that the invoice state is now Done
89 -
90   !assert {model: account.invoice, id: account_invoice_1}:
91     - state == 'paid'
92 -
93   I check that an payment entry gets created in the account.move.line
94 -
95   !python {model: account.invoice}: |
96     acc_id=self.browse(cr, uid, ref("account_invoice_1"))
97     assert(acc_id.move_id)
98 #-
99 #  I refund the invoice
100 #-
101 #  Creating a account.invoice.refund record
102 #-
103 #  !record {model: account.invoice.refund, id: account_invoice_refund_0}:
104 #    date: '2010-06-22'
105 #    description: 'Refund By Axelor '
106 #
107 #
108 #-
109 #  Performing an osv_memory action invoice_refund on module account.invoice.refund
110 #-
111 #  !python {model: account.invoice.refund}: |
112 #    self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US',
113 #      "tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_1")],
114 #      "type": "in_invoice", "active_id": ref("account_invoice_1"), })
115
116
117