|
11 | 11 | >combination_info['multiple_qty'] if combination_info['is_multiple'] else 1</attribute> |
12 | 12 | </xpath> |
13 | 13 | </template> |
| 14 | + <!-- |
| 15 | + Rewrite ``website_sale.base_unit_price`` template |
| 16 | + to have the same layout as ``website_sale.product_price``. |
| 17 | + This is basically a copy of the ``website_sale.product_price``. |
| 18 | + --> |
| 19 | + <template id="website_sale.base_unit_price" name="Product Base unit price"> |
| 20 | + <div |
| 21 | + name="product_price" |
| 22 | + t-attf-class="product_price {{'d-none' if combination_info['prevent_zero_price_sale'] else 'd-inline-block'}}" |
| 23 | + > |
| 24 | + <div |
| 25 | + name="product_price_container" |
| 26 | + class="css_editable_mode_hidden d-flex align-items-baseline justify-content-end gap-2 flex-wrap h5 mb-0 text-wrap" |
| 27 | + > |
| 28 | + <span |
| 29 | + class="oe_price o_base_unit_price" |
| 30 | + style="white-space: nowrap;" |
| 31 | + t-out="base_unit_price" |
| 32 | + t-options="{'widget': 'monetary', 'display_currency': website.currency_id}" |
| 33 | + /> |
| 34 | + / <span class="oe_custom_base_unit" t-field="product.base_unit_name" /> |
| 35 | + </div> |
| 36 | + </div> |
| 37 | + </template> |
| 38 | + <template |
| 39 | + id="product_page_base_unit_price" |
| 40 | + inherit_id="website_sale.product" |
| 41 | + name="Product page: base unit only product price" |
| 42 | + > |
| 43 | + <!-- Always hide ``website_sale.product_price`` when ``base_unit_price`` is available --> |
| 44 | + <t t-call="website_sale.product_price" position="attributes"> |
| 45 | + <attribute |
| 46 | + name="t-if" |
| 47 | + >not combination_info.get('base_unit_price')</attribute> |
| 48 | + </t> |
| 49 | + |
| 50 | + <!-- Hide existing ``o_base_unit_price_wrapper`` --> |
| 51 | + <xpath |
| 52 | + expr="//small[hasclass('o_base_unit_price_wrapper')]" |
| 53 | + position="attributes" |
| 54 | + > |
| 55 | + <attribute name="t-if">False</attribute> |
| 56 | + </xpath> |
| 57 | + <!-- Add below ``o_base_unit_price_wrapper`` the ``website_sale.base_unit_price`` |
| 58 | + to have same layout as ``website_sale.product_price`` |
| 59 | + --> |
| 60 | + <xpath expr="//small[hasclass('o_base_unit_price_wrapper')]" position="after"> |
| 61 | + <div |
| 62 | + t-if="combination_info.get('base_unit_price')" |
| 63 | + class="o_base_unit_price_wrapper" |
| 64 | + > |
| 65 | + <t t-call="website_sale.base_unit_price"> |
| 66 | + <t |
| 67 | + t-set="base_unit_price" |
| 68 | + t-value="combination_info['base_unit_price']" |
| 69 | + /> |
| 70 | + </t> |
| 71 | + </div> |
| 72 | + </xpath> |
| 73 | + </template> |
| 74 | + <template |
| 75 | + id="cta_wrapper_boxed_base_unit_price" |
| 76 | + inherit_id="website_sale.cta_wrapper_boxed" |
| 77 | + name="CTA boxed: base unit only product price" |
| 78 | + > |
| 79 | + <!-- The CTA boxed template inserts ``website_sale.product_price`` in its own block. |
| 80 | + Hide it when base_unit_price exists. |
| 81 | + --> |
| 82 | + <t t-call="website_sale.product_price" position="attributes"> |
| 83 | + <attribute |
| 84 | + name="t-if" |
| 85 | + >not combination_info.get('base_unit_price')</attribute> |
| 86 | + </t> |
| 87 | + |
| 88 | + <!-- Add ``website_sale.base_unit_price`` after ``website_sale.product_price`` --> |
| 89 | + <t t-call="website_sale.product_price" position="after"> |
| 90 | + <t t-if="combination_info.get('base_unit_price')"> |
| 91 | + <span class="oe_price"> |
| 92 | + <t t-call="website_sale.base_unit_price"> |
| 93 | + <t |
| 94 | + t-set="base_unit_price" |
| 95 | + t-value="combination_info['base_unit_price']" |
| 96 | + /> |
| 97 | + </t> |
| 98 | + </span> |
| 99 | + </t> |
| 100 | + </t> |
| 101 | + </template> |
14 | 102 | </odoo> |
0 commit comments