2 In order to test anglo_saxon Configure Different Accounts.
4 !record {model: account.account, id: account_anglo_stock_valuation}:
6 name: Stock Valuation Account- (test)
9 user_type: account.data_account_type_asset
11 Configure Stock Interim account (Received).
13 !record {model: account.account, id: account_anglo_stock_input}:
15 name: Stock Interim account (Received)
16 parent_id: account.cos
18 user_type: account.data_account_type_expense
20 Configure Stock Interim account (Delivered).
22 !record {model: account.account, id: account_anglo_stock_output}:
24 name: Stock Interim account (Delivered)
25 parent_id: account.rev
27 user_type: account.data_account_type_income
29 Configure Price difference creditor Account.
31 !record {model: account.account, id: account_anglo_price_difference}:
33 name: Price difference creditor Account
34 parent_id: account.cos
36 user_type: account.data_account_type_expense
38 Configure Cash Bank Account.
40 !record {model: account.account, id: account_anglo_cash}:
42 name: Cash/Bank Account
43 parent_id: account.cash
45 user_type: account.data_account_type_asset
48 Configure Creditor Account Payable.
50 !record {model: account.account, id: account_anglo_payable}:
52 name: Creditor Account Payable
53 parent_id: account.a_pay
55 user_type: account.data_account_type_payable
58 Configure Debtor Account Receivable.
60 !record {model: account.account, id: account_anglo_receivable}:
62 name: Debtor Account Receivable
63 parent_id: account.a_recv
65 user_type: account.data_account_type_receivable
68 Configure Cost of Good sale Account.
70 !record {model: account.account, id: account_anglo_cogs}:
72 name: Cost of goods sale account
73 parent_id: account.o_expense
75 user_type: account.data_account_type_expense
77 Configure Income Account.
79 !record {model: account.account, id: account_anglo_income}:
82 parent_id: account.o_income
84 user_type: account.data_account_type_income
86 I configure the account receivable of supplier
88 !record {model: res.partner, id: base.res_partner_3}:
89 property_account_payable: account_anglo_payable
90 property_account_receivable: account_anglo_receivable
92 I configure the account receivable of Customer.
94 !record {model: res.partner, id: base.res_partner_13}:
95 property_account_payable: account_anglo_payable
96 property_account_receivable: account_anglo_receivable
98 I configure the product category with stock valuation account.
100 !record {model: product.category, id: product.product_category_4}:
101 property_stock_valuation_account_id: account_anglo_stock_valuation
103 I configure the product with required accounts, and cost method = standard
105 !python {model: product.product}: |
106 self.write(cr, uid, [ref('product.product_product_10')], {'list_price': 20.00,'standard_price': 9,'categ_id': ref('product.product_category_4'),'valuation': 'real_time',
107 'property_account_income': ref('account_anglo_income'),'property_account_expense': ref('account_anglo_cogs'),
108 'property_account_creditor_price_difference': ref('account_anglo_price_difference'),'property_stock_account_input': ref('account_anglo_stock_input'),
109 'property_stock_account_output': ref('account_anglo_stock_output'), 'cost_method': 'standard'})
111 I create a draft Purchase Order.
113 !record {model: purchase.order, id: purchase_order_001}:
114 partner_id: base.res_partner_3
115 location_id: stock.stock_location_stock
118 - product_id: product.product_product_10
121 date_planned: !eval "'%s' % (time.strftime('%Y-%m-%d'))"
123 I confirm the purchase order.
125 !workflow {model: purchase.order, ref: purchase_order_001, action: purchase_confirm}
127 Receipt is ready for process so now we do it.
129 !python {model: stock.picking}: |
130 picking_id = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001"), context=context).picking_ids[0]
131 picking_id.do_transfer()
133 I check the Stock Interim account (Received) is credited successfully.
135 !python {model: account.account}: |
136 from openerp.tools import float_compare
137 credit = self.browse(cr, uid, ref('account_anglo_stock_input')).credit
138 float_compare(credit, 9, precision_digits=2) == 0, "Stock Interim account (Received) is not credited successfully."
140 I check the Stock valuation account is debited sucessfully.
142 !python {model: account.account}: |
143 from openerp.tools import float_compare
144 debit = self.browse(cr, uid, ref('account_anglo_stock_valuation')).debit
145 float_compare(debit, 9, precision_digits=2) == 0, "Stock valuation account is not debited successfully."
147 I Validate Invoice of Purchase Order.
149 !python {model: purchase.order}: |
150 invoice_ids = [x.id for x in self.browse(cr, uid, ref("purchase_order_001")).invoice_ids]
151 self.pool.get('account.invoice').signal_workflow(cr, uid, invoice_ids, 'invoice_open')
153 I check the Stock Interim account (Received) is debited sucessfully when Invoice validated.
155 !python {model: account.account}: |
156 from openerp.tools import float_compare
157 debit = self.browse(cr, uid, ref('account_anglo_stock_input')).debit
158 float_compare(debit, 9, precision_digits=2) == 0, "Stock Interim account (Received) is not debited successfully."
160 I check the Price difference creditor Account is debited sucessfully when Invoice validated.
162 !python {model: account.account}: |
163 from openerp.tools import float_compare
164 debit = self.browse(cr, uid, ref('account_anglo_price_difference')).debit
165 float_compare(debit, 1, precision_digits=2) == 0, "Price difference creditor Account is not debited successfully."
167 I check Payable(creditor) Account is Credited sucessfully when Invoice validated.
169 !python {model: account.account}: |
170 from openerp.tools import float_compare
171 credit = self.browse(cr, uid, ref('account_anglo_payable')).credit
172 float_compare(credit, 10, precision_digits=2) == 0, "Payable(creditor) Account is not Credited successfully."
176 !python {model: purchase.order}: |
177 po = self.browse(cr, uid, ref("purchase_order_001"))
178 for invoice in po.invoice_ids:
179 invoice.signal_workflow('invoice_open')
183 !python {model: purchase.order}: |
184 invoice_ids = self.browse(cr, uid, ref("purchase_order_001")).invoice_ids
185 order = self.browse(cr, uid, ref("purchase_order_001"))
186 journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', order.company_id.id)], limit=1)
187 for invoice in invoice_ids:
188 invoice.pay_and_reconcile(invoice.amount_total, ref('account_anglo_cash'), ref('account.period_8'), journal_ids[0], ref('account_anglo_cash'), ref('account.period_8'), journal_ids[0], name='test')
190 I check Payable(Creditors) Account is Debited sucessfully after invoice paid.
192 !python {model: account.account}: |
193 from openerp.tools import float_compare
194 debit = self.browse(cr, uid, ref('account_anglo_payable')).debit
195 assert float_compare(debit, 10, precision_digits=2) == 0, "Payable(Creditors) Account is not Debited successfully."
197 I check Bank/Cash account is credited sucessfully after invoice paid.
199 !python {model: account.account}: |
200 from openerp.tools import float_compare
201 credit = self.browse(cr, uid, ref('account_anglo_cash')).credit
202 float_compare(credit, 10, precision_digits=2) == 0, "Bank/Cash account is not credited successfully."
204 I create an Outgoing Picking order
206 !record {model: stock.picking, id: stock_picking_out001}:
207 partner_id: base.res_partner_13
209 - company_id: base.main_company
210 location_id: stock.stock_location_stock
211 product_id: product.product_product_10
213 product_uom: product.product_uom_unit
214 location_dest_id: stock.stock_location_customers
215 invoice_state: 2binvoiced
216 invoice_state: 2binvoiced
218 picking_type_id: stock.picking_type_out
220 I need to check the availability of the product, So I make my picking order for processing later.
222 !python {model: stock.picking}: |
223 self.action_confirm(cr, uid, [ref('stock_picking_out001')], context=context)
226 I check the product availability, Product is available in the stock and ready to be sent.
228 !python {model: stock.picking}: |
229 picking = self.browse(cr, uid, ref("stock_picking_out001"))
230 assert picking.state == "confirmed", "Picking should be confirmed."
231 for move_line in picking.move_lines:
232 assert move_line.state == "confirmed", "Move should be confirmed."
235 I process the delivery.
237 !python {model: stock.picking}: |
238 picking = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001"), context=context)
239 picking.do_transfer()
241 I check Stock Interim account (Delivery) is debited successfully.
243 !python {model: account.account}: |
244 from openerp.tools import float_compare
245 debit = self.browse(cr, uid, ref('account_anglo_stock_output')).debit
246 float_compare(debit, 9, precision_digits=2) == 0, "Stock Interim account (Delivery) is not debited successfully."
248 I check the Stock valuation account is credited sucessfully.
250 !python {model: account.account}: |
251 from openerp.tools import float_compare
252 credit = self.browse(cr, uid, ref('account_anglo_stock_valuation')).credit
253 float_compare(credit, 9, precision_digits=2) == 0, "Stock valuation account is not credited successfully."
255 As the Invoice state of the picking order is To be invoiced. I create invoice for my outgoing picking order.
257 !python {model: stock.invoice.onshipping}: |
258 wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
259 {'active_ids': [ref("stock_picking_out001")], "active_model": "stock.picking"})
260 self.create_invoice(cr, uid, [wiz_id], {"active_ids": [ref("stock_picking_out001")], "active_id": ref("stock_picking_out001")})
262 I check that the customer invoice is created successfully.
264 !python {model: account.invoice}: |
265 partner_id = self.pool.get('stock.picking').browse(cr, uid, ref('stock_picking_out001')).partner_id.id
266 inv_ids = self.search(cr, uid, [('type','=','out_invoice'),('partner_id','=',partner_id)])
267 assert inv_ids, 'No Invoice is generated!'
271 !python {model: stock.picking}: |
272 move_name = self.pool.get('stock.picking').browse(cr, uid, ref('stock_picking_out001')).name
273 account_invoice = self.pool.get('account.invoice').search(cr, uid, [('origin', '=', move_name)])
274 self.pool.get('account.invoice').signal_workflow(cr, uid, account_invoice, 'invoice_open')
276 I check Income Account is Credited sucessfully when Invoice validated.
278 !python {model: account.account}: |
279 from openerp.tools import float_compare
280 credit = self.browse(cr, uid, ref('account_anglo_income')).credit
281 float_compare(credit, 20, precision_digits=2) == 0, "Income Account is not Credited successfully."
283 I check Cost of goods sold account for debit.
285 !python {model: account.account}: |
286 from openerp.tools import float_compare
287 debit = self.browse(cr, uid, ref('account_anglo_cogs')).debit
288 float_compare(debit, 9, precision_digits=2) == 0, "Cost of goods sale is not Debited successfully."
290 I check Stock Interim account (Delivery)
292 !python {model: account.account}: |
293 from openerp.tools import float_compare
294 credit = self.browse(cr, uid, ref('account_anglo_stock_output')).credit
295 float_compare(credit, 9, precision_digits=2) == 0, "Stock Interim account (Delivery) is not credited successfully."
297 I check Receivable(Debtor) Account for debit.
299 !python {model: account.account}: |
300 from openerp.tools import float_compare
301 debit = self.browse(cr, uid, ref('account_anglo_receivable')).debit
302 float_compare(debit, 20, precision_digits=2) == 0, "Receivable(Debtors) Account is not Debited successfully."
306 !python {model: account.invoice}: |
307 move_name = self.pool.get('stock.picking').browse(cr, uid, ref('stock_picking_out001')).name
308 account_invoice= self.pool.get('account.invoice').search(cr, uid, [('origin', '=', move_name)])
309 journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash')], limit=1)
310 pay = self.pay_and_reconcile(cr, uid, account_invoice,
311 20.0, ref('account_anglo_cash'), ref('account.period_8'),
312 journal_ids[0], ref('account_anglo_cash'),
313 ref('account.period_8'), journal_ids[0],
314 name='Payment for test customer invoice')
315 assert (pay == True), "Incorrect Payment."
317 I check Receivable(Debtor) Account for credit.
319 !python {model: account.account}: |
320 from openerp.tools import float_compare
321 credit = self.browse(cr, uid, ref('account_anglo_receivable')).credit
322 float_compare(credit, 20, precision_digits=2) == 0, "Receivable(Debtors) Account is not Credited successfully."
324 I check Bank/Cash account is debited sucessfully after invoice paid.
326 !python {model: account.account}: |
327 from openerp.tools import float_compare
328 debit = self.browse(cr, uid, ref('account_anglo_cash')).debit
329 float_compare(debit, 20, precision_digits=2) == 0, "Bank/Cash account is not successfully credited."