summaryrefslogtreecommitdiff
path: root/addons/website_payment
diff options
context:
space:
mode:
authortbe-odoo <tbe@odoo.com>2017-08-07 14:35:14 +0200
committertbe-odoo <tbe@odoo.com>2017-08-29 17:11:23 +0200
commit64ae5e2bc32eb99b6a6b470a9aed3803a8ecda0f (patch)
tree6ef480cdd807c81cb750fce7cee5c2ae1e3aa3c0 /addons/website_payment
parent5fb121e77384a158d8cb1f7ad6a078e7c54df8ac (diff)
[IMP] payment: Supported payment options
- Added the ability to specify which payment option each payment acquirer supports and, displays those payment option on e-commerce footer.
Diffstat (limited to 'addons/website_payment')
-rw-r--r--addons/website_payment/models/website.py7
-rw-r--r--addons/website_payment/views/website_payment_templates.xml8
2 files changed, 9 insertions, 6 deletions
diff --git a/addons/website_payment/models/website.py b/addons/website_payment/models/website.py
index 540277d79c2..0bb533cd1c9 100644
--- a/addons/website_payment/models/website.py
+++ b/addons/website_payment/models/website.py
@@ -8,5 +8,8 @@ class Website(models.Model):
_inherit = "website"
@api.model
- def payment_acquirers(self):
- return list(self.env['payment.acquirer'].sudo().search([('website_published', '=', True)]))
+ def payment_options(self):
+ """ This function returns the list of payment options which are supported by payment acquirers that are published
+ """
+ options = self.env['payment.option'].sudo().search([('acquirer_ids', '!=', False)])
+ return [opt for opt in options if any(acq.website_published for acq in opt.acquirer_ids)]
diff --git a/addons/website_payment/views/website_payment_templates.xml b/addons/website_payment/views/website_payment_templates.xml
index c49937bb83f..95d5d44cbf2 100644
--- a/addons/website_payment/views/website_payment_templates.xml
+++ b/addons/website_payment/views/website_payment_templates.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
- <template id="header_footer_custom_payment" inherit_id="website.footer_default" customize_show="True" active="False" name="Payment Methods">
+ <template id="header_footer_custom_payment" inherit_id="website.footer_default" customize_show="True" active="False" name="Payment Options">
<xpath expr="//div[@id='info']" position="inside">
- <h4 class="payment_method_title">Payment Methods</h4>
+ <h4 class="payment_method_title">Payment Options</h4>
<ul class="payment_method_list list-inline">
- <t t-foreach="request.website.payment_acquirers()" t-as="acquirer">
+ <t t-foreach="request.website.payment_options()" t-as="option">
<li>
- <span t-field="acquirer.image_small" t-options='{"widget": "image", "alt-field": "name"}' />
+ <span t-field="option.image_small" t-options='{"widget": "image", "alt-field": "name"}' />
</li>
</t>
</ul>