Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
1638 Tampilan

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

Avatar
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Apr 24
3427
1
Nov 22
3343
2
Mar 15
4052
2
Agu 25
283
1
Des 23
2973