[WIP] nfu_ecommerce/controllers: add open qty ribbon
This commit is contained in:
parent
1a77c5ed98
commit
9f35fc87e9
2 changed files with 21 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ class WebsiteSale(WebsiteSale):
|
||||||
packaging_info[product.id] = {
|
packaging_info[product.id] = {
|
||||||
"state": batch_product.open_packaging_state,
|
"state": batch_product.open_packaging_state,
|
||||||
"open_qty": batch_product.open_packaging_qty,
|
"open_qty": batch_product.open_packaging_qty,
|
||||||
|
"open_max_qty": batch_product.open_packaging_max_qty,
|
||||||
"package_qty": batch_product.product_packaging_qty,
|
"package_qty": batch_product.product_packaging_qty,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,32 @@
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template id="products" inherit_id="website_sale.products">
|
||||||
|
<xpath expr="//div[contains(@t-attf-class, 'o_wsale_product_grid_wrapper')]" position="attributes">
|
||||||
|
<attribute name="t-attf-class" add="overflow-hidden" separator=" "/>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template
|
<template
|
||||||
id="ecom_show_extra_fields_products_item"
|
id="ecom_show_extra_fields_products_item"
|
||||||
inherit_id="website_sale.products_item"
|
inherit_id="website_sale.products_item"
|
||||||
active="True"
|
active="True"
|
||||||
name="Show Extra Fields"
|
name="Show Extra Fields"
|
||||||
>
|
>
|
||||||
|
<xpath expr="//div[hasclass('oe_product_image')]" position="before">
|
||||||
|
<t t-set="template_packaging_vals" t-value="get_product_packagings(product)"/>
|
||||||
|
<t t-if="template_packaging_vals">
|
||||||
|
<t
|
||||||
|
t-set="packaging_ribbon_color"
|
||||||
|
t-value="'green' if template_packaging_vals['state'] == 'full'
|
||||||
|
else 'red'"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
t-attf-class="o_ribbon o_not_editable o_ribbon_right"
|
||||||
|
t-att-style="'color: white; background-color: %s;' % packaging_ribbon_color"
|
||||||
|
>+5/+3</span>
|
||||||
|
</t>
|
||||||
|
</xpath>
|
||||||
<xpath expr="//div[hasclass('o_wsale_product_information_text')]" position="after">
|
<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])">
|
<t t-if="any([product[field.name] for field in website.shop_extra_field_ids])">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
|
|
@ -51,7 +71,6 @@
|
||||||
</t>
|
</t>
|
||||||
<br/>
|
<br/>
|
||||||
</t>
|
</t>
|
||||||
<t t-set="template_packaging_vals" t-value="get_product_packagings(product)"/>
|
|
||||||
<t t-if="template_packaging_vals">
|
<t t-if="template_packaging_vals">
|
||||||
<b>Open Qty: </b><span t-esc="template_packaging_vals['open_qty']"/>/<span
|
<b>Open Qty: </b><span t-esc="template_packaging_vals['open_qty']"/>/<span
|
||||||
t-esc="template_packaging_vals['package_qty']"
|
t-esc="template_packaging_vals['package_qty']"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue