[REF] sale: YML of order_process split into different file base on invoice policy.
bzr revid: hmo@tinyerp.com-20111201082344-093f9s8e509umeye
This commit is contained in:
parent
ebb2795c95
commit
47d741f8ff
|
@ -88,10 +88,13 @@ Dashboard for Sales Manager that includes:
|
|||
'demo_xml': ['sale_demo.xml'],
|
||||
'test': [
|
||||
'test/sale_order_demo.yml',
|
||||
'test/order_process.yml',
|
||||
'test/order_process_picking.yml',
|
||||
'test/order_process_postpaid.yml',
|
||||
'test/order_process_prepaid.yml',
|
||||
'test/order_process_manual.yml',
|
||||
'test/cancel_order.yml',
|
||||
#'test/delete_order.yml',
|
||||
#'test/edi_sale_order.yml',
|
||||
'test/delete_order.yml',
|
||||
'test/edi_sale_order.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
-
|
||||
I confirm the Quotation with "Deliver & invoice on demand".
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: order4}
|
||||
-
|
||||
I check that Invoice should not created.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_order = self.browse(cr, uid, ref("order4"))
|
||||
assert len(sale_order.invoice_ids) == False, "Invoice should not created."
|
||||
assert sale_order.picking_ids, "Delivery order should be created."
|
||||
-
|
||||
I create advance invoice.
|
||||
-
|
||||
!python {model: sale.advance.payment.inv}: |
|
||||
ctx = context.copy()
|
||||
ctx.update({"active_model": 'sale.order', "active_ids": [ref("order4")], "active_id":ref("order4")})
|
||||
order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("line7"), context=context)
|
||||
pay_id = self.create(cr, uid, {'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty})
|
||||
self.create_invoices(cr, uid, [pay_id], context=ctx)
|
||||
-
|
||||
I check Invoice which made advance
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
order = self.browse(cr, uid, ref('order4'))
|
||||
assert order.invoice_ids, "Invoice should be created after make advance invoice."
|
||||
-
|
||||
I create Invoice from sale order line.
|
||||
-
|
||||
!python {model: sale.order.line.make.invoice}: |
|
||||
ctx = context.copy()
|
||||
ctx.update({"active_model": 'sale.order.line', "active_ids": [ref("line8")], "active_id":ref("line8")})
|
||||
self.make_invoices(cr, uid, [], context=ctx)
|
||||
-
|
||||
I check Invoice which made from sale order line.
|
||||
-
|
||||
!python {model: sale.order.line}: |
|
||||
line = self.browse(cr, uid, ref('line8'))
|
||||
assert line.invoiced, "Line is not invoiced."
|
||||
assert line.invoice_lines, "Invoice line should be created."
|
||||
-
|
||||
I create manual Invoice for order.
|
||||
-
|
||||
!record {model: sale.make.invoice, id: sale_make_invoice_1}:
|
||||
invoice_date: !eval time.strftime('%Y-%m-%d')
|
||||
-
|
||||
!python {model: sale.make.invoice}: |
|
||||
ctx = context.copy()
|
||||
ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("order4")], "active_id":ref("order4")})
|
||||
self.make_invoices(cr, uid, [ref("sale_make_invoice_1")], context)
|
||||
-
|
||||
I open the Invoice.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
so = self.browse(cr, uid, ref("order4"))
|
||||
for invoice in so.invoice_ids:
|
||||
wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr)
|
||||
-
|
||||
I check Invoice after do manual.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_order = self.browse(cr, uid, ref("order4"))
|
||||
assert sale_order.invoice_ids, "Invoice should be created."
|
||||
#assert sale_order.state == 'progress', 'Order should be in progress.'
|
||||
#assert sale_order.invoiced, "Order is not invoiced."
|
||||
-
|
||||
I set order policy "Deliver & invoice on demand" as default policy.
|
||||
-
|
||||
!record {model: sale.config.picking_policy, id: sale.config.picking_policy_0}:
|
||||
order_policy: 'manual'
|
||||
-
|
||||
!python {model: sale.config.picking_policy}: |
|
||||
self.execute(cr, uid, [ref("sale.config.picking_policy_0")])
|
|
@ -111,7 +111,6 @@
|
|||
assert order.invoice_ids, "Invoice is not created."
|
||||
ac = order.partner_id.property_account_receivable.id
|
||||
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', order.company_id.id)], limit=1)
|
||||
|
||||
for invoice in order.invoice_ids:
|
||||
assert invoice.type == 'out_invoice',"Invoice should be Customer Invoice."
|
||||
assert invoice.account_id.id == ac,"Invoice account is not correspond."
|
||||
|
@ -131,120 +130,23 @@
|
|||
assert inv_line.price_unit == so_line.price_unit , "Price Unit is not correspond."
|
||||
assert inv_line.quantity == (so_line.product_uos and so_line.product_uos_qty) or so_line.product_uom_qty , "Product qty is not correspond."
|
||||
assert inv_line.price_subtotal == so_line.price_subtotal, "Price sub total is not correspond."
|
||||
-
|
||||
Now I confirm the Quotation with "Invoice on order after delivery" policy.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: order2}
|
||||
-
|
||||
I check that related delivery order after confirmed.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_order = self.browse(cr, uid, ref("order2"))
|
||||
assert sale_order.picking_ids, "Delivery Order should be created."
|
||||
assert len(sale_order.invoice_ids) == False, "Invoice should be not created."
|
||||
-
|
||||
Now, I dispatch delivery order.
|
||||
-
|
||||
!python {model: stock.partial.picking}: |
|
||||
order = self.pool.get('sale.order').browse(cr, uid, ref("order2"))
|
||||
for pick in order.picking_ids:
|
||||
data = pick.force_assign()
|
||||
if data == True:
|
||||
partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick.id]})
|
||||
self.do_partial(cr, uid, [partial_id])
|
||||
-
|
||||
I check that an invoice has been created.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
order = self.browse(cr, uid, ref("order2"))
|
||||
assert order.picked_rate == 100, "Shipment progress is not 100%."
|
||||
assert order.shipped, "Delivery Order should be dispatch."
|
||||
assert order.invoice_ids, "Invoice should be created after dispatch delivery order."
|
||||
-
|
||||
Now I confirm the Quotation with "Pay before delivery" policy.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: order3}
|
||||
-
|
||||
I check that delivery order should not created before invoice is paid.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_order = self.browse(cr, uid, ref("order3"))
|
||||
assert len(sale_order.picking_ids) == False, "Delivery order should not created before invoice."
|
||||
assert sale_order.invoice_ids, "Invoice should be created."
|
||||
-
|
||||
I confirm the Quotation with "Deliver & invoice on demand".
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: order4}
|
||||
-
|
||||
I check that Invoice should not created.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_order = self.browse(cr, uid, ref("order4"))
|
||||
assert len(sale_order.invoice_ids) == False, "Invoice should not created."
|
||||
assert sale_order.picking_ids, "Delivery order should be created."
|
||||
-
|
||||
I create advance invoice.
|
||||
-
|
||||
!python {model: sale.advance.payment.inv}: |
|
||||
ctx = context.copy()
|
||||
ctx.update({"active_model": 'sale.order', "active_ids": [ref("order4")], "active_id":ref("order4")})
|
||||
order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("line7"), context=context)
|
||||
pay_id = self.create(cr, uid, {'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty})
|
||||
self.create_invoices(cr, uid, [pay_id], context=ctx)
|
||||
-
|
||||
I check Invoice which made advance
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
order = self.browse(cr, uid, ref('order4'))
|
||||
assert order.invoice_ids, "Invoice should be created after make advance invoice."
|
||||
-
|
||||
I create Invoice from sale order line.
|
||||
-
|
||||
!python {model: sale.order.line.make.invoice}: |
|
||||
ctx = context.copy()
|
||||
ctx.update({"active_model": 'sale.order.line', "active_ids": [ref("line8")], "active_id":ref("line8")})
|
||||
self.make_invoices(cr, uid, [], context=ctx)
|
||||
-
|
||||
I check Invoice which made from sale order line.
|
||||
-
|
||||
!python {model: sale.order.line}: |
|
||||
line = self.browse(cr, uid, ref('line8'))
|
||||
assert line.invoice_lines, "Invoice line should be created."
|
||||
-
|
||||
I create manual Invoice for order.
|
||||
-
|
||||
!record {model: sale.make.invoice, id: sale_make_invoice_1}:
|
||||
invoice_date: !eval time.strftime('%Y-%m-%d')
|
||||
-
|
||||
!python {model: sale.make.invoice}: |
|
||||
ctx = context.copy()
|
||||
ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("order4")], "active_id":ref("order4")})
|
||||
self.make_invoices(cr, uid, [ref("sale_make_invoice_1")], context)
|
||||
-
|
||||
I check Invoice after do manual.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_order = self.browse(cr, uid, ref("order4"))
|
||||
assert sale_order.invoice_ids, "Invoice should be created."
|
||||
-
|
||||
I open the Invoice.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
so = self.browse(cr, uid, ref("order4"))
|
||||
so = self.browse(cr, uid, ref("order"))
|
||||
for invoice in so.invoice_ids:
|
||||
wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr)
|
||||
assert so.invoiced_rate == 100, "Invoiced Progress is not 100%."
|
||||
|
||||
-
|
||||
I set order policy "Deliver & invoice on demand" as default policy.
|
||||
I check the order after open invoice.
|
||||
-
|
||||
!record {model: sale.config.picking_policy, id: sale.config.picking_policy_0}:
|
||||
order_policy: 'manual'
|
||||
-
|
||||
!python {model: sale.config.picking_policy}: |
|
||||
self.execute(cr, uid, [ref("sale.config.picking_policy_0")])
|
||||
!python {model: sale.order}: |
|
||||
order = self.browse(cr, uid, ref("order"))
|
||||
#assert order.invoiced == True, "Sale order is not invoiced."
|
||||
assert order.invoiced_rate == 100, "Invoiced progress is not 100%."
|
||||
assert order.state == 'done', 'Order should be in closed.'
|
||||
-
|
||||
I print a sale order report.
|
||||
-
|
|
@ -0,0 +1,41 @@
|
|||
-
|
||||
Now I confirm the Quotation with "Invoice on order after delivery" policy.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: order2}
|
||||
-
|
||||
I check that related delivery order after confirmed.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_order = self.browse(cr, uid, ref("order2"))
|
||||
assert sale_order.picking_ids, "Delivery Order should be created."
|
||||
assert len(sale_order.invoice_ids) == False, "Invoice should be not created."
|
||||
-
|
||||
Now, I dispatch delivery order.
|
||||
-
|
||||
!python {model: stock.partial.picking}: |
|
||||
order = self.pool.get('sale.order').browse(cr, uid, ref("order2"))
|
||||
for pick in order.picking_ids:
|
||||
data = pick.force_assign()
|
||||
if data == True:
|
||||
partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick.id]})
|
||||
self.do_partial(cr, uid, [partial_id])
|
||||
-
|
||||
I open the Invoice.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
so = self.browse(cr, uid, ref("order2"))
|
||||
for invoice in so.invoice_ids:
|
||||
wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr)
|
||||
-
|
||||
I check that an order has been invoiced, shipped and closed.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
order = self.browse(cr, uid, ref("order2"))
|
||||
assert order.picked_rate == 100, "Shipment progress is not 100%."
|
||||
assert order.shipped, "Delivery Order should be dispatch."
|
||||
#assert order.invoiced == True, "Sale order is not invoiced."
|
||||
#assert order.invoiced_rate == 100, "Invoiced progress is not 100%."
|
||||
#assert order.state == 'done', 'Order should be in closed.'
|
||||
assert order.invoice_ids, "Invoice should be created after dispatch delivery order."
|
|
@ -0,0 +1,11 @@
|
|||
-
|
||||
Now I confirm the Quotation with "Pay before delivery" policy.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: order3}
|
||||
-
|
||||
I check that delivery order should not created before invoice is paid.
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_order = self.browse(cr, uid, ref("order3"))
|
||||
assert len(sale_order.picking_ids) == False, "Delivery order should not created before invoice."
|
||||
assert sale_order.invoice_ids, "Invoice should be created."
|
Loading…
Reference in New Issue