summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2018-08-24 23:00:25 +0200
committerJeremy Kersten <jke@odoo.com>2018-08-25 00:03:01 +0200
commit70d18276ecaafc6864a6d0e3c9ccf310bad34a01 (patch)
treec39892d2c80c5e02f84cd3d4a1ea1037bf9250ac
parent2fb95cbfe57379b9a5e61622e729d664c3bf1fba (diff)
[IMP] website_payment: make it website specific
Allow to specity on a payment acquirer on if it is specific to one website or common to all.
-rw-r--r--addons/website_payment/__init__.py2
-rw-r--r--addons/website_payment/__manifest__.py1
-rw-r--r--addons/website_payment/models/__init__.py1
-rw-r--r--addons/website_payment/models/payment_acquirer.py9
-rw-r--r--addons/website_payment/views/payment_acquirer.xml17
-rw-r--r--addons/website_sale/controllers/main.py1
6 files changed, 31 insertions, 0 deletions
diff --git a/addons/website_payment/__init__.py b/addons/website_payment/__init__.py
index 67dee8c60db..e9917144f69 100644
--- a/addons/website_payment/__init__.py
+++ b/addons/website_payment/__init__.py
@@ -1,2 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import models \ No newline at end of file
diff --git a/addons/website_payment/__manifest__.py b/addons/website_payment/__manifest__.py
index c71a0967d94..c42f639f52e 100644
--- a/addons/website_payment/__manifest__.py
+++ b/addons/website_payment/__manifest__.py
@@ -15,6 +15,7 @@ This is a bridge module which integrates payment acquirers with Website app.
],
'data': [
'views/res_config_settings_views.xml',
+ 'views/payment_acquirer.xml',
],
'auto_install': False,
}
diff --git a/addons/website_payment/models/__init__.py b/addons/website_payment/models/__init__.py
new file mode 100644
index 00000000000..0c52563d00c
--- /dev/null
+++ b/addons/website_payment/models/__init__.py
@@ -0,0 +1 @@
+from . import payment_acquirer \ No newline at end of file
diff --git a/addons/website_payment/models/payment_acquirer.py b/addons/website_payment/models/payment_acquirer.py
new file mode 100644
index 00000000000..fe0c00f9a26
--- /dev/null
+++ b/addons/website_payment/models/payment_acquirer.py
@@ -0,0 +1,9 @@
+# coding: utf-8
+
+from odoo import fields, models
+
+
+class PaymentAcquirer(models.Model):
+ _inherit = 'payment.acquirer'
+
+ website_id = fields.Many2one('website')
diff --git a/addons/website_payment/views/payment_acquirer.xml b/addons/website_payment/views/payment_acquirer.xml
new file mode 100644
index 00000000000..5da2b9eda7e
--- /dev/null
+++ b/addons/website_payment/views/payment_acquirer.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <data>
+
+ <record id="acquirer_form_webiste" model="ir.ui.view">
+ <field name="name">acquirer.form.paypal</field>
+ <field name="model">payment.acquirer</field>
+ <field name="inherit_id" ref="payment.acquirer_form"/>
+ <field name="arch" type="xml">
+ <field name='company_id' position='after'>
+ <field name="website_id" options="{'no_open': True, 'no_create_edit': True}"/>
+ </field>
+ </field>
+ </record>
+
+ </data>
+</odoo>
diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py
index d5092eb6cf1..b398caf1806 100644
--- a/addons/website_sale/controllers/main.py
+++ b/addons/website_sale/controllers/main.py
@@ -794,6 +794,7 @@ class WebsiteSale(http.Controller):
domain = expression.AND([
['&', ('website_published', '=', True), ('company_id', '=', order.company_id.id)],
+ ['|', ('website_id', '=', False), ('website_id', '=', request.website.id)],
['|', ('specific_countries', '=', False), ('country_ids', 'in', [order.partner_id.country_id.id])]
])
acquirers = request.env['payment.acquirer'].search(domain)