Skip to content

Commit 8817ddc

Browse files
committed
Merge PR #880 into 18.0
Signed-off-by pedrobaeza
2 parents e8f8b76 + 3b4836c commit 8817ddc

File tree

14 files changed

+680
-0
lines changed

14 files changed

+680
-0
lines changed

payment_partner/README.rst

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
===============
2+
Payment Partner
3+
===============
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:ffdcc5c57f3da52d2c758f47ad34396913d88fb9fd831d4ba491b1f7a2b3101d
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github
20+
:target: https://github.com/OCA/account-payment/tree/18.0/payment_partner
21+
:alt: OCA/account-payment
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/account-payment-18-0/account-payment-18-0-payment_partner
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-payment&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows to filter payment providers by partner.
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Usage
39+
=====
40+
41+
1. Access the Payment Providers page
42+
2. Unset the is global selector
43+
3. Access the partners and select the specific non global payment
44+
providers
45+
46+
After this, we will be able to select this provider for the partner.
47+
48+
Bug Tracker
49+
===========
50+
51+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-payment/issues>`_.
52+
In case of trouble, please check there if your issue has already been reported.
53+
If you spotted it first, help us to smash it by providing a detailed and welcomed
54+
`feedback <https://github.com/OCA/account-payment/issues/new?body=module:%20payment_partner%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
55+
56+
Do not contact contributors directly about support or help with technical issues.
57+
58+
Credits
59+
=======
60+
61+
Authors
62+
-------
63+
64+
* Dixmit
65+
66+
Contributors
67+
------------
68+
69+
- `Dixmit <https://www.dixmit.com>`__:
70+
71+
- Enric Tobella
72+
73+
Maintainers
74+
-----------
75+
76+
This module is maintained by the OCA.
77+
78+
.. image:: https://odoo-community.org/logo.png
79+
:alt: Odoo Community Association
80+
:target: https://odoo-community.org
81+
82+
OCA, or the Odoo Community Association, is a nonprofit organization whose
83+
mission is to support the collaborative development of Odoo features and
84+
promote its widespread use.
85+
86+
This module is part of the `OCA/account-payment <https://github.com/OCA/account-payment/tree/18.0/payment_partner>`_ project on GitHub.
87+
88+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

payment_partner/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

payment_partner/__manifest__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2024 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Payment Partner",
6+
"summary": """Filter Payments by Partner""",
7+
"version": "18.0.1.0.0",
8+
"license": "AGPL-3",
9+
"author": "Dixmit,Odoo Community Association (OCA)",
10+
"website": "https://github.com/OCA/account-payment",
11+
"depends": ["payment"],
12+
"data": [
13+
"views/payment_provider.xml",
14+
],
15+
"demo": [],
16+
}

payment_partner/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import payment_provider
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2024 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class PaymentProvider(models.Model):
8+
_inherit = "payment.provider"
9+
10+
filter_mode = fields.Selection(
11+
[("global", "Global"), ("include", "Include"), ("exclude", "Exclude")],
12+
default="global",
13+
)
14+
partner_ids = fields.Many2many("res.partner")
15+
16+
@api.model
17+
def _get_compatible_providers(self, company_id, partner_id, *args, **kwargs):
18+
result = super()._get_compatible_providers(
19+
company_id, partner_id, *args, **kwargs
20+
)
21+
return result.filtered(
22+
lambda r: not r.filter_mode
23+
or r.filter_mode == "global"
24+
or (r.filter_mode == "include" and partner_id in r.partner_ids.ids)
25+
or (r.filter_mode == "exclude" and partner_id not in r.partner_ids.ids)
26+
)

payment_partner/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [Dixmit](https://www.dixmit.com):
2+
- Enric Tobella
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module allows to filter payment providers by partner.

payment_partner/readme/USAGE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1. Access the Payment Providers page
2+
2. Unset the is global selector
3+
3. Access the partners and select the specific non global payment providers
4+
5+
After this, we will be able to select this provider for the partner.
9.23 KB
Loading

0 commit comments

Comments
 (0)