From 2a2a1c7b2843fc6fe0c82583120ce100fa4068fa Mon Sep 17 00:00:00 2001 From: tbe-odoo Date: Tue, 29 Aug 2017 13:50:14 +0200 Subject: [PATCH] [IMP] payment,website_sale/quote: Renaming a field and labels --- addons/payment/controllers/portal.py | 2 +- addons/payment/models/payment_acquirer.py | 17 ++++++----------- addons/payment/views/payment_templates.xml | 3 +-- addons/payment/views/payment_views.xml | 2 +- addons/website_quote/controllers/main.py | 4 ++-- addons/website_sale/controllers/main.py | 4 ++-- 6 files changed, 13 insertions(+), 19 deletions(-) diff --git a/addons/payment/controllers/portal.py b/addons/payment/controllers/portal.py index 0ce8471e808..c7fb34607ed 100644 --- a/addons/payment/controllers/portal.py +++ b/addons/payment/controllers/portal.py @@ -8,7 +8,7 @@ from odoo.http import request class WebsitePayment(http.Controller): @http.route(['/my/payment_method'], type='http', auth="user", website=True) def payment_method(self, **kwargs): - acquirers = list(request.env['payment.acquirer'].search([('website_published', '=', True), ('registration_view_template_id', '!=', False), ('prefered_payment_type', 'in', ['s2s', 'both'])])) + acquirers = list(request.env['payment.acquirer'].search([('website_published', '=', True), ('registration_view_template_id', '!=', False), ('payment_flow', '=', 's2s')])) partner = request.env.user.partner_id payment_tokens = partner.payment_token_ids payment_tokens |= partner.commercial_partner_id.sudo().payment_token_ids diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 28c13ce458e..e9c8c86c85b 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -117,8 +117,8 @@ class PaymentAcquirer(models.Model): help='Message displayed, if error is occur during the payment process.') save_token = fields.Selection([ ('none', 'Never'), - ('ask', 'Let the customer decide (recommended for eCommerce)'), - ('always', 'Always (recommended for Subscriptions)')], + ('ask', 'Let the customer decide'), + ('always', 'Always')], string='Save Cards', default='none', help="This option allows customers to save their credit card as a payment token and to reuse it for a later purchase." "If you manage subscriptions (recurring invoicing), you need it to automatically charge the customer when you " @@ -151,15 +151,10 @@ class PaymentAcquirer(models.Model): "Use this field anywhere a small image is required.") payment_icon_ids = fields.Many2many('payment.icon', string='Supported Payment Icons') - prefered_payment_type = fields.Selection(selection=[('s2s','Server to server'), - ('form', 'Form'), - ('both', 'Both') - ], default='form', required=True, string='Prefered payment type', help="""Which payment type you wish to use. - - Form: Redirect the user to the payment acquirer website to pay. - - Server to server: The user enter his credit card information on your website and is processed by Odoo. - - Both: Both are displayed to the user. - - Note: Subscriptions does not take this field in account, it uses server to server by default.""") + payment_flow = fields.Selection(selection=[('s2s','The customer encode his payment details on the website.'), + ('form', 'The customer is redirected to the website of the acquirer.')], + default='form', required=True, string='Payment flow', + help="""Note: Subscriptions does not take this field in account, it uses server to server by default.""") def _search_is_tokenized(self, operator, value): tokenized = self._get_feature_support()['tokenize'] diff --git a/addons/payment/views/payment_templates.xml b/addons/payment/views/payment_templates.xml index 4327939a7e3..182a80bf8d7 100644 --- a/addons/payment/views/payment_templates.xml +++ b/addons/payment/views/payment_templates.xml @@ -101,8 +101,7 @@ - - + diff --git a/addons/website_quote/controllers/main.py b/addons/website_quote/controllers/main.py index e30800169d7..859eb5f715c 100644 --- a/addons/website_quote/controllers/main.py +++ b/addons/website_quote/controllers/main.py @@ -69,8 +69,8 @@ class sale_quote(http.Controller): if order_sudo.require_payment or values['need_payment']: acquirers = request.env['payment.acquirer'].sudo().search([('website_published', '=', True), ('company_id', '=', order_sudo.company_id.id)]) - values['form_acquirers'] = [acq for acq in acquirers if acq.prefered_payment_type in ['form', 'both'] and acq.view_template_id] - values['s2s_acquirers'] = [acq for acq in acquirers if acq.prefered_payment_type in ['s2s', 'both'] and acq.registration_view_template_id] + values['form_acquirers'] = [acq for acq in acquirers if acq.payment_flow == 'form' and acq.view_template_id] + values['s2s_acquirers'] = [acq for acq in acquirers if acq.payment_flow == 's2s' and acq.registration_view_template_id] values['pms'] = request.env['payment.token'].search( [('partner_id', '=', order_sudo.partner_id.id), ('acquirer_id', 'in', [acq.id for acq in values['s2s_acquirers']])]) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 78c48c8b6e8..15ebd112268 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -716,8 +716,8 @@ class WebsiteSale(http.Controller): [('website_published', '=', True), ('company_id', '=', order.company_id.id)] ) - values['form_acquirers'] = [acq for acq in acquirers if acq.prefered_payment_type in ['form', 'both'] and acq.view_template_id] - values['s2s_acquirers'] = [acq for acq in acquirers if acq.prefered_payment_type in ['s2s', 'both'] and acq.registration_view_template_id] + values['form_acquirers'] = [acq for acq in acquirers if acq.payment_flow == 'form' and acq.view_template_id] + values['s2s_acquirers'] = [acq for acq in acquirers if acq.payment_flow == 's2s' and acq.registration_view_template_id] values['tokens'] = request.env['payment.token'].search( [('partner_id', '=', order.partner_id.id), ('acquirer_id', 'in', [acq.id for acq in values['s2s_acquirers']])])