From 91e1d6b44548673d8649ce768ba9a0768d4b04a2 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Tue, 14 Sep 2010 11:27:48 +0530 Subject: [PATCH] =?UTF-8?q?[IMP]:=20account:=20Chart=20of=20account=20is?= =?UTF-8?q?=20linked=20to=20the=20country=20user=20set=20in=20main=20compa?= =?UTF-8?q?ny=20setup.=20If=20user=20put=20Belgium,=20the=20chart=20of=20a?= =?UTF-8?q?ccount=20is=20belgium=20plan=20compatble=20normalis=C3=A9.=20If?= =?UTF-8?q?=20user=20set=20a=20country=20for=20which=20there=20is=20not=20?= =?UTF-8?q?chart=20of=20account,=20it=20is=20Generic=20chart=20of=20accoun?= =?UTF-8?q?t=20by=20default.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bzr revid: rpa@tinyerp.com-20100914055748-ku2ybuu9hat3bh4j --- addons/account/installer.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/addons/account/installer.py b/addons/account/installer.py index ef3ac72a261..6290dae7875 100644 --- a/addons/account/installer.py +++ b/addons/account/installer.py @@ -73,6 +73,21 @@ class account_installer(osv.osv_memory): return user.company_id.id return False + def _get_default_charts(self, cr, uid, context={}): + module_name = False + company_id = self._default_company(cr, uid, context=context) + company = self.pool.get('res.company').browse(cr, uid, company_id) + address_id = self.pool.get('res.partner').address_get(cr, uid, [company.partner_id.id]) + if address_id['default']: + address = self.pool.get('res.partner.address').browse(cr, uid, address_id['default']) + code = address.country_id.code + module_name = (code and 'l10n_' + code.lower()) or False + if module_name: + module_id = self.pool.get('ir.module.module').search(cr, uid, [('name', '=', module_name)]) + if module_id: + return module_name + return 'configurable' + _defaults = { 'date_start': lambda *a: time.strftime('%Y-01-01'), 'date_stop': lambda *a: time.strftime('%Y-12-31'), @@ -80,7 +95,8 @@ class account_installer(osv.osv_memory): 'sale_tax':lambda *a:0.0, 'purchase_tax':lambda *a:0.0, 'company_id': _default_company, - 'bank_accounts_id':_get_default_accounts + 'bank_accounts_id':_get_default_accounts, + 'charts': _get_default_charts } def on_change_tax(self, cr, uid, id, tax):