[IMP] account_voucher: misc changes and moveline with same amount with higer priority

bzr revid: psi@tinyerp.co.in-20101202130217-siz1ozkcq5har3mv
This commit is contained in:
psi (Open ERP)
2010-12-02 18:32:17 +05:30
parent 14e12bffb4
commit bc9bab7db4
5 changed files with 18 additions and 58 deletions
+1 -1
View File
@@ -497,7 +497,7 @@
<field name="domain">[('type','=','in_refund')]</field>
<field name="context">{'type':'in_refund', 'journal_type': 'purchase_refund'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">A vendor refund is a credit note from your supplier indicating that he refunds part or totality of the invoice sent to you.</field>
<field name="help">A supplier refund is a credit note from your supplier indicating that he refunds part or totality of the invoice sent to you.</field>
</record>
<menuitem action="action_invoice_tree4" id="menu_action_invoice_tree4" parent="menu_finance_payables"/>
+14 -3
View File
@@ -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={}):
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<openerp>
<data>
<report id="report_account_voucher"
<!-- <report id="report_account_voucher"
string="Voucher"
model="account.voucher"
name="voucher.cash_receipt.drcr"
@@ -9,7 +9,7 @@
groups="base.group_extended"
auto="False"
header = "False"
menu="True"/>
menu="True"/> -->
<report id="report_account_voucher_print"
string="Voucher Print"
@@ -327,56 +327,5 @@
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
<blockTable colWidths="154.0,108.0,118.0,144.0" style="Table5">
<tr>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">Receiver's Signature</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_Right_9">Authorised Signatory</para>
</td>
</tr>
</blockTable>
<para style="P1">
<font color="white"> </font>
</para>
</story>
</document>
@@ -224,7 +224,7 @@
</record>
<record id="action_vendor_payment" model="ir.actions.act_window">
<field name="name">Vendor Payment</field>
<field name="name">Supplier Payment</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]</field>