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

Conversation

LorenzoC0
Copy link
Contributor

Risolve #4360

… if a reversed entry is not in the same period of the line
Copy link

@MaurizioPellegrinet MaurizioPellegrinet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test funzionale: OK

@sergiocorato
Copy link
Contributor

@LorenzoC0 Puoi cortesemente aggiungere sui test come descritto nella issue?

Copy link
Contributor

@SirAionTech SirAionTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grazie della PR!
Puoi correggere il titolo del commit? C'è un 1 di troppo:

[FIX] 1l10n_it_intrastat_statement: Fixed grouping of intrastat lines if a reversed entry is not in the same period of the line

Potresti anche aggiungere un test? Così si evitano regressioni

Comment on lines +829 to +830
line.invoice_id.reversed_entry_id.date < period_date_start
or line.invoice_id.reversed_entry_id.date > period_date_stop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questi stessi campi vengono usati qualche riga sopra per filtrare il campo invoice_date, come mai qui invece viene usato date?

Comment on lines +826 to +833
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quindi la riga line viene segnata come rimborso solo quando la sua fattura ha un rimborso con data inclusa nel periodo, giusto?
Potresti modificarlo come suggerito qui sotto?

Suggested change
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)
refund_date = line.invoice_id.reversed_entry_id.date
if refund_date and period_date_start <= refund_date <= period_date_stop:
self.refund_line(line, to_refund_model)

Credo sia un po' più leggibile.

Inoltre, non serve anche che il rimborso sia intrastat?
Forse si potrebbe cercare se il rimborso è tra le fatture delle righe che sono già state incluse nella dichiarazione qualche riga sopra, cosa ne dici? Così non serve rifare questi controlli sulle date.

Comment on lines +813 to +814
period_date_start = fields.Date.to_date(period_date_start)
period_date_stop = fields.Date.to_date(period_date_stop)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

period_date_start/stop sono già delle date perché vengono da

period_date_start = date(year, 1, 1)
period_date_stop = date(year, 12, 31)
if self.period_type == "M":
month = self.period_number
period_date_start = date(year, month, 1)
period_date_stop = (
datetime(year, month, 1) + relativedelta(months=1) - timedelta(days=1)
)
elif self.period_type == "T":
quarter = self.period_number
month_start = int(12 / 4 * (quarter - 1) + 1)
period_date_start = date(year, month_start, 1)
period_date_stop = (
period_date_start + relativedelta(months=3) - timedelta(days=1)
)
return period_date_start, period_date_stop

come mai serve questa conversione?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants