[MOVE,IMP] sale:

[MOVE] sale/test/advance_invoice.yml => sale/test/ui/onchage_events.yml
[IMP] Improve code for onchange_events.yml

bzr revid: dbr@tinyerp.com-20111103132459-iukth5vhwcrqieus
This commit is contained in:
DBR (OpenERP) 2011-11-03 18:54:59 +05:30
parent f9ad7f8487
commit b0d8d2adfe
3 changed files with 12 additions and 157 deletions

View File

@ -87,7 +87,7 @@ Dashboard for Sales Manager that includes:
'demo_xml': ['sale_demo.xml'],
'test': [
'test/process/postpaid_order_policy.yml',
#'test/data_test.yml',
'test/ui/onchage_events.yml',
#'test/manual_order_policy.yml',
#'test/prepaid_order_policy.yml',
#'test/picking_order_policy.yml',
@ -96,7 +96,7 @@ Dashboard for Sales Manager that includes:
#'test/sale_procurement.yml',
#'test/invoice_on_ordered_qty.yml',
#'test/invoice_on_shipped_qty.yml',
#'test/sale_report.yml',
'test/ui/sale_report.yml',
],
'installable': True,
'active': False,

View File

@ -1,155 +0,0 @@
-
In order to test the Deposit wizard of sale module in the Open-ERP,
I create a Sale Order for LG Viewty Smart for qty 100 having order_policy manual.
-
!record {model: sale.order, id: sale_order_so5}:
date_order: !eval time.strftime('%Y-%m-%d')
invoice_quantity: order
order_line:
- name: LG Viewty Smart
price_unit: 170.0
product_uom: product.product_uom_unit
product_uom_qty: 100.0
state: draft
delay: 7.0
product_id: sale.product_product_lgviewtysmart0
product_uos_qty: 100.0
th_weight: 0.0
type: make_to_order
order_policy: manual
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I use the Advance Payment wizard.
-
!record {model: sale.advance.payment.inv, id: sale_advance_payment_inv_0}:
amount: 1000.0
product_id: product.product_product_pc3
qtty: 3.0
-
Then I click on the "Create Partial Invoice" button
-
!python {model: sale.advance.payment.inv}: |
self.create_invoices(cr, uid, [ref("sale_advance_payment_inv_0")], {"lang": 'en_US',
"active_model": 'sale.order', "active_ids": [ref("sale_order_so5")], "tz":
False, "active_id": ref("sale_order_so5"), })
-
I verify whether the invoice has been generated.
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so5"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so5"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
I verify that an invoice state has transit from draft to open state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','open')])
assert invoice_id, "Invoice is not in the open state"
-
I pay the invoice
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','open')])
self.pay_and_reconcile(cr, uid, invoice_id,
3000.0, ref('account.cash'), ref('account.period_5'),
ref('sale.account_journal_bankjournal0'), ref('account.cash'),
ref('account.period_8'), ref('sale.account_journal_bankjournal0'),
name='test')
-
I verify that invoice has transit from Open to Paid state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','paid')])
assert invoice_id, "Invoice for SO is not in paid state."
-
I verify that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so5"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
-
I confirm the Sale Order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so5}
-
I click on "Create Invoice" button of Sales order to create the invoice.
-
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so5}
-
I verify whether the invoice has been generated for SO
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so5"))
assert so.invoice_ids[1], "Invoices has not been generated for sale_order_so5"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
I verify that an invoice state has transit from draft to open state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','open')])
assert invoice_id, "Invoice is not in the open state"
-
I assign an analytic journal to the bank journal
-
!record {model: account.journal, id: sale.account_journal_bankjournal0}:
analytic_journal_id: account.cose_journal_sale
-
I pay the invoice
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','open')])
self.pay_and_reconcile(cr, uid, invoice_id,
14000.0, ref('account.cash'), ref('account.period_5'),
ref('sale.account_journal_bankjournal0'), ref('account.cash'),
ref('account.period_5'), ref('sale.account_journal_bankjournal0'),
name='test')
-
I verify that an invoice is in done state.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','paid')])
assert invoice_id, "Invoice for SO is not in done state."
-
I verify that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so5"))
assert(sale_id.invoiced == True), "Paid has not been set to true"

View File

@ -0,0 +1,10 @@
-
In order to test the onchange events of sale order.
-
I call onchange event to change the partner of order.
-
!python {model: sale.order}: |
self.onchange_partner_id(cr, uid, [ref('order')], ref('base.res_partner_3'))