| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<odoo> |
| 3 |
|
| 4 |
<template id="delivery_form"> |
| 5 |
<!-- Parameters description: |
| 6 |
- delivery_methods: The delivery methods to display, as a `delivery.carrier` recordset. |
| 7 |
- selected_dm_id: The selected delivery method id. |
| 8 |
--> |
| 9 |
<form id="o_delivery_form" class="o_delivery_form"> |
| 10 |
<h4 class="mb-3">Delivery method</h4> |
| 11 |
<ul t-if="delivery_methods" id="o_delivery_methods" class="list-group"> |
| 12 |
<t t-foreach="delivery_methods" t-as="dm"> |
| 13 |
<li name="o_delivery_method" class="list-group-item"> |
| 14 |
<t t-call="website_sale.delivery_method"> |
| 15 |
<t t-set="is_selected" t-value="dm.id == selected_dm_id"/> |
| 16 |
</t> |
| 17 |
</li> |
| 18 |
</t> |
| 19 |
</ul> |
| 20 |
<div t-else="" class="alert alert-warning"> |
| 21 |
<strong>No suitable delivery method could be found.</strong> |
| 22 |
</div> |
| 23 |
</form> |
| 24 |
</template> |
| 25 |
|
| 26 |
<template id="delivery_method"> |
| 27 |
<!-- Parameters description: |
| 28 |
- dm: The delivery method to display, as a `delivery.carrier` recordset. |
| 29 |
- is_selected: Whether the radio button of the delivery method should be checked. |
| 30 |
--> |
| 31 |
<t t-set="delivery_type" t-value="dm.delivery_type + '_use_locations'"/> |
| 32 |
<t |
| 33 |
t-set="is_pickup_needed" |
| 34 |
t-value="delivery_type in dm._fields and dm[delivery_type]" |
| 35 |
/> |
| 36 |
<div class="d-flex justify-content-between gap-3"> |
| 37 |
<div class="form-check flex-grow-1 cursor-pointer"> |
| 38 |
<!-- === Radio button === --> |
| 39 |
<input |
| 40 |
t-attf-id="o_delivery_{{dm.id}}" |
| 41 |
name="o_delivery_radio" |
| 42 |
type="radio" |
| 43 |
t-att-checked="is_selected" |
| 44 |
disabled="true" |
| 45 |
class="form-check-input position-absolute" |
| 46 |
t-att-data-dm-id="dm.id" |
| 47 |
t-att-data-delivery-type="dm.delivery_type" |
| 48 |
t-att-data-is-pickup-location-required="is_pickup_needed" |
| 49 |
/> |
| 50 |
<!-- === Delivery method label === --> |
| 51 |
<label |
| 52 |
name="o_delivery_method_label" |
| 53 |
class="form-check-label w-100" |
| 54 |
t-attf-for="o_delivery_{{dm.id}}" |
| 55 |
> |
| 56 |
<span name="o_delivery_method_name" t-field="dm.name"/> |
| 57 |
</label> |
| 58 |
</div> |
| 59 |
<!-- === Delivery price badge === --> |
| 60 |
<span class="o_wsale_delivery_price_badge text-muted fw-bold text-end" name="price"> |
| 61 |
<small class="fw-normal">Select to compute delivery rate</small> |
| 62 |
</span> |
| 63 |
</div> |
| 64 |
<!-- === Pick up location === --> |
| 65 |
<div |
| 66 |
t-if="is_pickup_needed" |
| 67 |
name="o_pickup_location" |
| 68 |
t-attf-class="position-relative d-flex gap-2 mt-3 mb-2 {{'' if is_selected else 'd-none'}}" |
| 69 |
> |
| 70 |
<t |
| 71 |
t-set="pickup_location_data" |
| 72 |
t-value="(is_selected and order.pickup_location_data) or {}" |
| 73 |
/> |
| 74 |
<div |
| 75 |
name="o_pickup_location_details" |
| 76 |
t-attf-class="d-flex justify-items-between align-items-center gap-3 w-100 border p-3 rounded {{'' if pickup_location_data else 'd-none'}}" |
| 77 |
> |
| 78 |
<span> |
| 79 |
<b name="o_pickup_location_name" t-out="pickup_location_data.get('name', '')"/> |
| 80 |
<br/> |
| 81 |
<span |
| 82 |
name="o_pickup_location_address" |
| 83 |
class="text-muted" |
| 84 |
t-out="(pickup_location_data.get('street', ) or '') |
| 85 |
+ ' ' |
| 86 |
+ (pickup_location_data.get('zip_code') or '') |
| 87 |
+ ' ' |
| 88 |
+ (pickup_location_data.get('city') or '')" |
| 89 |
/> |
| 90 |
</span> |
| 91 |
<span |
| 92 |
name="o_pickup_location_selector" |
| 93 |
class="btn btn-light fa fa-pencil ms-auto p-3" |
| 94 |
title="Change location" |
| 95 |
aria-label="Change location" |
| 96 |
t-att-data-location-id="pickup_location_data.get('id')" |
| 97 |
t-att-data-zip-code="pickup_location_data.get('zip_code')" |
| 98 |
t-att-data-pickup-location-data="json.dumps(pickup_location_data)" |
| 99 |
/> |
| 100 |
</div> |
| 101 |
<button |
| 102 |
t-if="not pickup_location_data" |
| 103 |
name="o_pickup_location_selector" |
| 104 |
type="button" |
| 105 |
class="btn btn-primary ms-4" |
| 106 |
t-att-data-zip-code="order.partner_shipping_id.zip" |
| 107 |
> |
| 108 |
Select a location |
| 109 |
</button> |
| 110 |
</div> |
| 111 |
<div |
| 112 |
t-if="dm.website_description" |
| 113 |
t-field="dm.website_description" |
| 114 |
class="text-muted mt-1" |
| 115 |
/> |
| 116 |
</template> |
| 117 |
|
| 118 |
</odoo> |