Skip to content

Commit

Permalink
Merge PR #583 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by alexis-via
  • Loading branch information
OCA-git-bot committed Feb 3, 2025
2 parents e28c5b6 + 465d15d commit 530a2bc
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions l10n_fr_account_vat_return/models/l10n_fr_account_vat_return.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,13 @@ def _prepare_speedy(self):
# used to create negative boxes at the end
"negative_box2logs": defaultdict(list),
"vat_groups": ["regular", "extracom_product", "oil"],
"adjust_account_codes": {
"expense_adjust_account": (
"658",
"Charges diverses de gestion courante",
),
"income_adjust_account": ("758", "Produits divers de gestion courante"),
},
}
speedy["bank_cash_journals"] = speedy["aj_obj"].search(
speedy["company_domain"] + [("type", "in", ("bank", "cash"))]
Expand Down Expand Up @@ -488,15 +495,10 @@ def _get_adjust_accounts(self, speedy):
# that all French companies must use the PCG,
# I select the account based on the code they should have
self.ensure_one()
account_lookup = {
"expense_adjust_account": ("658", "Charges diverses de gestion courante"),
"income_adjust_account": ("758", "Produits divers de gestion courante"),
}
for key, (account_code, account_name) in account_lookup.items():
limit = not account_code.startswith("445") and 1 or None
for key, (account_code, account_name) in speedy["adjust_account_codes"].items():
account = speedy["aa_obj"].search(
speedy["company_domain"] + [("code", "=like", account_code + "%")],
limit=limit,
limit=1,
)
if not account:
raise UserError(
Expand All @@ -508,18 +510,6 @@ def _get_adjust_accounts(self, speedy):
company=self.company_id.display_name,
)
)
if len(account) > 1:
raise UserError(
_(
"There are %(count)d accounts "
"%(account_code)s %(account_name)s in the chart of account "
"of company '%(company)s'. This scenario is not supported.",
count=len(account),
account_code=account_code,
account_name=account_name,
company=self.company_id.display_name,
)
)
speedy[key] = account

def manual2auto(self):
Expand Down

0 comments on commit 530a2bc

Please sign in to comment.