-
-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] account_payment_order_by_partner: add new module
- Loading branch information
Showing
18 changed files
with
737 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
================================ | ||
Account Payment Order By Partner | ||
================================ | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:8cec7dad270597148de4197592a735f1daf8daa01c6ed5381e1f2ce4b855e9a3 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/14.0/account_payment_order_by_partner | ||
: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-14-0/bank-payment-14-0-account_payment_order_by_partner | ||
: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=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module enhances payment order functionality in Odoo by ensuring that all payment lines within a payment order belong to the same partner. This enforces stricter partner consistency and aligns with workflows that require one payment order per partner, improving data integrity and preventing inconsistent payments. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
This module introduces an option to restrict Payment Orders to a single partner. | ||
To enable this feature: | ||
|
||
1. Go to **Invoicing > Configuration > Payment Modes**. | ||
2. In the desired Payment Mode, activate the checkbox **Individual Payment**. | ||
|
||
When this option is enabled, all move lines in a Payment Order must belong to the same partner. Any attempt to add lines from a different partner will result in a validation error. | ||
|
||
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_by_partner%0Aversion:%2014.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 | ||
~~~~~~~ | ||
|
||
* Escodoo | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Escodoo <https://escodoo.com.br>`_: | ||
|
||
* Marcel Savegnago <[email protected]> | ||
* Kaynnan Lemes <[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/14.0/account_payment_order_by_partner>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2025 - TODAY, Escodoo | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Account Payment Order By Partner", | ||
"version": "14.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Escodoo, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/bank-payment", | ||
"depends": [ | ||
"account_payment_order", | ||
], | ||
"data": [ | ||
"views/account_payment_mode.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from . import account_move | ||
from . import account_payment_line | ||
from . import account_payment_mode | ||
from . import account_payment_order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2025 - TODAY, Kaynnan Lemes <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class AccountMove(models.Model): | ||
|
||
_inherit = "account.move" | ||
|
||
def get_account_payment_domain(self, payment_mode): | ||
domain = super().get_account_payment_domain(payment_mode) | ||
if payment_mode.individual_payment: | ||
domain.append(("payment_line_ids.partner_id", "=", self.partner_id.id)) | ||
return domain | ||
24 changes: 24 additions & 0 deletions
24
account_payment_order_by_partner/models/account_payment_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2025 - TODAY, Kaynnan Lemes <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import _, api, models | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class AccountPaymentLine(models.Model): | ||
|
||
_inherit = "account.payment.line" | ||
|
||
@api.constrains("partner_id", "order_id") | ||
def _check_partner_consistency(self): | ||
for line in self: | ||
if line.order_id.payment_mode_id.individual_payment: | ||
partners = line.order_id.payment_line_ids.mapped("partner_id") | ||
if len(set(partners)) > 1: | ||
raise ValidationError( | ||
_( | ||
"The payment order contains lines with multiple partners. " | ||
"When the payment mode requires individual payments, " | ||
"all lines must belong to the same partner." | ||
) | ||
) |
14 changes: 14 additions & 0 deletions
14
account_payment_order_by_partner/models/account_payment_mode.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2025 - TODAY, Kaynnan Lemes <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class AccountPaymentMode(models.Model): | ||
|
||
_inherit = "account.payment.mode" | ||
individual_payment = fields.Boolean( | ||
string="Individual Payment per Partner", | ||
help="Enable this option to process payments individually" | ||
" for this partner instead of combining them in a single payment order.", | ||
) |
24 changes: 24 additions & 0 deletions
24
account_payment_order_by_partner/models/account_payment_order.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2025 - TODAY, Kaynnan Lemes <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import _, models | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class AccountPaymentOrder(models.Model): | ||
|
||
_inherit = "account.payment.order" | ||
|
||
def draft2open(self): | ||
for order in self: | ||
if order.payment_mode_id.individual_payment: | ||
partners = order.payment_line_ids.mapped("partner_id") | ||
if len(set(partners.ids)) > 1: | ||
raise UserError( | ||
_( | ||
"The Payment Mode '%s' requires individual payments. " | ||
"Ensure that all payment lines belong to the same partner." | ||
) | ||
% order.payment_mode_id.name | ||
) | ||
super().draft2open() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* `Escodoo <https://escodoo.com.br>`_: | ||
|
||
* Marcel Savegnago <[email protected]> | ||
* Kaynnan Lemes <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module enhances payment order functionality in Odoo by ensuring that all payment lines within a payment order belong to the same partner. This enforces stricter partner consistency and aligns with workflows that require one payment order per partner, improving data integrity and preventing inconsistent payments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This module introduces an option to restrict Payment Orders to a single partner. | ||
To enable this feature: | ||
|
||
1. Go to **Invoicing > Configuration > Payment Modes**. | ||
2. In the desired Payment Mode, activate the checkbox **Individual Payment**. | ||
|
||
When this option is enabled, all move lines in a Payment Order must belong to the same partner. Any attempt to add lines from a different partner will result in a validation error. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.