Skip to content

Commit a06f166

Browse files
committed
[IMP] intrastat_product: Change Float fields (total_amount + amount_company_currency + amount_accessory_cost_company_currency) to Monetary
Related to #335 (comment) TT61473
1 parent 9744c71 commit a06f166

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

intrastat_product/models/intrastat_product_declaration.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,9 @@ def default_get(self, fields_list):
133133
store=True,
134134
tracking=True,
135135
)
136-
total_amount = fields.Float(
136+
total_amount = fields.Monetary(
137137
compute="_compute_numbers",
138138
string="Total Fiscal Amount",
139-
digits="Account",
140139
store=True,
141140
help="Total fiscal amount in company currency of the declaration.",
142141
)
@@ -1104,17 +1103,17 @@ class IntrastatProductComputationLine(models.Model):
11041103
digits="Product Unit of Measure",
11051104
help="Supplementary Units Quantity",
11061105
)
1107-
amount_company_currency = fields.Float(
1106+
amount_company_currency = fields.Monetary(
11081107
string="Fiscal Value",
1109-
digits="Account",
1108+
currency_field="company_currency_id",
11101109
required=True,
11111110
help="Amount in company currency to write in the declaration. "
11121111
"Amount in company currency = amount in invoice currency "
11131112
"converted to company currency with the rate of the invoice date.",
11141113
)
1115-
amount_accessory_cost_company_currency = fields.Float(
1114+
amount_accessory_cost_company_currency = fields.Monetary(
11161115
string="Accessory Costs",
1117-
digits="Account",
1116+
currency_field="company_currency_id",
11181117
help="Amount in company currency of the accessory costs related to "
11191118
"this invoice line. By default, these accessory costs are computed "
11201119
"at the pro-rata of the amount of each invoice line.",
@@ -1309,9 +1308,9 @@ class IntrastatProductDeclarationLine(models.Model):
13091308
suppl_unit_qty = fields.Integer(
13101309
string="Suppl. Unit Qty", help="Supplementary Units Quantity"
13111310
)
1312-
amount_company_currency = fields.Float(
1311+
amount_company_currency = fields.Monetary(
13131312
string="Fiscal Value",
1314-
digits="Account",
1313+
currency_field="company_currency_id",
13151314
help="Amount in company currency to write in the declaration. "
13161315
"Amount in company currency = amount in invoice currency "
13171316
"converted to company currency with the rate of the invoice date.",

intrastat_product/views/intrastat_product_declaration.xml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,7 @@
7373
<group name="properties-2">
7474
<field name="action" readonly="state == 'done'" />
7575
<field name="revision" readonly="state == 'done'" />
76-
<field
77-
name="total_amount"
78-
widget="monetary"
79-
options="{'currency_field': 'currency_id'}"
80-
/>
76+
<field name="total_amount" />
8177
<field name="num_decl_lines" />
8278
<field
8379
name="company_id"
@@ -245,16 +241,8 @@
245241
required="reporting_level == 'extended'"
246242
invisible="reporting_level != 'extended'"
247243
/>
248-
<field
249-
name="amount_company_currency"
250-
widget="monetary"
251-
options="{'currency_field': 'company_currency_id'}"
252-
/>
253-
<field
254-
name="amount_accessory_cost_company_currency"
255-
widget="monetary"
256-
options="{'currency_field': 'company_currency_id'}"
257-
/>
244+
<field name="amount_company_currency" />
245+
<field name="amount_accessory_cost_company_currency" />
258246
<field name="company_currency_id" invisible="1" />
259247
<field name="transaction_id" required="1" />
260248
<label
@@ -414,11 +402,7 @@
414402
name="src_dest_country_code"
415403
invisible="reporting_level != 'extended'"
416404
/>
417-
<field
418-
name="amount_company_currency"
419-
widget="monetary"
420-
options="{'currency_field': 'company_currency_id'}"
421-
/>
405+
<field name="amount_company_currency" />
422406
<field name="company_currency_id" invisible="1" />
423407
<field name="transaction_id" />
424408
<label for="weight" invisible="reporting_level != 'extended'" />

0 commit comments

Comments
 (0)