diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py
index 4e51c63458e..17db1ef72d7 100644
--- a/addons/sale/__openerp__.py
+++ b/addons/sale/__openerp__.py
@@ -87,16 +87,10 @@ Dashboard for Sales Manager that includes:
],
'demo_xml': ['sale_demo.xml'],
'test': [
- 'test/process/order_policy.yml',
- 'test/process/run_scheduler.yml',
- 'test/process/cancel_order.yml',
- 'test/ui/execute_config.yml',
- 'test/ui/sale_order_demo.yml',
- 'test/ui/sale_make_invoice.yml',
- 'test/ui/make_advance_invoice.yml',
- 'test/ui/sale_line_invoice.yml',
- 'test/ui/delete_order.yml',
- 'test/ui/sale_report.yml',
+ 'test/order_process.yml',
+ 'test/cancel_order.yml',
+ 'test/sale_order_demo.yml',
+ 'test/delete_order.yml',
'test/edi_sale_order.yml',
],
'installable': True,
diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml
index d96f735d6f5..ce4853e0eda 100644
--- a/addons/sale/sale_demo.xml
+++ b/addons/sale/sale_demo.xml
@@ -12,16 +12,15 @@
- postpaid
+ picking
- New server config + material
-
-
+
+
123.20
make_to_stock
@@ -67,7 +66,8 @@
- picking
+ postpaid
+
diff --git a/addons/sale/test/process/cancel_order.yml b/addons/sale/test/cancel_order.yml
similarity index 100%
rename from addons/sale/test/process/cancel_order.yml
rename to addons/sale/test/cancel_order.yml
diff --git a/addons/sale/test/ui/delete_order.yml b/addons/sale/test/delete_order.yml
similarity index 100%
rename from addons/sale/test/ui/delete_order.yml
rename to addons/sale/test/delete_order.yml
diff --git a/addons/sale/test/order_process.yml b/addons/sale/test/order_process.yml
new file mode 100644
index 00000000000..407d11c064c
--- /dev/null
+++ b/addons/sale/test/order_process.yml
@@ -0,0 +1,254 @@
+-
+ In order to test process of the Sale Order,
+-
+ First I check the total amount of the Quotation before Approved.
+-
+ !assert {model: sale.order, id: order, string: The amount of the Quotation is not correctly computed}:
+ - sum([l.price_subtotal for l in order_line]) == amount_untaxed
+-
+ I confirm the quotation with "Invoice based on deliveries" policy.
+-
+ !workflow {model: sale.order, action: order_confirm, ref: order}
+-
+ I check that invoice should not created before dispatch delivery.
+-
+ !python {model: sale.order}: |
+ order = self.pool.get('sale.order').browse(cr, uid, ref("order"))
+ assert len(order.invoice_ids) == False, "Invoice should not created."
+-
+ I check that procurement after confirmed quotation.
+-
+ !python {model: sale.order}: |
+ from datetime import datetime, timedelta
+ from dateutil.relativedelta import relativedelta
+ from tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
+ order = self.browse(cr, uid, ref("order"))
+ for order_line in order.order_line:
+ procurement = order_line.procurement_id
+ date_planned = datetime.strptime(order.date_order, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=order_line.delay or 0.0)
+ date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+ assert procurement.date_planned == date_planned, "Scheduled date is not correspond."
+ assert procurement.product_id.id == order_line.product_id.id, "Product is not correspond."
+ assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond."
+ assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
+ assert procurement.procure_method == order_line.type, "Procurement method is not correspond."
+-
+ I run the scheduler.
+-
+ !python {model: procurement.order}: |
+ self.run_scheduler(cr, uid)
+
+-
+ I check the details of delivery order after confirmed quotation.
+-
+ !python {model: sale.order}: |
+ from datetime import datetime, timedelta
+ from dateutil.relativedelta import relativedelta
+ from tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
+ sale_order = self.browse(cr, uid, ref("order"))
+ assert sale_order.picking_ids, "Delivery order is not created."
+ for picking in sale_order.picking_ids:
+ assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state."
+ assert picking.origin == sale_order.name,"Origin of Delivery order is not correspond with sequence number of sale order."
+ assert picking.type == 'out',"Shipment should be Outgoing."
+ assert picking.move_type == sale_order.picking_policy,"Delivery Method is not corresponding with delivery method of sale order."
+ assert picking.address_id.id == sale_order.partner_shipping_id.id,"Shipping Address is not correspond with sale order."
+ assert picking.note == sale_order.note,"Notes is not correspond with sale order."
+ assert picking.invoice_state == (sale_order.order_policy=='picking' and '2binvoiced') or 'none',"Invoice policy is not correspond with sale order."
+ assert len(picking.move_lines) == len(sale_order.order_line), "Total move of delivery order are not corresposning with total sale order lines."
+ location_id = sale_order.shop_id.warehouse_id.lot_stock_id.id
+ output_id = sale_order.shop_id.warehouse_id.lot_output_id.id
+ for move in picking.move_lines:
+ order_line = move.sale_line_id
+ date_planned = datetime.strptime(sale_order.date_order, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=order_line.delay or 0.0)
+ date_planned = (date_planned - timedelta(days=sale_order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+ assert datetime.strptime(move.date_expected, DEFAULT_SERVER_DATETIME_FORMAT) == datetime.strptime(date_planned, DEFAULT_SERVER_DATETIME_FORMAT), "Excepted Date is not correspond with Planned Date."
+ assert move.product_id.id == order_line.product_id.id,"Product is not correspond."
+ assert move.product_qty == order_line.product_uom_qty,"Product Quantity is not correspond."
+ assert move.product_uom.id == order_line.product_uom.id,"Product UOM is not correspond."
+ assert move.product_uos_qty == order_line.product_uos_qty,"Product UOS Quantity is not correspond."
+ assert move.product_uos == (order_line.product_uos and order_line.product_uos.id) or order_line.product_uom.id,"Product UOS is not correspond"
+ assert move.product_packaging.id == order_line.product_packaging.id,"Product packaging is not correspond."
+ assert move.address_id.id == order_line.address_allotment_id.id or sale_order.partner_shipping_id.id,"Address is not correspond"
+ assert move.location_id.id == location_id,"Source Location is not correspond."
+ assert move.location_dest_id == output_id,"Destination Location is not correspond."
+ assert move.note == order_line.notes,"Notes is not correspond"
+ assert move.price_unit == order_line.product_id.standard_price or 0.0,"Price Unit is not correspond"
+-
+ Now, I dispatch delivery order.
+-
+ !python {model: stock.partial.picking}: |
+ order = self.pool.get('sale.order').browse(cr, uid, ref("order"))
+ 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 sale order to verify shipment.
+-
+ !python {model: sale.order}: |
+ order = self.pool.get('sale.order').browse(cr, uid, ref("order"))
+ assert order.shipped == True, "Sale order is not Delivered."
+ assert order.picked_rate == 100, "Shipment progress is not 100%."
+ assert len(order.invoice_ids) == False, "Invoice should not created on dispatch delivery order."
+-
+ I make Invoice from Delivery Order.
+-
+ !python {model: stock.invoice.onshipping}: |
+ sale = self.pool.get('sale.order')
+ sale_order = sale.browse(cr, uid, ref("order"))
+ ship_ids = [x.id for x in sale_order.picking_ids]
+ wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
+ {'active_ids': ship_ids, 'active_model': 'stock.picking'})
+ self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]})
+
+-
+ I check that Invoice details after dispatched delivery.
+-
+ !python {model: sale.order}: |
+ order = self.browse(cr, uid, ref("order"))
+ 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."
+ assert invoice.origin == order.name,"Origin of Invoice is not corresponding with sequence number of sale order."
+ assert invoice.reference == order.client_order_ref or order.name,"Reference is not correspond."
+ assert invoice.partner_id.id == order.partner_id.id,"Customer is not correspond."
+ assert invoice.address_invoice_id.id == order.partner_invoice_id.id,"Invoice Address is not correspond."
+ assert invoice.currency_id.id == order.pricelist_id.currency_id.id, "Currency is not correspond."
+ assert invoice.comment == order.note,"Notes is not correspond."
+ assert invoice.journal_id.id == journal_ids[0],"Sales Journal is not link on Invoice."
+ assert invoice.payment_term == order.payment_term and order.payment_term.id or False, "Payment term is not correspond."
+ for so_line in order.order_line:
+ inv_line = so_line.invoice_lines[0]
+ ac = so_line.product_id.product_tmpl_id.property_account_income.id or so_line.product_id.categ_id.property_account_income_categ.id
+ assert inv_line.product_id.id == so_line.product_id.id or False,"Product is not correspond"
+ assert inv_line.account_id.id == ac,"Account of Invoice line is not corresponding."
+ assert inv_line.uos_id.name == so_line.product_uom.id , "UOM is not correspond."
+ assert inv_line.price_unit == so_line.price_unit , "Price Unit is not correspond."
+ assert inv_line.quantity == 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.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 make advance invoice.
+-
+ !python {model: sale.advance.payment.inv}: |
+ ctx = context.copy()
+ ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("order4")], "active_id":ref("order4")})
+ order_line = self.get.pool('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
+-
+ !assert {model: sale.order.line, id: line7}:
+ - invoice_lines
+-
+ I make Invoice from sale order line.
+-
+ !python {model: sale.order.line.make.invoice}: |
+ ctx = context.copy()
+ ctx = 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.
+-
+ !assert {model: sale.order.line, id: line8}:
+ - invoice_lines
+-
+ I make 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"))
+ 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.
+-
+ !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")])
+-
+ I print a sale order report.
+-
+ !python {model: sale.order}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.sale.order').create(cr, uid, [ref('order')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'sale-sale_order.'+format), 'wb+').write(data)
diff --git a/addons/sale/test/process/order_policy.yml b/addons/sale/test/process/order_policy.yml
deleted file mode 100644
index ba8c35680af..00000000000
--- a/addons/sale/test/process/order_policy.yml
+++ /dev/null
@@ -1,183 +0,0 @@
--
- In order to test the Sale order flow, I compute the total of the listed products for Quotation1.
--
- I check the total untaxed amount of the Quotation1 is correctly computed.
--
- !assert {model: sale.order, id: order, string: The amount of the Quotation is not correctly computed}:
- - sum([l.price_subtotal for l in order_line]) == amount_untaxed
--
- For testing 'Invoice on order after delivery' order policy, I confirm the Quotation1.
--
- !workflow {model: sale.order, action: order_confirm, ref: order}
--
- After Quotation1 is confirmed, I check that related Picking is created and it is linked.
--
- !python {model: sale.order}: |
- sale_order = self.browse(cr, uid, ref("order"))
- assert sale_order.picking_ids, "Picking is not created for this sale order"
--
- I check that Picking details are correspond with Quotation1.
--
- !python {model: sale.order}: |
- sale_order = self.browse(cr, uid, ref("order"))
- for picking in sale_order.picking_ids:
- assert picking.state == "auto" or "confirmed", "Picking state should be in waitting state"
- assert picking.origin == sale_order.name,"Picking Name is not correspond with sale order"
- assert picking.type == 'out',"Picking type should be sending Goods"
- assert picking.move_type == sale_order.picking_policy,"Picking move type should be Partial Delivery"
- assert picking.sale_id.id == sale_order.id,"Sale order is not correspond"
- assert picking.address_id.id == sale_order.partner_shipping_id.id,"Address is not correspond with sale order"
- assert picking.note == sale_order.note,"Notes is not correspond with sale order"
- assert picking.invoice_state == (sale_order.order_policy=='picking' and '2binvoiced') or 'none',"Invoice state is not correspond with sale order"
- assert picking.company_id.id == sale_order.company_id.id,"Company is not correspond with sale order"
-
- location_id = sale_order.shop_id.warehouse_id.lot_stock_id.id
- for move in picking.move_lines:
- for order in sale_order.order_line:
- if move.name == order.name:
- assert move.name == order.name[:64],"Name is not correspond"
- assert move.product_id.id == order.product_id.id,"Product is not correspond"
- assert move.product_qty == order.product_uom_qty,"Product Quantity is not correspond"
- assert move.product_uom.id == order.product_uom.id,"Product UOM is not correspond"
- assert move.product_uos_qty == order.product_uos_qty,"Product UOS Quantity is not correspond"
- assert move.product_uos == (order.product_uos and order.product_uos.id) or order.product_uom.id,"Product UOS is not correspond"
- assert move.product_packaging.id == order.product_packaging.id,"Product packaging is not correspond"
- assert move.address_id.id == order.address_allotment_id.id or sale_order.partner_shipping_id.id,"Address is not correspond"
- assert move.location_id.id == location_id,"Source Location is not correspond"
- assert move.note == order.notes,"Notes is not correspond"
- assert move.company_id.id == sale_order.company_id.id,"Company is not correspond"
- assert move.price_unit == order.product_id.standard_price or 0.0,"Price Unit is not correspond"
--
- Now, I create draft invoice on based of picking for order1 where Invoice Policy is "Invoice on order after delivery".
--
- !python {model: stock.partial.picking}: |
- order = self.pool.get('sale.order').browse(cr, uid, ref("order"))
- pick_ids = order.picking_ids
- stock = self.pool.get('stock.picking')
- data = stock.force_assign(cr, uid, [pick_ids[0].id])
- if data == True:
- partial_id = self.create(cr, uid, {},context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
- self.do_partial(cr, uid, [partial_id])
- assert order.shipped == True, "Sale order is not marked as delivered"
- assert order.invoice_ids, "Invoice not created after picking for sale order1"
-
-#Progressbar code introduced by revid: mtr@tinyerp.com-20110829113915-leecwthb7g99txzk
-#form 'lp:~openerp-dev/openobject-addons/trunk-sale_coverage-mtr' branch
--
- I verify that Picked Progessbar is 100%.
--
- !python {model: sale.order}: |
- picked_rate = self._picked_rate(cr, uid, [ref("order")], 'picked_rate', None, {'active_model': 'ir.ui.menu','section_id': False, 'active_id': ref("order"), 'bin_size': True,'active_ids': [ref("order")], 'department_id': False})
- picked = picked_rate.values()
- assert picked[0] == 100, "Picked Progress bar is not 100%"
--
- For testing 'Pay before delivery' order policy, I confirm the Quotation3.
--
- !workflow {model: sale.order, action: order_confirm, ref: order3}
--
- After Quotation3 is confirmed, I check that related Invoice is created and it is linked.
--
- !python {model: sale.order}: |
- sale_order = self.browse(cr, uid, ref("order3"))
- assert sale_order.invoice_ids, "Invoice is not created for this sale order"
--
- I check that Invoice details are correspond with Quotation3.
--
- !python {model: sale.order}: |
- order = self.browse(cr, uid, ref("order3"))
- 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.origin == order.name,"Name is not correspond"
- assert invoice.type == 'out_invoice',"Type should be Out Invoice"
- assert invoice.reference == order.client_order_ref or order.name,"Reference is not correspond"
- assert invoice.partner_id.id == order.partner_id.id,"Partner is not correspond"
- assert invoice.address_invoice_id.id == order.partner_invoice_id.id,"Invoice Address is not correspond"
- assert invoice.currency_id.id == order.pricelist_id.currency_id.id, "Currency is not correspond"
- assert invoice.comment == order.note,"Notes is not correspond"
- assert invoice.fiscal_position.id == order.fiscal_position.id or order.partner_id.property_account_position.id,"Fiscal position not correspond"
- assert invoice.company_id.id == order.company_id.id,"Company is not correspond"
- assert invoice.user_id.id == order.user_id.id or False, "User is not correspond"
- assert invoice.account_id.id == ac,"There is no receivable account"
- assert invoice.journal_id.id == journal_ids[0],"There is no sales journal defined for this company"
- for inv in invoice.invoice_line:
- for so in order.order_line:
- if inv.name == so.name:
- ac = so.product_id.product_tmpl_id.property_account_income.id or so.product_id.categ_id.property_account_income_categ.id
- assert inv.name == so.name,"Name is not correspond"
- assert inv.origin == so.order_id.name,"Origin is not correspond"
- assert inv.discount == so.discount,"Discount is not correspond"
- assert inv.product_id.id == so.product_id.id or False,"Product is not correspond"
- assert inv.note == so.notes,"Notes is not correspond"
- assert inv.account_id.id == ac,"There is no income account defined for this product"
--
- For testing 'Invoice based on deliveries' order policy, I confirm the Quotation2.
--
- !workflow {model: sale.order, action: order_confirm, ref: order2}
--
- After Quotation2 is confirmed, I check that related Picking is created and it is linked.
--
- !python {model: sale.order}: |
- sale_order = self.browse(cr, uid, ref("order2"))
- assert sale_order.picking_ids, "Picking is not created for this sale order"
--
- Now, I validate the picking.
--
- !python {model: stock.partial.picking}: |
- order = self.pool.get('sale.order').browse(cr, uid, ref("order2"))
- pick_ids = order.picking_ids
- stock = self.pool.get('stock.picking')
- data = stock.force_assign(cr, uid, [pick_ids[0].id])
- if data == True:
- partial_id = self.create(cr, uid, {},context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
- self.do_partial(cr, uid, [partial_id])
--
- Then I click on 'Create Invoices' button.
--
- !python {model: stock.invoice.onshipping}: |
- import time
- sale_obj=self.pool.get('sale.order')
- sale_id=sale_obj.browse(cr, uid, ref("order2"))
- ids = [x.id for x in sale_id.picking_ids]
- wiz_id = self.create(cr, uid, {'invoice_date': time.strftime('%Y-%m-%d'), 'journal_id': ref('account.sales_journal')},
- {'active_ids': ids, 'active_model': 'stock.picking'})
- self.create_invoice(cr, uid, [wiz_id], {"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("order2"))
- assert(sale_id.invoice_ids), "Invoice is not created for order2"
--
- For testing the 'Deliver & invoice on demand' order policy, I confirm the Quotation4.
--
- !workflow {model: sale.order, action: order_confirm, ref: order4}
--
- After Quotation4 is confirmed, I check that related Invoice is created and it is linked.
--
- !python {model: sale.order}: |
- so = self.browse(cr, uid, ref("order4"))
- self.manual_invoice(cr, uid, [ref('order4')])
- assert so.invoice_ids, "Invoices is not created for this sale order"
- assert so.picking_ids, "Picking is not created for this sale order"
--
- I open the Invoice for this sale order.
--
- !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)
-
-#Progressbar code introduced by revid: mtr@tinyerp.com-20110829113915-leecwthb7g99txzk
-#form 'lp:~openerp-dev/openobject-addons/trunk-sale_coverage-mtr' branch
--
- I verify that Invoiced Progessbar is 100%.
--
- !python {model: sale.order}: |
- invoiced_rate = self._invoiced_rate(cr, uid, [ref("order4")], 'invoiced_rate', None, {'active_model': 'ir.ui.menu','section_id': False, 'active_id': ref("order4"), 'bin_size': True,'active_ids': [ref("order4")], 'department_id': False})
- invoiced = invoiced_rate.values()
- assert invoiced[0] == 100, "Invoiced Progress bar is not 100%"
-
diff --git a/addons/sale/test/process/run_scheduler.yml b/addons/sale/test/process/run_scheduler.yml
deleted file mode 100644
index 9f3bb95a04e..00000000000
--- a/addons/sale/test/process/run_scheduler.yml
+++ /dev/null
@@ -1,28 +0,0 @@
--
- In order to test the sale order working with procurements,
- I take some products with different supply method and procurement method.
--
- I confirm the order5.
--
- !workflow {model: sale.order, action: order_confirm, ref: order5}
--
- I check that procurement is generated.
--
- !python {model: procurement.order}: |
- from tools.translate import _
- so = self.pool.get('sale.order').browse(cr, uid, ref("order5"))
- proc_ids = self.search(cr, uid, [('origin','=',so.name)])
- assert proc_ids, _('No Procurements!')
--
- I run the scheduler.
--
- !python {model: procurement.order}: |
- self.run_scheduler(cr, uid)
--
- I check that the procurement for the product PC2 is in exception state.
- As PC2 product's supply method is produce and the BoM is not defined.
--
- !python {model: procurement.order}: |
- from tools.translate import _
- proc_ids = self.search(cr, uid, [('state','=','exception'),('product_id','=',ref('product.product_product_pc2'))])
- assert proc_ids, _('There is no procurement in exception state!')
diff --git a/addons/sale/test/sale_order_demo.yml b/addons/sale/test/sale_order_demo.yml
new file mode 100644
index 00000000000..415c65ed60d
--- /dev/null
+++ b/addons/sale/test/sale_order_demo.yml
@@ -0,0 +1,9 @@
+-
+ !record {model: sale.order, id: order2}:
+ partner_id: base.res_partner_2
+ order_line:
+ - product_id: product.product_product_pc2
+ product_uom_qty: 1.0
+ order_line:
+ - product_id: product.product_product_mb1
+ product_uom_qty: 8
diff --git a/addons/sale/test/ui/execute_config.yml b/addons/sale/test/ui/execute_config.yml
deleted file mode 100644
index d45b388f890..00000000000
--- a/addons/sale/test/ui/execute_config.yml
+++ /dev/null
@@ -1,16 +0,0 @@
--
- In order to test the configuration methods.
--
- !record {model: sale.config.picking_policy, id: sale.config.picking_policy_0}:
- sale_orders: False
- deli_orders: False
- task_work: False
- timesheet: False
- order_policy: 'manual'
- charge_delivery: False
--
- I execute that wizard of configuration.
--
- !python {model: sale.config.picking_policy}: |
- self.execute(cr, uid, [ref("sale.config.picking_policy_0")])
-
diff --git a/addons/sale/test/ui/make_advance_invoice.yml b/addons/sale/test/ui/make_advance_invoice.yml
deleted file mode 100644
index b765ffe81d1..00000000000
--- a/addons/sale/test/ui/make_advance_invoice.yml
+++ /dev/null
@@ -1,30 +0,0 @@
--
- In order to test the pay invoices in advance wizard of sale module in the OpenERP,
- I take a Sale order and create invoice.
--
- I create a record to pay advance invoice.
--
- !record {model: sale.advance.payment.inv, id: sale_make_invoice_adv}:
- product_id: product.product_product_pc1
- amount: 100.0
--
- Then I click on the "Advance Invoices" button.
--
- !python {model: sale.advance.payment.inv}: |
- context = {"lang": 'en_US', "search_default_user_id":1, "tz": False, "active_model": 'sale.order', "active_ids": [ref("order5")], "active_id":ref("order5")}
- self.create_invoices(cr, uid, [ref("sale_make_invoice_adv")], context)
- self.pool.get('sale.open.invoice').open_invoice(cr, uid, [ref("sale_make_invoice_adv")], context)
--
- I verify that an invoice has been created.
--
- !python {model: sale.order}: |
- inv = self.browse(cr, uid, ref('order5')).invoice_ids
- assert inv, "Invoices are not created"
--
- I verify that an account invoice line with origin 'SO003' is created.
--
- !python {model: sale.order}: |
- acc_inv_line = self.pool.get('account.invoice.line')
- inv = self.browse(cr, uid, ref('order5')).invoice_ids
- for line in inv:
- assert line.invoice_line, "Account invoice line not been created for order"
diff --git a/addons/sale/test/ui/sale_line_invoice.yml b/addons/sale/test/ui/sale_line_invoice.yml
deleted file mode 100644
index b539b82408b..00000000000
--- a/addons/sale/test/ui/sale_line_invoice.yml
+++ /dev/null
@@ -1,11 +0,0 @@
--
- In order to test the 'Make Invoices' of sale oreder line wizard in the OpenERP,
- I take a Sale order line and create invoice.
--
- I click on the "Make Invoices" button.
--
- !python {model: sale.order.line.make.invoice}: |
- context = {"lang": 'en_US', "search_default_user_id":1, "tz": False, "active_model": 'sale.order.line', "active_ids": [ref("order6_line1")], "active_id":ref("order6_line1")}
- order_line = self.pool.get('sale.order.line').browse(cr, uid, ref('order6_line1'))
- if order_line.invoiced == False:
- self.make_invoices(cr, uid, [ref("order6_line1")], context)
diff --git a/addons/sale/test/ui/sale_make_invoice.yml b/addons/sale/test/ui/sale_make_invoice.yml
deleted file mode 100644
index 345aab3490e..00000000000
--- a/addons/sale/test/ui/sale_make_invoice.yml
+++ /dev/null
@@ -1,42 +0,0 @@
--
- In order to test the 'Make Invoices' wizard of sale module in the OpenERP,
- I take a Sale order and create invoice.
--
- I confirm the Sale Order.
--
- !workflow {model: sale.order, action: order_confirm, ref: order3}
--
- I confirm another Sale Order.
--
- !workflow {model: sale.order, action: order_confirm, ref: order5}
--
- Then I create a record for make invoice.
--
- !record {model: sale.make.invoice, id: sale_make_invoice_1}:
- grouped: 1
- invoice_date: !eval time.strftime('%Y-%m-%d')
--
- Then I click on button of wizard for make invoice.
--
- !python {model: sale.make.invoice}: |
- context = {"lang": 'en_US', "search_default_user_id":1, "tz": False, "active_model": 'sale.order', "active_ids": [ref("order3"),ref("order5")], "active_id":ref("order3")}
- self.make_invoices(cr, uid, [ref("sale_make_invoice_1")], context)
--
- I verify that an invoice has been created.
--
- !python {model: sale.order}: |
- inv = self.browse(cr, uid, ref('order3')).invoice_ids
- inv1 = self.browse(cr, uid, ref('order5')).invoice_ids
- assert inv, "Invoices are not created"
- assert inv1, "Invoices are not created"
--
- I verify that an account invoice line is created.
--
- !python {model: sale.order}: |
- acc_inv_line = self.pool.get('account.invoice.line')
- inv = self.browse(cr, uid, ref('order3')).invoice_ids
- inv1 = self.browse(cr, uid, ref('order5')).invoice_ids
- for line in inv:
- assert line.invoice_line, "Account invoice line not been created for order3"
- for line in inv1:
- assert line.invoice_line, "Account invoice line not been created for order5"
diff --git a/addons/sale/test/ui/sale_order_demo.yml b/addons/sale/test/ui/sale_order_demo.yml
deleted file mode 100644
index a1b682f08d6..00000000000
--- a/addons/sale/test/ui/sale_order_demo.yml
+++ /dev/null
@@ -1,25 +0,0 @@
--
- In order to test the onchange events I create a record for sale order.
--
- !record {model: sale.order, id: order2}:
- partner_id: base.res_partner_2
- pricelist_id: 1
- shop_id: 'shop'
- order_policy: 'picking'
- picking_policy: 'direct'
- invoice_quantity: 'procurement'
- order_line:
- - product_id: product.product_product_pc2
- product_uom_qty: 1.0
- product_uom: 1
- price_unit: 540.0
- name: 'Computer assembled on demand'
- type: 'make_to_order'
- order_line:
- - product_id: product.product_product_mb1
- product_uom_qty: 8
- product_uos_qty: 8
- product_uom: 1
- price_unit: 88
- name: 'Mainboard ASUStek (purchased on order)'
- type: 'make_to_order'
diff --git a/addons/sale/test/ui/sale_report.yml b/addons/sale/test/ui/sale_report.yml
deleted file mode 100644
index 1d9619d1910..00000000000
--- a/addons/sale/test/ui/sale_report.yml
+++ /dev/null
@@ -1,8 +0,0 @@
--
- In order to test the PDF reports defined on a sale order, I print a sale order report.
--
- !python {model: sale.order}: |
- import netsvc, tools, os
- (data, format) = netsvc.LocalService('report.sale.order').create(cr, uid, [ref('sale.order'),ref('sale.order2')], {}, {})
- if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'sale-sale_order.'+format), 'wb+').write(data)