[FIX] account_payment : account_payment not allowing selection of invoices for paymen...
authornep-OpenERP <nep@tinyerp.com>
Mon, 26 Sep 2011 11:48:36 +0000 (17:18 +0530)
committernep-OpenERP <nep@tinyerp.com>
Mon, 26 Sep 2011 11:48:36 +0000 (17:18 +0530)
bzr revid: nep@tinyerp.com-20110926114836-bxuu1yt6vezevccd

addons/account_payment/wizard/account_payment_create_order_view.xml
addons/account_payment/wizard/account_payment_order.py
addons/account_payment/wizard/account_payment_populate_statement.py

index d301e72..593ce6a 100644 (file)
@@ -27,6 +27,7 @@
             <field name="arch" type="xml">
                        <form string="Search Payment lines">
                            <group col="4" colspan="6">
+                               <field name="entries"/>
                                </group>
                                <separator colspan="4"/>
                            <group col="2" colspan="4">
index eb0d8b2..3ae8dc1 100644 (file)
@@ -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):
index 9a7daaf..8f80576 100644 (file)
@@ -79,7 +79,7 @@ class account_payment_populate_statement(osv.osv_memory):
             if not line.move_line_id.id:
                 continue
             context.update({'move_line_ids': [line.move_line_id.id]})
-            result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id=statement.currency.id, ttype='payment', date=line.date, context=context)
+            result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), voucher_currency_id= statement.currency.id, ttype='payment', date=line.ml_maturity_date, context=context)
 
             voucher_res = {
                     'type': 'payment',