nfu/nfu_ecommerce/views/templates.xml

229 lines
11 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="products_open_packaging" inherit_id="website_sale.products">
<xpath expr="//aside[@id='products_grid_before']/div[1]/div[1]" position="before">
<a t-att-href="keep('/shop',open_packagings = False if open_packagings else True)">
<h6 t-attf-class="o_packaging_collapse_title mb-3 {{_titleClasses}}"><b>
<span t-if="open_packagings">All Products</span>
<span t-else="">Open Packagings</span>
</b></h6>
</a>
</xpath>
</template>
<template id="o_wsale_offcanvas" name="Open Packagings" inherit_id="website_sale.o_wsale_offcanvas">
<xpath expr="//div[@id='o_wsale_offcanvas_content']/div[1]" position="before">
<div class="position-relative o_wsale_offcanvas_title px-4 border-top">
<a t-att-href="keep('/shop',open_packagings = False if open_packagings else True)">
<h6 t-attf-class="o_packaging_collapse_title mb-3 pt-3 {{_titleClasses}}"><b>
<span t-if="open_packagings">All Products</span>
<span t-else="">Open Packagings</span>
</b></h6>
</a>
</div>
</xpath>
</template>
<template
id="ecom_show_extra_fields_products_item"
inherit_id="website_sale.products_item"
active="True"
name="Show Extra Fields"
>
<xpath expr="//div[hasclass('o_wsale_product_information_text')]" position="after">
<t t-if="any([product[field.name] for field in website.shop_extra_field_ids])">
<p class="text-muted">
<t t-foreach='website.shop_extra_field_ids' t-as='field' t-if='product[field.name]'>
<b><t t-esc='field.label'/>: </b>
<t t-if='field.field_id.ttype != "binary"'>
<span t-esc='product[field.name]' t-options="{'widget': field.field_id.ttype}"/>
</t>
<t t-else=''>
<a
target='_blank'
t-attf-href='/web/content/product.template/#{product.id}/#{field.name}?download=1'
>
<i class='fa fa-file'/>
</a>
</t>
<br/>
</t>
<t t-set="template_packaging_vals" t-value="get_product_packagings(product)"/>
<t t-if="template_packaging_vals">
<b>Open Qty: </b><span t-esc="template_packaging_vals['open_qty']"/>/<span
t-esc="template_packaging_vals['package_qty']"
/><br/>
<t t-if="template_packaging_vals['state']">
<b>State: </b><span t-esc="template_packaging_vals['state']"/>
<br/>
</t>
</t>
</p>
</t>
</xpath>
</template>
<template id="product_packagings" inherit_id="website_sale.product">
<xpath expr="//p[@t-field='product.description_sale']" position="after">
<div t-if="packaging_info">
<b>Open Qty: </b><span t-esc="packaging_info['open_qty']"/>/<span
t-esc="packaging_info['package_qty']"
/>
<br/>
<t t-if="packaging_info['state']">
<b>State: </b><span t-esc="packaging_info['state']"/>
<br/>
</t>
</div>
</xpath>
</template>
<template id="cart_lines_packaging" inherit_id="website_sale.cart_lines" name="Shopping Cart Lines">
<xpath expr="//td[hasclass('td-product_name')]" position="inside">
<div t-if="line.product_packaging_id and (line.product_packaging_id.qty != 1)">
<span t-if="line.open_qty > 0">Open Package: <t t-esc="line.open_qty"/>/<t
t-esc="line.product_packaging_id.qty"
/>
</span>
<span t-else="">No open package available</span>
<br/>
<span>Max Ordered Quantity: <span
t-esc="line.batch_uom_max_qty"
t-attf-class="#{'text-danger' if line.batch_uom_max_qty &lt; line.product_packaging_id.qty else ''}"
/></span>
</div>
</xpath>
<xpath expr="//th[hasclass('td-qty')]" position="after">
<th class="text-center td-qty">
<t t-if="show_qty">
<span>Max Qty</span>
</t>
</th>
</xpath>
<xpath expr="//td[hasclass('td-qty')]" position="after">
<td class="text-center td-qty">
<div class="css_quantity input-group mx-auto justify-content-center">
<t t-if="not line._is_not_sellable_line()">
<t t-if="show_qty">
<a
t-attf-href="#"
class="btn btn-link js_add_cart_json d-none d-md-inline-block"
aria-label="Remove one"
title="Remove one"
>
<i class="fa fa-minus"/>
</a>
<input
type="text"
name="max-qty"
class="js_quantity form-control quantity"
t-att-data-line-id="line.id"
t-att-data-product-id="line.product_id.id"
t-att-value="line.product_uom_max_qty and line.product_uom_max_qty or line.product_uom_qty"
t-att-data-min="line.product_uom_qty"
/>
<t t-if="line._get_shop_warning(clear=False)">
<a t-attf-href="#" class="btn btn-link">
<i
class='fa fa-warning text-warning'
t-att-title="line._get_shop_warning()"
role="img"
aria-label="Warning"
/>
</a>
</t>
<a
t-else=''
t-attf-href="#"
class="btn btn-link float_left js_add_cart_json d-none d-md-inline-block"
aria-label="Add one"
title="Add one"
>
<i class="fa fa-plus"/>
</a>
</t>
<t t-else="">
<input
type="hidden"
class="js_quantity form-control quantity"
t-att-data-line-id="line.id"
t-att-data-product-id="line.product_id.id"
t-att-value="line.product_uom_qty == line.product_uom_qty and line.product_uom_qty or line.product_uom_qty"
/>
</t>
</t>
<t t-else="">
<span class="text-muted w-100" t-esc="line.product_uom_qty"/>
<input
type="hidden"
class="js_quantity form-control quantity"
t-att-data-line-id="line.id"
t-att-data-product-id="line.product_id.id"
t-att-value="line.product_uom_qty"
/>
</t>
</div>
</td>
</xpath>
</template>
<template id="cart_summary_packaging" inherit_id="website_sale.cart_summary" name="Cart right column">
<xpath expr="//td[hasclass('td-product_name')]" position="inside">
<div t-if="line.product_packaging_id and (line.product_packaging_id.qty != 1)">
<span>Open Package: <t t-esc="line.compute_open_packages()"/>/<t t-esc="line.product_packaging_id.qty"/>
</span><br/>
<span>Max Ordered Quantity: <span
t-esc="line.batch_uom_max_qty"
t-attf-class="#{'text-danger' if line.batch_uom_max_qty &lt; line.product_packaging_id.qty else ''}"
/></span>
</div>
</xpath>
<xpath expr="//th[hasclass('td-qty')]" position="after">
<th class="border-top-0 td-qty">Max Qty</th>
</xpath>
<xpath expr="//td[hasclass('td-qty')]" position="after">
<td class='td-qty'>
<div t-esc="line.product_uom_max_qty"/>
</td>
</xpath>
</template>
<template id="total" inherit_id="website_sale.total">
<xpath expr="//tr[@id='empty']" position="after">
<tr id="balance">
<td class="text-end border-0">Balance:</td>
<td class="text-xl-end border-0">
<span
t-field="website_sale_order.balance"
class="monetary_field"
style="white-space: nowrap;"
t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"
/>
</td>
</tr>
</xpath>
<xpath expr="//tr[@id='order_total']" position="after">
<tr id="updated_balance">
<td class="text-end border-0">New balance:</td>
<td class="text-xl-end border-0">
<t t-if="website_sale_order.updated_balance &lt; 0">
<span
t-field="website_sale_order.updated_balance"
class="monetary_field text-danger"
style="white-space: nowrap;"
t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"
/>
</t>
<t t-else="">
<span
t-field="website_sale_order.updated_balance"
t-att-class="monetary_field"
style="white-space: nowrap;"
t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"
/>
</t>
</td>
</tr>
</xpath>
</template>
</odoo>