diff --git a/addons/account/account.py b/addons/account/account.py
index 3772a660de9..47c00ddb21a 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -1749,15 +1749,6 @@ class account_config_wizard(osv.osv_memory):
_name = 'account.config.wizard'
_inherit = 'res.config'
- def _get_charts(self, cr, uid, context):
- module_obj=self.pool.get('ir.module.module')
- ids=module_obj.search(cr, uid, [('category_id', '=', 'Account Charts'),
- ('state', '<>', 'installed')])
- res=[(m.id, m.shortdesc) for m in module_obj.browse(cr, uid, ids)]
- res.append((-1, 'None'))
- res.sort(key=lambda x: x[1])
- return res
-
_columns = {
'name':fields.char(
'Name', required=True, size=64,
@@ -1769,7 +1760,6 @@ class account_config_wizard(osv.osv_memory):
'date2': fields.date('End Date', required=True),
'period':fields.selection([('month','Month'), ('3months','3 Months')],
'Periods', required=True),
- 'charts' : fields.selection(_get_charts, 'Charts of Account',required=True)
}
_defaults = {
'code': lambda *a: time.strftime('%Y'),
@@ -1778,14 +1768,6 @@ class account_config_wizard(osv.osv_memory):
'date2': lambda *a: time.strftime('%Y-12-31'),
'period':lambda *a:'month',
}
- def install_account_chart(self, cr, uid, ids, context=None):
- for res in self.read(cr,uid,ids):
- chart_id = res['charts']
- if chart_id > 0:
- mod_obj = self.pool.get('ir.module.module')
- mod_obj.button_install(cr, uid, [chart_id], context=context)
- cr.commit()
- db, pool = pooler.restart_pool(cr.dbname, update_module=True)
def execute(self, cr, uid, ids, context=None):
for res in self.read(cr,uid,ids):
@@ -1805,7 +1787,6 @@ class account_config_wizard(osv.osv_memory):
res_obj.create_period(cr,uid,[new_id])
elif res['period']=='3months':
res_obj.create_period3(cr,uid,[new_id])
- self.install_account_chart(cr,uid,ids)
account_config_wizard()
diff --git a/addons/account/account_installer.xml b/addons/account/account_installer.xml
index fc96db128cf..d943bb452c7 100644
--- a/addons/account/account_installer.xml
+++ b/addons/account/account_installer.xml
@@ -23,6 +23,7 @@
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index ee2047bca88..c3b059950ad 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1460,8 +1460,6 @@
-
-
diff --git a/addons/account/installer.py b/addons/account/installer.py
index 3122fe77350..35a09406891 100644
--- a/addons/account/installer.py
+++ b/addons/account/installer.py
@@ -18,14 +18,30 @@
# along with this program. If not, see .
#
##############################################################################
+from operator import itemgetter
+
from osv import fields, osv
+import netsvc
class account_installer(osv.osv_memory):
_name = 'account.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')])
+ return list(
+ sorted(((m.name, m.shortdesc)
+ for m in modules.browse(cr, uid, ids)),
+ key=itemgetter(1)))
+
_columns = {
# Accounting
+ 'charts':fields.selection(_get_charts, 'Chart of Accounts',
+ required=True,
+ help="Installs localized accounting charts to match as closely as "
+ "possible the accounting needs of your company based on your "
+ "country."),
'account_analytic_default':fields.boolean('Analytic Accounting',
help="Automatically selects analytic accounts based on various "
"criteria."),
@@ -46,4 +62,17 @@ class account_installer(osv.osv_memory):
_defaults = {
'account_analytic_default':True,
}
+
+ def modules_to_install(self, cr, uid, ids, context=None):
+ modules = super(account_installer, self).modules_to_install(
+ cr, uid, ids, context=context)
+
+ chart = self.read(cr, uid, ids, ['charts'],
+ context=context)[0]['charts']
+ self.logger.notifyChannel(
+ 'installer', netsvc.LOG_DEBUG,
+ 'Installing chart of accounts %s'%chart)
+ return modules | set([chart])
+
+
account_installer()
diff --git a/addons/base_setup/base_setup_installer.xml b/addons/base_setup/base_setup_installer.xml
index bf359ec306e..f9b490c2e98 100644
--- a/addons/base_setup/base_setup_installer.xml
+++ b/addons/base_setup/base_setup_installer.xml
@@ -25,11 +25,10 @@ If you don't think you need any of these right now, you can easily install them
-
-
-
-
-
+
+
+
+
diff --git a/addons/base_setup/installer.py b/addons/base_setup/installer.py
index 3bdc34c48fa..2c1ba113e47 100644
--- a/addons/base_setup/installer.py
+++ b/addons/base_setup/installer.py
@@ -19,31 +19,12 @@
#
##############################################################################
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'],
@@ -73,10 +54,6 @@ class base_setup_installer(osv.osv_memory):
'account':fields.boolean('Financial & Accounting',
help="Helps you handle your accounting needs, as well as create "
"and track your budgets."),
- 'charts':fields.selection(_get_charts, 'Chart of Accounts',
- help="Installs localized accounting charts to match as closely as "
- "possible the accounting needs of your company based on your "
- "country."),
'purchase':fields.boolean('Purchase Management',
help="Helps you manage your purchase-related processes such as "
"requests for quotations, supplier invoices, etc..."),