[ADD] payment_environment
This commit is contained in:
parent
314d16d37c
commit
0ebfa8471f
|
|
@ -0,0 +1 @@
|
||||||
|
from . import models
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Copyright 2021 Camptocamp SA
|
||||||
|
# @author Iván Todorovich <ivan.todorovich@gmail.com>
|
||||||
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "Payment Acquirers' configuration with server_environment",
|
||||||
|
"summary": "Configure payment acquirers with server_environment",
|
||||||
|
"category": "Tools",
|
||||||
|
"version": "13.0.1.0.0",
|
||||||
|
"license": "LGPL-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"],
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
from . import payment_acquirer
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Copyright 2021 Camptocamp SA
|
||||||
|
# @author Iván Todorovich <ivan.todorovich@gmail.com>
|
||||||
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
* `Camptocamp <https://www.camptocamp.com>`_
|
||||||
|
|
||||||
|
* Iván Todorovich <ivan.todorovich@gmail.com>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This module allows to configure payment acquirers using server_environment files.
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Due to the special nature of this addon, you cannot test it on the OCA runbot.
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!--
|
||||||
|
Copyright 2021 Camptocamp SA
|
||||||
|
@author Iván Todorovich <ivan.todorovich@gmail.com>
|
||||||
|
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.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>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../payment_environment
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue