19 lines
683 B
Python
19 lines
683 B
Python
from odoo import models, fields, api
|
|
from odoo.http import request
|
|
from odoo.osv import expression
|
|
|
|
|
|
class Website(models.Model):
|
|
_inherit = 'website'
|
|
|
|
def sale_product_domain(self):
|
|
domain = super().sale_product_domain()
|
|
if '/shop' in request.httprequest.full_path:
|
|
domain = expression.AND([domain, [('hide_from_shop_front', '=', False)]])
|
|
if '/campaigns' in request.httprequest.full_path:
|
|
products = request.env['donation.request'].search([('stage_type', '=', 'approve'), ('show_in_most_active_page', '=', True)]).product_id
|
|
domain = expression.AND([domain, [('id', 'in', products.ids)]])
|
|
|
|
return domain
|
|
|