pos_ojol_discount_amount/models/product_template.py
2026-05-22 22:10:58 +07:00

16 lines
616 B
Python

# -*- coding: utf-8 -*-
from odoo import api, models
from odoo.fields import Domain
class ProductTemplate(models.Model):
_inherit = 'product.template'
@api.model
def _load_pos_data_domain(self, data, config):
domain = super()._load_pos_data_domain(data, config)
if config.ojol_discount_product_id:
# Ensure the discount product's template is loaded regardless of other domain constraints
discount_tmpl_domain = [('id', '=', config.ojol_discount_product_id.product_tmpl_id.id)]
domain = Domain.OR([domain, discount_tmpl_domain])
return domain