odoo - How to show only those products on Website which have Quantity in Hand in Odoo 10?
问题描述
I am new to Odoo. I want to show only those products on E-commerce Website which have quantity in hand greater than 0. I am using Odoo 10.
How can I do this?
My code is:
<div class="row">
<div class="hidden" id="products_grid_before"/>
<div class="col-md-12 col-xs-6" id="products_grid">
<table width="100%">
<tbody>
<tr t-ignore="true">
<td t-foreach="range(0,rows)" t-as="row" t-attf-width="#{100/rows}%"/>
</tr>
<tr t-foreach="bins" t-as="tr_product">
<t t-foreach="tr_product" t-as="td_product">
<t t-if="td_product">
<t t-set="product" t-value="td_product['product']"/>
<td t-att-colspan="td_product['x'] != 1 and td_product['x']" t-att-rowspan="td_product['y'] != 1 and td_product['y']" t-attf-class="oe_product oe_grid oe-height-#{td_product['y']*2} #{ td_product['class'] }">
<div class="oe_product_cart" t-att-data-publish="product.website_published and 'on' or 'off'">
<t t-set="product_image_big" t-value="td_product['x']+td_product['y'] > 2"/>
<t t-call="website_sale.products_item"/>
<t t-cell="website_sale.products_item"/>
</div>
</td>
</t>
<td t-if="not td_product" class="oe-height-2"/>
</t>
</tr>
</tbody>
</table>
<t t-if="not bins">
<div class="text-center text-muted oe_product">
<h3 class="css_editable_display">No product defined.</h3>
<p groups="sales_team.group_sale_manager">Click
<i>'New'</i> in the top-right corner to create your first product.
</p>
</div>
</t>
</div>
</div>
<div class="products_pager">
<t t-call="website.pager"/>
</div>
</div>
解决方案
只需在您展示产品的位置添加以下代码。
<t t-if="td_product.qty_available >= 0">
executable statement..
</t>
推荐阅读
- java - 如何在对象的数组属性中添加 Rest 验证?
- jquery - 使用 jquery 添加、删除或编辑后数据表未更新
- leaflet - 如何将 GeoMet WMS 与传单一起使用
- python-3.x - 如何修复“ImportError:无法导入名称'_win32stdio'”?遇到障碍的典型解决方案
- c# - 如何使用 Task.WaitAny() 确定哪些任务首先完成?
- laravel - 如何删除 2 个数组 Laravel 之间的重复值?
- python - 如何在 Single Flask App 中使用 Plotly-Dash 创建多个仪表板?
- numpy - 外积所有维度上的 Numpy 总和
- r - 从字符串格式 "c(\"4\", \"5\", \"7\", \"8\", \"9\", \"10\")" 转换为字符
- javascript - 无法获得输出.. 函数中给出的参数未读取