[IMP]: account: Chart of account is linked to the country user set in main company setup. If user put Belgium, the chart of account is belgium plan compatble normalisé. If user set a country for which there is not chart of account, it is Generic chart of account by default.
bzr revid: rpa@tinyerp.com-20100914055748-ku2ybuu9hat3bh4j
This commit is contained in:
parent
7909ba5672
commit
91e1d6b445
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue