Skip to content

Commit

Permalink
[ADD] account_payment_order_filename: new module
Browse files Browse the repository at this point in the history
Add new module account_payment_order_filename to let the user customize the file generated. This behavior use sequence to also have the possibility to generate a unique filename if necessary
  • Loading branch information
acsonefho committed Jul 5, 2024
1 parent 0ca46be commit 0ed12ad
Show file tree
Hide file tree
Showing 15 changed files with 690 additions and 0 deletions.
86 changes: 86 additions & 0 deletions account_payment_order_filename/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
==============================
Account Payment Order filename
==============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f3c5a8d7e2ed321e14f7969777a0e19f84e208f6c2985bf3a3f4bfa3ad4451d9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github
:target: https://github.com/OCA/bank-payment/tree/16.0/account_payment_order_filename
:alt: OCA/bank-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/bank-payment-16-0/bank-payment-16-0-account_payment_order_filename
: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/bank-payment&target_branch=16.0
:alt: Try me on Runboat

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

This module let the possibility to the user to specify a sequence for the filename generation on the payment order.

**Table of contents**

.. contents::
:local:

Configuration
=============

On the payment mode, just fill the field filename_sequence_id.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-payment/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/bank-payment/issues/new?body=module:%20account_payment_order_filename%0Aversion:%2016.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
~~~~~~~

* ACSONE SA/NV

Contributors
~~~~~~~~~~~~

* `Acsone <https://www.acsone.eu>`_:

* François Honoré <[email protected]>




Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/16.0/account_payment_order_filename>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions account_payment_order_filename/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions account_payment_order_filename/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Account Payment Order filename",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/bank-payment",
"development_status": "Beta",
"category": "Banking addons",
"depends": ["account_banking_pain_base"],
"data": [
"views/account_payment_mode.xml",
],
"installable": True,
}
2 changes: 2 additions & 0 deletions account_payment_order_filename/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_payment_mode
from . import account_payment_order
12 changes: 12 additions & 0 deletions account_payment_order_filename/models/account_payment_mode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2024 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models


class AccountPaymentMode(models.Model):
_inherit = "account.payment.mode"

filename_sequence_id = fields.Many2one(
comodel_name="ir.sequence",
help="Sequence used to generate the filename",
)
16 changes: 16 additions & 0 deletions account_payment_order_filename/models/account_payment_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models


class AccountPaymentOrder(models.Model):
_inherit = "account.payment.order"

def finalize_sepa_file_creation(self, xml_root, gen_args):
xml_string, filename = super().finalize_sepa_file_creation(xml_root, gen_args)
if self.payment_mode_id.filename_sequence_id:
filename = self._get_filename_with_sequence(filename)
return xml_string, filename

def _get_filename_with_sequence(self, previous_filename=""):
return self.payment_mode_id.filename_sequence_id._next() or previous_filename
1 change: 1 addition & 0 deletions account_payment_order_filename/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
On the payment mode, just fill the field filename_sequence_id.
6 changes: 6 additions & 0 deletions account_payment_order_filename/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* `Acsone <https://www.acsone.eu>`_:

* François Honoré <[email protected]>



1 change: 1 addition & 0 deletions account_payment_order_filename/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module let the possibility to the user to specify a sequence for the filename generation on the payment order.
Loading

0 comments on commit 0ed12ad

Please sign in to comment.