[MERGE] bug 834091
authorRaphael Collet <rco@openerp.com>
Mon, 3 Oct 2011 08:59:40 +0000 (10:59 +0200)
committerRaphael Collet <rco@openerp.com>
Mon, 3 Oct 2011 08:59:40 +0000 (10:59 +0200)
bzr revid: rco@openerp.com-20111003085940-3sqcnh7wpsqpld5w

1  2 
addons/account_payment/wizard/account_payment_create_order_view.xml
addons/account_payment/wizard/account_payment_order.py

@@@ -2,38 -2,39 +2,39 @@@
  <openerp>
      <data>
  
--              <record id="view_create_payment_order" model="ir.ui.view">
++        <record id="view_create_payment_order" model="ir.ui.view">
              <field name="name">payment.order.create.form</field>
              <field name="model">payment.order.create</field>
              <field name="type">form</field>
              <field name="arch" type="xml">
--                      <form string="Search Payment lines">
--                          <group col="4" colspan="6">
--                                      <field name="duedate" />
--                              </group>
--                              <separator colspan="4"/>
--                          <group col="2" colspan="4">
--                      <button special="cancel"  string="Cancel" icon='gtk-cancel'/>
--                                      <button name="search_entries" string="Search" colspan="1" type="object" icon="gtk-execute"/>
--                              </group>
--                      </form>
++                <form string="Search Payment lines">
++                    <group col="4" colspan="6">
++                        <field name="duedate" />
++                    </group>
++                    <separator colspan="4"/>
++                    <group col="2" colspan="4">
++                        <button special="cancel"  string="Cancel" icon='gtk-cancel'/>
++                        <button name="search_entries" string="Search" colspan="1" type="object" icon="gtk-execute"/>
++                    </group>
++                </form>
              </field>
          </record>
  
--              <record id="view_create_payment_order_lines" model="ir.ui.view">
++        <record id="view_create_payment_order_lines" model="ir.ui.view">
              <field name="name">payment.order.create.form</field>
              <field name="model">payment.order.create</field>
              <field name="type">form</field>
              <field name="arch" type="xml">
--                      <form string="Search Payment lines">
--                          <group col="4" colspan="6">
-                               </group>
-                               <separator colspan="4"/>
-                           <group col="2" colspan="4">
-                       <button special="cancel"  string="Cancel" icon='gtk-cancel'/>
-                                       <button name="create_payment" string="_Add to payment order" colspan="1" type="object" icon="gtk-execute"/>
-                               </group>
-                       </form>
 -                              <field name="entries"/>
 -                              </group>
 -                              <separator colspan="4"/>
 -                          <group col="2" colspan="4">
 -                      <button special="cancel"  string="Cancel" icon='gtk-cancel'/>
 -                                      <button name="create_payment" string="_Add to payment order" colspan="1" type="object" icon="gtk-execute"/>
 -                              </group>
 -                      </form>
++                <form string="Search Payment lines">
++                    <group col="4" colspan="6">
++                        <field name="entries"/>
++                    </group>
++                    <separator colspan="4"/>
++                    <group col="2" colspan="4">
++                        <button special="cancel"  string="Cancel" icon='gtk-cancel'/>
++                        <button name="create_payment" string="_Add to payment order" colspan="1" type="object" icon="gtk-execute"/>
++                    </group>
++                </form>
              </field>
          </record>
  
@@@ -46,5 -47,5 +47,5 @@@
              <field name="target">new</field>
          </record>
  
--      </data>
--</openerp>
++    </data>
++</openerp>
@@@ -48,12 -48,11 +48,11 @@@ class payment_order_create(osv.osv_memo
      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'])+')]')
++                node.set('domain', "[('id', 'in', %s)]" % str(context['line_ids']))
+             res['arch'] = etree.tostring(doc)
          return res
  
      def create_payment(self, cr, uid, ids, context=None):