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

is it possible to hide out-of-stock items/variants on website?

形象
丢弃
最佳答案

Hi,

Inherit the WebsiteSale controller

Create a custom module or add this to an existing one:

from odoo.addons.website_sale.controllers.main import WebsiteSale

from odoo.http import request


class WebsiteSaleCustom(WebsiteSale):


    def _get_search_domain(self, search, category, attrib_values, **kwargs):

        domain = super()._get_search_domain(search, category, attrib_values, **kwargs)

        domain += [('qty_available', '>', 0)]

        return domain


You can also use 'virtual_available' instead of 'qty_available' if you want to account for incoming stock.


ihope it is use full

形象
丢弃
相关帖文 回复 查看 活动
1
4月 24
3336
1
11月 22
2643
2
3月 15
3978
1
12月 23
2831
1
11月 23
2092