diff --git a/addons/payment/__init__.py b/addons/payment/__init__.py
index dc5e6b693d1..b75bfd8cfe4 100644
--- a/addons/payment/__init__.py
+++ b/addons/payment/__init__.py
@@ -2,3 +2,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
+from . import controllers
\ No newline at end of file
diff --git a/addons/payment/__manifest__.py b/addons/payment/__manifest__.py
index d63ded73884..0bc26ebfc9f 100644
--- a/addons/payment/__manifest__.py
+++ b/addons/payment/__manifest__.py
@@ -13,7 +13,8 @@
'views/payment_views.xml',
'views/account_payment_views.xml',
'views/payment_templates.xml',
- 'views/payment_assets.xml',
+ 'views/payment_portal_templates.xml',
+ 'views/assets.xml',
'views/res_partner_views.xml',
'security/ir.model.access.csv',
'security/payment_security.xml',
diff --git a/addons/payment/controllers/__init__.py b/addons/payment/controllers/__init__.py
new file mode 100644
index 00000000000..903b755e71e
--- /dev/null
+++ b/addons/payment/controllers/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import portal
diff --git a/addons/website_payment/controllers/main.py b/addons/payment/controllers/portal.py
similarity index 91%
rename from addons/website_payment/controllers/main.py
rename to addons/payment/controllers/portal.py
index f3548e9090f..93d33151d0a 100644
--- a/addons/website_payment/controllers/main.py
+++ b/addons/payment/controllers/portal.py
@@ -19,7 +19,7 @@ class WebsitePayment(http.Controller):
return_url = request.params.get('redirect', '/my/payment_method')
for acquirer in acquirers:
acquirer.form = acquirer.sudo()._registration_render(request.env.user.partner_id.id, {'error': {}, 'error_message': [], 'return_url': return_url, 'json': False, 'bootstrap_formatting': True, 'verify_validity': True})
- return request.render("website_payment.pay_methods", values)
+ return request.render("payment.pay_methods", values)
@http.route(['/website_payment/delete/'], methods=['POST'], type='http', auth="user", website=True)
def delete(self, delete_pm_id=None):
@@ -46,7 +46,7 @@ class WebsitePayment(http.Controller):
# auto-increment reference with a number suffix if the reference already exists
reference = request.env['payment.transaction'].get_next_reference(reference)
- partner_id = user.partner_id.id if user.partner_id.id != request.website.partner_id.id else False
+ partner_id = user.partner_id.id if not user._is_public() else False
payment_form = acquirer.sudo().render(reference, float(amount), currency.id, values={'return_url': '/website_payment/confirm', 'partner_id': partner_id})
values = {
@@ -56,11 +56,11 @@ class WebsitePayment(http.Controller):
'amount': float(amount),
'payment_form': payment_form,
}
- return request.render('website_payment.pay', values)
+ return request.render('payment.pay', values)
@http.route(['/website_payment/transaction'], type='json', auth="public", website=True)
def transaction(self, reference, amount, currency_id, acquirer_id):
- partner_id = request.env.user.partner_id.id if request.env.user.partner_id != request.website.partner_id else False
+ partner_id = request.env.user.partner_id.id if not request.env.user._is_public() else False
values = {
'acquirer_id': int(acquirer_id),
'reference': reference,
@@ -87,7 +87,7 @@ class WebsitePayment(http.Controller):
else:
status = 'danger'
message = tx.acquirer_id.error_msg
- return request.render('website_payment.confirm', {'tx': tx, 'status': status, 'message': message})
+ return request.render('payment.confirm', {'tx': tx, 'status': status, 'message': message})
else:
return request.redirect('/my/home')
diff --git a/addons/website_payment/static/lib/jquery.payment/jquery.payment.js b/addons/payment/static/lib/jquery.payment/jquery.payment.js
similarity index 100%
rename from addons/website_payment/static/lib/jquery.payment/jquery.payment.js
rename to addons/payment/static/lib/jquery.payment/jquery.payment.js
diff --git a/addons/website_payment/static/src/css/website_payment.css b/addons/payment/static/src/css/portal_payment.css
similarity index 100%
rename from addons/website_payment/static/src/css/website_payment.css
rename to addons/payment/static/src/css/portal_payment.css
diff --git a/addons/website_payment/static/src/css/website_payment.sass b/addons/payment/static/src/css/portal_payment.sass
similarity index 100%
rename from addons/website_payment/static/src/css/website_payment.sass
rename to addons/payment/static/src/css/portal_payment.sass
diff --git a/addons/website_payment/static/src/js/payment_acquirer.js b/addons/payment/static/src/js/payment_portal.js
similarity index 95%
rename from addons/website_payment/static/src/js/payment_acquirer.js
rename to addons/payment/static/src/js/payment_portal.js
index 357159ea17b..74b4cb95282 100644
--- a/addons/website_payment/static/src/js/payment_acquirer.js
+++ b/addons/payment/static/src/js/payment_portal.js
@@ -62,12 +62,17 @@ $(document).ready(function () {
});
-odoo.define('website_payment.payment_acquirer', function (require) {
+odoo.define('payment.payment_acquirer', function (require) {
"use strict";
var ajax = require('web.ajax');
var Dialog = require('web.Dialog');
-var website = require('website.website');
+
+$(document).ready(function () {
+
+ if( !$('#payment_tokens_list').length ) {
+ return $.Deferred().reject("DOM doesn't contain '.payment_tokens_list'");
+ }
var payment_methods = $('#payment_tokens_list');
@@ -115,3 +120,4 @@ var website = require('website.website');
});
});
});
+});
diff --git a/addons/payment/static/src/js/payment_transaction_portal.js b/addons/payment/static/src/js/payment_transaction_portal.js
new file mode 100644
index 00000000000..f8dac1da3d9
--- /dev/null
+++ b/addons/payment/static/src/js/payment_transaction_portal.js
@@ -0,0 +1,26 @@
+odoo.define('payment.website_payment', function (require) {
+"use strict";
+
+var ajax = require('web.ajax');
+
+$(document).ready(function () {
+
+ if(!$('.o_website_payment').length) {
+ return $.Deferred().reject("DOM doesn't contain '.o_website_payment'");
+ }
+
+ // When clicking on payment button: create the tx using json then continue to the acquirer
+ var $payment = $(".o_website_payment_form");
+ $payment.on("click", 'button[type="submit"],button[name="submit"]', function (ev) {
+ ev.preventDefault();
+ ev.stopPropagation();
+ $(ev.currentTarget).attr('disabled', true);
+ $(ev.currentTarget).prepend(' ');
+ var $form = $(ev.currentTarget).parents('form');
+ var data =$("div[class~='o_website_payment_new_payment']").data();
+ ajax.jsonRpc('/website_payment/transaction/', 'call', data).then(function (result) {
+ $form.submit();
+ });
+ });
+});
+});
diff --git a/addons/payment/views/assets.xml b/addons/payment/views/assets.xml
new file mode 100644
index 00000000000..da3d93ee378
--- /dev/null
+++ b/addons/payment/views/assets.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/payment/views/payment_assets.xml b/addons/payment/views/payment_assets.xml
deleted file mode 100644
index 47d4717ef97..00000000000
--- a/addons/payment/views/payment_assets.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/addons/payment/views/payment_portal_templates.xml b/addons/payment/views/payment_portal_templates.xml
new file mode 100644
index 00000000000..388696c75c5
--- /dev/null
+++ b/addons/payment/views/payment_portal_templates.xml
@@ -0,0 +1,142 @@
+
+
+
+
+
+ Payment Acquirers
+
+
+
+
+
+
+ - Payment Acquirers
+
+
+
+
Payment Acquirers
+
Add a new payment acquirer:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Your payment Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Payment
+
+
+
+
+
+
+ Payment
+
+
+
+
+
+
diff --git a/addons/website_payment/__init__.py b/addons/website_payment/__init__.py
index 8c67f893b37..dc5e6b693d1 100644
--- a/addons/website_payment/__init__.py
+++ b/addons/website_payment/__init__.py
@@ -2,4 +2,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
-from . import controllers
diff --git a/addons/website_payment/controllers/__init__.py b/addons/website_payment/controllers/__init__.py
deleted file mode 100644
index 12a7e529b67..00000000000
--- a/addons/website_payment/controllers/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from . import main
diff --git a/addons/website_payment/static/src/js/payment_transaction.js b/addons/website_payment/static/src/js/payment_transaction.js
deleted file mode 100644
index 79e6584f515..00000000000
--- a/addons/website_payment/static/src/js/payment_transaction.js
+++ /dev/null
@@ -1,26 +0,0 @@
-odoo.define('website_payment.website_payment', function (require) {
-"use strict";
-
-var ajax = require('web.ajax');
-var website = require('website.website');
-
-if(!$('.o_website_payment').length) {
- return $.Deferred().reject("DOM doesn't contain '.o_website_payment'");
-}
-
-// When clicking on payment button: create the tx using json then continue to the acquirer
-var $payment = $(".o_website_payment_form");
-$payment.on("click", 'button[type="submit"],button[name="submit"]', function (ev) {
- ev.preventDefault();
- ev.stopPropagation();
- $(ev.currentTarget).attr('disabled', true);
- $(ev.currentTarget).prepend(' ');
- var $form = $(ev.currentTarget).parents('form');
- var data =$("div[class~='o_website_payment_new_payment']").data();
- console.log(data);
- ajax.jsonRpc('/website_payment/transaction/', 'call', data).then(function (result) {
- $form.submit();
- });
-});
-
-});
diff --git a/addons/website_payment/views/website_payment_templates.xml b/addons/website_payment/views/website_payment_templates.xml
index ba012478c79..9b7a784ac28 100644
--- a/addons/website_payment/views/website_payment_templates.xml
+++ b/addons/website_payment/views/website_payment_templates.xml
@@ -1,164 +1,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Payment Acquirers
-
-
-
-
-
-
- - Payment Acquirers
-
-
-
-
Payment Acquirers
-
Add a new payment acquirer:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Your payment Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
- Payment
-
-
-
-
-
-
- Payment
-
-
-
-
-
-
+
\ No newline at end of file