summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier ALT <xal@openerp.com>2012-11-30 18:21:33 +0100
committerXavier ALT <xal@openerp.com>2012-11-30 18:21:33 +0100
commit2bf1eff2ceb11baba5e15fb21aecf41b53e393c6 (patch)
treea44884220e7bc5123c812e192023bea1948130eb
parent4e784e16af9740230462ba3f6fd31cd24f66fabf (diff)
[MERGE] OPW 577037: account_voucher: 'import entries' wizard should allow selecting credit notes
cumulative forward-port of v6.0 revids: - ach@tinyerp.com-20110704105916-6toonyhlltu83h1d - ach@tinyerp.com-20110803092023-q16pwcco77tpomsz - xal@openerp.com-20121130161732-d37t8h7u4gqak4tx bzr revid: xal@openerp.com-20121130172133-jxnrf7fi2i4s4g1a
-rw-r--r--addons/account_voucher/wizard/account_statement_from_invoice.py7
-rw-r--r--addons/account_voucher/wizard/account_statement_from_invoice_view.xml2
2 files changed, 7 insertions, 2 deletions
diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py
index ae6dc78fb4c..f4476f10b99 100644
--- a/addons/account_voucher/wizard/account_statement_from_invoice.py
+++ b/addons/account_voucher/wizard/account_statement_from_invoice.py
@@ -100,6 +100,11 @@ class account_statement_from_invoice_lines(osv.osv_memory):
if voucher_line_dict:
voucher_line_dict.update({'voucher_id': voucher_id})
voucher_line_obj.create(cr, uid, voucher_line_dict, context=context)
+
+ #Updated the amount of voucher in case of partially paid invoice
+ amount_res = voucher_line_dict.get('amount_unreconciled',amount)
+ voucher_obj.write(cr, uid, voucher_id, {'amount':amount_res}, context=context)
+
if line.journal_id.type == 'sale':
type = 'customer'
elif line.journal_id.type == 'purchase':
@@ -108,7 +113,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
type = 'general'
statement_line_obj.create(cr, uid, {
'name': line.name or '?',
- 'amount': amount,
+ 'amount': amount_res if amount >= 0 else -amount_res,
'type': type,
'partner_id': line.partner_id.id,
'account_id': line.account_id.id,
diff --git a/addons/account_voucher/wizard/account_statement_from_invoice_view.xml b/addons/account_voucher/wizard/account_statement_from_invoice_view.xml
index 1c0c00bd662..c8582a1bd21 100644
--- a/addons/account_voucher/wizard/account_statement_from_invoice_view.xml
+++ b/addons/account_voucher/wizard/account_statement_from_invoice_view.xml
@@ -38,7 +38,7 @@
<form string="Import Entries">
<group colspan="4" expand="1">
<separator string="Payable and Receivables" colspan="4"/>
- <field height="300" width="700" name="line_ids" colspan="4" nolabel="1" domain="[('account_id.type','in',['receivable','payable']),('reconcile_id','=',False), ('reconcile_partial_id','=',False), ('state', '=', 'valid')]"/>
+ <field height="300" width="700" name="line_ids" colspan="4" nolabel="1" domain="[('account_id.type','in',['receivable','payable']),('reconcile_id','=',False), ('journal_id.type','not in',['bank','cash']), ('state', '=', 'valid')]"/>
</group>
<group colspan="4" col="6">
<label string ="" colspan="2"/>