-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
314d16d
commit 1c1a0b7
Showing
13 changed files
with
95 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 @@ | ||
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 2021 Camptocamp SA | ||
# @author Iván Todorovich <ivan.todorovich@gmail.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
|
||
{ | ||
"name": "Payment Acquirers' configuration with server_environment", | ||
"summary": "Configure payment acquirers with server_environment", | ||
"category": "Tools", | ||
"version": "13.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Camptocamp, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/server-env", | ||
"maintainers": ["ivantodorovich"], | ||
"depends": ["payment", "server_environment"], | ||
"data": ["views/payment_acquirer.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 @@ | ||
from . import payment_acquirer |
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,23 @@ | ||
# Copyright 2021 Camptocamp SA | ||
# @author Iván Todorovich <ivan.todorovich@gmail.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
|
||
from odoo import models | ||
|
||
|
||
class PaymentAcquirer(models.Model): | ||
_name = "payment.acquirer" | ||
_inherit = [ | ||
"payment.acquirer", | ||
"server.env.techname.mixin", | ||
"server.env.mixin", | ||
] | ||
|
||
@property | ||
def _server_env_fields(self): | ||
base_fields = super()._server_env_fields | ||
acquirer_fields = { | ||
"state": {}, | ||
} | ||
acquirer_fields.update(base_fields) | ||
return acquirer_fields |
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,17 @@ | ||
With this module installed, the payment acquirers are configured in | ||
the `server_environment_files` module (which is a module you should provide, | ||
see the documentation of `server_environment` for more information). | ||
|
||
In the configuration file of each environment, for each payment acquirer you | ||
may use the section `[payment_acquirer.technical_name]` to configure the | ||
acquirer values, where "technical_name" is the acquirer's `tech_name`. | ||
|
||
This module alone only lets you configure the `state` field, which allows to | ||
set the acquirer's environment. Most payment acquirers will define specific | ||
fields to store their credentials, so glue modules are required to include them | ||
in `_server_env_fields` if that's what you want. | ||
|
||
Example of config file :: | ||
|
||
[payment_acquirer.paypal] | ||
state = test |
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,3 @@ | ||
* `Camptocamp <https://www.camptocamp.com>`_ | ||
|
||
* Iván Todorovich <ivan.todorovich@gmail.com> |
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 allows to configure payment acquirers using server_environment files. |
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,5 @@ | ||
To install this module, you need to have the server_environment module | ||
installed and properly configured. | ||
|
||
After installed, the environment configurable fields will be read from | ||
the environment files. |
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 @@ | ||
Due to the special nature of this addon, you cannot test it on the OCA runbot. |
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,2 @@ | ||
Once configured, Odoo will read the payment acquirer values from the | ||
configuration file related to each environment defined in the main Odoo file. |
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,18 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- | ||
Copyright 2021 Camptocamp SA | ||
@author Iván Todorovich <ivan.todorovich@gmail.com> | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
--> | ||
<odoo> | ||
<record id="acquirer_form" model="ir.ui.view"> | ||
<field name="model">payment.acquirer</field> | ||
<field name="inherit_id" ref="payment.acquirer_form" /> | ||
<field name="groups_id" eval="[(4, ref('base.group_system'))]" /> | ||
<field name="arch" type="xml"> | ||
<field name="provider" position="before"> | ||
<field name="tech_name" groups="base.group_no_one" /> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |
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 @@ | ||
../../../../payment_environment |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |