diff --git a/addons/account/account.py b/addons/account/account.py index 45308a9e7d4..1a593e4ad59 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2774,6 +2774,7 @@ class account_chart_template(osv.osv): 'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'), 'code_digits': fields.integer('# of Digits', required=True, help="No. of Digits to use for account code"), 'visible': fields.boolean('Can be Visible?', help="Set this to False if you don't want this template to be used actively in the wizard that generate Chart of Accounts from templates, this is useful when you want to generate accounts of this template only when loading its child template."), + 'currency_id': fields.many2one('res.currency', 'Currency'), 'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sale and purchase rates or choose from list of taxes. This last choice assumes that the set of tax defined on this template is complete'), 'account_root_id': fields.many2one('account.account.template', 'Root Account', domain=[('parent_id','=',False)]), 'tax_code_root_id': fields.many2one('account.tax.code.template', 'Root Tax Code', domain=[('parent_id','=',False)]), @@ -3029,16 +3030,6 @@ class wizard_multi_charts_accounts(osv.osv_memory): 'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sales and purchase rates or use the usual m2o fields. This last choice assumes that the set of tax defined for the chosen template is complete'), } - def onchange_company_id(self, cr, uid, ids, company_id, context=None): - if context is None:context = {} - if context.get('default_currency_id', False): - dummy, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', context.get('default_currency_id')) - return {'value': {'currency_id': view_id}} - currency_id = False - if company_id: - currency_id = self.pool.get('res.company').browse(cr, uid, company_id, context=context).currency_id.id - return {'value': {'currency_id': currency_id}} - def onchange_tax_rate(self, cr, uid, ids, rate=False, context=None): return {'value': {'purchase_tax_rate': rate or False}} @@ -3048,7 +3039,8 @@ class wizard_multi_charts_accounts(osv.osv_memory): res['value'] = {'complete_tax_set': False, 'sale_tax': False, 'purchase_tax': False} if chart_template_id: data = self.pool.get('account.chart.template').browse(cr, uid, chart_template_id, context=context) - res['value'].update({'complete_tax_set': data.complete_tax_set}) + currency_id = data.currency_id.id or self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id + res['value'].update({'complete_tax_set': data.complete_tax_set, 'currency_id': currency_id}) if data.complete_tax_set: # default tax is given by the lowest sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 91c6d6608fd..cb53d7d8fdc 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2120,7 +2120,7 @@ - +