[IMP] payment,website_sale/quote: Renaming a field and labels
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -101,8 +101,7 @@
|
||||
</t>
|
||||
</ul>
|
||||
</div>
|
||||
<div t-attf-id="o_payment_form_acq_{{acq.id}}" class="panel-footer hidden">
|
||||
<p>You'll be redirected to the <t t-esc="acq.provider"/> website after clicking on the payment button.</p>
|
||||
<div t-attf-id="o_payment_form_acq_{{acq.id}}" t-attf-class="hidden {{'panel-footer' if acq.save_token == 'ask' else ''}}">
|
||||
<label t-if="acq.save_token == 'ask'"><input type="checkbox" name="o_payment_form_save_token"/> Save my payment data</label>
|
||||
<t t-raw="acq.form"/>
|
||||
</div>
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
</div>
|
||||
<field name="registration_view_template_id" groups="base.group_no_one"/>
|
||||
<field name="payment_icon_ids" widget="many2many_tags"/>
|
||||
<field name="prefered_payment_type"/>
|
||||
<field name="payment_flow" widget="radio"/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
@@ -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']])])
|
||||
|
||||
@@ -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']])])
|
||||
|
||||
Reference in New Issue
Block a user