[IMP] sale:-improved the yaml files
[odoo/odoo.git] / addons / sale / test / advance_invoice.yml
1 -
2   In order to test the Deposit wizard of sale module in the Open-ERP,
3   I create a Sale Order for LG Viewty Smart for qty 100 having order_policy manual.
4
5   !record {model: sale.order, id: sale_order_so5}:
6     date_order: '2010-07-17'
7     invoice_quantity: order
8     name: SO004
9     order_line:
10       - name: LG Viewty Smart
11         price_unit: 170.0
12         product_uom: product.product_uom_unit
13         product_uom_qty: 100.0
14         state: draft
15         delay: 7.0
16         product_id: sale.product_product_lgviewtysmart0
17         product_uos_qty: 100.0
18         th_weight: 0.0
19         type: make_to_order
20     order_policy: manual
21     partner_id: sale.res_partner_cleartrail0
22     partner_invoice_id: sale.res_partner_address_2
23     partner_order_id: sale.res_partner_address_1
24     partner_shipping_id: sale.res_partner_address_3
25     picking_policy: direct
26     pricelist_id: product.list0
27     shop_id: sale.shop
28 -
29   I confirm the Sale Order.
30
31   !workflow {model: sale.order, action: order_confirm, ref: sale_order_so5}
32 -
33    I use the Advance Payment wizard.
34
35   !record {model: sale.advance.payment.inv, id: sale_advance_payment_inv_0}:
36     amount: 1000.0
37     product_id: product.product_product_pc3
38     qtty: 3.0
39
40   Then I click on the "Create Partial Invoice" button
41
42   !python {model: sale.advance.payment.inv}: |
43     self.create_invoices(cr, uid, [ref("sale_advance_payment_inv_0")], {"lang": 'en_US',
44       "active_model": 'sale.order', "active_ids": [ref("sale_order_so5")], "tz":
45       False, "active_id": ref("sale_order_so5"), })
46 -
47   I verify whether the invoice has been generated.
48 -
49   !python {model: sale.order}: |
50     so = self.browse(cr, uid, ref("sale_order_so5"))
51     assert so.invoice_ids, "Invoices has not been generated for sale_order_so5"    
52 -    
53   I open the Invoice for the SO.
54 -
55   !python {model: account.invoice}: |
56     sale_order_obj = self.pool.get('sale.order')
57     so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
58     import netsvc
59     wf_service = netsvc.LocalService("workflow")
60     invoice_ids = so.invoice_ids
61     for invoice in invoice_ids:
62       wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
63 -
64   I verify that an invoice state has transit from draft to open state
65 -
66   !python {model: account.invoice}: |
67     sale_order_obj = self.pool.get('sale.order')
68     so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
69     invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
70     assert invoice_id, "Invoice is not in the open state"
71 -
72   Creating a account invoice pay entry.
73
74   !record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
75     amount: 3000.0
76     date: '2010-07-17'
77     journal_id: sale.account_journal_bankjournal0
78     name: test
79     period_id: account.period_5
80
81   I pay the invoice.
82 -
83   !python {model: account.invoice.pay}: |
84     sale_order_obj = self.pool.get('sale.order')
85     so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
86     self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "active_model": "account.invoice", 
87       "tz":False,"record_id": so.invoice_ids[0].id, "active_ids": [so.invoice_ids[0].id], "type":
88       "out_invoice", "active_id": so.invoice_ids[0].id})
89 -
90   Creating an account invoice pay writeoff entry.
91
92   !record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_5}:
93     analytic_id: account.analytic_customers
94     comment: Write-Off
95     writeoff_acc_id: account.a_sale
96     writeoff_journal_id: sale.account_journal_bankjournal0
97 -
98   I verify that invoice has transit from Open to Done state
99 -
100   !python {model: account.invoice}: |
101     sale_order_obj = self.pool.get('sale.order')
102     so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
103     invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','paid')])
104     assert invoice_id, "Invoice for SO is not in done state."
105 -
106   I verify that Paid has been set to true.
107 -
108   !python {model: sale.order}: |
109     sale_id=self.browse(cr, uid, ref("sale_order_so5"))
110     assert(sale_id.invoiced == True), "Paid has not been set to true"
111 -
112   I click on "Create Invoice" button of Sales order to create the invoice.
113
114   !workflow {model: sale.order, action: manual_invoice, ref: sale_order_so5}
115 -
116   I verify whether the invoice has been generated for SO
117 -
118   !python {model: sale.order}: |
119     so = self.browse(cr, uid, ref("sale_order_so5"))
120     assert so.invoice_ids[1], "Invoices has not been generated for sale_order_so5" 
121 -
122   I open the Invoice for the SO.
123 -
124   !python {model: account.invoice}: |
125     sale_order_obj = self.pool.get('sale.order')
126     so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
127     import netsvc
128     wf_service = netsvc.LocalService("workflow")
129     invoice_ids = so.invoice_ids
130     for invoice in invoice_ids:
131       wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
132 -
133   I verify that an invoice state has transit from draft to open state
134 -
135   !python {model: account.invoice}: |
136     sale_order_obj = self.pool.get('sale.order')
137     so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
138     invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
139     assert invoice_id, "Invoice is not in the open state"
140 -
141   Creating a account invoice pay entry.
142
143   !record {model: account.invoice.pay, id: account_invoice_pay_tst2}:
144     amount: 14000.0
145     date: '2010-07-17'
146     journal_id: sale.account_journal_bankjournal0
147     name: test
148     period_id: account.period_5
149
150   I pay the invoice.
151 -
152   !python {model: account.invoice.pay}: |
153     sale_order_obj = self.pool.get('sale.order')
154     so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
155     self.wo_check(cr, uid, [ref("account_invoice_pay_tst2")], {"lang": "en_US", "active_model": "account.invoice", 
156       "tz":False,"record_id": so.invoice_ids[1].id, "active_ids": [so.invoice_ids[1].id], "type":
157       "out_invoice", "active_id": so.invoice_ids[1].id})
158 -
159   Creating an account invoice pay writeoff entry.
160
161   !record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
162     analytic_id: account.analytic_customers
163     comment: Write-Off
164     writeoff_acc_id: account.a_sale
165     writeoff_journal_id: sale.account_journal_bankjournal0
166
167   Pay and Reconcile the Invoice.
168
169   !python {model: account.invoice.pay.writeoff}: |
170     sale_order_obj = self.pool.get('sale.order')
171     so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))   
172     self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
173       {"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
174       [so.invoice_ids[1].id], "type": "out_invoice", "active_id": so.invoice_ids[1].id})
175 -
176   I verify that an invoice is in done state.
177 -
178   !python {model: account.invoice}: |
179     sale_order_obj = self.pool.get('sale.order')
180     so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
181     invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','paid')])
182     assert invoice_id, "Invoice for SO is not in done state."
183 -
184   I verify that Paid has been set to true.
185 -
186   !python {model: sale.order}: |
187     sale_id=self.browse(cr, uid, ref("sale_order_so5"))
188     assert(sale_id.invoiced == True), "Paid has not been set to true"