Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 1l10n_it_intrastat_statement: Fixed grouping of intrastat lines of reversed entries #4361

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion l10n_it_intrastat_statement/models/intrastat_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,10 @@ def compute_statement(self):
(2, 1), # Sale (Purchase) section 2 refunds section 1
(4, 3), # Sale (Purchase) section 4 refunds section 3
]

period_date_start = fields.Date.to_date(period_date_start)
period_date_stop = fields.Date.to_date(period_date_stop)

for section_type in ["purchase", "sale"]:
for section_number, refund_section_number in refund_map:
section_details = (section_type, section_number)
Expand All @@ -819,7 +823,14 @@ def compute_statement(self):
*refund_section_details
)
to_refund_model = self.env[refund_section_model]
self.refund_line(line, to_refund_model)
if not (
line.invoice_id.reversed_entry_id
and (
line.invoice_id.reversed_entry_id.date < period_date_start
or line.invoice_id.reversed_entry_id.date > period_date_stop
)
):
self.refund_line(line, to_refund_model)
return True

@staticmethod
Expand Down
Loading