Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
1541 Weergaven

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

Avatar
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
apr. 24
3341
1
nov. 22
2693
2
mrt. 15
3979
1
dec. 23
2835
1
nov. 23
2101