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

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
3417
1
11月 22
3280
2
3月 15
4040
2
8月 25
228
1
12月 23
2939