*set the destination bank account as not mandatory

bzr revid: qdp@tinyerp.com-20080916090541-7gl2tz4ia15qdtry
This commit is contained in:
qdp 2008-09-16 11:05:41 +02:00
parent 13723b16f5
commit 1a91fbe7d3
3 changed files with 10 additions and 8 deletions

View 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:

View 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"/>

View 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: