From cfb6ba7f158482f2e48bdecba952fa41b3248f85 Mon Sep 17 00:00:00 2001 From: qdp Date: Wed, 17 Sep 2008 16:57:37 +0200 Subject: [PATCH] *improvement and overall cleaning + better views bzr revid: qdp@tinyerp.com-20080917145737-p0t5r4wnc5eaae8h --- addons/account_payment/payment.py | 20 +++++--- addons/account_payment/payment_view.xml | 64 +++++++++---------------- 2 files changed, 35 insertions(+), 49 deletions(-) diff --git a/addons/account_payment/payment.py b/addons/account_payment/payment.py index c56116aaeab..7b110f8635a 100644 --- a/addons/account_payment/payment.py +++ b/addons/account_payment/payment.py @@ -391,8 +391,8 @@ class payment_line(osv.osv): # help='Amount to pay in the partner currency'), # 'currency': fields.function(_currency, string='Currency', # method=True, type='many2one', obj='res.currency'), - 'currency': fields.many2one('res.currency','Currency',required=True), - 'company_currency': fields.many2one('res.currency','Currency',readonly=True), + 'currency': fields.many2one('res.currency','Partner Currency',required=True), + 'company_currency': fields.many2one('res.currency','Company Currency',readonly=True), 'bank_id': fields.many2one('res.partner.bank', 'Destination Bank account'), 'order_id': fields.many2one('payment.order', 'Order', required=True, ondelete='cascade', select=True), @@ -432,17 +432,23 @@ class payment_line(osv.osv): def onchange_move_line(self,cr,uid,ids,move_line_id,payment_type,date_prefered,date_planned,currency=False,company_currency=False,context=None): data={} - data['amount_currency']=data['currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False + + data['amount_currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False + if move_line_id: line = self.pool.get('account.move.line').browse(cr,uid,move_line_id) data['amount_currency']=line.amount_to_pay - res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency, company_currency, context) + res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency, company_currency, if res: data['amount'] = res['value']['amount'] data['partner_id']=line.partner_id.id - data['currency']=line.currency_id and line.currency_id.id or False - if not data['currency']: - data['currency']=line.invoice and line.invoice.currency_id.id or False + temp = line.currency_id and line.currency_id.id or False + if not temp: + if line.invoice: + data['currency'] = line.invoice.currency_id.id + else: + data['currency'] = temp + # calling onchange of partner and updating data dictionary temp_dict=self.onchange_partner(cr,uid,ids,line.partner_id.id,payment_type) data.update(temp_dict['value']) diff --git a/addons/account_payment/payment_view.xml b/addons/account_payment/payment_view.xml index d77c454a90c..bba56a6d7ca 100644 --- a/addons/account_payment/payment_view.xml +++ b/addons/account_payment/payment_view.xml @@ -3,6 +3,18 @@ + + account.move.line.form.inherit + account.move.line + form + + + + + + + + account.move.line.tree account.move.line @@ -17,6 +29,7 @@ + @@ -88,8 +101,7 @@
- - + @@ -102,7 +114,6 @@ - @@ -115,34 +126,23 @@ - -
- + - + - - - + - - - - +
@@ -167,7 +167,6 @@ - @@ -212,9 +211,7 @@ - - - + @@ -222,7 +219,7 @@ - + @@ -238,18 +235,12 @@ - - - - - @@ -261,30 +252,19 @@ tree - + - - - - + - - - - -