diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 0131ca0437b..06c3ed15a93 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -133,7 +133,9 @@ module named account_voucher. 'test/account_bank_statement.yml', 'test/account_cash_statement.yml', 'test/account_report.yml', - ], + + + ], 'installable': True, 'active': False, 'certificate': '0080331923549', diff --git a/addons/account/account.py b/addons/account/account.py index 470282fadcd..f79e36c7681 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -204,7 +204,7 @@ class account_account(osv.osv): args[pos] = ('id', 'in', ids1) pos += 1 - if context and context.has_key('consolidate_childs'): #add consolidated childs of accounts + if context and context.has_key('consolidate_children'): #add consolidated children of accounts ids = super(account_account, self).search(cr, uid, args, offset, limit, order, context=context, count=count) for consolidate_child in self.browse(cr, uid, context['account_id'], context=context).child_consol_ids: @@ -285,6 +285,7 @@ class account_account(osv.osv): children_and_consolidated.reverse() brs = list(self.browse(cr, uid, children_and_consolidated, context=context)) sums = {} + currency_obj = self.pool.get('res.currency') while brs: current = brs[0] # can_compute = True @@ -299,8 +300,11 @@ class account_account(osv.osv): brs.pop(0) for fn in field_names: sums.setdefault(current.id, {})[fn] = accounts.get(current.id, {}).get(fn, 0.0) - if current.child_id: - sums[current.id][fn] += sum(sums[child.id][fn] for child in current.child_id) + for child in current.child_id: + if child.company_id.currency_id.id == current.company_id.currency_id.id: + sums[current.id][fn] += sums[child.id][fn] + else: + sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context) res = {} null_result = dict((fn, 0.0) for fn in field_names) for id in ids: @@ -607,8 +611,8 @@ class account_journal(osv.osv): } _defaults = { - 'user_id': lambda self,cr,uid,context: uid, - 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, + 'user_id': lambda self, cr, uid, context: uid, + 'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, } _sql_constraints = [ ('code_company_uniq', 'unique (code, company_id)', 'The code of the journal must be unique per company !'), @@ -708,7 +712,6 @@ class account_journal(osv.osv): return self.name_get(cr, user, ids, context=context) - def onchange_type(self, cr, uid, ids, type, currency, context=None): obj_data = self.pool.get('ir.model.data') user_pool = self.pool.get('res.users') @@ -1278,6 +1281,8 @@ class account_move(osv.osv): return super(account_move, self).copy(cr, uid, id, default, context) def unlink(self, cr, uid, ids, context=None, check=True): + if context is None: + context = {} toremove = [] obj_move_line = self.pool.get('account.move.line') for move in self.browse(cr, uid, ids, context=context): @@ -1916,7 +1921,7 @@ class account_tax(osv.osv): RETURN: [ tax ] tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_id':2} - one tax for each tax id in IDS and their childs + one tax for each tax id in IDS and their children """ res = self._unit_compute(cr, uid, taxes, price_unit, address_id, product, partner, quantity) total = 0.0 @@ -2011,7 +2016,7 @@ class account_tax(osv.osv): RETURN: [ tax ] tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_id':2} - one tax for each tax id in IDS and their childs + one tax for each tax id in IDS and their children """ res = self._unit_compute_inv(cr, uid, taxes, price_unit, address_id, product, partner=None) total = 0.0 @@ -2611,11 +2616,12 @@ class wizard_multi_charts_accounts(osv.osv_memory): cr.execute("SELECT company_id FROM account_account WHERE active = 't' AND account_account.parent_id IS NULL AND name != %s", ("Chart For Automated Tests",)) configured_cmp = [r[0] for r in cr.fetchall()] unconfigured_cmp = list(set(company_ids)-set(configured_cmp)) - if unconfigured_cmp: - cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)] - for field in res['fields']: - if field == 'company_id': - res['fields'][field]['domain'] = unconfigured_cmp + for field in res['fields']: + if field == 'company_id': + res['fields'][field]['domain'] = unconfigured_cmp + res['fields'][field]['selection'] = [('', '')] + if unconfigured_cmp: + cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)] res['fields'][field]['selection'] = cmp_select return res diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index e24e763ff56..b59df303170 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -50,11 +50,10 @@ class account_analytic_line(osv.osv): if context is None: context = {} if context.get('from_date',False): - args.append(['date', '>=',context['from_date']]) + args.append(['date', '>=', context['from_date']]) if context.get('to_date',False): - args.append(['date','<=',context['to_date']]) - + args.append(['date','<=', context['to_date']]) return super(account_analytic_line, self).search(cr, uid, args, offset, limit, order, context=context, count=count) @@ -158,4 +157,4 @@ class res_partner(osv.osv): res_partner() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/account_demo.xml b/addons/account/account_demo.xml index 5ef0ee4992d..566185c70c3 100644 --- a/addons/account/account_demo.xml +++ b/addons/account/account_demo.xml @@ -126,6 +126,9 @@ - + + + + diff --git a/addons/account/account_end_fy.xml b/addons/account/account_end_fy.xml index 5f4ed44adfe..650bffc58e9 100644 --- a/addons/account/account_end_fy.xml +++ b/addons/account/account_end_fy.xml @@ -14,7 +14,7 @@ action="action_account_period_tree" id="menu_action_account_period_close_tree" parent="account.menu_account_end_year_treatments" - sequence="0" groups="base.group_extended,group_account_manager,group_account_user"/> + sequence="0" groups="base.group_extended"/> diff --git a/addons/account/account_installer.xml b/addons/account/account_installer.xml index 495b4f4e5ba..64d124f1dc2 100644 --- a/addons/account/account_installer.xml +++ b/addons/account/account_installer.xml @@ -24,7 +24,7 @@ - + diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index f0cec0abda3..5b661e3e7d7 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -155,7 +155,7 @@