Skip to content

Commit

Permalink
[ADD] payment_sepa_dd_payment_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
remytms committed Jan 9, 2025
1 parent 7e2ad59 commit 542e02d
Show file tree
Hide file tree
Showing 10 changed files with 570 additions and 0 deletions.
70 changes: 70 additions & 0 deletions payment_sepa_dd_payment_mode/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
======================================
Payment SEPA Direct Debit Payment Mode
======================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d5514507c207937042ea64484cf364dd8c11232d97806933a51e12dcf7c534f9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-coopiteasy%2Faddons-lightgray.png?logo=github
:target: https://github.com/coopiteasy/addons/tree/16.0/payment_sepa_dd_payment_mode
:alt: coopiteasy/addons

|badge1| |badge2| |badge3|

Form to order subscription product

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/addons/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/coopiteasy/addons/issues/new?body=module:%20payment_sepa_dd_payment_mode%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
~~~~~~~

* Coop IT Easy SC

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

* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Rémy Taymans

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

.. |maintainer-remytms| image:: https://github.com/remytms.png?size=40px
:target: https://github.com/remytms
:alt: remytms

Current maintainer:

|maintainer-remytms|

This module is part of the `coopiteasy/addons <https://github.com/coopiteasy/addons/tree/16.0/payment_sepa_dd_payment_mode>`_ project on GitHub.

You are welcome to contribute.
5 changes: 5 additions & 0 deletions payment_sepa_dd_payment_mode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later
from . import models
from . import controllers
27 changes: 27 additions & 0 deletions payment_sepa_dd_payment_mode/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

{
"name": "Payment SEPA Direct Debit Payment Mode",
"summary": """
Manage payment_mode with payment_sepa_dd
Glue module between payment_sepa_dd and account_payment_sale.""",
"version": "16.0.0.1.0",
"category": "Banking addons",
"website": "https://github.com/coopiteasy/addons",
"author": "Coop IT Easy SC",
"maintainers": ["remytms"],
"license": "AGPL-3",
"application": False,
"depends": [
"payment_sepa_dd",
"account_payment_sale",
"website_sale",
],
"excludes": [],
"data": [],
"assets": {},
"demo": [],
"qweb": [],
}
4 changes: 4 additions & 0 deletions payment_sepa_dd_payment_mode/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later
from . import main
18 changes: 18 additions & 0 deletions payment_sepa_dd_payment_mode/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo.http import request

from odoo.addons.website_sale.controllers.main import PaymentPortal


class PaymentPortalSEPADD(PaymentPortal):
def _validate_transaction_for_order(self, transaction, sale_order_id):
"""Throws a ValidationError if IBAN is not correct"""
if transaction.provider_id.code == "sepa_dd":
# Set SEPA Direct Debit payment_mode_id
order = request.env["sale.order"].sudo().browse(sale_order_id).exists()
order.payment_mode_id = order.get_sepa_dd_payment_mode()

return super()._validate_transaction_for_order(transaction, sale_order_id)
4 changes: 4 additions & 0 deletions payment_sepa_dd_payment_mode/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later
from . import sale_order
17 changes: 17 additions & 0 deletions payment_sepa_dd_payment_mode/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later


from odoo import api, models


class SaleOrder(models.Model):
_inherit = "sale.order"

@api.model
def get_sepa_dd_payment_mode(self):
return self.env["account.payment.mode"].search(
[("payment_method_id.code", "=", "sepa_direct_debit")],
limit=1,
)
3 changes: 3 additions & 0 deletions payment_sepa_dd_payment_mode/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Rémy Taymans
1 change: 1 addition & 0 deletions payment_sepa_dd_payment_mode/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Form to order subscription product
Loading

0 comments on commit 542e02d

Please sign in to comment.