← Back to team overview

openerp-community team mailing list archive

[Merge] lp:~openerp-community/openobject-addons/stefan-therp_lp786845 into lp:openobject-addons/6.0

 

Stefan Rijnhart (Therp) has proposed merging lp:~openerp-community/openobject-addons/stefan-therp_lp786845 into lp:openobject-addons/6.0.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #786845 in OpenERP Addons: "[6.0] account_payment: selecting partner bank fails when no suitable bank types are given"
  https://bugs.launchpad.net/openobject-addons/+bug/786845

For more details, see:
https://code.launchpad.net/~openerp-community/openobject-addons/stefan-therp_lp786845/+merge/61927
-- 
https://code.launchpad.net/~openerp-community/openobject-addons/stefan-therp_lp786845/+merge/61927
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-addons/stefan-therp_lp786845.
=== modified file 'account_payment/account_move_line.py'
--- account_payment/account_move_line.py	2011-01-14 00:11:01 +0000
+++ account_payment/account_move_line.py	2011-05-23 08:21:42 +0000
@@ -93,7 +93,6 @@
         bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type,
                 context=context)
         for line in self.browse(cr, uid, ids, context=context):
-            line2bank[line.id] = False
             if line.invoice and line.invoice.partner_bank_id:
                 line2bank[line.id] = line.invoice.partner_bank_id.id
             elif line.partner_id:
@@ -104,8 +103,11 @@
                         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
+                if line.id not in line2bank:
+                    if line.partner_id.bank_ids:
+                        line2bank[line.id] = line.partner_id.bank_ids[0].id
+                    else:
+                        line2bank[line.id] = False
             else:
                 raise osv.except_osv(_('Error !'), _('No partner defined on entry line'))
         return line2bank
@@ -117,4 +119,4 @@
 
 account_move_line()
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'account_payment/account_payment.py'
--- account_payment/account_payment.py	2011-02-01 11:04:30 +0000
+++ account_payment/account_payment.py	2011-05-23 08:21:42 +0000
@@ -437,7 +437,7 @@
             if part_obj.bank_ids and payment_type:
                 bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type, context=context)
                 for bank in part_obj.bank_ids:
-                    if bank.state in bank_type:
+                    if not bank_type or bank.state in bank_type:
                         data['bank_id'] = bank.id
                         break
         return {'value': data}