跳至內容
選單
此問題已被標幟
2 回覆
1587 瀏覽次數

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
3364
1
11月 22
3025
2
3月 15
4004
1
8月 25
50
1
12月 23
2879