From ba8f090d1878c869b910308d8725d45e10f97a14 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Tue, 13 Jul 2010 14:31:30 +0530 Subject: [PATCH] [IMP]: improvement in accounting module bzr revid: mga@tinyerp.com-20100713090130-nprwe7f05iv9w5q6 --- addons/account/account_cash_statement.py | 2 +- addons/account/account_move_line.py | 1 + addons/account/account_view.xml | 1 - addons/account_voucher/voucher.py | 19 ++++++++++++------- addons/account_voucher/voucher_view.xml | 2 +- .../account_voucher_payment_view.xml | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 896b71e9f25..1a0727e626f 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -183,7 +183,7 @@ class account_cash_statement(osv.osv): ('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"), 'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"), 'closing_date':fields.datetime("Closed On"), - 'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on Opening Balance and Transactions"), + 'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on Starting Balance and Cash Transactions"), 'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"), 'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'), 'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'), diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index cc74b2a9158..bf12bdc2087 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -674,6 +674,7 @@ 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 + # Ifdate_p in context => take this date if context.has_key('date_p') and context['date_p']: date=context['date_p'] diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index de8bc843faa..78cb6cadd7e 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2300,7 +2300,6 @@ - diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index 13df5a496fc..47ff58a3226 100644 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -428,15 +428,17 @@ class account_voucher_line(osv.osv): 'type': lambda *a: 'cr' } - def onchange_partner(self, cr, uid, ids, partner_id, ttype ,type1): - vals = {} + def onchange_partner(self, cr, uid, ids, partner_id, ttype ,type1, currency): + currency_pool = self.pool.get('res.currency') + company = self.pool.get('res.users').browse(cr, uid, uid).company_id + + vals = { + 'account_id': False, + 'type': False , + 'amount': False + } if not partner_id: - vals.update({ - 'account_id': False, - 'type': False , - 'amount': False - }) return { 'value' : vals } @@ -466,6 +468,9 @@ class account_voucher_line(osv.osv): balance = partner.debit ttype = 'cr' + if company.currency_id != currency: + balance = currency_pool.compute(cr, uid, company.currency_id.id, currency, balance) + vals.update({ 'account_id': account_id, 'type': ttype, diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml index 658b8f8429b..1a781c4cc34 100644 --- a/addons/account_voucher/voucher_view.xml +++ b/addons/account_voucher/voucher_view.xml @@ -37,7 +37,7 @@ - + diff --git a/addons/account_voucher_payment/account_voucher_payment_view.xml b/addons/account_voucher_payment/account_voucher_payment_view.xml index cc11d3a064c..3f118120c8a 100755 --- a/addons/account_voucher_payment/account_voucher_payment_view.xml +++ b/addons/account_voucher_payment/account_voucher_payment_view.xml @@ -10,7 +10,7 @@ - +