This commit does a couple of small related improvements: - adds new delivery options: "Local Delivery". We replace the existing "Normal Delivery Charges" with the new "Local Delivery" since it is now redundant. - Originally a "Local Pickup" demo option was going to be added, but this appeared redundant with the "[On Site Pick]" added in odoo/odoo#87636 . Regardless, an additional `carrier_description` field has been added so users can include extra instructions (e.g. address to pick up from, when pickup can occur, etc) to sales orders/ confirmation emails (emails only via ecommerce sales). - adds option to filter based on zip prefix rather than the previous zip "range" option, which was too restrictive in some cases (e.g. in the UK where zips can have letters in them). Note that users can view/edit zip prefixes in menu under settings when debug mode is active. Note: - prefixes are ordered by name so its easier to read large numbers prefixes - prefixes are always capitalized to avoid duplicate prefixes that differ by case + avoid capitalizing all prefixes every time the `_match_address` logic is called Task: 2706451 Upgrade PR: odoo/upgrade#3384 closes odoo/odoo#84620 Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
159 lines
8.1 KiB
XML
159 lines
8.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<data noupdate="1">
|
|
|
|
<!-- Carrier -->
|
|
|
|
<record id="product_product_delivery_poste" model="product.product">
|
|
<field name="name">The Poste</field>
|
|
<field name="default_code">Delivery_009</field>
|
|
<field name="type">service</field>
|
|
<field name="categ_id" ref="delivery.product_category_deliveries"/>
|
|
<field name="sale_ok" eval="False"/>
|
|
<field name="purchase_ok" eval="False"/>
|
|
<field name="list_price">20.0</field>
|
|
<field name="invoice_policy">order</field>
|
|
</record>
|
|
|
|
<record id="delivery_carrier" model="delivery.carrier">
|
|
<field name="name">The Poste</field>
|
|
<field name="fixed_price">20.0</field>
|
|
<field name="sequence">2</field>
|
|
<field name="delivery_type">base_on_rule</field>
|
|
<field name="product_id" ref="delivery.product_product_delivery_poste"/>
|
|
</record>
|
|
|
|
<!-- Local Delivery -->
|
|
<record id="product_product_local_delivery" model="product.product">
|
|
<field name="name">Local Delivery</field>
|
|
<field name="default_code">Delivery_010</field>
|
|
<field name="type">service</field>
|
|
<field name="categ_id" ref="delivery.product_category_deliveries"/>
|
|
<field name="sale_ok" eval="False"/>
|
|
<field name="purchase_ok" eval="False"/>
|
|
<field name="list_price">10.0</field>
|
|
<field name="invoice_policy">order</field>
|
|
</record>
|
|
<record id="delivery_local_delivery" model="delivery.carrier">
|
|
<field name="name">Local Delivery</field>
|
|
<field name="fixed_price">5.0</field>
|
|
<field name="free_over" eval="True"/>
|
|
<field name="amount">50</field>
|
|
<field name="sequence">4</field>
|
|
<field name="delivery_type">fixed</field>
|
|
<field name="product_id" ref="delivery.product_product_local_delivery"/>
|
|
</record>
|
|
|
|
<record id="delivery_price_rule1" model="delivery.price.rule">
|
|
<field name="carrier_id" ref="delivery_carrier"/>
|
|
<field eval="5" name="max_value"/>
|
|
<field eval="20" name="list_base_price"/>
|
|
</record>
|
|
<!-- delivery charge of product if weight more than 5kg-->
|
|
<record id="delivery_price_rule2" model="delivery.price.rule">
|
|
<field name="carrier_id" ref="delivery_carrier"/>
|
|
<field name="operator">>=</field>
|
|
<field eval="5" name="max_value"/>
|
|
<field eval="50" name="list_base_price"/>
|
|
</record>
|
|
|
|
<!-- free delivery charge if price more than 300-->
|
|
<record id="delivery_price_rule3" model="delivery.price.rule">
|
|
<field name="carrier_id" ref="delivery_carrier"/>
|
|
<field eval="300" name="max_value"/>
|
|
<field name="operator">>=</field>
|
|
<field name="variable">price</field>
|
|
<field eval="0" name="list_base_price"/>
|
|
</record>
|
|
|
|
<record forcecreate="True" id="property_delivery_carrier" model="ir.property">
|
|
<field name="name">property_delivery_carrier_id</field>
|
|
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_delivery_carrier_id')]"/>
|
|
<field name="value" eval="'delivery.carrier,'+str(ref('delivery_local_delivery'))"/>
|
|
</record>
|
|
|
|
<!--Sample sale orders with carrier defined-->
|
|
<record id="outgoing_shipment_with_carrier_confirmed_1" model="stock.picking">
|
|
<field name="picking_type_id" ref="stock.picking_type_out"/>
|
|
<field name="origin">outgoing shipment</field>
|
|
<field name="user_id"></field>
|
|
<field name="carrier_id" ref="delivery_carrier"/>
|
|
<field name="partner_id" ref="base.res_partner_1"/>
|
|
<field name="scheduled_date" eval="DateTime.today() - timedelta(days=3)"/>
|
|
<field name="location_id" ref="stock.stock_location_stock"/>
|
|
<field name="location_dest_id" ref="stock.stock_location_customers"/>
|
|
<field name="move_ids" model="stock.move" eval="[(0, 0, {
|
|
'name': obj().env.ref('product.product_product_6').name,
|
|
'product_id': ref('product.product_product_6'),
|
|
'product_uom': ref('uom.product_uom_unit'),
|
|
'product_uom_qty': 1.0,
|
|
'picking_type_id': ref('stock.picking_type_out'),
|
|
'location_id': ref('stock.stock_location_stock'),
|
|
'location_dest_id': ref('stock.stock_location_customers'),
|
|
})]"/>
|
|
</record>
|
|
|
|
<record id="outgoing_shipment_with_carrier_assigned_1" model="stock.picking">
|
|
<field name="picking_type_id" ref="stock.picking_type_out"/>
|
|
<field name="origin">outgoing shipment</field>
|
|
<field name="user_id"></field>
|
|
<field name="carrier_id" ref="delivery_carrier"/>
|
|
<field name="partner_id" ref="base.res_partner_1"/>
|
|
<field name="scheduled_date" eval="DateTime.today() - timedelta(days=3)"/>
|
|
<field name="location_id" ref="stock.stock_location_stock"/>
|
|
<field name="location_dest_id" ref="stock.stock_location_customers"/>
|
|
<field name="move_ids" model="stock.move" eval="[(0, 0, {
|
|
'name': obj().env.ref('product.product_product_6').name,
|
|
'product_id': ref('product.product_product_6'),
|
|
'product_uom': ref('uom.product_uom_unit'),
|
|
'product_uom_qty': 1.0,
|
|
'picking_type_id': ref('stock.picking_type_out'),
|
|
'location_id': ref('stock.stock_location_stock'),
|
|
'location_dest_id': ref('stock.stock_location_customers'),
|
|
})]"/>
|
|
</record>
|
|
|
|
<record id="outgoing_shipment_with_carrier_done_1" model="stock.picking">
|
|
<field name="picking_type_id" ref="stock.picking_type_out"/>
|
|
<field name="origin">outgoing shipment</field>
|
|
<field name="user_id"></field>
|
|
<field name="carrier_id" ref="delivery_carrier"/>
|
|
<field name="partner_id" ref="base.res_partner_1"/>
|
|
<field name="scheduled_date" eval="DateTime.today() - timedelta(days=8)"/>
|
|
<field name="location_id" ref="stock.stock_location_stock"/>
|
|
<field name="location_dest_id" ref="stock.stock_location_customers"/>
|
|
<field name="move_ids" model="stock.move" eval="[(0, 0, {
|
|
'name': obj().env.ref('product.product_product_6').name,
|
|
'product_id': ref('product.product_product_6'),
|
|
'product_uom': ref('uom.product_uom_unit'),
|
|
'product_uom_qty': 1.0,
|
|
'picking_type_id': ref('stock.picking_type_out'),
|
|
'location_id': ref('stock.stock_location_stock'),
|
|
'location_dest_id': ref('stock.stock_location_customers'),
|
|
})]"/>
|
|
</record>
|
|
<function model="stock.picking" name="action_confirm">
|
|
<value model="stock.picking" eval="[
|
|
obj().env.ref('delivery.outgoing_shipment_with_carrier_done_1').id,
|
|
obj().env.ref('delivery.outgoing_shipment_with_carrier_assigned_1').id,
|
|
obj().env.ref('delivery.outgoing_shipment_with_carrier_confirmed_1').id,
|
|
]"/>
|
|
</function>
|
|
<function model="stock.picking" name="action_assign">
|
|
<value model="stock.picking" eval="[
|
|
obj().env.ref('delivery.outgoing_shipment_with_carrier_done_1').id,
|
|
obj().env.ref('delivery.outgoing_shipment_with_carrier_assigned_1').id,
|
|
]"/>
|
|
</function>
|
|
<function model="stock.move.line" name="write">
|
|
<value model="stock.move.line" search="[('picking_id', '=', ref('delivery.outgoing_shipment_with_carrier_done_1'))]"/>
|
|
<value eval="{'qty_done': 1}"/>
|
|
</function>
|
|
<function model="stock.picking" name="_action_done">
|
|
<value model="stock.picking" eval="[
|
|
obj().env.ref('delivery.outgoing_shipment_with_carrier_done_1').id,
|
|
]"/>
|
|
</function>
|
|
</data>
|
|
</odoo>
|