diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py index 9b0949e07e1..5ac26ce3d23 100644 --- a/addons/delivery/__openerp__.py +++ b/addons/delivery/__openerp__.py @@ -39,6 +39,7 @@ 'partner_view.xml' ], 'demo_xml': ['delivery_demo.xml'], + 'test':['delivery_test.yml',], 'installable': True, 'active': False, 'certificate': '0033981912253', diff --git a/addons/delivery/test/delivery_test.yml b/addons/delivery/test/delivery_test.yml new file mode 100644 index 00000000000..aedb76b4926 --- /dev/null +++ b/addons/delivery/test/delivery_test.yml @@ -0,0 +1,176 @@ +- + In order to test the delivery module, I will do Configuration ‣ Delivery ‣ Delivery Method + And there are two methods for doing that + Delivery based on order quantities, + Delivery based on delivered quantities. + +- + I have creating the partner associated with the transport +- + Creating a res.partner record +- + !record {model: res.partner, id: res_partner_thepost0}: + address: + - country_id: base.in + name: Micro Link + credit_limit: 0.0 + name: The Post + property_account_payable: account.a_pay + property_account_receivable: account.a_recv + + +- + + I have creating associated product for delivery. +- + !record {model: product.product, id: product_product_deliverybypost0}: + categ_id: product.product_category_services + cost_method: standard + mes_type: fixed + name: Delivery Product + procure_method: make_to_stock + supply_method: buy + type: service + uom_id: product.product_uom_unit + uom_po_id: product.product_uom_unit + warranty: 0.0 + +- + + Creating a Delivery Method +- + !record {model: delivery.carrier, id: delivery_carrier_theopenerpexperss0}: + name: The OpenERP Experss + partner_id: res_partner_thepost0 + product_id: product_product_deliverybypost0 +- + Creating a delivery.grid record and define the region for which the tariffs in the grid will be applicable. + Then set the condition for which this rule is applicable +- + !record {model: delivery.grid, id: delivery_grid_weight0}: + carrier_id: delivery_carrier_theopenerpexperss0 + line_ids: + - list_price: 120.0 + max_value: 250.0 + name: Weight of product + operator: <= + standard_price: 60.0 + type: weight + price_type: fixed + variable_factor: weight + - list_price: 0.0 + max_value: 500.0 + name: Price >= 500 + operator: <= + standard_price: 20.0 + type: price + price_type: fixed + variable_factor: weight + country_ids: + - base.id + - base.be + - base.in + - base.io + + name: Weight + sequence: 1 + +- + To check the Delivery based on order quantities , I have created sale order and picking_policy is direct +- + !record {model: sale.order, id: sale_order_so0}: + date_order: '2010-05-11' + invoice_quantity: order + name: Test/delivery + order_line: + - name: '[PC1] Basic PC' + price_unit: 450.0 + product_uom: product.product_uom_unit + product_uom_qty: 10.0 + state: draft + delay: 2.0 + product_id: product.product_product_pc1 + product_uos_qty: 10.0 + th_weight: 0.0 + type: make_to_stock + order_policy: manual + partner_id: base.res_partner_agrolait + partner_invoice_id: base.res_partner_address_8 + partner_order_id: base.res_partner_address_8 + partner_shipping_id: base.res_partner_address_8 + picking_policy: direct + pricelist_id: product.list0 + shop_id: sale.shop + +- + Creating a delivery.sale.order record +- + !record {model: delivery.sale.order, id: delivery_sale_order_0}: + carrier_id: delivery_carrier_theopenerpexperss0 +- + To add the delivery charges on the quotation, I have click on Delivery costs button and select the carrier +- + !python {model: delivery.sale.order}: | + self.delivery_set(cr, uid, [ref("delivery_sale_order_0")], {"lang": "en_US", "active_model": + "sale.order", "tz": False, "order_id": 8, "active_ids": [ref("sale_order_so0")], + "active_id": ref("sale_order_so0"), }) +- + I check that I have two order line on the sale order +- + Performing a workflow action order_confirm on module sale.order +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_so0} + +- + To check the Invoicing based on deliveries.I have created new sale order and picking_policy is Complete Delivery +- + !record {model: sale.order, id: sale_order_test_complete0}: + name: Test/Complete Deliver + carrier_id: delivery.delivery_carrier_theopenerpexperss0 + invoice_quantity: procurement + order_line: + - name: '[PC1] Basic PC' + price_unit: 450.0 + product_uom: product.product_uom_unit + product_uom_qty: 10.0 + state: draft + delay: 2.0 + product_id: product.product_product_pc1 + product_uos_qty: 10.0 + th_weight: 0.0 + type: make_to_stock + partner_id: base.res_partner_4 + partner_order_id: base.res_partner_address_7 + partner_invoice_id: base.res_partner_address_7 + partner_shipping_id: base.res_partner_address_7 + pricelist_id: product.list0 + order_policy: picking + + +- + Performing a workflow action order_confirm on module sale.order +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_test_complete0} +- + Creating a stock.invoice.onshipping record +- + !record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}: + journal_id: account.sales_journal + type: out_invoice +- + Create a Invoice form picking +- + !python {model: stock.invoice.onshipping}: | + so=self.pool.get('sale.order').browse(cr,uid,ref('sale_order_test_complete0')) + self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US", + "tz": False, "active_model": "stock.picking", "contact_display": "partner", + "active_ids": [so.picking_ids[0].id], "active_id": so.picking_ids[0].id }) +- + To check invoice corresponding to the delivery charge in invoice line +- + !python {model: account.invoice}: | + import base + so=self.pool.get('sale.order').browse(cr,uid,ref('sale_order_test_complete0')) + ids=len(so.invoice_ids[0].invoice_line) + assert len(ids), "Invoice hasn't Created" + diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index 7ac6edccd3c..206cd89b6df 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -97,7 +97,6 @@ proc_obj._procure_confirm(cr,uid) - On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on - the button 'New RfQ'. This opens a window to ask me the supplier and I set DistriPC - Creating a purchase.requisition.partner record @@ -123,7 +122,7 @@ - !python {model: purchase.order}: | - order_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + order_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) assert (order_ids==2), "Purchase order hasn't Created" - I set the purchase requisition as 'Not Exclusive' @@ -200,8 +199,8 @@ pick=self.browse(cr,uid,picking_id[0]) move =pick.move_lines[0] partial_datas = { - 'partner_id': 4, - 'address_id': 7, + 'partner_id':pick.address_id.partner_id.id, + 'address_id': pick.address_id.id, 'delivery_date' : time.strftime('%Y-%m-%d'), } partial_datas['move%s'%(move.id)]= { diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml index e70e8200eef..f5e668d0d53 100644 --- a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml +++ b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml @@ -93,6 +93,7 @@ - !python {model: purchase.requisition}: | requisition_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + ids=len(requisition_ids) assert len(requisition_ids), "Purchase requisition hasn't Created" - On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on