[MERGE] Sale: Merge sale module yaml changes
bzr revid: mra@mra-laptop-20100729101819-wptko37qm0p9dqw6
This commit is contained in:
@@ -70,12 +70,17 @@
|
||||
],
|
||||
'demo_xml': ['sale_demo.xml','board_sale_demo.xml'],
|
||||
'test': [
|
||||
'test/shipping_manual_sale_order.yml',
|
||||
'test/prepaid_sale_order.yml',
|
||||
'test/data_test.yml',
|
||||
'test/manual_order_policy.yml',
|
||||
'test/prepaid_order_policy.yml',
|
||||
'test/picking_order_policy.yml',
|
||||
'test/postpaid_order_policy.yml',
|
||||
'test/advance_invoice.yml',
|
||||
'test/so_make_line_invoice.yml',
|
||||
'test/so_make_invoice.yml',
|
||||
'test/sale_procurement.yml',
|
||||
'test/invoice_on_ordered_qty.yml',
|
||||
'test/invoice_on_shipped_qty.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
||||
@@ -1,269 +1,23 @@
|
||||
-
|
||||
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
|
||||
-
|
||||
I am going to sell my Mobile products to the customer with name Cleartrail
|
||||
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.
|
||||
-
|
||||
I create View Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_view0}:
|
||||
close_method: none
|
||||
code: View
|
||||
name: View
|
||||
sign: 1
|
||||
-
|
||||
I create Income Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_income0}:
|
||||
close_method: unreconciled
|
||||
code: Income
|
||||
name: Income
|
||||
sign: 1
|
||||
-
|
||||
I create Expense Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_expense0}:
|
||||
close_method: unreconciled
|
||||
code: Expense
|
||||
name: Expense
|
||||
sign: 1
|
||||
-
|
||||
I create Cash Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_cash0}:
|
||||
close_method: balance
|
||||
code: Cash
|
||||
name: Cash
|
||||
sign: 1
|
||||
-
|
||||
I create Minimal Chart Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_minimalchart0}:
|
||||
code: '0'
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Minimal Chart
|
||||
parent_left: 1
|
||||
parent_right: 12
|
||||
type: view
|
||||
user_type: account_account_type_view0
|
||||
-
|
||||
I create Payable Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_payable1}:
|
||||
code: AP
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Payable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 2
|
||||
parent_right: 3
|
||||
reconcile: true
|
||||
type: payable
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
I create Receivable Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_receivable0}:
|
||||
code: AR
|
||||
currency_mode: current
|
||||
name: Receivable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 4
|
||||
parent_right: 5
|
||||
reconcile: true
|
||||
type: receivable
|
||||
user_type: account_account_type_income0
|
||||
-
|
||||
I create Cash Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_cash0}:
|
||||
code: C
|
||||
currency_mode: current
|
||||
name: Cash
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 6
|
||||
parent_right: 7
|
||||
type: other
|
||||
user_type: account_account_type_cash0
|
||||
-
|
||||
I create Purchases Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_purchases0}:
|
||||
code: P
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Purchases
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 8
|
||||
parent_right: 9
|
||||
type: other
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
I create Sales Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_sales0}:
|
||||
code: S
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Sales
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 10
|
||||
parent_right: 11
|
||||
type: other
|
||||
user_type: account_account_type_income0
|
||||
-
|
||||
I create Purchase Journal.
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_purchasejournal0}:
|
||||
code: PUJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_purchases0
|
||||
default_debit_account_id: account_account_purchases0
|
||||
name: Purchase Journal
|
||||
sequence_id: account.sequence_purchase_journal
|
||||
type: purchase
|
||||
view_id: account.account_journal_view
|
||||
-
|
||||
I create Sale Journal.
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_salejournal0}:
|
||||
code: SAJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_sales0
|
||||
default_debit_account_id: account_account_sales0
|
||||
name: Sale Journal
|
||||
sequence_id: account.sequence_sale_journal
|
||||
type: sale
|
||||
view_id: account.account_journal_view
|
||||
-
|
||||
I create Bank Journal.
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_bankjournal0}:
|
||||
code: BNK
|
||||
default_credit_account_id: account_account_cash0
|
||||
default_debit_account_id: account_account_cash0
|
||||
name: Bank Journal
|
||||
sequence_id: account.sequence_journal
|
||||
type: cash
|
||||
view_id: account.account_journal_bank_view
|
||||
-
|
||||
I create ir.property for account payable.
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_payable
|
||||
name: property_account_expense_categ
|
||||
value_reference: account.account,5
|
||||
-
|
||||
I create ir.property for account receivable.
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_receivable
|
||||
name: property_account_income_categ
|
||||
value_reference: account.account,6
|
||||
-
|
||||
I create Partner category Customers.
|
||||
-
|
||||
!record {model: res.partner.category, id: res_partner_category_customers0}:
|
||||
name: Customers
|
||||
-
|
||||
I create Cleartrail Customer.
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_cleartrail0}:
|
||||
category_id:
|
||||
- res_partner_category_customers0
|
||||
name: Cleartrail
|
||||
-
|
||||
I create contact address for Cleartrail.
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_1}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: onam plaza, 14 B palasia A B Road
|
||||
type: contact
|
||||
-
|
||||
I create invoice address for Cleartrail.
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_2}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sarda house 24 B palasia, A B Road
|
||||
type: invoice
|
||||
-
|
||||
I create delivery address for Cleartrail.
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_3}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sangam house 15 B palasia, A B Road
|
||||
type: delivery
|
||||
-
|
||||
Customer Cleartrail has specific instrument requirement regarding the stockable products.
|
||||
-
|
||||
I define product category Mobile Products Sellable.
|
||||
-
|
||||
!record {model: product.category, id: product_category_allproductssellable0}:
|
||||
name: Mobile Products Sellable
|
||||
|
||||
|
||||
-
|
||||
I define product category Mobile Services.
|
||||
-
|
||||
!record {model: product.category, id: product_category_services0}:
|
||||
name: Mobile Services
|
||||
-
|
||||
I define LG Viewty Smart product template.
|
||||
-
|
||||
!record {model: product.template, id: product_template_lgviewtysmart0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 170.0
|
||||
mes_type: fixed
|
||||
name: LG Viewty Smart
|
||||
procure_method: make_to_order
|
||||
standard_price: 160.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
|
||||
-
|
||||
I define LG Viewty Smart product.
|
||||
-
|
||||
!record {model: product.product, id: product_product_lgviewtysmart0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 170.0
|
||||
mes_type: fixed
|
||||
name: LG Viewty Smart
|
||||
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 160.00\n'
|
||||
pricelist_sale: 'Public Pricelist (0.00) : 170.00\n'
|
||||
procure_method: make_to_order
|
||||
property_account_expense: sale.account_account_payable1
|
||||
property_account_income: sale.account_account_receivable0
|
||||
seller_delay: '1'
|
||||
standard_price: 160.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy prepaid.
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so0}:
|
||||
date_order: '2010-05-03'
|
||||
!record {model: sale.order, id: sale_order_so5}:
|
||||
date_order: '2010-07-17'
|
||||
invoice_quantity: order
|
||||
name: SO004
|
||||
order_line:
|
||||
- name: LG Viewty Smart
|
||||
price_unit: 170.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
product_uom_qty: 100.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_lgviewtysmart0
|
||||
product_uos_qty: 500.0
|
||||
product_uos_qty: 100.0
|
||||
th_weight: 0.0
|
||||
type: make_to_order
|
||||
order_policy: prepaid
|
||||
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
|
||||
@@ -271,28 +25,164 @@
|
||||
picking_policy: direct
|
||||
pricelist_id: product.list0
|
||||
shop_id: sale.shop
|
||||
|
||||
-
|
||||
I confirm the Sale Order.
|
||||
-
|
||||
I use the Advance Payment wizard.
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so5}
|
||||
-
|
||||
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
|
||||
|
||||
|
||||
-
|
||||
Performing an osv_memory action create_invoices on module sale.advance.payment.inv
|
||||
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_so0")], "tz":
|
||||
False, "active_id": ref("sale_order_so0"), })
|
||||
"active_model": 'sale.order', "active_ids": [ref("sale_order_so5")], "tz":
|
||||
False, "active_id": ref("sale_order_so5"), })
|
||||
-
|
||||
I will verify whether the invoice has been generated.
|
||||
I verify whether the invoice has been generated.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
|
||||
|
||||
|
||||
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) and ('state','=','open')])
|
||||
assert invoice_id, "Invoice is not in the open state"
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
|
||||
amount: 3000.0
|
||||
date: '2010-07-17'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: test
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "active_model": "account.invoice",
|
||||
"tz":False,"record_id": so.invoice_ids[0].id, "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id})
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_5}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
-
|
||||
I verify that invoice has transit from Open to 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) and ('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"
|
||||
-
|
||||
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) and ('state','=','open')])
|
||||
assert invoice_id, "Invoice is not in the open state"
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst2}:
|
||||
amount: 14000.0
|
||||
date: '2010-07-17'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: test
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst2")], {"lang": "en_US", "active_model": "account.invoice",
|
||||
"tz":False,"record_id": so.invoice_ids[1].id, "active_ids": [so.invoice_ids[1].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[1].id})
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[1].id], "type": "out_invoice", "active_id": so.invoice_ids[1].id})
|
||||
-
|
||||
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) and ('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"
|
||||
@@ -1,42 +1,42 @@
|
||||
-
|
||||
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
|
||||
In order to test the sale module, I need to configure details regarding product,customer and account.
|
||||
-
|
||||
I am going to sell my Mobile products to the customer with name Cleartrail
|
||||
-
|
||||
-
|
||||
I create View Account Type.
|
||||
-
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_view0}:
|
||||
close_method: none
|
||||
code: View
|
||||
name: View
|
||||
sign: 1
|
||||
-
|
||||
-
|
||||
I create Income Account Type.
|
||||
-
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_income0}:
|
||||
close_method: unreconciled
|
||||
code: Income
|
||||
name: Income
|
||||
sign: 1
|
||||
-
|
||||
-
|
||||
I create Expense Account Type.
|
||||
-
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_expense0}:
|
||||
close_method: unreconciled
|
||||
code: Expense
|
||||
name: Expense
|
||||
sign: 1
|
||||
-
|
||||
-
|
||||
I create Cash Account Type.
|
||||
-
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_cash0}:
|
||||
close_method: balance
|
||||
code: Cash
|
||||
name: Cash
|
||||
sign: 1
|
||||
-
|
||||
-
|
||||
I create Minimal Chart Account.
|
||||
-
|
||||
-
|
||||
!record {model: account.account, id: account_account_minimalchart0}:
|
||||
code: '0'
|
||||
company_id: base.main_company
|
||||
@@ -46,9 +46,9 @@
|
||||
parent_right: 12
|
||||
type: view
|
||||
user_type: account_account_type_view0
|
||||
-
|
||||
-
|
||||
I create Payable Account.
|
||||
-
|
||||
-
|
||||
!record {model: account.account, id: account_account_payable1}:
|
||||
code: AP
|
||||
company_id: base.main_company
|
||||
@@ -60,11 +60,12 @@
|
||||
reconcile: true
|
||||
type: payable
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
-
|
||||
I create Receivable Account.
|
||||
-
|
||||
-
|
||||
!record {model: account.account, id: account_account_receivable0}:
|
||||
code: AR
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Receivable
|
||||
parent_id: account_account_minimalchart0
|
||||
@@ -73,11 +74,12 @@
|
||||
reconcile: true
|
||||
type: receivable
|
||||
user_type: account_account_type_income0
|
||||
-
|
||||
-
|
||||
I create Cash Account.
|
||||
-
|
||||
-
|
||||
!record {model: account.account, id: account_account_cash0}:
|
||||
code: C
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Cash
|
||||
parent_id: account_account_minimalchart0
|
||||
@@ -85,9 +87,9 @@
|
||||
parent_right: 7
|
||||
type: other
|
||||
user_type: account_account_type_cash0
|
||||
-
|
||||
-
|
||||
I create Purchases Account.
|
||||
-
|
||||
-
|
||||
!record {model: account.account, id: account_account_purchases0}:
|
||||
code: P
|
||||
company_id: base.main_company
|
||||
@@ -98,9 +100,9 @@
|
||||
parent_right: 9
|
||||
type: other
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
-
|
||||
I create Sales Account.
|
||||
-
|
||||
-
|
||||
!record {model: account.account, id: account_account_sales0}:
|
||||
code: S
|
||||
company_id: base.main_company
|
||||
@@ -111,9 +113,9 @@
|
||||
parent_right: 11
|
||||
type: other
|
||||
user_type: account_account_type_income0
|
||||
-
|
||||
-
|
||||
I create Purchase Journal.
|
||||
-
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_purchasejournal0}:
|
||||
code: PUJ
|
||||
company_id: base.main_company
|
||||
@@ -123,9 +125,9 @@
|
||||
sequence_id: account.sequence_purchase_journal
|
||||
type: purchase
|
||||
view_id: account.account_journal_view
|
||||
-
|
||||
-
|
||||
I create Sale Journal.
|
||||
-
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_salejournal0}:
|
||||
code: SAJ
|
||||
company_id: base.main_company
|
||||
@@ -135,81 +137,80 @@
|
||||
sequence_id: account.sequence_sale_journal
|
||||
type: sale
|
||||
view_id: account.account_journal_view
|
||||
-
|
||||
-
|
||||
I create Bank Journal.
|
||||
-
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_bankjournal0}:
|
||||
code: BNK
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_cash0
|
||||
default_debit_account_id: account_account_cash0
|
||||
name: Bank Journal
|
||||
sequence_id: account.sequence_journal
|
||||
type: cash
|
||||
view_id: account.account_journal_bank_view
|
||||
-
|
||||
-
|
||||
I create ir.property for account payable.
|
||||
-
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_payable
|
||||
name: property_account_expense_categ
|
||||
value_reference: account.account,5
|
||||
-
|
||||
-
|
||||
I create ir.property for account receivable.
|
||||
-
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_receivable
|
||||
name: property_account_income_categ
|
||||
value_reference: account.account,6
|
||||
-
|
||||
-
|
||||
I create Partner category Customers.
|
||||
-
|
||||
-
|
||||
!record {model: res.partner.category, id: res_partner_category_customers0}:
|
||||
name: Customers
|
||||
-
|
||||
I create Cleartrail Customer.
|
||||
-
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_cleartrail0}:
|
||||
category_id:
|
||||
- res_partner_category_customers0
|
||||
name: Cleartrail
|
||||
-
|
||||
-
|
||||
I create contact address for Cleartrail.
|
||||
-
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_1}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: onam plaza, 14 B palasia A B Road
|
||||
type: contact
|
||||
-
|
||||
-
|
||||
I create invoice address for Cleartrail.
|
||||
-
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_2}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sarda house 24 B palasia, A B Road
|
||||
type: invoice
|
||||
-
|
||||
-
|
||||
I create delivery address for Cleartrail.
|
||||
-
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_3}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sangam house 15 B palasia, A B Road
|
||||
type: delivery
|
||||
-
|
||||
Customer Cleartrail has specific instrument requirement regarding the stockable products.
|
||||
-
|
||||
-
|
||||
I define product category Mobile Products Sellable.
|
||||
-
|
||||
-
|
||||
!record {model: product.category, id: product_category_allproductssellable0}:
|
||||
name: Mobile Products Sellable
|
||||
|
||||
|
||||
-
|
||||
I define product category Mobile Services.
|
||||
-
|
||||
I define product category Mobile Services.
|
||||
-
|
||||
!record {model: product.category, id: product_category_services0}:
|
||||
name: Mobile Services
|
||||
-
|
||||
-
|
||||
I define LG Viewty Smart product template.
|
||||
-
|
||||
!record {model: product.template, id: product_template_lgviewtysmart0}:
|
||||
@@ -239,138 +240,53 @@
|
||||
property_account_expense: sale.account_account_payable1
|
||||
property_account_income: sale.account_account_receivable0
|
||||
seller_delay: '1'
|
||||
seller_ids:
|
||||
- delay: 1
|
||||
name: base.res_partner_agrolait
|
||||
min_qty: 2.0
|
||||
qty: 5.0
|
||||
standard_price: 160.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy prepaid.
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so1}:
|
||||
date_order: '2010-05-03'
|
||||
invoice_quantity: order
|
||||
name: Test_SO001
|
||||
order_line:
|
||||
- name: LG Viewty Smart
|
||||
price_unit: 170.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_lgviewtysmart0
|
||||
product_uos_qty: 500.0
|
||||
th_weight: 0.0
|
||||
type: make_to_order
|
||||
order_policy: prepaid
|
||||
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 confirm the sale order.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so1}
|
||||
-
|
||||
I will verify whether the invoice has been generated for SO since Shipping policy is 'Payment Before Delivery'
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so1"
|
||||
-
|
||||
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_so1"))
|
||||
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)
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
|
||||
amount: 85000.0
|
||||
date: '2010-05-10'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: tst
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
|
||||
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
|
||||
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
|
||||
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id })
|
||||
|
||||
|
||||
-
|
||||
I will verify the picking associated with the sale order sale_order_so1
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
assert so.picking_ids,"Picking has not been generated for sale_order_so1"
|
||||
-
|
||||
Products are delivered to the Cleartrail Customer.
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
I verify that picking order is in done state.
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
|
||||
if picking_id:
|
||||
pick = self.browse(cr,uid,picking_id[0])
|
||||
assert (pick.state) =='done', "Picking for SO is not in done state."
|
||||
I define Slider Mobile template.
|
||||
-
|
||||
!record {model: product.template, id: product_template_slidermobile0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 200.0
|
||||
mes_type: fixed
|
||||
name: Slider Mobile
|
||||
procure_method: make_to_order
|
||||
standard_price: 189.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I define Slider Mobile.
|
||||
-
|
||||
!record {model: product.product, id: product_product_slidermobile0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 200
|
||||
mes_type: fixed
|
||||
name: Slider Mobile
|
||||
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 500.0.00\n'
|
||||
pricelist_sale: 'Public Pricelist (0.00) : 510.00\n'
|
||||
procure_method: make_to_order
|
||||
property_account_expense: sale.account_account_payable1
|
||||
property_account_income: sale.account_account_receivable0
|
||||
seller_delay: '1'
|
||||
seller_ids:
|
||||
- delay: 1
|
||||
name: base.res_partner_agrolait
|
||||
min_qty: 2.0
|
||||
qty: 5.0
|
||||
standard_price: 189.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
@@ -0,0 +1,151 @@
|
||||
-
|
||||
In order to test the Sale module in OpenERP,
|
||||
I create a Sale Order for Slider Mobile for 500 quantity having Shipping Policy 'Shipping & Manual Invoice' and Invoice on 'Ordered quantities'
|
||||
in order to create an invoice based on the ordered quantity
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so8}:
|
||||
date_order: '2010-07-17'
|
||||
invoice_quantity: order
|
||||
name: Test_SO006
|
||||
order_line:
|
||||
- name: Slider Mobile
|
||||
price_unit: 200
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 200.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_slidermobile0
|
||||
product_uos_qty: 200.0
|
||||
type: make_to_order
|
||||
order_policy: manual
|
||||
invoice_quantity: order
|
||||
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 confirm the Sale Order.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so8}
|
||||
-
|
||||
I verify that the picking has been generated for the sale order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
assert so.picking_ids,"Picking has not been generated for sale_order_so8"
|
||||
-
|
||||
Then I click on the "Products Received" button of Incoming Shipments
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
|
||||
date: '2010-07-17 17:52:09'
|
||||
-
|
||||
Then I done the picking
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': '100',
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
I click on Create Invoice button to create the invoice.
|
||||
-
|
||||
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so8}
|
||||
-
|
||||
I verify whether the invoice has been generated for SO
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so8"
|
||||
-
|
||||
I verify that an invoice is created on the basis of ordered quantity
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
for so_lines in so.order_line:
|
||||
qty=so_lines.product_uom_qty
|
||||
ids = self.search(cr, uid, [('origin', '=', so.name)])
|
||||
inv_brw = self.browse(cr,uid,ids)[0]
|
||||
for inv_lines in inv_brw.invoice_line:
|
||||
qty1=inv_lines.quantity
|
||||
invoice_id = self.search(cr, uid, [('qty1','=', 'qty') and ('origin', '=', so.name)])
|
||||
assert invoice_id, "Quantities are not same"
|
||||
-
|
||||
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_so8"))
|
||||
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)
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
|
||||
amount: 40000.0
|
||||
date: '2010-07-17'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: tst
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
|
||||
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id })
|
||||
-
|
||||
I verify the invoice are in paid state or not.
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
invoice_ids = so.invoice_ids
|
||||
for invoice in invoice_ids:
|
||||
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
|
||||
-
|
||||
I check that Paid has been set to true.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_id=self.browse(cr, uid, ref("sale_order_so8"))
|
||||
assert(sale_id.invoiced == True), "Paid has not been set to true"
|
||||
@@ -0,0 +1,154 @@
|
||||
-
|
||||
In order to test the Sale module in OpenERP,
|
||||
I create a Sale Order for Slider Mobile for 500 quantity having Shipping Policy 'Shipping & Manual Invoice' and Invoice on 'Shipped quantities'
|
||||
in order to create an invoice based on the shipping quantity
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so6}:
|
||||
date_order: '2010-07-17'
|
||||
invoice_quantity: order
|
||||
name: Test_SO006
|
||||
order_line:
|
||||
- name: Slider Mobile
|
||||
price_unit: 200
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 200.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_slidermobile0
|
||||
product_uos_qty: 200.0
|
||||
type: make_to_order
|
||||
order_policy: manual
|
||||
invoice_quantity: procurement
|
||||
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 confirm the Sale Order.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so6}
|
||||
-
|
||||
I verify that the picking has been generated for the sale order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so6"))
|
||||
assert so.picking_ids,"Picking has not been generated for sale_order_so6"
|
||||
-
|
||||
Then I click on the "Products Received" button of Incoming Shipments
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
|
||||
date: '2010-07-17 17:52:09'
|
||||
-
|
||||
Then I done the picking
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': '100',
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
I click on Create Invoice button to create the invoice.
|
||||
-
|
||||
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so6}
|
||||
-
|
||||
I verify whether the invoice has been generated for SO
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so6"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so6"
|
||||
-
|
||||
I verify that an invoice is created on the basis of shipped quantity
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
ids = picking_obj.search(cr, uid, [('origin', '=', so.name)])
|
||||
pick_brw = picking_obj.browse(cr,uid, ids)[0]
|
||||
for lines in pick_brw.move_lines:
|
||||
qty=lines.product_qty
|
||||
inv_id = self.search(cr, uid, [('origin', '=', so.name)])
|
||||
inv_brw = self.browse(cr,uid,inv_id)[0]
|
||||
for inv_lines in inv_brw.invoice_line:
|
||||
qty1=inv_lines.quantity
|
||||
invoice_id = self.search(cr, uid, [('qty1','=', 'qty') and ('origin', '=', so.name)])
|
||||
assert invoice_id, "Quantities are not same"
|
||||
-
|
||||
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_so6"))
|
||||
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)
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
|
||||
amount: 20000.0
|
||||
date: '2010-07-17'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: tst
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
|
||||
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id })
|
||||
-
|
||||
I verify the invoice are in paid state or not.
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
|
||||
invoice_ids = so.invoice_ids
|
||||
for invoice in invoice_ids:
|
||||
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
|
||||
-
|
||||
I check that Paid has been set to true.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_id=self.browse(cr, uid, ref("sale_order_so6"))
|
||||
assert(sale_id.invoiced == True), "Paid has not been set to true"
|
||||
@@ -0,0 +1,339 @@
|
||||
-
|
||||
In order to test the Sale module in OpenERP,
|
||||
I create a Sale Order for Slider Mobile for 500 quantity having Shipping Policy 'Shipping & Manual Invoice'
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so0}:
|
||||
date_order: '2010-07-17'
|
||||
invoice_quantity: order
|
||||
name: Test_SO002
|
||||
order_line:
|
||||
- name: Slider Mobile
|
||||
price_unit: 200
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_slidermobile0
|
||||
product_uos_qty: 500.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 confirm the Sale Order.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
|
||||
-
|
||||
I click on Create Invoice button to create the invoice.
|
||||
-
|
||||
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so0}
|
||||
|
||||
-
|
||||
I verify whether the invoice has been generated for SO
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
|
||||
-
|
||||
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_so0"))
|
||||
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_so0"))
|
||||
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
|
||||
assert invoice_id, "Invoice is not in the open state"
|
||||
-
|
||||
I verify that its Journal Entries has been created
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
|
||||
inv_brw = self.browse(cr, uid, invoice_id)[0]
|
||||
assert inv_brw.move_id, "Journal Entries has not been created"
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
|
||||
amount: 100000.0
|
||||
date: '2010-07-17'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: test
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "active_model": "account.invoice",
|
||||
"tz":False,"record_id": so.invoice_ids[0].id, "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id})
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
-
|
||||
I verify the 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_so0"))
|
||||
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('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_so0"))
|
||||
assert(sale_id.invoiced == True), "Paid has not been set to true"
|
||||
-
|
||||
I verify that the picking has been generated for the sale order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert so.picking_ids,"Picking has not been generated for sale_order_so0"
|
||||
-
|
||||
I verify that delivery order has been generated for sale order
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
|
||||
assert (picking_id),"Delivery order has not been generated"
|
||||
-
|
||||
I verify that a procurement has been generated for so
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
from tools.translate import _
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
|
||||
assert proc_ids, _('No Procurements!')
|
||||
-
|
||||
Then I click on the "Run Procurement" button
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
|
||||
for proc in proc_ids:
|
||||
wf_service.trg_validate(uid, 'procurement.order',proc,'button_check', cr)
|
||||
-
|
||||
I verify that a procurement state is "running"
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
|
||||
assert proc_ids, _('Procurement is not in the running state!')
|
||||
-
|
||||
I verify that a purchase order has been generated
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if(mod_brw.state == 'installed'):
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
pur_id=pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
assert pur_id, _('Purchase order has not been generated')
|
||||
|
||||
-
|
||||
I click on the "Confirm" button to confirm the purchase order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if(mod_brw.state == 'installed'):
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
for pur in pur_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr)
|
||||
-
|
||||
I click on the "Approved by supplier" button to approve the purchase order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
for pur in pur_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr)
|
||||
-
|
||||
I verify that a picking related to purchase order has been generated.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
assert(po.picking_ids),"Picking for purchase order has not been generated"
|
||||
-
|
||||
Then I click on the "Products Received" button of Incoming Shipments
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
|
||||
date: '2010-07-17 17:52:09'
|
||||
-
|
||||
I click on the "Validate" button
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
pick_ser_id = self.search(cr, uid, [('purchase_id', '=', po.id )])
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for pick in pick_ser_id:
|
||||
wf_service.trg_validate(uid, 'stock.picking',pick,'button_done', cr)
|
||||
-
|
||||
I verify that picking for purchase order has been done.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if(mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ) and ('state', '=', 'done')])
|
||||
assert ids, _('Picking is not in the done state!')
|
||||
-
|
||||
Then I done the picking
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
I verify that picking for sale order is in done state.
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
pick = self.browse(cr,uid,picking_id[0])
|
||||
assert (pick.state) =='done', "Picking for SO is not in done state."
|
||||
-
|
||||
Then I done the delivery order
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
I verify that delivery state is done
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
|
||||
pick = self.browse(cr,uid,picking_id[0])
|
||||
assert (pick.state) =='done', "Picking for SO is not in done state."
|
||||
-
|
||||
I verify that a "Picked" has been set to true
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert (so.shipped == True), "Picked has not been set to True"
|
||||
-
|
||||
I verify that a sale order is in done state
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert (so.state == 'done'), "Sale order is not in the done state."
|
||||
@@ -0,0 +1,329 @@
|
||||
-
|
||||
In order to test the Sale module in OpenERP,
|
||||
I create a Sale Order for Slider Mobile for qty 500 having Shipping Policy is 'Invoice from Picking'
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so7}:
|
||||
date_order: '2010-07-15'
|
||||
invoice_quantity: order
|
||||
name: Test_SO007
|
||||
order_line:
|
||||
- name: Slider Mobile
|
||||
price_unit: 200
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_slidermobile0
|
||||
product_uos_qty: 500.0
|
||||
th_weight: 0.0
|
||||
type: make_to_order
|
||||
order_policy: picking
|
||||
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 confirm the sale order.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so7}
|
||||
-
|
||||
I verify that picking has been generated for the sale order.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so7"))
|
||||
assert so.picking_ids,"Picking has not been generated for sale_order_so7"
|
||||
-
|
||||
Then I done the picking
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
Then I create invoice from picking
|
||||
-
|
||||
!record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}:
|
||||
invoice_date: '2010-07-15'
|
||||
journal_id: account.sales_journal
|
||||
type: out_invoice
|
||||
-
|
||||
Then I click on 'Create Invoices' button
|
||||
-
|
||||
!python {model: stock.invoice.onshipping}: |
|
||||
sale_obj=self.pool.get('sale.order')
|
||||
sale_id=sale_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
ids = picking_obj.search(cr, uid, [('origin', '=', sale_id.name)])
|
||||
self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US",
|
||||
"search_default_available": 1, "tz": False, "active_model": "stock.picking",
|
||||
"contact_display": "partner", "active_ids": ids, "active_id": ids[0]})
|
||||
-
|
||||
I check that an invoice has been created.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_id=self.browse(cr, uid, ref("sale_order_so7"))
|
||||
assert(sale_id.invoice_ids), "Invoice has not been created"
|
||||
-
|
||||
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_so7"))
|
||||
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)
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
|
||||
amount: 255000.0
|
||||
date: '2010-07-15'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: tst
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
|
||||
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id })
|
||||
-
|
||||
I verify the invoice are in paid state or not.
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
invoice_ids = so.invoice_ids
|
||||
for invoice in invoice_ids:
|
||||
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
|
||||
-
|
||||
I check that Paid has been set to true.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_id=self.browse(cr, uid, ref("sale_order_so7"))
|
||||
assert(sale_id.invoiced == True), "Paid has not been set to true"
|
||||
-
|
||||
I verify that a procurement has been generated for so
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
from tools.translate import _
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
|
||||
assert proc_ids, _('No Procurements!')
|
||||
-
|
||||
Then I click on the "Run Procurement" button
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
|
||||
for proc in proc_ids:
|
||||
wf_service.trg_validate(uid, 'procurement.order',proc,'button_check', cr)
|
||||
-
|
||||
I verify that a procurement state is "running"
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
|
||||
assert proc_ids, _('Procurement is not in the running state!')
|
||||
-
|
||||
I verify that a purchase order has been generated
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
so = self.browse(cr, uid, ref("sale_order_so7"))
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
pur_id=pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
assert pur_id, _('Purchase order has not been generated')
|
||||
-
|
||||
I click on the "Confirm" button to confirm the purchase order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so7"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
for pur in pur_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr)
|
||||
-
|
||||
I click on the "Approved by supplier" button to approve the purchase order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so7"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
for pur in pur_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr)
|
||||
-
|
||||
I verify that a picking related to purchase order has been generated.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so7"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
assert(po.picking_ids),"Picking for purchase order has not been generated"
|
||||
-
|
||||
Then I click on the "Products Received" button of Incoming Shipments
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
|
||||
date: '2010-07-15 17:52:09'
|
||||
-
|
||||
I click on the "Validate" button
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
pick_ser_id = self.search(cr, uid, [('purchase_id', '=', po.id )])
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for pick in pick_ser_id:
|
||||
wf_service.trg_validate(uid, 'stock.picking',pick,'button_done', cr)
|
||||
-
|
||||
I verify that picking for purchase order has been done.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so7"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ) and ('state', '=', 'done')])
|
||||
assert ids, _('Picking is not in the done state!')
|
||||
-
|
||||
I verify that delivery order has been generated for sale order
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
|
||||
assert (picking_id),"Delivery order has not been generated"
|
||||
-
|
||||
I verify that delivery has been done
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
I verify that delivery state is done
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
|
||||
if picking_id:
|
||||
pick = self.browse(cr,uid,picking_id[0])
|
||||
assert (pick.state) =='done', "Picking for SO is not in done state."
|
||||
-
|
||||
I verify that a "Picked" has been set to true
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so7"))
|
||||
assert (so.shipped == True), "Picked has not been set to True"
|
||||
-
|
||||
I verify that a sale order is in done state
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so7"))
|
||||
assert (so.state == 'done'), "Sale order is not in the done state."
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
-
|
||||
In order to test the Sale module in OpenERP,
|
||||
I create a Sale Order for Slider Mobile for qty 500 having Shipping Policy is 'Invoice on order after Delivery'
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so8}:
|
||||
date_order: '2010-07-15'
|
||||
invoice_quantity: order
|
||||
name: Test_SO008
|
||||
order_line:
|
||||
- name: Slider Mobile
|
||||
price_unit: 200.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_slidermobile0
|
||||
product_uos_qty: 500.0
|
||||
type: make_to_order
|
||||
order_policy: postpaid
|
||||
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 confirm the Sale Order.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so8}
|
||||
-
|
||||
I verify that the picking has been generated for the sale order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
assert so.picking_ids,"Picking has not been generated for sale_order_so8"
|
||||
-
|
||||
Then I done the picking
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
I verify that picking order is in done state.
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick = self.browse(cr,uid,picking_id[0])
|
||||
assert (pick.state == 'done'), "Picking for SO is not in done state."
|
||||
-
|
||||
I verify that delivery order has been generated for sale order
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
|
||||
assert (picking_id),"Delivery order has not been generated"
|
||||
-
|
||||
I click on the Products Sent button and then on the Validate button
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
I verify that delivery state is done
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
|
||||
if picking_id:
|
||||
pick = self.browse(cr,uid,picking_id[0])
|
||||
assert (pick.state) =='done', "Picking for SO is not in done state."
|
||||
-
|
||||
I verify that a procurement has been generated for so
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
from tools.translate import _
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
|
||||
assert proc_ids, _('No Procurements!')
|
||||
-
|
||||
Then I click on the "Run Procurement" button
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
|
||||
for proc in proc_ids:
|
||||
wf_service.trg_validate(uid, 'procurement.order',proc,'button_check', cr)
|
||||
-
|
||||
I verify that a procurement state is "running"
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
|
||||
-
|
||||
I verify that a purchase order has been generated
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
pur_id=pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
assert pur_id, _('Purchase order has not been generated')
|
||||
-
|
||||
I click on the "Confirm" button to confirm the purchase order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
for pur in pur_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr)
|
||||
-
|
||||
I click on the "Approved by supplier" button to approve the purchase order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
for pur in pur_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr)
|
||||
-
|
||||
I verify that a picking related to purchase order has been generated.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
assert(po.picking_ids),"Picking for purchase order has not been generated"
|
||||
-
|
||||
Then I click on the "Products Received" button of Incoming Shipments
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
|
||||
date: '2010-07-15 17:52:09'
|
||||
-
|
||||
I click on the "Validate" button
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
pick_ser_id = self.search(cr, uid, [('purchase_id', '=', po.id )])
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for pick in pick_ser_id:
|
||||
wf_service.trg_validate(uid, 'stock.picking',pick,'button_done', cr)
|
||||
-
|
||||
I verify that picking for purchase order has been done.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ) and ('state', '=', 'done')])
|
||||
assert ids, _('Picking is not in the done state!')
|
||||
-
|
||||
I verify that a "Picked" has been set to true
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
assert (so.shipped == True), "Picking is not done."
|
||||
-
|
||||
I verify that an invoice has been generated for SO
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
assert so.invoice_ids, "Invoice has not been generated"
|
||||
-
|
||||
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_so8"))
|
||||
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)
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
|
||||
amount: 100000.0
|
||||
date: '2010-07-15'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: test
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "tz":
|
||||
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id})
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
-
|
||||
I verify the invoice are in paid state or not.
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
|
||||
invoice_ids = so.invoice_ids
|
||||
for invoice in invoice_ids:
|
||||
assert (invoice.state) =='paid', "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_so8"))
|
||||
assert(sale_id.invoiced == True), "Paid has not been set to true"
|
||||
-
|
||||
I verify that sale order is in done state
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so8"))
|
||||
assert (so.state == 'done'), "Sale order is not in the done state."
|
||||
@@ -0,0 +1,284 @@
|
||||
-
|
||||
I create a Sale Order for LG Viewty Smart for qty 500 having Shipping Policy is 'Payment Before Delivery'
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so1}:
|
||||
date_order: '2010-07-20'
|
||||
invoice_quantity: order
|
||||
name: Test_SO001
|
||||
order_line:
|
||||
- name: Slider Mobile
|
||||
price_unit: 200
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_slidermobile0
|
||||
product_uos_qty: 500.0
|
||||
th_weight: 0.0
|
||||
type: make_to_order
|
||||
order_policy: prepaid
|
||||
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 confirm the sale order.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so1}
|
||||
-
|
||||
I verify whether the invoice has been generated for SO since Shipping policy is 'Payment Before Delivery'
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so1"
|
||||
-
|
||||
I verify there are no pickings attached to this sale order
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
picking_id = self.search(cr, uid, [('origin','!=',so.name),(('type','=','out')and('type','=','delivery'))])
|
||||
assert picking_id,"There is a picking attached to this sale order"
|
||||
-
|
||||
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_so1"))
|
||||
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)
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
|
||||
amount: 85000.0
|
||||
date: '2010-07-20'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: tst
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
|
||||
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
-
|
||||
I verify the invoice is in done state or not.
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','paid')])
|
||||
assert invoice_id, "Invoice for SO is not in done state."
|
||||
-
|
||||
I check that Paid has been set to true.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_id=self.browse(cr, uid, ref("sale_order_so1"))
|
||||
assert(sale_id.invoiced == True), "Paid has not been set to true"
|
||||
-
|
||||
I verify the picking associated with the sale order sale_order_so1
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
assert so.picking_ids,"Picking has not been generated"
|
||||
-
|
||||
Products are delivered to the Cleartrail Customer.
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
I verify that picking order is in done state.
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
pick = self.browse(cr,uid,picking_id[0])
|
||||
assert (pick.state) =='done', "Picking for SO is not in done state."
|
||||
-
|
||||
I verify that a procurement has been generated for so
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
from tools.translate import _
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
|
||||
assert proc_ids, _('No Procurements!')
|
||||
-
|
||||
Then I click on the "Run Procurement" button
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
|
||||
for proc in proc_ids:
|
||||
wf_service.trg_validate(uid, 'procurement.order',proc,'button_check', cr)
|
||||
-
|
||||
I verify that a procurement state is "running"
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if(mod_brw.state == 'installed'):
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
|
||||
assert proc_ids, _('Procurement is not in the running state!')
|
||||
-
|
||||
I verify that a purchase order has been generated
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if(mod_brw.state == 'installed'):
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
pur_id=pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
assert pur_id, _('Purchase order has not been generated')
|
||||
-
|
||||
I click on the "Confirm" button to confirm the purchase order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if(mod_brw.state == 'installed'):
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
for pur in pur_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr)
|
||||
-
|
||||
I click on the "Approved by supplier" button to approve the purchase order
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
for pur in pur_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr)
|
||||
-
|
||||
I verify that a picking related to purchase order has been generated.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
assert(po.picking_ids),"Picking for purchase order has not been generated"
|
||||
-
|
||||
Then I click on the "Products Received" button of Incoming Shipments
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
|
||||
date: '2010-07-20 17:52:09'
|
||||
-
|
||||
I click on the "Validate" button
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if (mod_brw.state == 'installed'):
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
pick_ser_id = self.search(cr, uid, [('purchase_id', '=', po.id )])
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for pick in pick_ser_id:
|
||||
wf_service.trg_validate(uid, 'stock.picking',pick,'button_done', cr)
|
||||
-
|
||||
I verify that picking for purchase order has been done.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
from tools.translate import _
|
||||
modules = self.pool.get('ir.module.module')
|
||||
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
|
||||
mod_brw = modules.browse(cr,uid,mod_pur)[0]
|
||||
if(mod_brw.state == 'installed'):
|
||||
pur_obj = self.pool.get('purchase.order')
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
po = pur_obj.browse(cr, uid, pur_id)[0]
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ) and ('state', '=', 'done')])
|
||||
assert ids, _('Picking is not in the done state!')
|
||||
-
|
||||
I verify that a "Picked" has been set to true
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
assert (so.shipped == True), "Picking is not done."
|
||||
-
|
||||
I verify that a sale order is in done state
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so1"))
|
||||
assert (so.state == 'done'), "Sale order is not in the done state."
|
||||
@@ -1,384 +0,0 @@
|
||||
-
|
||||
In order to test the sale module, I need to configure details regarding product & customer.
|
||||
-
|
||||
I am going to sell my Mobile products to the customer with name Cleartrail
|
||||
-
|
||||
I create View Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_view0}:
|
||||
close_method: none
|
||||
code: View
|
||||
name: View
|
||||
sign: 1
|
||||
-
|
||||
I create Income Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_income0}:
|
||||
close_method: unreconciled
|
||||
code: Income
|
||||
name: Income
|
||||
sign: 1
|
||||
-
|
||||
I create Expense Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_expense0}:
|
||||
close_method: unreconciled
|
||||
code: Expense
|
||||
name: Expense
|
||||
sign: 1
|
||||
-
|
||||
I create Cash Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_cash0}:
|
||||
close_method: balance
|
||||
code: Cash
|
||||
name: Cash
|
||||
sign: 1
|
||||
-
|
||||
I create Minimal Chart Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_minimalchart0}:
|
||||
code: '0'
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Minimal Chart
|
||||
parent_left: 1
|
||||
parent_right: 12
|
||||
type: view
|
||||
user_type: account_account_type_view0
|
||||
-
|
||||
I create Payable Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_payable1}:
|
||||
code: AP
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Payable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 2
|
||||
parent_right: 3
|
||||
reconcile: true
|
||||
type: payable
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
I create Receivable Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_receivable0}:
|
||||
code: AR
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Receivable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 4
|
||||
parent_right: 5
|
||||
reconcile: true
|
||||
type: receivable
|
||||
user_type: account_account_type_income0
|
||||
-
|
||||
I create Cash Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_cash0}:
|
||||
code: C
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Cash
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 6
|
||||
parent_right: 7
|
||||
type: other
|
||||
user_type: account_account_type_cash0
|
||||
-
|
||||
I create Purchases Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_purchases0}:
|
||||
code: P
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Purchases
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 8
|
||||
parent_right: 9
|
||||
type: other
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
I create Sales Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_sales0}:
|
||||
code: S
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Sales
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 10
|
||||
parent_right: 11
|
||||
type: other
|
||||
user_type: account_account_type_income0
|
||||
-
|
||||
I create Purchase Journal.
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_purchasejournal0}:
|
||||
code: PUJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_purchases0
|
||||
default_debit_account_id: account_account_purchases0
|
||||
name: Purchase Journal
|
||||
sequence_id: account.sequence_purchase_journal
|
||||
type: purchase
|
||||
view_id: account.account_journal_view
|
||||
-
|
||||
I create Sale Journal.
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_salejournal0}:
|
||||
code: SAJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_sales0
|
||||
default_debit_account_id: account_account_sales0
|
||||
name: Sale Journal
|
||||
sequence_id: account.sequence_sale_journal
|
||||
type: sale
|
||||
view_id: account.account_journal_view
|
||||
-
|
||||
I create Bank Journal.
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_bankjournal0}:
|
||||
code: BNK
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_cash0
|
||||
default_debit_account_id: account_account_cash0
|
||||
name: Bank Journal
|
||||
sequence_id: account.sequence_journal
|
||||
type: cash
|
||||
view_id: account.account_journal_bank_view
|
||||
-
|
||||
I create ir.property for account payable.
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_payable
|
||||
name: property_account_expense_categ
|
||||
value_reference: account.account,5
|
||||
-
|
||||
I create ir.property for account receivable.
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_receivable
|
||||
name: property_account_income_categ
|
||||
value_reference: account.account,6
|
||||
-
|
||||
I create Partner category Customers.
|
||||
-
|
||||
!record {model: res.partner.category, id: res_partner_category_customers0}:
|
||||
name: Customers
|
||||
-
|
||||
I create Cleartrail Customer.
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_cleartrail0}:
|
||||
category_id:
|
||||
- res_partner_category_customers0
|
||||
name: Cleartrail
|
||||
-
|
||||
I create contact address for Cleartrail.
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_1}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: onam plaza, 14 B palasia A B Road
|
||||
type: contact
|
||||
-
|
||||
I create invoice address for Cleartrail.
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_2}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sarda house 24 B palasia, A B Road
|
||||
type: invoice
|
||||
-
|
||||
I create delivery address for Cleartrail.
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_3}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sangam house 15 B palasia, A B Road
|
||||
type: delivery
|
||||
-
|
||||
Customer Cleartrail has specific instrument requirement regarding the stockable products.
|
||||
-
|
||||
I define product category Mobile Products Sellable.
|
||||
-
|
||||
!record {model: product.category, id: product_category_allproductssellable0}:
|
||||
name: Mobile Products Sellable
|
||||
-
|
||||
I define product category Mobile Services.
|
||||
-
|
||||
!record {model: product.category, id: product_category_services0}:
|
||||
name: Mobile Services
|
||||
-
|
||||
I define New Chocolate Slider Mobile template.
|
||||
-
|
||||
!record {model: product.template, id: product_template_newchocolateslidermobile0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 200.0
|
||||
mes_type: fixed
|
||||
name: New Chocolate Slider Mobile
|
||||
procure_method: make_to_order
|
||||
standard_price: 189.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I define New Chocolate Slider Mobile.
|
||||
-
|
||||
!record {model: product.product, id: product_product_newchocolateslidermobile0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 200.0
|
||||
mes_type: fixed
|
||||
name: New Chocolate Slider Mobile
|
||||
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 189.00\n'
|
||||
pricelist_sale: 'Public Pricelist (0.00) : 200.00\n'
|
||||
procure_method: make_to_order
|
||||
property_account_expense: sale.account_account_payable1
|
||||
property_account_income: sale.account_account_receivable0
|
||||
seller_delay: '1'
|
||||
standard_price: 189.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy manual.
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so0}:
|
||||
date_order: '2010-05-12'
|
||||
invoice_quantity: order
|
||||
name: Test_SO002
|
||||
order_line:
|
||||
- name: New Chocolate Slider Mobile
|
||||
price_unit: 200.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_newchocolateslidermobile0
|
||||
product_uos_qty: 500.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 confirm the Sale Order.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
|
||||
-
|
||||
I click on Create Invoice button to create the invoice.
|
||||
-
|
||||
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so0}
|
||||
-
|
||||
I verify whether the invoice has been generated for SO
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
|
||||
-
|
||||
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_so0"))
|
||||
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)
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
|
||||
amount: 100000.0
|
||||
date: '2010-05-10'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: test
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "tz":
|
||||
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id})
|
||||
|
||||
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
|
||||
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
-
|
||||
I verify the invoice are in paid state or not.
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
invoice_ids = so.invoice_ids
|
||||
for invoice in invoice_ids:
|
||||
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
|
||||
-
|
||||
I verify the picking associated with the sale order sale_order_so0.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert so.picking_ids,"Picking has not been generated for sale_order_so0"
|
||||
-
|
||||
Products are delivered to the Cleartrail Customer.
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, [pick.id],partial_datas)
|
||||
-
|
||||
I verify that picking order is in done state.
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick = self.browse(cr,uid,picking_id[0])
|
||||
assert (pick.state) =='done', "Picking for SO is not in done state."
|
||||
@@ -1,307 +1,29 @@
|
||||
-
|
||||
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
|
||||
-
|
||||
I am going to sell my Mobile products to the customer with name Cleartrail
|
||||
-
|
||||
I create View Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_view0}:
|
||||
close_method: none
|
||||
code: View
|
||||
name: View
|
||||
sign: 1
|
||||
-
|
||||
I create Income Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_income0}:
|
||||
close_method: unreconciled
|
||||
code: Income
|
||||
name: Income
|
||||
sign: 1
|
||||
-
|
||||
I create Expense Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_expense0}:
|
||||
close_method: unreconciled
|
||||
code: Expense
|
||||
name: Expense
|
||||
sign: 1
|
||||
-
|
||||
I create Cash Account Type.
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_cash0}:
|
||||
close_method: balance
|
||||
code: Cash
|
||||
name: Cash
|
||||
sign: 1
|
||||
-
|
||||
I create Minimal Chart Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_minimalchart0}:
|
||||
code: '0'
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Minimal Chart
|
||||
parent_left: 1
|
||||
parent_right: 12
|
||||
type: view
|
||||
user_type: account_account_type_view0
|
||||
-
|
||||
I create Payable Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_payable1}:
|
||||
code: AP
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Payable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 2
|
||||
parent_right: 3
|
||||
reconcile: true
|
||||
type: payable
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
I create Receivable Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_receivable0}:
|
||||
code: AR
|
||||
currency_mode: current
|
||||
name: Receivable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 4
|
||||
parent_right: 5
|
||||
reconcile: true
|
||||
type: receivable
|
||||
user_type: account_account_type_income0
|
||||
-
|
||||
I create Cash Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_cash0}:
|
||||
code: C
|
||||
currency_mode: current
|
||||
name: Cash
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 6
|
||||
parent_right: 7
|
||||
type: other
|
||||
user_type: account_account_type_cash0
|
||||
-
|
||||
I create Purchases Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_purchases0}:
|
||||
code: P
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Purchases
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 8
|
||||
parent_right: 9
|
||||
type: other
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
I create Sales Account.
|
||||
-
|
||||
!record {model: account.account, id: account_account_sales0}:
|
||||
code: S
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Sales
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 10
|
||||
parent_right: 11
|
||||
type: other
|
||||
user_type: account_account_type_income0
|
||||
-
|
||||
I create Purchase Journal.
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_purchasejournal0}:
|
||||
code: PUJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_purchases0
|
||||
default_debit_account_id: account_account_purchases0
|
||||
name: Purchase Journal
|
||||
sequence_id: account.sequence_purchase_journal
|
||||
type: purchase
|
||||
view_id: account.account_journal_view
|
||||
-
|
||||
I create Sale Journal.
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_salejournal0}:
|
||||
code: SAJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_sales0
|
||||
default_debit_account_id: account_account_sales0
|
||||
name: Sale Journal
|
||||
sequence_id: account.sequence_sale_journal
|
||||
type: sale
|
||||
view_id: account.account_journal_view
|
||||
-
|
||||
I create Bank Journal.
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_bankjournal0}:
|
||||
code: BNK
|
||||
default_credit_account_id: account_account_cash0
|
||||
default_debit_account_id: account_account_cash0
|
||||
name: Bank Journal
|
||||
sequence_id: account.sequence_journal
|
||||
type: cash
|
||||
view_id: account.account_journal_bank_view
|
||||
-
|
||||
I create ir.property for account payable.
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_payable
|
||||
name: property_account_expense_categ
|
||||
value_reference: account.account,5
|
||||
-
|
||||
I create ir.property for account receivable.
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_receivable
|
||||
name: property_account_income_categ
|
||||
value_reference: account.account,6
|
||||
-
|
||||
I create Partner category Customers.
|
||||
-
|
||||
!record {model: res.partner.category, id: res_partner_category_customers0}:
|
||||
name: Customers
|
||||
-
|
||||
I create Cleartrail Customer.
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_cleartrail0}:
|
||||
category_id:
|
||||
- res_partner_category_customers0
|
||||
name: Cleartrail
|
||||
-
|
||||
I create contact address for Cleartrail.
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_1}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: onam plaza, 14 B palasia A B Road
|
||||
type: contact
|
||||
-
|
||||
I create invoice address for Cleartrail.
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_2}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sarda house 24 B palasia, A B Road
|
||||
type: invoice
|
||||
-
|
||||
I create delivery address for Cleartrail.
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_3}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sangam house 15 B palasia, A B Road
|
||||
type: delivery
|
||||
-
|
||||
Customer Cleartrail has specific instrument requirement regarding the stockable products.
|
||||
-
|
||||
I define product category Mobile Products Sellable.
|
||||
-
|
||||
!record {model: product.category, id: product_category_allproductssellable0}:
|
||||
name: Mobile Products Sellable
|
||||
-
|
||||
I define product category Mobile Services.
|
||||
-
|
||||
!record {model: product.category, id: product_category_services0}:
|
||||
name: Mobile Services
|
||||
-
|
||||
I define LG Viewty Smart product template.
|
||||
-
|
||||
!record {model: product.template, id: product_template_lgviewtysmart0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 170.0
|
||||
mes_type: fixed
|
||||
name: LG Viewty Smart
|
||||
procure_method: make_to_order
|
||||
standard_price: 160.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I define LG Viewty Smart product.
|
||||
-
|
||||
!record {model: product.product, id: product_product_lgviewtysmart0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 170.0
|
||||
mes_type: fixed
|
||||
name: LG Viewty Smart
|
||||
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 160.00\n'
|
||||
pricelist_sale: 'Public Pricelist (0.00) : 170.00\n'
|
||||
procure_method: make_to_order
|
||||
property_account_expense: sale.account_account_payable1
|
||||
property_account_income: sale.account_account_receivable0
|
||||
seller_delay: '1'
|
||||
standard_price: 160.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I define New Chocolate Slider Mobile template.
|
||||
-
|
||||
!record {model: product.template, id: product_template_newchocolateslidermobile0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 200.0
|
||||
mes_type: fixed
|
||||
name: New Chocolate Slider Mobile
|
||||
procure_method: make_to_order
|
||||
standard_price: 189.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I define New Chocolate Slider Mobile.
|
||||
-
|
||||
!record {model: product.product, id: product_product_newchocolateslidermobile0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 200.0
|
||||
mes_type: fixed
|
||||
name: New Chocolate Slider Mobile
|
||||
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 189.00\n'
|
||||
pricelist_sale: 'Public Pricelist (0.00) : 200.00\n'
|
||||
procure_method: make_to_order
|
||||
property_account_expense: sale.account_account_payable1
|
||||
property_account_income: sale.account_account_receivable0
|
||||
seller_delay: '1'
|
||||
standard_price: 189.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy manual.
|
||||
In order to test the invoices based on sale order lines of sales module in OpenERP
|
||||
I create a Sale Order for two products LG Viewty Smart and Slider mobile for qty 100 having order_policy manual.
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so3}:
|
||||
date_order: '2010-05-12'
|
||||
date_order: '2010-07-12'
|
||||
invoice_quantity: order
|
||||
name: Test_SO003
|
||||
order_line:
|
||||
- name: New Chocolate Slider Mobile
|
||||
- name: Slider Mobile
|
||||
price_unit: 200.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
product_uom_qty: 100.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_newchocolateslidermobile0
|
||||
product_uos_qty: 500.0
|
||||
product_id: sale.product_product_slidermobile0
|
||||
product_uos_qty: 100.0
|
||||
type: make_to_order
|
||||
- name: LG Viewty Smart
|
||||
price_unit: 170.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
product_uom_qty: 100.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_lgviewtysmart0
|
||||
product_uos_qty: 500.0
|
||||
product_uos_qty: 100.0
|
||||
th_weight: 0.0
|
||||
type: make_to_order
|
||||
order_policy: manual
|
||||
@@ -317,23 +39,205 @@
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so3}
|
||||
-
|
||||
I create an invoice on sale order line.
|
||||
I click on the "Create Invoice" button of sale order line
|
||||
-
|
||||
!record {model: sale.order.line.make.invoice, id: sale_order_line_make_invoice_0}:
|
||||
{}
|
||||
-
|
||||
invoice is created for specific sale order line.
|
||||
-
|
||||
!python {model: sale.order.line.make.invoice}: |
|
||||
!python {model: sale.order.line}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
|
||||
sol = so.order_line[0]
|
||||
self.make_invoices(cr, uid, [ref("sale_order_line_make_invoice_0")], {"lang":
|
||||
'en_US', "active_model": "sale.order.line", "active_ids": [ref(sol.id)], "tz":
|
||||
False, "active_id": ref(sol.id), })
|
||||
sol = so.order_line[0]
|
||||
self.create_sale_order_line_invoice(cr, uid, [sol.id], {"lang": "en_US",
|
||||
"tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale.menu_invoicing_sales_order_lines")],
|
||||
"search_default_uninvoiced": 1, "active_id": ref("sale.menu_invoicing_sales_order_lines"),
|
||||
})
|
||||
-
|
||||
I verify that invoice regarding sale order line has been created.
|
||||
I verify that "Invoiced" has been set to True.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_id=self.browse(cr, uid, ref("sale_order_so3"))
|
||||
sol = sale_id.order_line[0]
|
||||
assert(sol.invoiced == True), "Invoiced has not been set to true"
|
||||
-
|
||||
I verify that an invoice for sale order line has been created.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so3"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so3"
|
||||
-
|
||||
I click on the Create button of invoice
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
|
||||
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_so3"))
|
||||
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
|
||||
assert invoice_id, "Invoice is not in the open state"
|
||||
-
|
||||
Creating an account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
|
||||
amount: 20000.0
|
||||
date: '2010-07-12'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: test
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "active_model": "account.invoice",
|
||||
"tz":False,"record_id": so.invoice_ids[0].id, "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id})
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
-
|
||||
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_so3"))
|
||||
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('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_so3"))
|
||||
assert(sale_id.invoiced == True), "Paid has not been set to true"
|
||||
-
|
||||
I click on the "Create Invoice" button of sale order and verify that it gives a warning message
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
try:
|
||||
wf_service.trg_validate(uid, 'sale.order',ref("sale_order_so3"),'manual_invoice', cr)
|
||||
except:
|
||||
pass
|
||||
-
|
||||
I create an invoice for another sale order line.
|
||||
-
|
||||
I click on the "Create Invoice" button of sale order line
|
||||
-
|
||||
!python {model: sale.order.line}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
|
||||
sol = so.order_line[1]
|
||||
self.create_sale_order_line_invoice(cr, uid, [sol.id], {"lang": "en_US",
|
||||
"tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale.menu_invoicing_sales_order_lines")],
|
||||
"search_default_uninvoiced": 1, "active_id": ref("sale.menu_invoicing_sales_order_lines"),
|
||||
})
|
||||
-
|
||||
I verify that invoice for sale order line has been created.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so3"))
|
||||
assert so.invoice_ids[1], "Invoices has not been generated for sale_order_so3"
|
||||
-
|
||||
I verify that "Invoiced" has been set to True.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_id=self.browse(cr, uid, ref("sale_order_so3"))
|
||||
sol = sale_id.order_line[1]
|
||||
assert(sol.invoiced == True), "Invoiced has not been set to true"
|
||||
-
|
||||
I verify that "Paid" has been set to False.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_id=self.browse(cr, uid, ref("sale_order_so3"))
|
||||
assert(sale_id.invoiced == False), "Paid has not been set to true"
|
||||
-
|
||||
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_so3"))
|
||||
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_so3"))
|
||||
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
|
||||
assert invoice_id, "Invoice is not in the open state"
|
||||
-
|
||||
Creating a account invoice pay entry.
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
|
||||
amount: 17000.0
|
||||
date: '2010-07-12'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: test
|
||||
period_id: account.period_5
|
||||
-
|
||||
I pay the invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "active_model": "account.invoice",
|
||||
"tz":False,"record_id": so.invoice_ids[1].id, "active_ids": [so.invoice_ids[1].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[1].id})
|
||||
-
|
||||
Creating an account invoice pay writeoff entry.
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_1}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
-
|
||||
Pay and Reconcile the Invoice.
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_1")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[1].id], "type": "out_invoice", "active_id": so.invoice_ids[1].id})
|
||||
-
|
||||
I verify the 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_so3"))
|
||||
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('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_so3"))
|
||||
assert(sale_id.invoiced == True), "Paid has not been set to true"
|
||||
Reference in New Issue
Block a user