Skip to content
Open
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
2 changes: 2 additions & 0 deletions l10n_fr_einvoicing/data/neutralize.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UPDATE res_company SET fr_ctc_client_id = NULL, fr_ctc_client_secret = NULL, fr_ctc_accredited_platform = NULL, fr_ctc_auth_method = NULL;
DELETE FROM fr_einvoicing_token;
4 changes: 3 additions & 1 deletion l10n_fr_einvoicing/models/fr_einvoicing_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def create(self, vals_list):
return events

def _auto_process(self):
if tools.config.get("running_env") in ("dev", "test"):
if tools.config.get("running_env") in ("dev", "test") or self.env[
"ir.config_parameter"
].sudo().get_param("database.is_neutralized"):
result = {"logs": []}
company = self[0].company_id
try:
Expand Down
15 changes: 13 additions & 2 deletions l10n_fr_einvoicing/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,9 @@ def _fr_ctc_authorization_code_redirect(self):
running_env = tools.config.get("running_env")
siren = self.partner_id._get_siren(raise_if_none=True)
optional_uri_params = {"superpdp_company_number": siren}
if running_env in ("test", "dev"):
if running_env in ("test", "dev") or self.env[
"ir.config_parameter"
].sudo().get_param("database.is_neutralized"):
optional_uri_params["superpdp_company_number_scheme"] = "sandbox"
else:
optional_uri_params["superpdp_company_number_scheme"] = "fr_siren"
Expand Down Expand Up @@ -603,7 +605,16 @@ def _fr_ctc_superpdp_sandbox_create(
# WARNING: Burger Queen and Tricatel suffixes are different in earch sandbox
# so you MUST customize the 2 arguments
logger.info("Start to create a SUPER PDP sandbox")
if tools.config.get("running_env") not in ("test", "dev"):
running_env = tools.config.get("running_env", False)
if not running_env and not self.env["ir.config_parameter"].sudo().get_param(
"database.is_neutralized"
):
logger.warning(
"You are trying to create a SUPER PDP sandbox but database is not "
"neutralized. Aborting."
)
return False
elif running_env and running_env not in ("test", "dev"):
logger.warning(
"You are trying to create a SUPER PDP sandbox but running_env is not "
"test/dev. Aborting."
Expand Down
Loading