[FIX] web_planner, account: add support for enterprise module + fix link 'Revenue Recognition'

Now, when the module is not found, instead to display a traceback, we open a popup to upgrade to Enterprise.

That will be wrong in case of outdated / wrong link, but in most cases, it is because it is an enterprise module.

This commit closes #13882

TODO: Remove zindex 1051 on planner in master/saas-14
This commit is contained in:
Jeremy Kersten
2016-10-19 18:31:37 +02:00
parent 28560a34da
commit 62c0a161ef
3 changed files with 38 additions and 2 deletions
+1 -1
View File
@@ -408,7 +408,7 @@
<span class="fa fa-tasks fa-4x"></span>
<h3><strong>Revenue Recognition</strong></h3>
<p>Use in conjunction with contracts to calculate your monthly revenue for multi-month contracts.</p>
<a t-att-href="prepare_backend_url('base.open_module_tree', 'form', 'account_asset')"
<a t-att-href="prepare_backend_url('base.open_module_tree', 'form', 'account_deferred_revenue')"
class="btn odoo_purple">
<span class="fa fa-arrow-circle-o-down"/> Install Now
</a>
+2
View File
@@ -65,6 +65,8 @@ class Planner(models.Model):
module = self.env['ir.module.module'].sudo().search([('name', '=', module_name)], limit=1)
if module:
params['id'] = module.id
else:
return "#show_enterprise"
return "/web#%s" % (urlencode(params),)
@api.model
@@ -49,6 +49,7 @@ var PlannerDialog = Widget.extend({
category_selector: 'div[menu-category-id]',
events: {
'click li a[href^="#"]:not([data-toggle="collapse"])': 'change_page',
'click a[href^="#show_enterprise"]': 'show_enterprise',
'click button.mark_as_done': 'click_on_done',
'click a.btn-next': 'change_to_next_page',
'click .o_planner_close_block span': 'close_modal',
@@ -420,7 +421,40 @@ var PlannerDialog = Widget.extend({
destroy: function() {
this.$el.modal('hide');
return this._super.apply(this, arguments);
}
},
show_enterprise: function(ev) {
ev.preventDefault();
var message = $(QWeb.render('EnterpriseUpgrade'));
var buttons = [
{
text: _t("Upgrade now"),
classes: 'btn-primary',
close: true,
click: this.confirm_upgrade,
},
{
text: _t("Cancel"),
close: true,
},
];
var dialog = new Dialog(this, {
size: 'medium',
buttons: buttons,
$content: $('<div>', {
html: message,
}),
title: _t("Odoo Enterprise"),
}).open();
// force dialog to be hover the planner
dialog.$el.parents('.modal').css('z-index', 1052);
return dialog;
},
confirm_upgrade: function() {
new Model("res.users").call("search_count", [[["share", "=", false]]]).then(function(data) {
window.location = "https://www.odoo.com/odoo-enterprise/upgrade?utm_medium=community_upgrade&num_users=" + data;
});
},
});
return {