diff --git a/l10n_it_intrastat_statement/models/intrastat_statement_purchase_section.py b/l10n_it_intrastat_statement/models/intrastat_statement_purchase_section.py index cf21a693c5b3..05c66c294aee 100644 --- a/l10n_it_intrastat_statement/models/intrastat_statement_purchase_section.py +++ b/l10n_it_intrastat_statement/models/intrastat_statement_purchase_section.py @@ -148,10 +148,13 @@ def _prepare_statement_line(self, inv_intra_line, statement_id=None): statement_id.company_id or company_id, dp_model.precision_get('Account')) + # check if additional_units has a value + has_additional_units = bool(inv_intra_line.additional_units) res.update({ 'transaction_nature_id': transaction_nature_id.id, 'weight_kg': round(inv_intra_line.weight_kg) or 1, - 'additional_units': round(inv_intra_line.additional_units) or 1, + 'additional_units': round(inv_intra_line.additional_units) or ( + 0 if not has_additional_units else 1), 'statistic_amount_euro': statistic_amount, 'delivery_code_id': delivery_code_id.id, 'transport_code_id': transport_code_id.id, diff --git a/l10n_it_intrastat_statement/models/intrastat_statement_sale_section.py b/l10n_it_intrastat_statement/models/intrastat_statement_sale_section.py index 6fc2eec9a7af..0eab98d39987 100644 --- a/l10n_it_intrastat_statement/models/intrastat_statement_sale_section.py +++ b/l10n_it_intrastat_statement/models/intrastat_statement_sale_section.py @@ -112,10 +112,13 @@ def _prepare_statement_line(self, inv_intra_line, statement_id=None): statement_id.company_id or company_id, dp_model.precision_get('Account')) + # check if additional_units has a value + has_additional_units = bool(inv_intra_line.additional_units) res.update({ 'transaction_nature_id': transaction_nature_id.id, 'weight_kg': round(inv_intra_line.weight_kg) or 1, - 'additional_units': round(inv_intra_line.additional_units) or 1, + 'additional_units': round(inv_intra_line.additional_units) or ( + 0 if not has_additional_units else 1), 'statistic_amount_euro': statistic_amount, 'delivery_code_id': delivery_code_id.id, 'transport_code_id': transport_code_id.id,