Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][ADD] account_payment_base_oca: New base module for OCA/bank-payment #1401

Draft
wants to merge 1 commit into
base: 18.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions account_payment_base_oca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
========================
Account Payment Base OCA
========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:398fe25e1ed0988a7a0504f68878755aa77b7b87532718ca8dfaa344c31b88e1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/18.0/account_payment_base_oca
: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-18-0/bank-payment-18-0-account_payment_base_oca
: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=18.0
:alt: Try me on Runboat

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

This is the new base module for the OCA **bank-payment** project. This
module has been developped for Odoo 18 to adapt the OCA bank-payment
stack to the new native payment mode object of Odoo.

**Table of contents**

.. contents::
:local:

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_base_oca%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 <alexis.delattre@akretion.com>
- Eric Lembregts <eric@lembregts.eu>
- Andrea Stirpe <a.stirpe@onestein.nl>
- Marçal Isern <marsal.isern@qubiq.es>
- Miquel Alzanillas <malzanillas@apsl.net>
- Raphaël Valyi
- Stefan Rijnhart (Therp)
- Alexandre Fayolle
- Stéphane Bidoul <stephane.bidoul@acsone.eu>
- Danimar Ribeiro
- Angel Moya <angel.moya@domatix.com>
- `Tecnativa <https://www.tecnativa.com>`__:

- Pedro M. Baeza
- Carlos Dauden
- Víctor Martínez

- `DynApps <https://www.dynapps.be>`__:

- Raf Ven <raf.ven@dynapps.be>

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.

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

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-alexis-via|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions account_payment_base_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import reports
26 changes: 26 additions & 0 deletions account_payment_base_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2024-2025 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Account Payment Base OCA",
"version": "18.0.1.0.0",
"category": "Accounting",
"license": "AGPL-3",
"summary": "OCA extensions to native payment objects of Odoo",
"author": "Akretion,Odoo Community Association (OCA)",
"maintainers": ["alexis-via"],
"development_status": "Beta",
"website": "https://github.com/OCA/bank-payment",
"depends": ["account"],
"data": [
"security/ir.model.access.csv",
"views/account_payment_method.xml",
"views/account_payment_method_line.xml",
"views/account_move.xml",
"reports/account_invoice_report_view.xml",
"security/ir_rule.xml",
],
"demo": ["demo/demo.xml"],
"installable": True,
}
53 changes: 53 additions & 0 deletions account_payment_base_oca/demo/demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="bank_qonto" model="res.bank">
<field name="name">Qonto</field>
<field name="bic">QNTOFRP1XXX</field>
<field name="street">20 bis rue La Fayette</field>
<field name="zip">75009</field>
<field name="city">Paris</field>
<field name="country" ref="base.fr" />
</record>
<record id="bank_la_banque_postale" model="res.bank">
<field name="name">La Banque Postale</field>
<field name="bic">PSSTFRPPXXX</field>
<field name="street">115 rue de Sèvres</field>
<field name="zip">75007</field>
<field name="city">Paris</field>
<field name="country" ref="base.fr" />
</record>
<record id="bank_societe_generale" model="res.bank">
<field name="name">Société Générale</field>
<field name="bic">SOGEFRPPXXX</field>
<field name="street">1 avenue du Roi Fabien 1er</field>
<field name="zip">75008</field>
<field name="city">Paris</field>
<field name="country" ref="base.fr" />
</record>
<record id="bank_fortis" model="res.bank">
<field name="name">BNP Paribas Fortis Charleroi</field>
<field name="bic">GEBABEBB03A</field>
<field name="city">Charleroi</field>
<field name="country" ref="base.be" />
</record>
<record id="main_company_iban" model="res.partner.bank">
<field name="acc_number">FR76 4242 4242 4242 4242 4242 424</field>
<field name="bank_id" ref="bank_la_banque_postale" />
<field name="partner_id" ref="base.main_partner" />
</record>
<record id="main_company_iban2" model="res.partner.bank">
<field name="acc_number">FR20 1242 1242 1242 1242 1242 124</field>
<field name="bank_id" ref="bank_societe_generale" />
<field name="partner_id" ref="base.main_partner" />
</record>
<record id="res_partner_12_iban" model="res.partner.bank">
<field name="acc_number">FR66 1212 1212 1212 1212 1212 121</field>
<field name="bank_id" ref="bank_qonto" />
<field name="partner_id" ref="base.res_partner_12" />
</record>
<record id="res_partner_2_iban" model="res.partner.bank">
<field name="acc_number">BE96 9988 7766 5544</field>
<field name="bank_id" ref="bank_fortis" />
<field name="partner_id" ref="base.res_partner_2" />
</record>
</odoo>
5 changes: 5 additions & 0 deletions account_payment_base_oca/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import account_payment_method
from . import account_payment_method_line
from . import account_move
from . import res_partner_bank
from . import res_bank
16 changes: 16 additions & 0 deletions account_payment_base_oca/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024-2025 Akretion France (https://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class AccountMove(models.Model):
_inherit = "account.move"

bank_account_required = fields.Boolean(
related="preferred_payment_method_line_id.payment_method_id.bank_account_required",
)
payment_method_code = fields.Char(
related="preferred_payment_method_line_id.payment_method_id.code", store=True
)
34 changes: 34 additions & 0 deletions account_payment_base_oca/models/account_payment_method.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2016-2025 Akretion France (https://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class AccountPaymentMethod(models.Model):
_inherit = "account.payment.method"

# native field, we just inherit string and help
code = fields.Char(
string="Code (do not modify)",
help="This code is used in the source code of the Odoo module that handles "
"this payment method. Therefore, if you change it, "
"the generation of the payment file may fail.",
)
active = fields.Boolean(default=True)
bank_account_required = fields.Boolean(
help="Activate this option if this payment method requires you to "
"know the bank account number of your customer or supplier."
)
# add the one2many field which is not native
line_ids = fields.One2many(
comodel_name="account.payment.method.line",
inverse_name="payment_method_id",
string="Payment Methods",
)

@api.depends("code", "name", "payment_type")
def _compute_display_name(self):
for method in self:
name = f"[{method.code}] {method.name} ({method.payment_type})"
method.display_name = name
Loading
Loading