[FIX] Only commercial partners are allowed in bank statement lines

This commit is contained in:
unknown
2014-02-21 14:02:10 +01:00
committed by Yannick Vaucher
2 changed files with 6 additions and 1 deletions

View File

@@ -658,6 +658,11 @@ class AccountBankSatementLine(Model):
# This can be quite a performance killer as we read ir.properity fields
if partner_id:
part = obj_partner.browse(cr, uid, partner_id, context=context)
part = part.commercial_partner_id
# When the method is called from bank statement completion,
# ensure that the line's partner is a commercial
# (accounting) entity
res['partner_id'] = part.id
pay_account = part.property_account_payable.id
receiv_account = part.property_account_receivable.id
# If no value, look on the default company property