Skip to content

Commit

Permalink
[IMP] account_banking_fr_lcr: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-via committed Jan 30, 2025
1 parent efb73be commit 38e060a
Show file tree
Hide file tree
Showing 21 changed files with 185 additions and 108 deletions.
83 changes: 53 additions & 30 deletions account_banking_fr_lcr/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,38 @@ French Letter of Change
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--france-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-france/tree/16.0/account_banking_fr_lcr
:target: https://github.com/OCA/l10n-france/tree/18.0/account_banking_fr_lcr
:alt: OCA/l10n-france
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-france-16-0/l10n-france-16-0-account_banking_fr_lcr
:target: https://translation.odoo-community.org/projects/l10n-france-18-0/l10n-france-18-0-account_banking_fr_lcr
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-france&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-france&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds support for French Letters of Change. This module supports:
This module adds support for French Letters of Change. This module
supports:

* **Direct letter of change** (in French : *Lettre de change directe* or *LCR directe*),
* **Accepted letter of change** (in French : *Lettre de change acceptée* ; I call it *paper letter of change*),
* **Promissory note** (in French : *Billet à ordre*),
- **Direct letter of change** (in French : *Lettre de change directe*
or *LCR directe*),
- **Accepted letter of change** (in French : *Lettre de change
acceptée* ; I call it *paper letter of change*),
- **Promissory note** (in French : *Billet à ordre*),

It supports cash discounts debit orders and Dailly convention.

This module has 2 main features:

* for **Accepted Letter of Change**, generate a paper letter of change as PDF following the official layout NF K 11-030-1.
* generate of LCR (or BOR) CFONB files to send to your bank.
- for **Accepted Letter of Change**, generate a paper letter of change
as PDF following the official layout NF K 11-030-1.
- generate of LCR (or BOR) CFONB files to send to your bank.

This module follows the specifications published on the `CFONB website <https://www.cfonb.org/>`_, section *Espace documentaire > Instruments de paiement > Effet de commerce* (document version of September 2002).
This module follows the specifications published on the `CFONB
website <https://www.cfonb.org/>`__, section *Espace documentaire >
Instruments de paiement > Effet de commerce* (document version of
September 2002).

**Table of contents**

Expand All @@ -53,10 +60,14 @@ Installation

This module requires 2 Python libs:

* `pypdf <https://pypi.org/project/pypdf/>`_ version 3.10 or above,
* `unidecode <https://pypi.org/project/Unidecode/>`_ (any version).
- `pypdf <https://pypi.org/project/pypdf/>`__ version 3.10 or above,
- `unidecode <https://pypi.org/project/Unidecode/>`__ (any version).

In order to have the SIREN of the company and of the customer set in the CFONB file (optional field) and printed on the paper letter of exchange, the OCA module **l10n_fr_siret** must be installed. The installation of the module **l10n_fr_siret** is optional (because the SIREN field in the CFONB file is optional).
In order to have the SIREN of the company and of the customer set in the
CFONB file (optional field) and printed on the paper letter of exchange,
the OCA module **l10n_fr_siret** must be installed. The installation of
the module **l10n_fr_siret** is optional (because the SIREN field in the
CFONB file is optional).

Configuration
=============
Expand All @@ -65,51 +76,63 @@ To configure this module, you need to create a new payment mode linked
to the payment method *Lettre de Change Relevé* that is automatically
created when you install this module.

Once you selected this payment method, you will have a new section *Bill of Exchange* on the payment mode where you will have to configure:
Once you selected this payment method, you will have a new section *Bill
of Exchange* on the payment mode where you will have to configure:

* the *LCR type*: *Lettre de change non acceptée (LCR directe)*, *Lettre de change acceptée* or *Billet à ordre*,
* the *Default Collection Option*,
* if you have a *Dailly Convention*,
* in case you have a Dailly convention, you will be able to configure the *Default Dailly Option* and the *Convention Type*.
- the *LCR type*: *Lettre de change non acceptée (LCR directe)*,
*Lettre de change acceptée* or *Billet à ordre*,
- the *Default Collection Option*,
- if you have a *Dailly Convention*,
- in case you have a Dailly convention, you will be able to configure
the *Default Dailly Option* and the *Convention Type*.

Usage
=====

This module adds a new field *Bill of Exchange Bank Account* on customer invoices to select the bank account of the customer that will be debited by the letter of exchange. This bank account must be a french IBAN.
This module adds a new field *Bill of Exchange Bank Account* on customer
invoices to select the bank account of the customer that will be debited
by the letter of exchange. This bank account must be a french IBAN.

If you configured the payment mode for **Accepted Letter of Change**, you will have a button *Print Bill of Exchange* on customer invoices to get the letter of change as PDF.
If you configured the payment mode for **Accepted Letter of Change**,
you will have a button *Print Bill of Exchange* on customer invoices to
get the letter of change as PDF.

This module uses the standard workflow of debit orders as implemented in the OCA module **account_payment_order**. A debit order linked to a payment mode with the payment method *Lettre de change relevé* has a few additionnal constraints:
This module uses the standard workflow of debit orders as implemented in
the OCA module **account_payment_order**. A debit order linked to a
payment mode with the payment method *Lettre de change relevé* has a few
additionnal constraints:

* all payment lines must be in euro currency,
* the bank accounts on the payment lines must be french IBANs,
* if the payment order is configured with cash discount, you must configure the value date on the payment order (new field added by this module).
- all payment lines must be in euro currency,
- the bank accounts on the payment lines must be french IBANs,
- if the payment order is configured with cash discount, you must
configure the value date on the payment order (new field added by
this module).

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-france/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-france/issues/new?body=module:%20account_banking_fr_lcr%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-france/issues/new?body=module:%20account_banking_fr_lcr%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~
-------

* Akretion

Contributors
~~~~~~~~~~~~
------------

* Alexis de Lattre <[email protected]>
- Alexis de Lattre <[email protected]>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -129,6 +152,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-alexis-via|

This module is part of the `OCA/l10n-france <https://github.com/OCA/l10n-france/tree/16.0/account_banking_fr_lcr>`_ project on GitHub.
This module is part of the `OCA/l10n-france <https://github.com/OCA/l10n-france/tree/18.0/account_banking_fr_lcr>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
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": "16.0.1.0.0",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "Akretion,Odoo Community Association (OCA)",
"maintainers": ["alexis-via"],
Expand Down
7 changes: 4 additions & 3 deletions account_banking_fr_lcr/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

try:
from pypdf import PdfReader, PdfWriter
except (ImportError, IOError) as err:
except (OSError, ImportError) as err:
logger.debug(err)


Expand Down Expand Up @@ -81,7 +81,8 @@ def _post(self, soft=True):
for move in self:
if move.move_type == "out_invoice" and move.payment_method_code == "fr_lcr":
# We consider bank account as required only for letter of change,
# not for promissory note (we may only know the bank account when receiving it)
# not for promissory note (we may only know the bank account when
# receiving it)
if (
move.payment_mode_fr_lcr_type in ("accepted", "not_accepted")
and not move.fr_lcr_partner_bank_id
Expand Down Expand Up @@ -278,7 +279,7 @@ def fr_lcr_generate_attachment(self):
final_report_writer.write(final_report_io)
final_report_bytes = final_report_io.getvalue()

filename = "lettre_de_change-%s.pdf" % self.name.replace("/", "-")
filename = f"lettre_de_change-{self.name.replace('/', '-')}.pdf"
attach = self.env["ir.attachment"].create(
{
"name": filename,
Expand Down
3 changes: 2 additions & 1 deletion account_banking_fr_lcr/models/account_payment_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def _check_fr_lcr(self):
):
raise ValidationError(
_(
"The field 'Bill of Exchange Type' must be set on payment mode '%s'."
"The field 'Bill of Exchange Type' must be set on "
"payment mode '%s'."
)
% mode.display_name
)
9 changes: 5 additions & 4 deletions account_banking_fr_lcr/models/account_payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class AccountPaymentOrder(models.Model):
states={"draft": [("readonly", False)]},
string="Collection Option",
)
# if fr_lcr_value_date is also used for Dailly, we'll have to change the code and the view
# if fr_lcr_value_date is also used for Dailly, we'll have to change
# the code and the view
fr_lcr_value_date = fields.Date(string="Value Date")
# invisible, to show or not the field 'fr_lcr_dailly_option'
fr_lcr_dailly = fields.Boolean(
Expand Down Expand Up @@ -91,7 +92,6 @@ def draft2open(self):
# on account.payment.line
res = super().draft2open()
today = fields.Date.context_today(self)
self.env.ref("base.EUR").id
for order in self:
if order.payment_method_code == "fr_lcr":
if not order.fr_lcr_collection_option:
Expand Down Expand Up @@ -266,8 +266,9 @@ def _prepare_final_cfonb_line(self, total_amount, transactions_count):
return cfonb_line

def _fr_lcr_line_separator(self):
"""It seems that some bank don't want a line break. For the moment, we have this hook.
If it is confirm, we'll make it a configuration parameter"""
"""It seems that some bank don't want a line break. For the moment,
we have this hook. If it is confirm, we'll make it a configuration parameter
"""
return "\r\n"

def generate_payment_file(self):
Expand Down
3 changes: 3 additions & 0 deletions account_banking_fr_lcr/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
13 changes: 13 additions & 0 deletions account_banking_fr_lcr/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
To configure this module, you need to create a new payment mode linked
to the payment method *Lettre de Change Relevé* that is automatically
created when you install this module.

Once you selected this payment method, you will have a new section *Bill
of Exchange* on the payment mode where you will have to configure:

- the *LCR type*: *Lettre de change non acceptée (LCR directe)*, *Lettre
de change acceptée* or *Billet à ordre*,
- the *Default Collection Option*,
- if you have a *Dailly Convention*,
- in case you have a Dailly convention, you will be able to configure
the *Default Dailly Option* and the *Convention Type*.
10 changes: 0 additions & 10 deletions account_banking_fr_lcr/readme/CONFIGURE.rst

This file was deleted.

1 change: 1 addition & 0 deletions account_banking_fr_lcr/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Alexis de Lattre \<<[email protected]>\>
1 change: 0 additions & 1 deletion account_banking_fr_lcr/readme/CONTRIBUTORS.rst

This file was deleted.

21 changes: 21 additions & 0 deletions account_banking_fr_lcr/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This module adds support for French Letters of Change. This module
supports:

- **Direct letter of change** (in French : *Lettre de change directe* or
*LCR directe*),
- **Accepted letter of change** (in French : *Lettre de change acceptée*
; I call it *paper letter of change*),
- **Promissory note** (in French : *Billet à ordre*),

It supports cash discounts debit orders and Dailly convention.

This module has 2 main features:

- for **Accepted Letter of Change**, generate a paper letter of change
as PDF following the official layout NF K 11-030-1.
- generate of LCR (or BOR) CFONB files to send to your bank.

This module follows the specifications published on the [CFONB
website](https://www.cfonb.org/), section *Espace documentaire \>
Instruments de paiement \> Effet de commerce* (document version of
September 2002).
14 changes: 0 additions & 14 deletions account_banking_fr_lcr/readme/DESCRIPTION.rst

This file was deleted.

10 changes: 10 additions & 0 deletions account_banking_fr_lcr/readme/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This module requires 2 Python libs:

- [pypdf](https://pypi.org/project/pypdf/) version 3.10 or above,
- [unidecode](https://pypi.org/project/Unidecode/) (any version).

In order to have the SIREN of the company and of the customer set in the
CFONB file (optional field) and printed on the paper letter of exchange,
the OCA module **l10n_fr_siret** must be installed. The installation of
the module **l10n_fr_siret** is optional (because the SIREN field in the
CFONB file is optional).
6 changes: 0 additions & 6 deletions account_banking_fr_lcr/readme/INSTALL.rst

This file was deleted.

18 changes: 18 additions & 0 deletions account_banking_fr_lcr/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This module adds a new field *Bill of Exchange Bank Account* on customer
invoices to select the bank account of the customer that will be debited
by the letter of exchange. This bank account must be a french IBAN.

If you configured the payment mode for **Accepted Letter of Change**,
you will have a button *Print Bill of Exchange* on customer invoices to
get the letter of change as PDF.

This module uses the standard workflow of debit orders as implemented in
the OCA module **account_payment_order**. A debit order linked to a
payment mode with the payment method *Lettre de change relevé* has a few
additionnal constraints:

- all payment lines must be in euro currency,
- the bank accounts on the payment lines must be french IBANs,
- if the payment order is configured with cash discount, you must
configure the value date on the payment order (new field added by this
module).
9 changes: 0 additions & 9 deletions account_banking_fr_lcr/readme/USAGE.rst

This file was deleted.

Loading

0 comments on commit 38e060a

Please sign in to comment.