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

[16.0][FIX] l10n_es_aeat_mod303: Avoid negatives in fee to compensate #4048

Merged
Show file tree
Hide file tree
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
18 changes: 5 additions & 13 deletions l10n_es_aeat_mod303/models/mod303.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,18 +519,11 @@
- fields.Date.to_date(mod303.date_start)
),
)
if prev_report and (
prev_report.remaining_cuota_compensar > 0
or prev_report.result_type == "C"
):
mod303.write(
{
"potential_cuota_compensar": (
prev_report.remaining_cuota_compensar
- prev_report.resultado_liquidacion
),
}
)
if prev_report.remaining_cuota_compensar > 0:
amount = prev_report.remaining_cuota_compensar
if prev_report.result_type == "C":
amount -= prev_report.resultado_liquidacion

Check warning on line 525 in l10n_es_aeat_mod303/models/mod303.py

View check run for this annotation

Codecov / codecov/patch

l10n_es_aeat_mod303/models/mod303.py#L525

Added line #L525 was not covered by tests
mod303.potential_cuota_compensar = amount if amount > 0 else 0
if mod303.return_last_period:
cuota_compensar = mod303.potential_cuota_compensar
elif (
Expand All @@ -547,7 +540,6 @@
else:
cuota_compensar = 0
mod303.cuota_compensar = cuota_compensar

return res

def button_confirm(self):
Expand Down
2 changes: 2 additions & 0 deletions l10n_es_aeat_mod303/tests/test_l10n_es_aeat_mod303.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,8 @@ def test_model_303_partial_compensation(self):
}
)
model303_3T.button_calculate()
model303_3T.potential_cuota_compensar = 819
model303_3T.cuota_compensar = 609
model303_3T.button_confirm()
model303_3T.button_post()
# Check move lines from 303 3T 2015
Expand Down
2 changes: 2 additions & 0 deletions l10n_es_aeat_mod390/tests/test_l10n_es_aeat_mod390.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ def test_model_390_using_303_02(self):

model303_4T.return_last_period = True
model303_4T.button_calculate()
model303_4T.potential_cuota_compensar = 674.48
model303_4T.cuota_compensar = 674.48
self.model390_2018.button_calculate()
# Check casilla_85, casilla_95, casilla_97, casilla_98, casilla_662
self.assertAlmostEqual(self.model390_2018.casilla_85, 0.0, 2)
Expand Down