Display products used by customs category

Closes #14770
This commit is contained in:
Maxime Richez committed 2026-05-07 11:19:56 +02:00
1 parent 30a52dd460
commit ee4bdd08bb
2 files changed
+30

No files matched your search

+28
View File
@@ -1,5 +1,7 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from sql import Null
from trytond.model import ModelSQL, ModelView, fields, sequence_ordered
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Bool, Eval, Or
@@ -160,6 +162,32 @@ class Template(metaclass=PoolMeta):
return callback
class TemplateCustomsCategory(ModelSQL):
__name__ = 'product.template-product.category.customs'
template = fields.Many2One('product.template', 'Template')
category = fields.Many2One('product.category', 'Category')
@classmethod
def table_query(cls):
pool = Pool()
Template = pool.get('product.template')
template = Template.__table__()
return template.select(
template.id.as_('id'),
template.id.as_('template'),
template.customs_category.as_('category'),
where=template.customs_category != Null)
class TemplateCategoryAll(metaclass=PoolMeta):
__name__ = 'product.template-product.category.all'
@classmethod
def union_models(cls):
return super().union_models() + [
'product.template-product.category.customs']
class Product_TariffCode(sequence_ordered(), ModelSQL, ModelView):
__name__ = 'product-customs.tariff.code'
product = fields.Reference('Product', selection=[
+2
View File
@@ -20,5 +20,7 @@ model:
customs.AgentSelection
product.Category
product.Template
product.TemplateCustomsCategory
product.TemplateCategoryAll
product.Product_TariffCode
product.Product