From b352ccc815709862a24ab4eb8aca97ded3ff9502 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 19 Nov 2010 10:53:05 +0530 Subject: [PATCH 1/6] [IMP] account_voucher: writeoff implementation bzr revid: psi@tinyerp.co.in-20101119052305-tmev02bzyyy2n3b0 --- addons/account/account_move_line.py | 2 + addons/account_voucher/account_voucher.py | 125 +++--------------- .../wizard/account_voucher_payment_option.py | 80 +++-------- .../wizard/account_voucher_payment_option.xml | 3 +- 4 files changed, 37 insertions(+), 173 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 93d5c37bd08..16ea52b65d4 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -716,6 +716,8 @@ class account_move_line(osv.osv): account_id = line['account_id']['id'] partner_id = (line['partner_id'] and line['partner_id']['id']) or False writeoff = debit - credit + if 'write_off' in context and context['write_off']['writeoff_amount']: + writeoff = context['write_off']['writeoff_amount'] # Ifdate_p in context => take this date if context.has_key('date_p') and context['date_p']: diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 14abad25413..bc5fef3ab44 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -543,7 +543,7 @@ class account_voucher(osv.osv): mod_obj = self.pool.get('ir.model.data') if context is None: context = {} - voucher = self.browse(cr, uid, [ids[0]], context=context)[0] + voucher = self.browse(cr, uid, ids, context=context)[0] debit= credit = 0.0 if voucher.line_dr_ids: for line in voucher.line_dr_ids: @@ -666,7 +666,6 @@ class account_voucher(osv.osv): 'date': inv.date, 'date_maturity': inv.date_due } - if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0): master_line = move_line_pool.create(cr, uid, move_line) @@ -719,9 +718,14 @@ class account_voucher(osv.osv): sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1 move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0 master_line = move_line_pool.create(cr, uid, move_line) + test_ids.append('master_line') if line.move_line_id.id: rec_ids = [master_line, line.move_line_id.id] rec_list_ids.append(rec_ids) + writeoff_account_id = False + writeoff_journal_id = False + writeoff_period_id = inv.period_id.id, + comment = False if not currency_pool.is_zero(cr, uid, inv.currency_id, line_total): diff = line_total @@ -745,119 +749,22 @@ class account_voucher(osv.osv): move_line['account_id'] = account_id move_line_pool.create(cr, uid, move_line) + for rec_ids in rec_list_ids: + if len(rec_ids) >= 2: + if 'write_off' in context and context['write_off']['writeoff_acc_id']: + writeoff_account_id = context['write_off']['writeoff_acc_id'] + writeoff_journal_id = context['write_off']['writeoff_journal_id'] + comment = context['write_off']['comment'] + self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) + else: + self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) + self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted', 'number': name, }) move_pool.post(cr, uid, [move_id], context={}) - for rec_ids in rec_list_ids: - if len(rec_ids) >= 2: - move_line_pool.reconcile_partial(cr, uid, rec_ids) - return True - - def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''): - if context is None: - context = {} - seq_obj = self.pool.get('ir.sequence') - #TODO check if we can use different period for payment and the writeoff line - assert len(ids)==1, "Can only pay one voucher at a time" - voucher = self.browse(cr, uid, ids[0]) - if voucher.number: - name = voucher.number - elif voucher.journal_id.sequence_id: - name = seq_obj.get_id(cr, uid, voucher.journal_id.sequence_id.id) - else: - raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !')) - if not voucher.reference: - ref = name.replace('/','') - else: - ref = voucher.reference - - src_account_id = voucher.account_id.id - # Take the seq as name for move - types = {'sale': -1, 'purchase': 1, 'payment': 1, 'receipt': -1} - direction = types[voucher.type] - #take the choosen date - if 'date_p' in context and context['date_p']: - date = context['date_p'] - else: - date = time.strftime('%Y-%m-%d') - # Take the amount in currency and the currency of the payment - if 'amount_currency' in context and context['amount_currency'] and 'currency_id' in context and context['currency_id']: - amount_currency = context['amount_currency'] - currency_id = context['currency_id'] - else: - amount_currency = False - currency_id = False - pay_journal = self.pool.get('account.journal').read(cr, uid, pay_journal_id, ['type'], context=context) - if voucher.type in ('sale', 'receipt'): - if pay_journal['type'] == 'bank': - entry_type = 'bank_pay_voucher' # Bank payment - else: - entry_type = 'pay_voucher' # Cash payment - else: - entry_type = 'cont_voucher' - - # Pay attention to the sign for both debit/credit AND amount_currency - l1 = { - 'debit': direction * pay_amount>0 and direction * pay_amount, - 'credit': direction * pay_amount<0 and - direction * pay_amount, - 'account_id': src_account_id, - 'partner_id': voucher.partner_id.id, - 'ref':ref, - 'date': date, - 'currency_id':currency_id, - 'amount_currency':amount_currency and direction * amount_currency or 0.0, - 'company_id': voucher.company_id.id, - } - l2 = { - 'debit': direction * pay_amount<0 and - direction * pay_amount, - 'credit': direction * pay_amount>0 and direction * pay_amount, - 'account_id': pay_account_id, - 'partner_id': voucher.partner_id.id, - 'ref':ref, - 'date': date, - 'currency_id':currency_id, - 'amount_currency':amount_currency and - direction * amount_currency or 0.0, - 'company_id': voucher.company_id.id, - } - - if not name: - name = voucher.line_ids and voucher.line_ids[0].name or voucher.number - l1['name'] = name - l2['name'] = name - lines = [(0, 0, l1), (0, 0, l2)] - move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'name': name, 'date': date} - move_id = self.pool.get('account.move').create(cr, uid, move, context=context) - - line_ids = [] - total = 0.0 - line = self.pool.get('account.move.line') - move_ids = [move_id,] - if voucher.move_id: - move_ids.append(voucher.move_id.id) - cr.execute('SELECT id FROM account_move_line '\ - 'WHERE move_id IN %s', - ((move_id,),)) - lines = line.browse(cr, uid, map(lambda x: x[0], cr.fetchall()) ) - for l in lines: - if l.account_id.id == src_account_id: - line_ids.append(l.id) - total += (l.debit or 0.0) - (l.credit or 0.0) - - voc_id, name = self.name_get(cr, uid, [voucher.id], context=context)[0] - if (not round(total,self.pool.get('decimal.precision').precision_get(cr, uid, 'Account'))) or writeoff_acc_id: - self.pool.get('account.move.line').reconcile(cr, uid, line_ids, 'manual', writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context) - else: - code = voucher.currency_id.code - # TODO: use currency's formatting function - msg = _("Invoice '%s' is paid partially: %s%s of %s%s (%s%s remaining)") % \ - (name, pay_amount, code, voucher.amount_total, code, total, code) - self.log(cr, uid, voc_id, msg) - self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context) - # Update the stored value (fields.function), so we write to trigger recompute - self.write(cr, uid, ids, {'state':'posted'}, context=context) return True def copy(self, cr, uid, id, default={}, context=None): diff --git a/addons/account_voucher/wizard/account_voucher_payment_option.py b/addons/account_voucher/wizard/account_voucher_payment_option.py index cbc22364fed..408bf909fd2 100644 --- a/addons/account_voucher/wizard/account_voucher_payment_option.py +++ b/addons/account_voucher/wizard/account_voucher_payment_option.py @@ -21,6 +21,7 @@ from osv import fields, osv from tools.translate import _ +import decimal_precision as dp class account_voucher_pay_writeoff(osv.osv_memory): """ @@ -28,11 +29,22 @@ class account_voucher_pay_writeoff(osv.osv_memory): """ _name = "account.voucher.pay.writeoff" _description = "Pay Voucher" + + def _get_amount(self, cr, uid, context=None): + voucher_obj = self.pool.get('account.voucher') + voucher = voucher_obj.browse(cr, uid, context['voucher_id'], context=context) + amount = 0.0 + for line in voucher.line_ids: + amount += line.amount_unreconciled + diff = amount - voucher.amount + return diff + _columns = { 'payment_option':fields.selection([ ('not_reconcile', 'Do not reconcile balance'), ('close_balance', 'close the balance'), ], 'Payment Option', required=True), + 'writeoff_amount': fields.float('Writeoff Amount', required=True, digits_compute = dp.get_precision('Account')), 'writeoff_acc_id': fields.many2one('account.account', 'Write-Off account'), 'writeoff_journal_id': fields.many2one('account.journal', 'Write-Off journal'), 'comment': fields.char('Comment', size=64, required=True), @@ -41,76 +53,18 @@ class account_voucher_pay_writeoff(osv.osv_memory): _defaults = { 'payment_option': 'not_reconcile', 'comment': 'Write-Off', + 'writeoff_amount': _get_amount } def pay_and_reconcile_writeoff(self, cr, uid, ids, context=None): voucher_obj = self.pool.get('account.voucher') - data = self.read(cr, uid, ids,context=context)[0] + data = self.read(cr, uid, ids, context=context)[0] voucher_id = context.get('voucher_id', False) - if data['payment_option'] == 'not_reconcile': - voucher_obj.action_move_line_create(cr, uid, [voucher_id], context=context) - return {} - context.update({'write_off':data}) - self.pool.get('account.voucher.pay').pay_and_reconcile(cr, uid, [voucher_id], context=context) + if data['payment_option'] == 'close_balance': + context.update({'write_off':data}) + voucher_obj.action_move_line_create(cr, uid, [voucher_id], context=context) return {} account_voucher_pay_writeoff() -class account_voucher_pay(osv.osv_memory): - """ - Generate pay invoice wizard, user can make partial or full payment for invoice. - """ - _name = "account.voucher.pay" - _description = "Pay Voucher" - - def pay_and_reconcile(self, cr, uid, ids, context=None): - cur_obj = self.pool.get('res.currency') - voucher_obj = self.pool.get('account.voucher') - if context is None: - context = {} - voucher = voucher_obj.browse(cr, uid, [ids[0]], context=context)[0] - writeoff_account_id = False - writeoff_journal_id = False - comment = False - - if 'write_off' in context and context['write_off'] : - writeoff_account_id = context['write_off']['writeoff_acc_id'] - writeoff_journal_id = context['write_off']['writeoff_journal_id'] - comment = context['write_off']['comment'] - - amount = voucher.amount - journal = voucher.journal_id - # Compute the amount in company's currency, with the journal currency (which is equal to payment currency) - # when it is needed : If payment currency (according to selected journal.currency) is <> from company currency - if journal.currency and voucher.company_id.currency_id.id<>journal.currency.id: - ctx = {'date': voucher.date} - amount = cur_obj.compute(cr, uid, journal.currency.id, voucher.company_id.currency_id.id, amount, context=ctx) - currency_id = journal.currency.id - # Put the paid amount in currency, and the currency, in the context if currency is different from company's currency - context.update({'amount_currency': voucher.amount, 'currency_id': currency_id}) - - if voucher.company_id.currency_id.id<>voucher.currency_id.id: - ctx = {'date':voucher.date} - amount = cur_obj.compute(cr, uid, voucher.currency_id.id, voucher.company_id.currency_id.id, amount, context=ctx) - currency_id = voucher.currency_id.id - # Put the paid amount in currency, and the currency, in the context if currency is different from company's currency - context.update({'amount_currency':voucher.amount,'currency_id':currency_id}) - - # Take the choosen date - if comment: - context.update({'date_p':voucher.date, 'comment':comment}) - else: - context.update({'date_p':voucher.date, 'comment':False}) - - acc_id = journal.default_credit_account_id and journal.default_credit_account_id.id - if not acc_id: - raise osv.except_osv(_('Error !'), _('Your journal must have a default credit and debit account.')) - - voucher_obj.pay_and_reconcile(cr, uid, ids, - amount, acc_id, voucher.period_id.id, journal.id, writeoff_account_id, - voucher.period_id, writeoff_journal_id, context, voucher.name) - return {} - -account_voucher_pay() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_voucher/wizard/account_voucher_payment_option.xml b/addons/account_voucher/wizard/account_voucher_payment_option.xml index 85980cd2b33..e762bcbc657 100644 --- a/addons/account_voucher/wizard/account_voucher_payment_option.xml +++ b/addons/account_voucher/wizard/account_voucher_payment_option.xml @@ -12,9 +12,10 @@ + + - From e86ddeff43666f1f36a0b11842c0389e17c6874d Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 19 Nov 2010 14:10:37 +0530 Subject: [PATCH 2/6] [IMP] account_voucher:Writeoff implementation for customer and supplier payments bzr revid: psi@tinyerp.co.in-20101119084037-jcqxpwz5349jwkm1 --- addons/account_voucher/account_voucher.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index bc5fef3ab44..d1e260dab66 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -718,7 +718,6 @@ class account_voucher(osv.osv): sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1 move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0 master_line = move_line_pool.create(cr, uid, move_line) - test_ids.append('master_line') if line.move_line_id.id: rec_ids = [master_line, line.move_line_id.id] rec_list_ids.append(rec_ids) @@ -749,16 +748,18 @@ class account_voucher(osv.osv): move_line['account_id'] = account_id move_line_pool.create(cr, uid, move_line) + voucher = self.browse(cr, uid, ids)[0] + for rec_ids in rec_list_ids: if len(rec_ids) >= 2: - if 'write_off' in context and context['write_off']['writeoff_acc_id']: - writeoff_account_id = context['write_off']['writeoff_acc_id'] - writeoff_journal_id = context['write_off']['writeoff_journal_id'] - comment = context['write_off']['comment'] - self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) - else: - self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) - + for line in voucher.line_ids: + if line.amount_unreconciled != line.amount: + if 'write_off' in context and context['write_off']['writeoff_acc_id']: + writeoff_account_id = context['write_off']['writeoff_acc_id'] + writeoff_journal_id = context['write_off']['writeoff_journal_id'] + comment = context['write_off']['comment'] + self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) + self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted', From 9373354e815a683f3d026d0fd6306ca4b0598f3c Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 19 Nov 2010 16:43:56 +0530 Subject: [PATCH 3/6] [IMP] account_voucher:Writeoff implementation for customer and supplier payments bzr revid: psi@tinyerp.co.in-20101119111356-1mxdvqj04xawm7b3 --- addons/account_voucher/account_voucher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index d1e260dab66..0425dc41ee9 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -759,7 +759,8 @@ class account_voucher(osv.osv): writeoff_journal_id = context['write_off']['writeoff_journal_id'] comment = context['write_off']['comment'] self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) - self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) + else: + self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted', From 6ff9caa04af0d0885bb1d24b90bf85c512377db6 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Mon, 22 Nov 2010 16:40:50 +0530 Subject: [PATCH 4/6] [IMP] account: cumulative balance for journal report bzr revid: psi@tinyerp.co.in-20101122111050-jjwk79g6m5lq7g0p --- addons/account/report/account_journal.py | 20 +++- addons/account/report/account_journal.rml | 112 +++++++++++----------- 2 files changed, 72 insertions(+), 60 deletions(-) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 82af01cdb0b..336a32b2a7a 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -117,10 +117,22 @@ class journal_print(report_sxw.rml_parse, common_report_header): move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted'] - - self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + '',(tuple(move_state), period_id, tuple(journal_id) )) - ids = map(lambda x: x[0], self.cr.fetchall()) - return obj_mline.browse(self.cr, self.uid, ids) + self.cr.execute("SELECT l.id, l.date, l.ref, l.name, l.debit, l.credit, m.name as move_name, acc.code as account_code, rp.name as partner_name "\ + "FROM account_move_line l "\ + "LEFT JOIN account_move m ON (m.id=l.move_id) "\ + "LEFT JOIN account_account acc ON (l.account_id = acc.id) "\ + "LEFT JOIN res_partner rp ON (l.partner_id=rp.id) "\ + "WHERE m.state IN %s "\ + "AND l.period_id = %s "\ + "AND l.journal_id IN %s " + self.query_get_clause + " "\ + "ORDER BY l."+ self.sort_selection + " ", + (tuple(move_state), period_id, tuple(journal_id) )) + res = self.cr.dictfetchall() + account_sum = 0.0 + for l in res: + account_sum += l['debit'] - l['credit'] + l['progress'] = account_sum + return res def _set_get_account_currency_code(self, account_id): self.cr.execute("SELECT c.symbol AS code "\ diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index cb37b4e83f5..0a20da7fc9a 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -176,9 +176,9 @@ - - - + + + @@ -202,44 +202,44 @@ - [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]] - [[ data['model']=='ir.ui.menu' and 'Chart of Account' or removeParentNode('para') ]] + [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]] + [[ data['model']=='ir.ui.menu' and 'Chart of Account' or removeParentNode('para') ]] Fiscal Year - Journal + Journal Filters By - Entries Sorted By + Entries Sorted By Target Moves - - [[ get_account(data) or '' ]] + + [[ get_account(data) or '' ]] [[ get_fiscalyear(data) or '' ]] - [[o.journal_id.name ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] - - Start Date - End Date - - - [[ formatLang(get_start_date(data),date=True) ]] - [[ formatLang(get_end_date(data),date=True) ]] - - - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] - - Start Period - End Period - - - [[ get_start_period(data) or removeParentNode('para') ]] - [[ get_end_period(data) or removeParentNode('para') ]] - - - - [[ get_sortby(data) ]] - [[ get_target_move(data) ]] - - + [[o.journal_id.name ]] + [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] + [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + + Start Date + End Date + + + [[ formatLang(get_start_date(data),date=True) ]] + [[ formatLang(get_end_date(data),date=True) ]] + + + [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + + Start Period + End Period + + + [[ get_start_period(data) or removeParentNode('para') ]] + [[ get_end_period(data) or removeParentNode('para') ]] + + + + [[ get_sortby(data) ]] + [[ get_target_move(data) ]] + + @@ -269,14 +269,14 @@ [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]] - [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] - [[ line.ref ]] - [[ line.account_id.code ]] - [[ line.partner_id and line.partner_id.name ]] - [[ line.move_id.name ]] - [[ line.name ]] - [[ formatLang(line.debit) ]] - [[ formatLang(line.credit) ]] - [[ formatLang(line.credit - line.debit) ]] [[ company.currency_id.symbol ]] + [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line['date'],date=True) ]] + [[ line['ref'] or '' ]] + [[ line['account_code'] or '' ]] + [[ line['partner_name'] or '' ]] + [[ line['move_name'] or '' ]] - [[ line['name'] or '' ]] + [[ formatLang(line['debit']) ]] + [[ formatLang(line['credit']) ]] + [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] @@ -290,8 +290,8 @@ Move/Entry label Debit Credit - Balance - Currency + Balance + Currency [[o.period_id.name ]] @@ -301,19 +301,19 @@ [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id)) ]] - [[ formatLang((sum_debit(o.period_id.id, o.journal_id.id) - sum_credit(o.period_id.id, o.journal_id.id))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((sum_debit(o.period_id.id, o.journal_id.id) - sum_credit(o.period_id.id, o.journal_id.id))) ]] [[ company.currency_id.symbol ]] [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]] - [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] - [[ line.ref ]] - [[ line.account_id.code ]] - [[ line.partner_id and line.partner_id.name ]] - [[ line.move_id.name ]] - [[ line.name ]] - [[ formatLang(line.debit) ]] - [[ formatLang(line.credit) ]] - [[ formatLang(line.credit - line.debit) ]] [[ company.currency_id.symbol ]] - [[ line.currency_id and formatLang(line.amount_currency) or '' ]] [[ line.currency_id.symbol or '']] + [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line['date'],date=True) ]] + [[ line['ref'] or '' ]] + [[ line['account_code'] or '' ]] + [[ line['partner_name'] or '' ]] + [[ line['move_name'] or '' ]] - [[ line['name'] or '' ]] + [[ formatLang(line['debit']) ]] + [[ formatLang(line['credit']) ]] + [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] + [[ line.currency_id and formatLang(line.amount_currency) or '' ]] [[ line.currency_id.symbol or '']] From 1785b797a4ca1357ca3c8a0aa9912dd6b6146cf1 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Mon, 22 Nov 2010 16:52:10 +0530 Subject: [PATCH 5/6] [FIX] account: small change in journal report bzr revid: psi@tinyerp.co.in-20101122112210-ohdvm7ivvgjz9ncx --- addons/account/report/account_journal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 336a32b2a7a..fcab2312c42 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -130,7 +130,7 @@ class journal_print(report_sxw.rml_parse, common_report_header): res = self.cr.dictfetchall() account_sum = 0.0 for l in res: - account_sum += l['debit'] - l['credit'] + account_sum += l['credit']-l['debit'] l['progress'] = account_sum return res From fad4dba6f41920737e989260f997f3a41ab31550 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Mon, 22 Nov 2010 17:43:58 +0530 Subject: [PATCH 6/6] [IMP] account_voucher: remove local branch changes bzr revid: psi@tinyerp.co.in-20101122121358-8p73warpovcpfs7y --- addons/account/account_move_line.py | 2 -- addons/account_voucher/account_voucher.py | 17 ----------------- 2 files changed, 19 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 16ea52b65d4..93d5c37bd08 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -716,8 +716,6 @@ class account_move_line(osv.osv): account_id = line['account_id']['id'] partner_id = (line['partner_id'] and line['partner_id']['id']) or False writeoff = debit - credit - if 'write_off' in context and context['write_off']['writeoff_amount']: - writeoff = context['write_off']['writeoff_amount'] # Ifdate_p in context => take this date if context.has_key('date_p') and context['date_p']: diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 509f6b00b92..f902810ac31 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -694,10 +694,6 @@ class account_voucher(osv.osv): if line.move_line_id.id: rec_ids = [master_line, line.move_line_id.id] rec_list_ids.append(rec_ids) - writeoff_account_id = False - writeoff_journal_id = False - writeoff_period_id = inv.period_id.id, - comment = False if not currency_pool.is_zero(cr, uid, inv.currency_id, line_total): diff = line_total @@ -722,19 +718,6 @@ class account_voucher(osv.osv): move_line_pool.create(cr, uid, move_line) - voucher = self.browse(cr, uid, ids)[0] - - for rec_ids in rec_list_ids: - if len(rec_ids) >= 2: - for line in voucher.line_ids: - if line.amount_unreconciled != line.amount: - if 'write_off' in context and context['write_off']['writeoff_acc_id']: - writeoff_account_id = context['write_off']['writeoff_acc_id'] - writeoff_journal_id = context['write_off']['writeoff_journal_id'] - comment = context['write_off']['comment'] - self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) - else: - self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted',