summaryrefslogtreecommitdiff
path: root/addons/base_setup
diff options
context:
space:
mode:
authorChristophe Simonis <chs@tinyerp.com>2010-01-13 15:03:28 +0100
committerChristophe Simonis <chs@tinyerp.com>2010-01-13 15:03:28 +0100
commit3dfcd6465b25cc8529a0ba4d68cf665a186c8617 (patch)
treeaf353483f09722473b6e7ee6baf6c2329275b527 /addons/base_setup
parent61880aa6eac1cfb3e6538cd23d1c4a583619a489 (diff)
parent2234cde1a0a75320af1936ac86db65dd75cf94f8 (diff)
[MERGE]
bzr revid: chs@tinyerp.com-20100113140328-71w2yvlwbfn8oj34
Diffstat (limited to 'addons/base_setup')
-rw-r--r--addons/base_setup/__init__.py1
-rw-r--r--addons/base_setup/__terp__.py4
-rw-r--r--addons/base_setup/base_setup_installer.xml71
-rw-r--r--addons/base_setup/installer.py78
4 files changed, 153 insertions, 1 deletions
diff --git a/addons/base_setup/__init__.py b/addons/base_setup/__init__.py
index f8a7a810426..2e2da2196e5 100644
--- a/addons/base_setup/__init__.py
+++ b/addons/base_setup/__init__.py
@@ -19,6 +19,7 @@
#
##############################################################################
+import installer
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_setup/__terp__.py b/addons/base_setup/__terp__.py
index 88f57f599df..6f7f4337740 100644
--- a/addons/base_setup/__terp__.py
+++ b/addons/base_setup/__terp__.py
@@ -41,7 +41,9 @@
'website': 'http://www.openerp.com',
'depends': ['base'],
'init_xml': ['base_setup_data.xml'],
- 'update_xml': ['security/ir.model.access.csv', 'base_setup_wizard.xml'],
+ 'update_xml': ['security/ir.model.access.csv',
+ 'base_setup_wizard.xml',
+ 'base_setup_installer.xml'],
'demo_xml': ['base_setup_demo.xml'],
'installable': True,
'active': True,
diff --git a/addons/base_setup/base_setup_installer.xml b/addons/base_setup/base_setup_installer.xml
new file mode 100644
index 00000000000..b5735d7075b
--- /dev/null
+++ b/addons/base_setup/base_setup_installer.xml
@@ -0,0 +1,71 @@
+<openerp>
+ <data>
+ <record id="view_base_setup_installer" model="ir.ui.view">
+ <field name="name">base.setup.installer.view</field>
+ <field name="model">base.setup.installer</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="base.res_config_view_base"/>
+ <field name="arch" type="xml">
+ <data>
+ <form position="attributes"><attribute name="string">
+ Base Setup Modules Installation
+ </attribute></form>
+
+ <group string="res_config_contents" position="replace">
+ <separator string="Install Modules" colspan="4"/>
+ <image name="gtk-dialog-info"/>
+ <newline/>
+ <label align="0.0" string=" Lorem ipsum dolor
+ sit amet, consectetur adipiscing elit. Cras metus
+ augue, ultricies et vehicula id, fringilla quis
+ mauris. Vestibulum fringilla ipsum sit amet est
+ adipiscing eget euismod velit semper. Proin non mauris
+ velit. Donec malesuada nisi sed augue viverra commodo
+ sagittis nisi rutrum. Cras vitae libero nunc, a
+ molestie sapien. Proin et augue sit amet est egestas
+ fermentum ut eu lacus. Etiam nisi orci, volutpat
+ aliquam viverra interdum, vehicula iaculis
+ lectus. Mauris ligula sapien, auctor in pharetra non,
+ ultrices quis odio."/>
+ <group>
+ <separator string="Generic Modules" colspan="4"/>
+ <field name="crm"/> <field name="sale"/>
+ <field name="project"/> <field name="knowledge"/>
+ <field name="stock"/> <field name="mrp"/>
+ <field name="account"/>
+ <field name="charts" attrs="{readonly:[('account','=',False)]}"/>
+ <field name="purchase"/> <field name="hr"/>
+ <field name="pos"/> <field name="marketing"/>
+ <field name="tools"/> <field name="report_design"/>
+ <separator string="Generic Modules" colspan="4"/>
+ <field name="profile_association"/>
+ <field name="profile_training"/>
+ <field name="profile_auction"/>
+ <field name="profile_bookstore"/>
+ </group>
+ </group>
+
+ <xpath expr='//button[@name="action_skip"]' position='replace'/>
+ <xpath expr='//button[@name="action_next"]' position='attributes'>
+ <attribute name='string'>Install Modules</attribute>
+ </xpath>
+ </data>
+ </field>
+ </record>
+
+ <record id="action_base_setup_installer" model="ir.actions.act_window">
+ <field name="name">Base Setup Modules Installation</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">base.setup.installer</field>
+ <field name="view_id" ref="view_base_setup_installer"/>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ </record>
+
+ <record id="base_setup_installer_todo" model="ir.actions.todo">
+ <field name="action_id" ref="action_base_setup_installer"/>
+ <field name="sequence">1</field>
+ </record>
+ </data>
+</openerp>
diff --git a/addons/base_setup/installer.py b/addons/base_setup/installer.py
new file mode 100644
index 00000000000..8aa2ec23ed4
--- /dev/null
+++ b/addons/base_setup/installer.py
@@ -0,0 +1,78 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from osv import fields, osv
+from itertools import chain
+from operator import itemgetter
+import netsvc
+
+class base_setup_installer(osv.osv_memory):
+ _name = 'base.setup.installer'
+ _inherit = 'res.config.installer'
+
+ def _get_charts(self, cr, uid, context=None):
+ modules = self.pool.get('ir.module.module')
+ ids = modules.search(cr, uid, [('category_id','=','Account Charts'),
+ ('state','!=','installed')])
+ return list(
+ sorted(((m.name, m.shortdesc)
+ for m in modules.browse(cr, uid, ids)),
+ key=itemgetter(1)))
+
+ def _if_account(self, cr, uid, ids, context=None):
+ chart = self.read(cr, uid, ids, ['charts'],
+ context=context)[0]['charts']
+ self.logger.notifyChannel(
+ 'installer', netsvc.LOG_DEBUG,
+ 'Addon "account" selected, installing chart of accounts %s'%chart)
+ return [chart]
+
+ _install_if = {
+ ('sale','crm'): ['sale_crm'],
+ ('sale','project'): ['project_mrp'],
+ }
+ _columns = {
+ # Generic modules
+ 'crm':fields.boolean('Customer Relationship Management'),
+ 'sale':fields.boolean('Sales Management'),
+ 'project':fields.boolean('Project Management'),
+ 'knowledge':fields.boolean('Knowledge Management'),
+ 'stock':fields.boolean('Warehouse Management'),
+ 'mrp':fields.boolean('Manufacturing'),
+ 'account':fields.boolean('Financial & Accounting'),
+ 'charts':fields.selection(_get_charts, 'Chart of Accounts',
+ readonly=True),
+ 'purchase':fields.boolean('Purchase Management'),
+ 'hr':fields.boolean('Human Resources'),
+ 'pos':fields.boolean('Point of Sales'),
+ 'marketing':fields.boolean('Marketing'),
+ 'tools':fields.boolean('Miscellaneous Tools'),
+ 'report_design':fields.boolean('Advanced Reporting'),
+ # Vertical modules
+ 'profile_association':fields.boolean('Associations'),
+ 'profile_training':fields.boolean('Training Centers'),
+ 'profile_auction':fields.boolean('Auction Houses'),
+ 'profile_bookstore':fields.boolean('Book Stores'),
+ }
+ _defaults = {
+ 'crm': True,
+ }
+base_setup_installer()
+