nfu/nfu_ecommerce/models/product_template.py
2024-10-04 18:04:06 +02:00

21 lines
696 B
Python

from odoo import models
class ProductTemplate(models.Model):
_inherit = "product.template"
def action_publish_on_website(self):
for product in self:
product.is_published = True
def action_unpublish_on_website(self):
for product in self:
product.is_published = False
def _search_get_detail(self, website, order, options):
search_details = super()._search_get_detail(website, order, options)
open_product_ids = options.get("open_product_ids")
domain = search_details["base_domain"]
if len(open_product_ids):
domain.append([("id", "in", tuple(open_product_ids))])
return search_details