diff options
| author | Joseph Caburnay <jcb@odoo.com> | 2019-08-29 08:41:05 +0000 |
|---|---|---|
| committer | Pierre Masereel <pim@odoo.com> | 2019-09-09 14:08:51 +0000 |
| commit | d6543adc0541ad8a2906df87b705aefd108b212c (patch) | |
| tree | f0352fb76d030a39e35fd78b662b096c8748ee6c /addons/pos_adyen | |
| parent | 7c6c76d0219462c4f652f4dba3e57e2ab1162d64 (diff) | |
[IMP] point_of_sale, pos_adyen, pos_mercury: payment terminal per method
For now when you are using payment terminals in the point of sale, you
have different way to configure payment temrminals, for the IOT, you
have to select the payment terminal in the pos config, and for adyen and
ventiv you have to configure them in the payment method.
So we've modified it to always configure payment terminal on payment
mehthod, and not on the pos config anymore, with iot you'll be able to
select the specific device you want to use, even if it is not on the iot
box set on the pos config.
closes odoo/odoo#35665
Task-id: 2042382
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons/pos_adyen')
| -rw-r--r-- | addons/pos_adyen/models/pos_payment_method.py | 11 | ||||
| -rw-r--r-- | addons/pos_adyen/views/pos_payment_method_views.xml | 14 |
2 files changed, 16 insertions, 9 deletions
diff --git a/addons/pos_adyen/models/pos_payment_method.py b/addons/pos_adyen/models/pos_payment_method.py index c3489797173..6576485cebd 100644 --- a/addons/pos_adyen/models/pos_payment_method.py +++ b/addons/pos_adyen/models/pos_payment_method.py @@ -15,7 +15,9 @@ _logger = logging.getLogger(__name__) class PosPaymentMethod(models.Model): _inherit = 'pos.payment.method' - use_payment_terminal = fields.Selection(selection_add=[('adyen', 'Adyen')]) + def _get_payment_terminal_selection(self): + return super(PosPaymentMethod, self)._get_payment_terminal_selection() + [('adyen', 'Adyen')] + adyen_api_key = fields.Char(string="Adyen API key", help='Used when connecting to Adyen: https://docs.adyen.com/user-management/how-to-get-the-api-key/#description', copy=False) adyen_terminal_identifier = fields.Char(help='[Terminal model]-[Serial number], for example: P400Plus-123456789', copy=False) adyen_test_mode = fields.Boolean(help='Run transactions in the test environment.') @@ -116,3 +118,10 @@ class PosPaymentMethod(models.Model): return True return req.json() + + @api.onchange('use_payment_terminal') + def _onchange_use_payment_terminal(self): + super(PosPaymentMethod, self)._onchange_use_payment_terminal() + if self.use_payment_terminal != 'adyen': + self.adyen_api_key = False + self.adyen_terminal_identifier = False diff --git a/addons/pos_adyen/views/pos_payment_method_views.xml b/addons/pos_adyen/views/pos_payment_method_views.xml index 50aa6b39cb0..7c1d28597f0 100644 --- a/addons/pos_adyen/views/pos_payment_method_views.xml +++ b/addons/pos_adyen/views/pos_payment_method_views.xml @@ -5,14 +5,12 @@ <field name="model">pos.payment.method</field> <field name="inherit_id" ref="point_of_sale.pos_payment_method_view_form"/> <field name="arch" type="xml"> - <group name="Payment methods" position="inside"> - <group> - <field name="adyen_api_key" - attrs="{'invisible': [('use_payment_terminal', '!=', 'adyen')], 'required': [('use_payment_terminal', '=', 'adyen')]}"/> - <field name="adyen_terminal_identifier" attrs="{'invisible': [('use_payment_terminal', '!=', 'adyen')], 'required': [('use_payment_terminal', '=', 'adyen')]}"/> - <field name="adyen_test_mode" attrs="{'invisible': [('use_payment_terminal', '!=', 'adyen')]}"/> - </group> - </group> + <xpath expr="//field[@name='use_payment_terminal']" position="after"> + <field name="adyen_api_key" + attrs="{'invisible': [('use_payment_terminal', '!=', 'adyen')], 'required': [('use_payment_terminal', '=', 'adyen')]}"/> + <field name="adyen_terminal_identifier" attrs="{'invisible': [('use_payment_terminal', '!=', 'adyen')], 'required': [('use_payment_terminal', '=', 'adyen')]}"/> + <field name="adyen_test_mode" attrs="{'invisible': [('use_payment_terminal', '!=', 'adyen')]}"/> + </xpath> </field> </record> </odoo> |
