From 72b6ac7daf626f4a2f00ce0c0b54bff82cd673fe Mon Sep 17 00:00:00 2001 From: "Purnendu Singh (OpenERP)" Date: Thu, 8 Sep 2011 16:19:21 +0530 Subject: [PATCH] [FIX] account_payment: account_payment not allowing selection of invoices for payment lp bug: https://launchpad.net/bugs/834091 fixed bzr revid: psi@tinyerp.com-20110908104921-70a4v56zxfyeh5al --- .../account_payment_create_order_view.xml | 3 +- .../wizard/account_payment_order.py | 29 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/addons/account_payment/wizard/account_payment_create_order_view.xml b/addons/account_payment/wizard/account_payment_create_order_view.xml index 905baf7e118..10d437533f4 100644 --- a/addons/account_payment/wizard/account_payment_create_order_view.xml +++ b/addons/account_payment/wizard/account_payment_create_order_view.xml @@ -26,7 +26,8 @@ form
- + + diff --git a/addons/account_payment/wizard/account_payment_order.py b/addons/account_payment/wizard/account_payment_order.py index d1137078c32..613b049a412 100644 --- a/addons/account_payment/wizard/account_payment_order.py +++ b/addons/account_payment/wizard/account_payment_order.py @@ -29,7 +29,7 @@ class payment_order_create(osv.osv_memory): Create a payment object with lines corresponding to the account move line to pay according to the date and the mode provided by the user. Hypothesis: - - Small number of non-reconcilied move line, payment mode and bank account type, + - Small number of non-reconciled move line, payment mode and bank account type, - Big number of partner and bank account. If a type is given, unsuitable account Entry lines are ignored. @@ -48,12 +48,11 @@ class payment_order_create(osv.osv_memory): def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(payment_order_create, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) if context and 'line_ids' in context: - view_obj = etree.XML(res['arch']) - child = view_obj.getchildren()[0] - domain = '[("id", "in", '+ str(context['line_ids'])+')]' - field = etree.Element('field', attrib={'domain': domain, 'name':'entries', 'colspan':'4', 'height':'300', 'width':'800', 'nolabel':"1"}) - child.addprevious(field) - res['arch'] = etree.tostring(view_obj) + doc = etree.XML(res['arch']) + nodes = doc.xpath("//field[@name='entries']") + for node in nodes: + node.set('domain', '[("id", "in", '+ str(context['line_ids'])+')]') + res['arch'] = etree.tostring(doc) return res def create_payment(self, cr, uid, ids, context=None): @@ -81,14 +80,14 @@ class payment_order_create(osv.osv_memory): elif payment.date_prefered == 'fixed': date_to_pay = payment.date_scheduled payment_obj.create(cr, uid,{ - 'move_line_id': line.id, - 'amount_currency': line.amount_to_pay, - 'bank_id': line2bank.get(line.id), - 'order_id': payment.id, - 'partner_id': line.partner_id and line.partner_id.id or False, - 'communication': line.ref or '/', - 'date': date_to_pay, - 'currency': line.invoice and line.invoice.currency_id.id or False, + 'move_line_id': line.id, + 'amount_currency': line.amount_to_pay, + 'bank_id': line2bank.get(line.id), + 'order_id': payment.id, + 'partner_id': line.partner_id and line.partner_id.id or False, + 'communication': line.ref or '/', + 'date': date_to_pay, + 'currency': line.invoice and line.invoice.currency_id.id or False, }, context=context) return {'type': 'ir.actions.act_window_close'}