Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
1436 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
dub 24
3284
1
lis 22
2152
2
bře 15
3929
1
pro 23
2770
1
lis 23
2026