From 85bdfc4a286b5ce682c5d1bf7116ac01f3306564 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Sat, 24 Oct 2009 16:24:02 +0530 Subject: [PATCH] [FIX] Account : Onchange of amount/base amount of Invocie tax corrected lp bug: https://launchpad.net/bugs/458553 fixed bzr revid: jvo@tinyerp.com-20091024105402-kpclegj6labz54mi --- addons/account/invoice.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 10a49230480..54e258d791d 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -1121,24 +1121,27 @@ class account_invoice_tax(osv.osv): 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="The tax basis of the tax declaration."), 'tax_amount': fields.float('Tax Code Amount', digits=(16,int(config['price_accuracy']))), } + def base_change(self, cr, uid, ids, base,currency_id=False,company_id=False,date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency=False if company_id: - company_currency=company_obj.browse(cr,uid,company_id).id + company_currency = company_obj.read(cr,uid,[company_id],['currency_id'])[0]['currency_id'][0] if currency_id and company_currency: - base=cur_obj.compute(cr, uid, currency_id, company_currency, base, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) + base = cur_obj.compute(cr, uid, currency_id, company_currency, base, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'base_amount':base}} + def amount_change(self, cr, uid, ids, amount,currency_id=False,company_id=False,date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency=False if company_id: - company_currency=company_obj.browse(cr,uid,company_id).id + company_currency = company_obj.read(cr,uid,[company_id],['currency_id'])[0]['currency_id'][0] if currency_id and company_currency: - amount=cur_obj.compute(cr, uid, currency_id, company_currency, amount, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) + amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'tax_amount':amount}} + _order = 'sequence' _defaults = { 'manual': lambda *a: 1,