[IMP] iap: Adapt insufficient credit message

based on enterprise and trial
This commit is contained in:
TWA
2018-09-18 08:55:26 +02:00
committed by Rémi Rahir
parent 389cb3e8dd
commit 947194c03d
2 changed files with 30 additions and 12 deletions
+6 -6
View File
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server saas~11.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-17 08:42+0000\n"
"PO-Revision-Date: 2018-09-17 08:42+0000\n"
"POT-Creation-Date: 2018-09-17 14:10+0000\n"
"PO-Revision-Date: 2018-09-17 14:10+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -27,14 +27,14 @@ msgstr ""
#. module: iap
#. openerp-web
#: code:addons/iap/static/src/js/crash_manager.js:41
#: code:addons/iap/static/src/js/crash_manager.js:23
#, python-format
msgid "Buy credits at Odoo"
msgstr ""
#. module: iap
#. openerp-web
#: code:addons/iap/static/src/js/crash_manager.js:44
#: code:addons/iap/static/src/js/crash_manager.js:61
#, python-format
msgid "Cancel"
msgstr ""
@@ -90,7 +90,7 @@ msgstr ""
#. module: iap
#. openerp-web
#: code:addons/iap/static/src/js/crash_manager.js:38
#: code:addons/iap/static/src/js/crash_manager.js:51
#, python-format
msgid "Insufficient Balance"
msgstr ""
@@ -124,7 +124,7 @@ msgstr ""
#. module: iap
#. openerp-web
#: code:addons/iap/static/src/js/crash_manager.js:41
#: code:addons/iap/static/src/js/crash_manager.js:23
#, python-format
msgid "Start a Trial at Odoo"
msgstr ""
+24 -6
View File
@@ -10,10 +10,23 @@ var _t = core._t;
var QWeb = core.qweb;
CrashManager.include({
/**
* Change button string depending if it's Enterprise and trial available
* (Only change the text message in the button, doesn't change IAP side validation)
*
* @param {boolean} isTrial
* @returns {string}
* @private
*/
_getButtonMessage: function (isTrial){
var isEnterprise = _.last(odoo.session_info.server_version_info) === 'e';
return isTrial && isEnterprise ? _t('Start a Trial at Odoo') : _t('Buy credits at Odoo');
},
/**
* @override
*/
rpc_error: function (error) {
var self = this;
if (error.data.name === "odoo.addons.iap.models.iap.InsufficientCreditError") {
var error_data = JSON.parse(error.data.message);
ajax.jsonRpc('/web/dataset/call_kw', 'call', {
@@ -29,7 +42,7 @@ CrashManager.include({
}).then(function (url) {
var content = $(QWeb.render('iap.redirect_to_odoo_credit', {
data: error_data,
}))
}));
if (error_data.body) {
content.css('padding', 0);
}
@@ -37,12 +50,17 @@ CrashManager.include({
size: 'large',
title: error_data.title || _t("Insufficient Balance"),
$content: content,
buttons: [
{text: error_data.trial ? _t('Start a Trial at Odoo'):_t('Buy credits at Odoo'), classes : "btn-primary", click: function() {
buttons: [{
text: self._getButtonMessage(error_data.trial),
classes: "btn-primary",
click: function () {
window.open(url, '_blank');
}, close:true},
{text: _t("Cancel"), close: true}
],
},
close: true,
}, {
text: _t("Cancel"),
close: true,
}],
}).open();
});
} else {