Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
1609 Vues

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

Avatar
Ignorer
Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
1
avr. 24
3380
1
nov. 22
3228
2
mars 15
4026
2
août 25
182
1
déc. 23
2900