@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,4 +4,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="product" expand="2"/>
|
||||
<field name="tariff_code" expand="1"/>
|
||||
<field name="organization" optional="0"/>
|
||||
<field name="country" optional="0"/>
|
||||
<field name="start_day" optional="1"/>
|
||||
<field name="start_month" optional="1"/>
|
||||
<field name="end_day" optional="1"/>
|
||||
<field name="end_month" optional="1"/>
|
||||
</tree>
|
||||
|
||||
@@ -4,4 +4,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<tree sequence="sequence">
|
||||
<field name="product" expand="2"/>
|
||||
<field name="tariff_code" expand="1"/>
|
||||
<field name="organization" optional="0"/>
|
||||
<field name="country" optional="0"/>
|
||||
<field name="start_day" optional="1"/>
|
||||
<field name="start_month" optional="1"/>
|
||||
<field name="end_day" optional="1"/>
|
||||
<field name="end_month" optional="1"/>
|
||||
</tree>
|
||||
|
||||
Reference in New Issue
Block a user