[IMP] Reportings Review
[odoo/odoo.git] / addons / account_anglo_saxon / test / anglo_saxon.yml
1 -
2   In order to test anglo_saxon Configure Different Accounts.
3 -
4   !record {model: account.account, id: account_anglo_stock_valuation}:
5     code: X3000
6     name: Stock Valuation Account- (test)
7     parent_id: account.cas
8     type: other
9     user_type: account.data_account_type_asset
10 -
11   Configure Stock Interim account (Received).
12 -
13   !record {model: account.account, id: account_anglo_stock_input}:
14     code: X2800
15     name: Stock Interim account (Received)
16     parent_id: account.cos
17     type: other
18     user_type: account.data_account_type_expense
19 -
20   Configure Stock Interim account (Delivered).
21 -
22   !record {model: account.account, id: account_anglo_stock_output}:
23     code: X2801
24     name: Stock Interim account (Delivered)
25     parent_id: account.rev
26     type: other
27     user_type: account.data_account_type_income
28 -
29   Configure Price difference creditor Account.
30 -
31   !record {model: account.account, id: account_anglo_price_difference}:
32     code: X7095
33     name: Price difference creditor Account
34     parent_id: account.cos
35     type: other
36     user_type: account.data_account_type_expense
37 -
38   Configure Cash Bank Account.
39 -
40   !record {model: account.account, id: account_anglo_cash}:
41     code: X5000
42     name: Cash/Bank Account 
43     parent_id: account.cash  
44     type: other
45     user_type: account.data_account_type_asset
46     reconcile: True
47 -
48   Configure Creditor Account Payable. 
49 -
50   !record {model: account.account, id: account_anglo_payable}:
51     code: X440001
52     name: Creditor Account Payable 
53     parent_id: account.a_pay  
54     type: other
55     user_type: account.data_account_type_payable
56     reconcile: True
57 -
58   Configure Debtor Account Receivable. 
59 -
60   !record {model: account.account, id: account_anglo_receivable}:
61     code: X400001
62     name: Debtor Account Receivable 
63     parent_id: account.a_recv  
64     type: other
65     user_type: account.data_account_type_receivable
66     reconcile: True
67 -
68   Configure Cost of Good sale Account.
69 -
70   !record {model: account.account, id: account_anglo_cogs}:
71     code: X7000
72     name: Cost of goods sale account
73     parent_id: account.o_expense
74     type: other
75     user_type: account.data_account_type_expense
76 -
77   Configure Income Account.
78 -
79   !record {model: account.account, id: account_anglo_income}:
80     code: X8000
81     name: Income Account
82     parent_id: account.o_income
83     type: other
84     user_type: account.data_account_type_income
85 -
86   I configure the account receivable of supplier
87 -
88   !record {model: res.partner, id: base.res_partner_3}:
89     property_account_payable: account_anglo_payable
90     property_account_receivable: account_anglo_receivable
91 -
92   I configure the account receivable of Customer.
93 -
94   !record {model: res.partner, id: base.res_partner_13}:
95     property_account_payable: account_anglo_payable
96     property_account_receivable: account_anglo_receivable
97 -
98   I configure the product category with stock valuation account.
99 -
100   !record {model: product.category, id: product.product_category_4}:
101     property_stock_valuation_account_id: account_anglo_stock_valuation
102 -
103   I configure the product with required accounts, and cost method = standard
104 -
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'})
110 -
111   I create a draft Purchase Order.
112 -
113   !record {model: purchase.order, id: purchase_order_001}:
114     partner_id: base.res_partner_3
115     location_id: stock.stock_location_stock
116     pricelist_id: 1
117     order_line:
118       - product_id: product.product_product_10
119         product_qty: 1
120         price_unit: 10
121         date_planned: !eval "'%s' % (time.strftime('%Y-%m-%d'))"
122 -
123   I confirm the purchase order.
124 -
125   !workflow {model: purchase.order, ref: purchase_order_001, action: purchase_confirm}
126 -
127   Receipt is ready for process so now we do it.
128 -
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()
132 -
133   I check the Stock Interim account (Received) is credited successfully.
134 -
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."
139 -
140   I check the Stock valuation account is debited sucessfully.
141 -
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."
146 -
147   I Validate Invoice of Purchase Order.
148 -
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')
152 -
153   I check the Stock Interim account (Received) is debited sucessfully when Invoice validated.
154 -
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."
159 -
160   I check the Price difference creditor Account is debited sucessfully when Invoice validated.
161 -
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."
166 -
167   I check Payable(creditor) Account is Credited sucessfully when Invoice validated.
168 -
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."
173 -
174   I open the Invoice.
175 -
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')
180 -
181   I pay the invoice.
182 -
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')
189 -
190   I check Payable(Creditors) Account is Debited sucessfully after invoice paid.
191 -
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."
196 -
197   I check Bank/Cash account is credited sucessfully after invoice paid.
198 -
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."
203 -
204   I create an Outgoing Picking order
205 -
206   !record {model: stock.picking, id: stock_picking_out001}:
207     partner_id: base.res_partner_13
208     move_lines:
209       - company_id: base.main_company
210         location_id: stock.stock_location_stock
211         product_id: product.product_product_10
212         product_uom_qty: 1.0
213         product_uom: product.product_uom_unit
214         location_dest_id: stock.stock_location_customers
215     move_type: direct
216     invoice_state: 2binvoiced
217     picking_type_id: stock.picking_type_out
218 -
219   I need to check the availability of the product, So I make my picking order for processing later.
220 -
221   !python {model: stock.picking}: |
222     self.action_confirm(cr, uid, [ref('stock_picking_out001')], context=context)
223
224 -
225   I check the product availability, Product is available in the stock and ready to be sent.
226 -
227   !python {model: stock.picking}: |
228     picking = self.browse(cr, uid, ref("stock_picking_out001"))
229     assert picking.state == "confirmed", "Picking should be confirmed."
230     for move_line in picking.move_lines:
231         assert move_line.state == "confirmed", "Move should be confirmed."
232
233 -
234   I process the delivery.
235 -
236   !python {model: stock.picking}: |
237     picking = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001"), context=context)
238     picking.do_transfer()
239
240   I check Stock Interim account (Delivery) is debited successfully.
241 -
242   !python {model: account.account}: |
243     from openerp.tools import float_compare
244     debit = self.browse(cr, uid, ref('account_anglo_stock_output')).debit
245     float_compare(debit, 9, precision_digits=2) == 0, "Stock Interim account (Delivery) is not debited successfully."
246 -
247   I check the Stock valuation account is credited sucessfully.
248 -
249   !python {model: account.account}: |
250     from openerp.tools import float_compare
251     credit = self.browse(cr, uid, ref('account_anglo_stock_valuation')).credit
252     float_compare(credit, 9, precision_digits=2) == 0, "Stock valuation account is not credited successfully."
253 -
254   As the Invoice state of the picking order is To be invoiced. I create invoice for my outgoing picking order.
255 -
256   !python {model: stock.invoice.onshipping}: |
257     wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
258       {'active_ids': [ref("stock_picking_out001")], "active_model": "stock.picking"})
259     self.create_invoice(cr, uid, [wiz_id], {"active_ids": [ref("stock_picking_out001")], "active_id": ref("stock_picking_out001")})
260 -
261   I check that the customer invoice is created successfully.
262 -
263   !python {model: account.invoice}: |
264     partner_id = self.pool.get('stock.picking').browse(cr, uid, ref('stock_picking_out001')).partner_id.id
265     inv_ids = self.search(cr, uid, [('type','=','out_invoice'),('partner_id','=',partner_id)])
266     assert inv_ids, 'No Invoice is generated!'
267 -
268   I open the Invoice.
269 -
270   !python {model: stock.picking}: |
271     move_name = self.pool.get('stock.picking').browse(cr, uid, ref('stock_picking_out001')).name
272     account_invoice = self.pool.get('account.invoice').search(cr, uid, [('origin', '=', move_name)])
273     self.pool.get('account.invoice').signal_workflow(cr, uid, account_invoice, 'invoice_open')
274 -
275   I check Income Account is Credited sucessfully when Invoice validated.
276 -
277   !python {model: account.account}: |
278     from openerp.tools import float_compare
279     credit = self.browse(cr, uid, ref('account_anglo_income')).credit
280     float_compare(credit, 20, precision_digits=2) == 0, "Income Account is not Credited successfully."
281 -
282   I check Cost of goods sold account for debit.
283 -
284   !python {model: account.account}: |
285     from openerp.tools import float_compare
286     debit = self.browse(cr, uid, ref('account_anglo_cogs')).debit
287     float_compare(debit, 9, precision_digits=2) == 0, "Cost of goods sale is not Debited successfully."
288 -
289   I check Stock Interim account (Delivery)
290 -
291   !python {model: account.account}: |
292     from openerp.tools import float_compare
293     credit = self.browse(cr, uid, ref('account_anglo_stock_output')).credit
294     float_compare(credit, 9, precision_digits=2) == 0, "Stock Interim account (Delivery) is not credited successfully."
295 -
296   I check Receivable(Debtor) Account for debit.
297 -
298   !python {model: account.account}: |
299     from openerp.tools import float_compare
300     debit = self.browse(cr, uid, ref('account_anglo_receivable')).debit
301     float_compare(debit, 20, precision_digits=2) == 0, "Receivable(Debtors) Account is not Debited successfully."
302 -
303   I pay the invoice.
304 -
305   !python {model: account.invoice}: |
306     move_name = self.pool.get('stock.picking').browse(cr, uid, ref('stock_picking_out001')).name
307     account_invoice= self.pool.get('account.invoice').search(cr, uid, [('origin', '=', move_name)])
308     journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash')], limit=1)
309     pay = self.pay_and_reconcile(cr, uid, account_invoice,
310                         20.0, ref('account_anglo_cash'), ref('account.period_8'),
311                         journal_ids[0], ref('account_anglo_cash'),
312                         ref('account.period_8'), journal_ids[0],
313                         name='Payment for test customer invoice')
314     assert (pay == True), "Incorrect Payment."
315 -
316   I check Receivable(Debtor) Account for credit.
317 -
318   !python {model: account.account}: |
319     from openerp.tools import float_compare
320     credit = self.browse(cr, uid, ref('account_anglo_receivable')).credit
321     float_compare(credit, 20, precision_digits=2) == 0, "Receivable(Debtors) Account is not Credited successfully."
322 -
323   I check Bank/Cash account is debited sucessfully after invoice paid.
324 -
325   !python {model: account.account}: |
326     from openerp.tools import float_compare
327     debit = self.browse(cr, uid, ref('account_anglo_cash')).debit
328     float_compare(debit, 20, precision_digits=2) == 0, "Bank/Cash account is not successfully credited."