[IMP] add the test case for anglo_saxon sale product

bzr revid: rma@tinyerp.com-20130404053554-codkxw7mx5lco9mo
This commit is contained in:
Randhir Mayatra (OpenERP) 2013-04-04 11:05:54 +05:30
parent 1e6fbae643
commit 5eb09b0224
1 changed files with 164 additions and 27 deletions

View File

@ -37,23 +37,16 @@
-
I have configure the product category with stock valuation account
-
!record {model: product.category, id: product_product_3_1}:
name: PC Assemble SC234
parent_id: product.product_product_3
property_stock_valuation_account_id : account_anglo_1
!python {model: product.category}: |
self.write(cr, uid, [ref('product.product_category_4')], {'property_stock_valuation_account_id': ref('account_anglo_1')})
-
I have configure the product with required accounts
-
!record {model: product.product, id: product_product_3}:
name: PC Assemble SC234
list_price: 20.00
standard_price: 10
valuation: real_time
property_account_income: account.o_income
property_account_expense: account.o_expense
property_account_creditor_price_difference: account_anglo_4
property_stock_account_input: account_anglo_2
property_stock_account_output: account_anglo_3
!python {model: product.product}: |
self.write(cr, uid, [ref('product.product_product_3')], {'list_price': 20.00,'standard_price': 9,'valuation': 'real_time',
'property_account_income': ref('account.o_income'),'property_account_expense': ref('account.o_expense'),
'property_account_creditor_price_difference': ref('account_anglo_4'),'property_stock_account_input': ref('account_anglo_2'),
'property_stock_account_output': ref('account_anglo_3')})
-
I create a draft Purchase Order
-
@ -64,6 +57,7 @@
order_line:
- product_id: product.product_product_3
product_qty: 1
price_unit: 10
date_planned: '2013-08-31'
-
I confirm the purchase order
@ -77,16 +71,17 @@
partial_id = self.create(cr, uid, {},context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
self.do_partial(cr, uid, [partial_id])
-
I check that purchase order is shipped.
I check the Stock Interim account (Received) credit successfully
-
!python {model: purchase.order}: |
assert self.browse(cr, uid, ref("purchase_order_1")).shipped == True,"Purchase order should be delivered"
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account_anglo_2'))
assert acc.credit == 9, "Stock Interim account (Received) credit not successfully"
-
I check the Stock Interim account (Received) credit and Stock valuation account debit
I check the Stock valuation account debit sucessfully
-
!python {model: account.move.line}: |
acc = self.browse(cr, uid, ref('product.product_product_3'))
assert acc.id, "Account move line entries not created successfully"
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account_anglo_1'))
assert acc.debit == 9, "Stock valuation account not debited successfully"
-
I Validate Invoice of Purchase Order.
-
@ -94,13 +89,155 @@
invoice_ids = [x.id for x in self.browse(cr, uid, ref("purchase_order_1")).invoice_ids]
self.pool.get('account.invoice').signal_invoice_open(cr, uid, invoice_ids)
-
I check that purchase order is invoiced.
I check the Stock Interim account (Received) debited sucessfully when Invoice validated
-
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account_anglo_2'))
assert acc.debit == 9, "Stock Interim account (Received) debited not successfully"
-
I check the Price difference creditor Account debited sucessfully when Invoice validated
-
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account_anglo_4'))
assert acc.debit == 1, "Price difference creditor Account debited not successfully"
-
I check Payable(Creditor) Account Credited sucessfully when Invoice validated
-
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account.a_pay'))
assert acc.credit == 10, "Payable(Creditor) Account Credited not successfully"
-
I open the Invoice.
-
!python {model: purchase.order}: |
assert self.browse(cr, uid, ref("purchase_order_1")).invoiced == True,"Purchase Order should be invoiced"
po = self.browse(cr, uid, ref("purchase.purchase_order_1"))
account_invoice_obj = self.pool.get('account.invoice')
for invoice in po.invoice_ids:
account_invoice_obj.signal_invoice_open(cr, uid, [invoice.id])
# -
# I pay the invoice
# -
# !python {model: account.invoice}: |
# purchase_order = self.pool.get('purchase.order')
# order = purchase_order.browse(cr, uid, ref("purchase.purchase_order_1"))
# journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', order.company_id.id)], limit=1)
# for invoice in order.invoice_ids:
# invoice.pay_and_reconcile(
# invoice.amount_total, ref('account.cash'), ref('account.period_8'),
# journal_ids[0], ref('account.cash'),
# ref('account.period_8'), journal_ids[0],
# name='test')
# -
# I check the order after paid invoice.
# -
# !python {model: purchase.order}: |
# order = self.browse(cr, uid, ref("purchase.purchase_order_1"))
# assert order.invoiced == True, "purchase order is not invoiced."
# assert order.invoiced_rate == 100, "Invoiced progress is not 100%."
# assert order.state == 'done', 'Order should be in closed.'
-
I check the Stock Interim account (Received) and Price difference creditor Account debited and Payable acccount credited
I check Payable(Creditor) Account Debited sucessfully after invoice paid
-
!python {model: account.move.line}: |
acc = self.browse(cr, uid, ref('product.product_product_3'))
assert acc.id, "Account move entries in Payable account not created successfully"
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account.a_pay'))
assert acc.debit == 10, "Payable(Creditor) Account Debited not successfully"
-
I check Bank/Cash account credited sucessfully after invoice paid
-
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account.cash'))
assert acc.credit == 10, "Bank/Cash account not successfully credited"
-
Create the delivery order for received product
-
I create an Outgoing Picking order.
-
!record {model: stock.picking, id: stock_picking_out0}:
partner_id: base.res_partner_address_22
invoice_state: 2binvoiced
move_lines:
- company_id: base.main_company
location_id: stock.stock_location_3
product_id: product.product_product_3
product_qty: 1.0
product_uom: product.product_uom_unit
location_dest_id: stock.stock_location_customers
move_type: direct
type: out
-
I need to check the availability of the product so I make my picking order for processing later.
-
!python {model: stock.picking}: |
self.draft_force_assign(cr, uid, [ref("stock_picking_out0")], {"lang": "en_US", "search_default_available":
1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
"active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
})
-
I check the product availability. Product is available in the stock and ready to be sent.
-
!python {model: stock.picking}: |
self.action_assign(cr, uid, [ref("stock_picking_out0")], {"lang": "en_US", "search_default_available":
1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
"active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
})
-
I process the delivery
-
!python {model: stock.partial.picking}: |
partial_id = self.create(cr, uid, {}, context={'active_model':'stock.picking',
'active_ids':[ref('stock_picking_out0')]})
self.do_partial(cr, uid, [partial_id])
-
I check Stock Interim account (Delivary) debited successfully
-
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account_anglo_3'))
assert acc.debit == 9, "Stock Interim account (Delivary) not successfully debited"
-
I check the Stock valuation account credited sucessfully
-
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account_anglo_1'))
assert acc.credit == 9, "Stock valuation account not credited successfully"
-
As the Invoice state of the picking order is To be invoiced. I create invoice for my outgoing picking order.
-
!python {model: stock.invoice.onshipping}: |
wiz_id = self.create(cr, uid, {'invoice_date': '2010-08-04', 'journal_id': ref('account.sales_journal')},
{'active_ids': [ref("stock_picking_out0")], "active_model": "stock.picking"})
self.create_invoice(cr, uid, [wiz_id], {"lang": "en_US",
"search_default_available": 1, "tz": False, "active_model": "stock.picking",
"contact_display": "partner", "active_ids": [ref("stock_picking_out0")], "active_id": ref("stock_picking_out0")})
-
I check that the customer invoice is created successfully.
-
!python {model: account.invoice}: |
picking_obj = self.pool.get('stock.picking')
picking = picking_obj.browse(cr, uid, [ref('stock_picking_out0')])
partner = picking[0].partner_id.id
inv_ids = self.search(cr, uid, [('type','=','out_invoice'),('partner_id','=',partner)])
assert inv_ids, 'No Invoice is generated!'
-
I check Receivable(Creditor) Account Debited sucessfully when Invoice validated
-
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account.a_recv'))
assert acc.debit == 20, "Receivable(Debtor) Account debited not successfully"
-
I check Income Account Credited sucessfully when Invoice validated
-
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account.o_income'))
assert acc.credit == 20, "Receivable(Debtor) Account Credited not successfully"
-
I check Cost of goods sale debit
-
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account.o_expense'))
assert acc.debit == 9, "Cost of goods sale not debited"
-
I check Cost of goods sale credit
-
!python {model: account.account}: |
acc = self.browse(cr, uid, ref('account_anglo_3'))
assert acc.credit == 9, "Stock Interim account (Delivary) not successfully credited"