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.
5 !record {model: sale.order, id: sale_order_so5}:
6 date_order: '2010-07-17'
7 invoice_quantity: order
10 - name: LG Viewty Smart
12 product_uom: product.product_uom_unit
13 product_uom_qty: 100.0
16 product_id: sale.product_product_lgviewtysmart0
17 product_uos_qty: 100.0
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
29 I confirm the Sale Order.
31 !workflow {model: sale.order, action: order_confirm, ref: sale_order_so5}
33 I use the Advance Payment wizard.
35 !record {model: sale.advance.payment.inv, id: sale_advance_payment_inv_0}:
37 product_id: product.product_product_pc3
40 Then I click on the "Create Partial Invoice" button
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"), })
47 I verify whether the invoice has been generated.
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"
53 I open the Invoice for the SO.
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"))
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)
64 I verify that an invoice state has transit from draft to open state
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"
72 Creating a account invoice pay entry.
74 !record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
77 journal_id: sale.account_journal_bankjournal0
79 period_id: account.period_5
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})
90 Creating an account invoice pay writeoff entry.
92 !record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_5}:
93 analytic_id: account.analytic_customers
95 writeoff_acc_id: account.a_sale
96 writeoff_journal_id: sale.account_journal_bankjournal0
98 I verify that invoice has transit from Open to Done state
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."
106 I verify that Paid has been set to true.
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"
112 I click on "Create Invoice" button of Sales order to create the invoice.
114 !workflow {model: sale.order, action: manual_invoice, ref: sale_order_so5}
116 I verify whether the invoice has been generated for SO
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"
122 I open the Invoice for the SO.
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"))
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)
133 I verify that an invoice state has transit from draft to open state
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"
141 Creating a account invoice pay entry.
143 !record {model: account.invoice.pay, id: account_invoice_pay_tst2}:
146 journal_id: sale.account_journal_bankjournal0
148 period_id: account.period_5
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})
159 Creating an account invoice pay writeoff entry.
161 !record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
162 analytic_id: account.analytic_customers
164 writeoff_acc_id: account.a_sale
165 writeoff_journal_id: sale.account_journal_bankjournal0
167 Pay and Reconcile the Invoice.
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})
176 I verify that an invoice is in done state.
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."
184 I verify that Paid has been set to true.
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"