diff --git a/modules/customs/CHANGELOG b/modules/customs/CHANGELOG index 93744c1c69..73ee7d3a16 100644 --- a/modules/customs/CHANGELOG +++ b/modules/customs/CHANGELOG @@ -1,3 +1,4 @@ +* Show tariff code criteria on product form * Support country organization for tariff code and duty rate * Use ir.calendar.month for tariff code months diff --git a/modules/customs/product.py b/modules/customs/product.py index bd91fb4e04..5396ead115 100644 --- a/modules/customs/product.py +++ b/modules/customs/product.py @@ -182,6 +182,30 @@ class Product_TariffCode(sequence_ordered(), ModelSQL, ModelView): ], required=True) tariff_code = fields.Many2One('customs.tariff.code', 'Tariff Code', required=True, ondelete='CASCADE') + country = fields.Function( + fields.Many2One('country.country', "Country"), 'get_tariff_code_field') + organization = fields.Function( + fields.Many2One('country.organization', "Organization"), + 'get_tariff_code_field') + start_day = fields.Function( + fields.Integer("Start Day"), 'get_tariff_code_field') + start_month = fields.Function( + fields.Many2One('ir.calendar.month', "Start Month"), + 'get_tariff_code_field') + end_day = fields.Function( + fields.Integer("End Day"), 'get_tariff_code_field') + end_month = fields.Function( + fields.Many2One('ir.calendar.month', "End Month"), + 'get_tariff_code_field') + + def get_tariff_code_field(self, name): + field = getattr(self.__class__, name) + value = getattr(self.tariff_code, name, None) + if isinstance(value, ModelSQL): + if field._type == 'reference': + return str(value) + return value.id + return value def get_rec_name(self, name): return self.tariff_code.rec_name diff --git a/modules/customs/view/product-tariff_code_list.xml b/modules/customs/view/product-tariff_code_list.xml index 65185423fc..90d99dde54 100644 --- a/modules/customs/view/product-tariff_code_list.xml +++ b/modules/customs/view/product-tariff_code_list.xml @@ -4,4 +4,10 @@ this repository contains the full copyright notices and license terms. --> + + + + + + diff --git a/modules/customs/view/product-tariff_code_list_sequence.xml b/modules/customs/view/product-tariff_code_list_sequence.xml index 5ef353c129..b43d6c7234 100644 --- a/modules/customs/view/product-tariff_code_list_sequence.xml +++ b/modules/customs/view/product-tariff_code_list_sequence.xml @@ -4,4 +4,10 @@ this repository contains the full copyright notices and license terms. --> + + + + + +