From bc9bab7db406b0ed3c1b6fabf13c33c7b3929ccf Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Thu, 2 Dec 2010 18:32:17 +0530 Subject: [PATCH] [IMP] account_voucher: misc changes and moveline with same amount with higer priority bzr revid: psi@tinyerp.co.in-20101202130217-siz1ozkcq5har3mv --- addons/account/account_invoice_view.xml | 2 +- addons/account_voucher/account_voucher.py | 17 +++++-- .../account_voucher_report.xml | 4 +- .../report/account_voucher_print.rml | 51 ------------------- .../voucher_payment_receipt_view.xml | 2 +- 5 files changed, 18 insertions(+), 58 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index e5427a93361..9d10107c5c9 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -497,7 +497,7 @@ [('type','=','in_refund')] {'type':'in_refund', 'journal_type': 'purchase_refund'} - A vendor refund is a credit note from your supplier indicating that he refunds part or totality of the invoice sent to you. + A supplier refund is a credit note from your supplier indicating that he refunds part or totality of the invoice sent to you. diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index f902810ac31..9d06d181ef2 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -418,6 +418,18 @@ class account_voucher(osv.osv): ids.reverse() moves = move_line_pool.browse(cr, uid, ids) + priority_moves = [] + for line in moves: + original_amount = line.credit or line.debit or 0.0 + if original_amount == price: + priority_moves.append(line) + + if priority_moves: + for line in moves: + if line not in priority_moves: + priority_moves.append(line) + moves = priority_moves + company_currency = journal.company_id.currency_id.id if company_currency != currency_id and ttype == 'payment': total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit) @@ -438,13 +450,13 @@ class account_voucher(osv.osv): if line.debit and line.reconcile_partial_id and ttype == 'payment': continue - orignal_amount = line.credit or line.debit or 0.0 + original_amount = line.credit or line.debit or 0.0 rs = { 'name':line.move_id.name, 'type': line.credit and 'dr' or 'cr', 'move_line_id':line.id, 'account_id':line.account_id.id, - 'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, orignal_amount), + 'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, original_amount), 'date_original':line.date, 'date_due':line.date_maturity, 'amount_unreconciled':currency_pool.compute(cr, uid, company_currency, currency_id, line.amount_unreconciled) @@ -468,7 +480,6 @@ class account_voucher(osv.osv): default['value']['pre_line'] = 1 elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0: default['value']['pre_line'] = 1 - return default def onchange_date(self, cr, user, ids, date, context={}): diff --git a/addons/account_voucher/account_voucher_report.xml b/addons/account_voucher/account_voucher_report.xml index 785fd91df73..8af204efbbe 100644 --- a/addons/account_voucher/account_voucher_report.xml +++ b/addons/account_voucher/account_voucher_report.xml @@ -1,7 +1,7 @@ - + menu="True"/> --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Receiver's Signature - - - - - - - - - - - - - Authorised Signatory - - - - - - diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 83b6243a627..0ed2bac22a5 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -224,7 +224,7 @@ - Vendor Payment + Supplier Payment account.voucher form [('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]