- 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 create the partner associated with the transport. - I create partner. - !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 create 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 - I create the Delivery Method. - !record {model: delivery.carrier, id: delivery_carrier_theopenerpexperss0}: name: The OpenERP Experss partner_id: res_partner_thepost0 product_id: product_product_deliverybypost0 - I create 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 - I create 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 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 confirm the sale order. - !workflow {model: sale.order, action: order_confirm, ref: sale_order_so0} - To check the Invoicing based on deliveries.I create 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 - I confirm the sale order. - !workflow {model: sale.order, action: order_confirm, ref: sale_order_test_complete0} - I Create stock.invoice.onshipping - !record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}: journal_id: account.sales_journal type: out_invoice - I Create 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 })