Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tryton
Tryton
Commits
f907ad193307
Commit
f907ad19
authored
Jan 11, 2023
by
Maxime Richez
Browse files
Add more details in tariff code list on product form
Closes
#11888
parent
d5a5f27fad76
Pipeline
#61489
passed with stages
in 16 minutes and 59 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
modules/customs/CHANGELOG
View file @
f907ad19
* Show tariff code criteria on product form
* Support country organization for tariff code and duty rate
* Use ir.calendar.month for tariff code months
...
...
modules/customs/product.py
View file @
f907ad19
...
...
@@ -182,6 +182,30 @@
],
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
...
...
modules/customs/view/product-tariff_code_list.xml
View file @
f907ad19
...
...
@@ -4,4 +4,10 @@
<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>
modules/customs/view/product-tariff_code_list_sequence.xml
View file @
f907ad19
...
...
@@ -4,4 +4,10 @@
<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>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment