*set the destination bank account as not mandatory
authorqdp <qdp@tinyerp.com>
Tue, 16 Sep 2008 09:05:41 +0000 (11:05 +0200)
committerqdp <qdp@tinyerp.com>
Tue, 16 Sep 2008 09:05:41 +0000 (11:05 +0200)
bzr revid: qdp@tinyerp.com-20080916090541-7gl2tz4ia15qdtry

addons/account_payment/account_move_line.py
addons/account_payment/payment_view.xml
addons/account_payment/wizard/wizard_payment_order.py

index 884a840..23a0afc 100644 (file)
@@ -104,11 +104,13 @@ class account_move_line(osv.osv):
                 line2bank[line.id] = line.invoice.partner_bank.id
             elif line.partner_id:
                 if not line.partner_id.bank_ids:
-                    raise osv.except_osv(_('Error !'), _('Partner '+ line.partner_id.name+ ' has no bank account defined'))
-                for bank in line.partner_id.bank_ids:
-                    if bank.state in bank_type:
-                        line2bank[line.id] = bank.id
-                        break
+                    #raise osv.except_osv(_('Error !'), _('Partner '+ line.partner_id.name+ ' has no bank account defined'))
+                    line2bank[line.id] = False
+                else:
+                    for bank in line.partner_id.bank_ids:
+                        if bank.state in bank_type:
+                            line2bank[line.id] = bank.id
+                            break
                 if line.id not in line2bank and line.partner_id.bank_ids:
                     line2bank[line.id] = line.partner_id.bank_ids[0].id
             else:
index ef6773c..102b4ec 100644 (file)
@@ -97,7 +97,7 @@
                                         <field name="currency" nolabel="1"/>
                                     </group>
                                     <field name="partner_id" on_change="onchange_partner(partner_id,parent.mode)" select="1"/>
-                                    <field domain="[('partner_id','=',partner_id)]" name="bank_id" required="1"/>
+                                    <field domain="[('partner_id','=',partner_id)]" name="bank_id"/>
                                     <separator colspan="2" string="Owner Account"/>
                                     <separator colspan="2" string="Desitination Account"/>
                                     <field colspan="2" name="info_owner" nolabel="1"/>
index 76e26f7..be87f04 100644 (file)
@@ -75,7 +75,7 @@ def search_entries(self, cr, uid, data, context):
     <field name="entries" colspan="4" height="300" width="800" nolabel="1"
         domain="[('id', 'in', [%s])]" %s/>
 </form>''' % (','.join([str(x) for x in line_ids]), ctx)
-    return {'entries': line_ids}
+    return {}
 
 def create_payment(self, cr, uid, data, context):
     line_ids= data['form']['entries'][0][2]
@@ -88,7 +88,7 @@ def create_payment(self, cr, uid, data, context):
     payment = order_obj.browse(cr, uid, data['id'],
             context=context)
     t = payment.mode and payment.mode.type.id or None
-    line2bank= pool.get('account.move.line').line2bank(cr, uid,
+    line2bank = pool.get('account.move.line').line2bank(cr, uid,
             line_ids, t, context)
 
     ## Finally populate the current payment with new lines: