Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
1651 Переглядів

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
квіт. 24
3451
1
лист. 22
3735
2
бер. 15
4084
2
серп. 25
295
1
груд. 23
3003