diff --git a/addons/account/account.py b/addons/account/account.py index 73c42b4f863..6ae6968f364 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -920,7 +920,10 @@ class account_move(osv.osv): amount+= (line.debit - line.credit) return amount - def _centralise(self, cr, uid, move, mode): + def _centralise(self, cr, uid, move, mode, context=None): + if context is None: + context = {} + if mode=='credit': account_id = move.journal_id.default_debit_account_id.id mode2 = 'debit' @@ -943,8 +946,9 @@ class account_move(osv.osv): if res: line_id = res[0] else: + context.update({'journal_id': move.journal_id.id, 'period_id': move.period_id.id}) line_id = self.pool.get('account.move.line').create(cr, uid, { - 'name': 'Centralisation '+mode, + 'name': _t(cr, None, 'selection', context.get('lang'), source=(mode.capitalize()+' Centralisation')) or (mode.capitalize()+' Centralisation'), 'centralisation': mode, 'account_id': account_id, 'move_id': move.id, @@ -953,7 +957,7 @@ class account_move(osv.osv): 'date': move.period_id.date_stop, 'debit': 0.0, 'credit': 0.0, - }, {'journal_id': move.journal_id.id, 'period_id': move.period_id.id}) + }, context) # find the first line of this move with the other mode # so that we can exclude it from our calculation @@ -1035,8 +1039,8 @@ class account_move(osv.osv): # continue if journal.centralisation: - self._centralise(cr, uid, move, 'debit') - self._centralise(cr, uid, move, 'credit') + self._centralise(cr, uid, move, 'debit', context=context) + self._centralise(cr, uid, move, 'credit', context=context) self.pool.get('account.move.line').write(cr, uid, line_draft_ids, { 'state': 'valid' }, context, check=False) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 7e289f695ea..30a472032f0 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -578,7 +578,7 @@ class account_bank_statement_line(osv.osv): 'account_id': fields.many2one('account.account','Account', required=True), 'statement_id': fields.many2one('account.bank.statement', 'Statement', - select=True, required=True), + select=True, required=True, ondelete='cascade'), 'reconcile_id': fields.many2one('account.bank.statement.reconcile', 'Reconcile', states={'confirm':[('readonly',True)]}), 'move_ids': fields.many2many('account.move', diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index f5beac34601..309b67c0299 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -425,6 +425,20 @@ {'type':'out_refund'} + + + + tree + + + + + + form + + + + diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 04e695248db..fcade623b76 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -103,9 +103,10 @@ class account_move_line(osv.osv): total_new=0.00 for i in context['lines']: - total_new +=(i[2]['debit'] or 0.00)- (i[2]['credit'] or 0.00) - for item in i[2]: - data[item]=i[2][item] + if i[2]: + total_new +=(i[2]['debit'] or 0.00)- (i[2]['credit'] or 0.00) + for item in i[2]: + data[item]=i[2][item] if context['journal']: journal_obj=self.pool.get('account.journal').browse(cr,uid,context['journal']) if journal_obj.type == 'purchase': diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 1fa6df738c5..590a82a3ab1 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -340,7 +340,6 @@ - @@ -351,7 +350,6 @@
- diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 4a3298ba5b9..7a8cb8ce20e 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -758,7 +758,7 @@ class account_invoice(osv.osv): for i in line: i[2]['period_id'] = period_id - move_id = self.pool.get('account.move').create(cr, uid, move) + move_id = self.pool.get('account.move').create(cr, uid, move, context=context) new_move_name = self.pool.get('account.move').browse(cr, uid, move_id).name # make the invoice point to that move self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name}) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index f6443c0cf0b..be40d8bacef 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -162,8 +162,8 @@