Skip to content

Commit

Permalink
[MIG] account_banking_fr_lcr to v16
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-via committed Dec 28, 2022
1 parent 139ee49 commit cd6391b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion account_banking_fr_lcr/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "French Letter of Change",
"summary": "Create French LCR CFONB files",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Akretion,Odoo Community Association (OCA)",
"maintainers": ["alexis-via"],
Expand Down
6 changes: 5 additions & 1 deletion account_banking_fr_lcr/models/account_payment_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ class AccountPaymentMethod(models.Model):
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res["fr_lcr"] = {"mode": "multi", "domain": [("type", "=", "bank")]}
res["fr_lcr"] = {
"mode": "multi",
"domain": [("type", "=", "bank")],
"currency_id": self.env.ref("base.EUR").id,
}
return res
30 changes: 18 additions & 12 deletions account_banking_fr_lcr/models/account_payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,25 @@ def _get_rib_from_iban(self, partner_bank):
if partner_bank.acc_type != "iban":
raise UserError(
_(
"For the bank account '{acc_number}' of partner '{partner}', "
"For the bank account '%(acc_number)s' of partner '%(partner)s', "
"the Bank Account Type should be 'IBAN'."
).format(
acc_number=partner_bank.acc_number,
partner=partner_bank.partner_id.display_name,
)
% {
"acc_number": partner_bank.acc_number,
"partner": partner_bank.partner_id.display_name,
}
)
iban = partner_bank.sanitized_acc_number
if iban[0:2] != "FR":
raise UserError(
_(
"LCR are only for French bank accounts. The IBAN '{acc_number}' "
"of partner '{partner}' is not a French IBAN."
).format(
acc_number=partner_bank.acc_number,
partner=partner_bank.partner_id.display_name,
"LCR are only for French bank accounts. The IBAN '%(acc_number)s' "
"of partner '%(partner)s' is not a French IBAN."
)
% {
"acc_number": partner_bank.acc_number,
"partner": partner_bank.partner_id.display_name,
}
)
assert len(iban) == 27, "French IBANs must have 27 caracters"
return {
Expand Down Expand Up @@ -242,10 +244,14 @@ def generate_payment_file(self):
if line.currency_id != eur_currency:
raise UserError(
_(
"The currency of payment line '{payment_line}' is "
"'{currency}'. To be included in a French LCR, "
"The currency of payment line '%(payment_line)s' is "
"'%(currency)s'. To be included in a French LCR, "
"the currency must be EUR."
).format(payment_line=line.name, currency=line.currency_id.name)
)
% {
"payment_line": line.display_name,
"currency": line.currency_id.name,
}
)
transactions_count += 1
cfonb_string += self._prepare_cfonb_line(line, transactions_count)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# generated from manifests external_dependencies
python-stdnum
python-stdnum>=1.18
unidecode
6 changes: 6 additions & 0 deletions setup/account_banking_fr_lcr/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit cd6391b

Please sign in to comment.