跳至内容
菜单
此问题已终结
1 回复
3770 查看

I sell products to Consumers, Retailers and Distributors

Consumers can buy a SINGLE item (an EACH).

Retailers cannot buy an EACH, they must buy a PACK.

Distributors cannot buy an EACH or a PACK, they must buy a CASE.

I have Pricelists setup and have assigned them to Customers so they see the correct pricelist when they shop, but Consumers can still see PACK and CASE.  Retailers can still see EACH and CASE.  Distributors can still see EACH and PACK.

I want each Customer type to only see the products on their pricelist.  (I have set the price to negative $1 for any product that they are not allowed to buy).

形象
丢弃
最佳答案

Make a custom view that overrides how the default view works:

Thee lines in BOLD UNDERLINE are what were added, these are the magic pieces!


<td t-att-colspan="td_product['x'] != 1 and td_product['x']" position="replace">
<t t-set="combination_info" t-value="product._get_combination_info(only_template=True, add_qty=add_qty or 1, pricelist=pricelist)"/>
<t t-if="combination_info['price'] and combination_info['price'] > 0">
<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 #{td_product['class']}">
<div t-attf-class="o_wsale_product_grid_wrapper o_wsale_product_grid_wrapper_#{td_product['x']}_#{td_product['y']}">
<t t-call="website_sale.products_item">
<t t-set="product_image_big" t-value="td_product['x'] + td_product['y'] &gt; 2"/>
</t>
</div>
</td>
</t>
</td>


Then you get this:






形象
丢弃