b3588ad66211d9191611b0db9a3e3996936fb452
[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         invoice_state: 2binvoiced
216     invoice_state: 2binvoiced
217     move_type: direct
218     picking_type_id: stock.picking_type_out
219 -
220   I need to check the availability of the product, So I make my picking order for processing later.
221 -
222   !python {model: stock.picking}: |
223     self.action_confirm(cr, uid, [ref('stock_picking_out001')], context=context)
224
225 -
226   I check the product availability, Product is available in the stock and ready to be sent.
227 -
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."
233
234 -
235   I process the delivery.
236 -
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()
240
241   I check Stock Interim account (Delivery) is debited successfully.
242 -
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."
247 -
248   I check the Stock valuation account is credited sucessfully.
249 -
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."
254 -
255   As the Invoice state of the picking order is To be invoiced. I create invoice for my outgoing picking order.
256 -
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")})
261 -
262   I check that the customer invoice is created successfully.
263 -
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!'
268 -
269   I open the Invoice.
270 -
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')
275 -
276   I check Income Account is Credited sucessfully when Invoice validated.
277 -
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."
282 -
283   I check Cost of goods sold account for debit.
284 -
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."
289 -
290   I check Stock Interim account (Delivery)
291 -
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."
296 -
297   I check Receivable(Debtor) Account for debit.
298 -
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."
303 -
304   I pay the invoice.
305 -
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."
316 -
317   I check Receivable(Debtor) Account for credit.
318 -
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."
323 -
324   I check Bank/Cash account is debited sucessfully after invoice paid.
325 -
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."