From df11608dd36bc83ca889295b54951514efed8a0a Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 6 Jan 2010 14:34:05 +0100 Subject: [PATCH 01/15] [add] base_setup: modules installer bzr revid: xmo@tinyerp.com-20100106133405-majde4n8llrzxuh4 --- addons/base_setup/__init__.py | 1 + addons/base_setup/__terp__.py | 4 +- addons/base_setup/base_setup_installer.xml | 71 ++++++++++++++++++++ addons/base_setup/installer.py | 78 ++++++++++++++++++++++ 4 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 addons/base_setup/base_setup_installer.xml create mode 100644 addons/base_setup/installer.py diff --git a/addons/base_setup/__init__.py b/addons/base_setup/__init__.py index 250123c8f54..dc2b3dbc11a 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 660206a20be..898afe503fb 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 @@ + + + + base.setup.installer.view + base.setup.installer + form + + + +
+ Base Setup Modules Installation +
+ + + + + + + + + + Install Modules + +
+
+
+ + + Base Setup Modules Installation + ir.actions.act_window + base.setup.installer + + form + form + new + + + + + 1 + +
+
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 (). +# +# 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 . +# +############################################################################## +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() + From 24b29730f28f97fee48b93d35031b4ac22cfd546 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 6 Jan 2010 15:25:33 +0100 Subject: [PATCH 02/15] [add] hr: modules installer bzr revid: xmo@tinyerp.com-20100106142533-1gdvrblv32eqj06a --- addons/hr/__init__.py | 1 + addons/hr/__terp__.py | 3 +- addons/hr/hr_installer.xml | 65 ++++++++++++++++++++++++++++++++++++++ addons/hr/installer.py | 42 ++++++++++++++++++++++++ 4 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 addons/hr/hr_installer.xml create mode 100644 addons/hr/installer.py diff --git a/addons/hr/__init__.py b/addons/hr/__init__.py index fb89900b095..1b1cd902775 100644 --- a/addons/hr/__init__.py +++ b/addons/hr/__init__.py @@ -20,6 +20,7 @@ ############################################################################## import hr +import installer import hr_department import report diff --git a/addons/hr/__terp__.py b/addons/hr/__terp__.py index c62f6ccbf5d..80e7facc89b 100644 --- a/addons/hr/__terp__.py +++ b/addons/hr/__terp__.py @@ -43,7 +43,8 @@ 'security/ir.model.access.csv', 'hr_view.xml', 'hr_department_view.xml', - 'process/hr_process.xml' + 'process/hr_process.xml', + 'hr_installer.xml' ], 'demo_xml': ['hr_demo.xml', 'hr_department_demo.xml'], 'installable': True, diff --git a/addons/hr/hr_installer.xml b/addons/hr/hr_installer.xml new file mode 100644 index 00000000000..4e8a66a5833 --- /dev/null +++ b/addons/hr/hr_installer.xml @@ -0,0 +1,65 @@ + + + + hr.installer.view + hr.installer + form + + + +
+ Human Resources Modules Installation +
+ + + + + + + + + + Install Modules + +
+
+
+ + + Human Resources Modules Installation + ir.actions.act_window + hr.installer + + form + form + new + + + + + 1 + +
+
diff --git a/addons/hr/installer.py b/addons/hr/installer.py new file mode 100644 index 00000000000..1ac9ce91d4c --- /dev/null +++ b/addons/hr/installer.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# 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 . +# +############################################################################## +from osv import fields, osv + +class hr_installer(osv.osv_memory): + _name = 'hr.installer' + _inherit = 'res.config.installer' + + _columns = { + # Human Resources Management + 'hr_holidays':fields.boolean('Holidays / Leaves Management'), + 'hr_expense':fields.boolean('Expenses'), + 'hr_jobs':fields.boolean('Recruitement Process'), + 'hr_timesheet_sheet':fields.boolean('Timesheets'), + 'hr_contract':fields.boolean("Employee's Contracts"), + 'hr_evaluation':fields.boolean('Periodic Evaluations'), + 'hr_attendance':fields.boolean('Attendances (Sign In/Out)'), + } + _defaults = { + 'hr_holidays': True, + 'hr_expense': True, + } +hr_installer() + From fd3f48784d5f4920d5d51c6ffba80b262cb925ec Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 6 Jan 2010 15:57:55 +0100 Subject: [PATCH 03/15] [fix] hr: title of installer view bzr revid: xmo@tinyerp.com-20100106145755-pgy4jlwla57wfvmr --- addons/hr/hr_installer.xml | 2 +- addons/hr/installer.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/hr/hr_installer.xml b/addons/hr/hr_installer.xml index 4e8a66a5833..4f7c1993963 100644 --- a/addons/hr/hr_installer.xml +++ b/addons/hr/hr_installer.xml @@ -12,7 +12,7 @@ - +