[ADD] default home action addon
authorXavier Morel <xmo@openerp.com>
Tue, 19 Jul 2011 12:33:05 +0000 (14:33 +0200)
committerXavier Morel <xmo@openerp.com>
Tue, 19 Jul 2011 12:33:05 +0000 (14:33 +0200)
bzr revid: xmo@openerp.com-20110719123305-bd5s1pbcjpoc927g

17 files changed:
addons/base_default_home/__init__.py [new file with mode: 0644]
addons/base_default_home/__openerp__.py [new file with mode: 0644]
addons/base_default_home/static/src/img/accounting.png [new file with mode: 0644]
addons/base_default_home/static/src/img/administration.png [new file with mode: 0644]
addons/base_default_home/static/src/img/association.png [new file with mode: 0644]
addons/base_default_home/static/src/img/human-resources.png [new file with mode: 0644]
addons/base_default_home/static/src/img/knowledge.png [new file with mode: 0644]
addons/base_default_home/static/src/img/manufacturing.png [new file with mode: 0644]
addons/base_default_home/static/src/img/marketing.png [new file with mode: 0644]
addons/base_default_home/static/src/img/point-of-sale.png [new file with mode: 0644]
addons/base_default_home/static/src/img/project.png [new file with mode: 0644]
addons/base_default_home/static/src/img/purchases.png [new file with mode: 0644]
addons/base_default_home/static/src/img/sales.png [new file with mode: 0644]
addons/base_default_home/static/src/img/tools.png [new file with mode: 0644]
addons/base_default_home/static/src/img/warehouse.png [new file with mode: 0644]
addons/base_default_home/static/src/js/home.js [new file with mode: 0644]
addons/base_default_home/static/src/xml/base_default_home.xml [new file with mode: 0644]

diff --git a/addons/base_default_home/__init__.py b/addons/base_default_home/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/addons/base_default_home/__openerp__.py b/addons/base_default_home/__openerp__.py
new file mode 100644 (file)
index 0000000..f86a835
--- /dev/null
@@ -0,0 +1,7 @@
+{
+    "name" : "OpenERP Web installer home",
+    "version" : "2.0",
+    "depends" : ['base'],
+    'active': True,
+    'js': ['static/src/js/home.js'],
+}
diff --git a/addons/base_default_home/static/src/img/accounting.png b/addons/base_default_home/static/src/img/accounting.png
new file mode 100644 (file)
index 0000000..6110536
Binary files /dev/null and b/addons/base_default_home/static/src/img/accounting.png differ
diff --git a/addons/base_default_home/static/src/img/administration.png b/addons/base_default_home/static/src/img/administration.png
new file mode 100644 (file)
index 0000000..ba4e403
Binary files /dev/null and b/addons/base_default_home/static/src/img/administration.png differ
diff --git a/addons/base_default_home/static/src/img/association.png b/addons/base_default_home/static/src/img/association.png
new file mode 100644 (file)
index 0000000..ed976c3
Binary files /dev/null and b/addons/base_default_home/static/src/img/association.png differ
diff --git a/addons/base_default_home/static/src/img/human-resources.png b/addons/base_default_home/static/src/img/human-resources.png
new file mode 100644 (file)
index 0000000..69a0dc1
Binary files /dev/null and b/addons/base_default_home/static/src/img/human-resources.png differ
diff --git a/addons/base_default_home/static/src/img/knowledge.png b/addons/base_default_home/static/src/img/knowledge.png
new file mode 100644 (file)
index 0000000..35c8d57
Binary files /dev/null and b/addons/base_default_home/static/src/img/knowledge.png differ
diff --git a/addons/base_default_home/static/src/img/manufacturing.png b/addons/base_default_home/static/src/img/manufacturing.png
new file mode 100644 (file)
index 0000000..29d8468
Binary files /dev/null and b/addons/base_default_home/static/src/img/manufacturing.png differ
diff --git a/addons/base_default_home/static/src/img/marketing.png b/addons/base_default_home/static/src/img/marketing.png
new file mode 100644 (file)
index 0000000..e37fefa
Binary files /dev/null and b/addons/base_default_home/static/src/img/marketing.png differ
diff --git a/addons/base_default_home/static/src/img/point-of-sale.png b/addons/base_default_home/static/src/img/point-of-sale.png
new file mode 100644 (file)
index 0000000..ddd5b8a
Binary files /dev/null and b/addons/base_default_home/static/src/img/point-of-sale.png differ
diff --git a/addons/base_default_home/static/src/img/project.png b/addons/base_default_home/static/src/img/project.png
new file mode 100644 (file)
index 0000000..8b7da18
Binary files /dev/null and b/addons/base_default_home/static/src/img/project.png differ
diff --git a/addons/base_default_home/static/src/img/purchases.png b/addons/base_default_home/static/src/img/purchases.png
new file mode 100644 (file)
index 0000000..9b8bf4f
Binary files /dev/null and b/addons/base_default_home/static/src/img/purchases.png differ
diff --git a/addons/base_default_home/static/src/img/sales.png b/addons/base_default_home/static/src/img/sales.png
new file mode 100644 (file)
index 0000000..0025e04
Binary files /dev/null and b/addons/base_default_home/static/src/img/sales.png differ
diff --git a/addons/base_default_home/static/src/img/tools.png b/addons/base_default_home/static/src/img/tools.png
new file mode 100644 (file)
index 0000000..30b1514
Binary files /dev/null and b/addons/base_default_home/static/src/img/tools.png differ
diff --git a/addons/base_default_home/static/src/img/warehouse.png b/addons/base_default_home/static/src/img/warehouse.png
new file mode 100644 (file)
index 0000000..6232eaa
Binary files /dev/null and b/addons/base_default_home/static/src/img/warehouse.png differ
diff --git a/addons/base_default_home/static/src/js/home.js b/addons/base_default_home/static/src/js/home.js
new file mode 100644 (file)
index 0000000..ac319e2
--- /dev/null
@@ -0,0 +1,40 @@
+openerp.base_default_home = function (openerp) {
+    QWeb.add_template('/base_default_home/static/src/xml/base_default_home.xml');
+
+    var old_home = openerp.base.WebClient.prototype.default_home;
+
+    openerp.base_default_home = {
+        applications: [[
+                'sales',
+                'purchases',
+                'warehouse',
+                'manufacturing'
+            ], [
+                'project',
+                'accounting',
+                'human resources',
+                'marketing'
+            ], [
+                'knowledge',
+                'point of sale',
+                'tools',
+                'administration'
+            ]
+        ]
+    };
+
+    openerp.base.WebClient.prototype.default_home = function () {
+        var self = this;
+        var Installer = new openerp.base.DataSet(
+                this.session, 'base.setup.installer');
+        Installer.call('already_installed', [], function (installed_modules) {
+            if (!_(installed_modules).isEmpty()) {
+                return old_home.call(self);
+            }
+            self.$element.find('.oe-application').html(
+                QWeb.render('HomeInstallerTiles', {
+                    rows: openerp.base_default_home.applications
+            }));
+        });
+    }
+};
diff --git a/addons/base_default_home/static/src/xml/base_default_home.xml b/addons/base_default_home/static/src/xml/base_default_home.xml
new file mode 100644 (file)
index 0000000..829e60b
--- /dev/null
@@ -0,0 +1,17 @@
+<template>
+    <div t-name="HomeInstallerTiles" class="oe-dashboard-home-tiles">
+        <table width="100%">
+            <tr t-foreach="rows" t-as="row">
+                <td t-foreach="row" t-as="application" width="25%">
+                    <div class="oe-dashboard-home-tile"
+                         t-att-data-menuid="application">
+                        <div class="oe-dashboard-home-tile-icon">
+                            <img t-att-src="'/base_default_home/static/src/img/' + application.replace(new RegExp('\\s', 'g'), '-') + '.png'"/>
+                        </div>
+                        <span><t t-esc="application"/></span>
+                    </div>
+                </td>
+            </tr>
+        </table>
+    </div>
+</template>