1 openerp.base_default_home = function (openerp) {
2 QWeb.add_template('/base_default_home/static/src/xml/base_default_home.xml');
4 openerp.base_default_home = {
8 module: 'crm', name: 'CRM',
9 help: "Acquire leads, follow opportunities, manage prospects and phone calls, \u2026"
11 module: 'sale', name: 'Sales',
12 help: "Do quotations, follow sales orders, invoice and control deliveries"
14 module: 'account_voucher', name: 'Invoicing',
15 help: "Send invoice, track payments and reminders"
17 module: 'project', name: 'Projects',
18 help: "Manage projects, track tasks, invoice task works, follow issues, \u2026"
22 module: 'purchase', name: 'Purchase',
23 help: "Do purchase orders, control invoices and reception, follow your suppliers, \u2026"
25 module: 'stock', name: 'Warehouse',
26 help: "Track your stocks, schedule product moves, manage incoming and outgoing shipments, \u2026"
28 module: 'hr', name: 'Human Resources',
29 help: "Manage employees and their contracts, follow laves, recruit people, \u2026"
31 module: 'point_of_sale', name: 'Point of Sales',
32 help: "Manage shop sales, use touch-screen POS"
36 module: 'profile_tools', name: 'Extra Tools',
37 help: "Track ideas, manage lunch, create surveys, share data"
39 module: 'mrp', name: 'Manufacturing',
40 help: "Manage your manufacturing, control your supply chain, personalize master data, \u2026"
42 module: 'marketing', name: 'Marketing',
43 help: "Manage campaigns, follow activities, automate emails, \u2026"
45 module: 'knowledge', name: 'Knowledge',
46 help: "Track your documents, browse your files, \u2026"
52 openerp.base.WebClient.include({
53 default_home: function () {
55 // resig class can't handle _super in async contexts, by the
56 // time async callback comes back, _super has already been
57 // reset to a baseline value of this.prototype (or something
59 old_home = this._super;
60 var Installer = new openerp.base.DataSet(
61 this, 'base.setup.installer');
62 Installer.call('already_installed', [], function (installed_modules) {
63 if (!_(installed_modules).isEmpty()) {
64 return old_home.call(self);
66 self.$element.find('.oe-application').html(
67 QWeb.render('StaticHome', {
68 url: window.location.protocol + '//' + window.location.host + window.location.pathname,
69 session: self.session,
70 rows: openerp.base_default_home.applications
71 })).delegate('.oe-static-home-tile-text button', 'click', function () {
72 self.install_module($(this).val());
75 }, function (err, event) {
76 event.preventDefault();
77 return old_home.call(self);
80 install_module: function (module_name) {
81 var Modules = new openerp.base.DataSetSearch(
82 this, 'ir.module.module', null,
83 [['name', '=', module_name], ['state', '=', 'uninstalled']]),
84 Upgrade = new openerp.base.DataSet(this, 'base.module.upgrade');
87 message: '<img src="/base_default_home/static/src/img/throbber.gif">'
89 Modules.read_slice(['id'], null, null, function (records) {
90 if (!(records.length === 1)) { return; }
91 Modules.call('state_update',
92 [_.pluck(records, 'id'), 'to install', ['uninstalled']],
94 Upgrade.call('upgrade_module', [[]], function () {
96 // TODO: less brutal reloading
97 window.location.reload(true);