Skip to content

Commit

Permalink
l10n_fr_das2: move declaration threshold to pyfrdas2
Browse files Browse the repository at this point in the history
Move the partner declaration threashold to the pyfrdas2 lib. This
configuration parameter should never be changed by the use anyway. With
the encryption that change every year, we will release every year a new
lib, so we can change the result of get_partner_declaration_threshold()
if the tax administration changes the amount.
  • Loading branch information
alexis-via committed Jun 6, 2024
1 parent 0e589ce commit 41ad0b1
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 79 deletions.
1 change: 0 additions & 1 deletion l10n_fr_das2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from . import models
from . import wizards
3 changes: 1 addition & 2 deletions l10n_fr_das2/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
"l10n_fr_cog",
],
"external_dependencies": {
"python": ["stdnum", "pyfrdas2"],
"python": ["stdnum", "pyfrdas2>=0.4"],
},
"data": [
"security/das2_security.xml",
"security/ir.model.access.csv",
"views/l10n_fr_das2.xml",
"views/res_partner.xml",
"views/res_config_settings.xml",
],
"demo": ["demo/demo.xml"],
"installable": True,
Expand Down
1 change: 0 additions & 1 deletion l10n_fr_das2/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from . import l10n_fr_das2
from . import res_partner
from . import res_company
18 changes: 8 additions & 10 deletions l10n_fr_das2/models/l10n_fr_das2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from datetime import datetime

from markupsafe import Markup
from pyfrdas2 import format_street_block, generate_file
from pyfrdas2 import (
format_street_block,
generate_file,
get_partner_declaration_threshold,
)
from stdnum.fr.siret import is_valid

from odoo import _, api, fields, models, tools
Expand Down Expand Up @@ -240,15 +244,9 @@ def generate_lines(self):
currency=company.currency_id.name,
)
)
if company.fr_das2_partner_declare_threshold <= 0:
raise UserError(
_(
"The DAS2 partner declaration threshold is not set on "
"company '%s'."
)
% company.display_name
)
self.partner_declare_threshold = company.fr_das2_partner_declare_threshold
self.write(

Check warning on line 247 in l10n_fr_das2/models/l10n_fr_das2.py

View check run for this annotation

Codecov / codecov/patch

l10n_fr_das2/models/l10n_fr_das2.py#L247

Added line #L247 was not covered by tests
{"partner_declare_threshold": get_partner_declaration_threshold(self.year)}
)
das2_partners = self.env["res.partner"].search(
[("parent_id", "=", False), ("fr_das2_type", "!=", False)]
)
Expand Down
21 changes: 0 additions & 21 deletions l10n_fr_das2/models/res_company.py

This file was deleted.

29 changes: 0 additions & 29 deletions l10n_fr_das2/views/res_config_settings.xml

This file was deleted.

1 change: 0 additions & 1 deletion l10n_fr_das2/wizards/__init__.py

This file was deleted.

13 changes: 0 additions & 13 deletions l10n_fr_das2/wizards/res_config_settings.py

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# generated from manifests external_dependencies
pyfrdas2
pyfrdas2>=0.4
python-stdnum
python-stdnum>=1.18
requests_oauthlib
Expand Down

0 comments on commit 41ad0b1

Please sign in to comment.