[FIX] default type completion

This commit is contained in:
unknown
2013-03-01 15:17:11 +01:00
parent 4ba531b2fa
commit fc100f8a9a

View File

@@ -499,14 +499,14 @@ class AccountBankSatementLine(Model):
res = {}
obj_partner = self.pool.get('res.partner')
obj_stat = self.pool.get('account.bank.statement')
receiv_account = pay_account = account_id = False
ltype= receiv_account = pay_account = account_id = False
# If profile has a receivable_account_id, we return it in any case
if profile_id:
profile = self.pool.get("account.statement.profile").browse(
cr, uid, profile_id, context=context)
if profile.receivable_account_id:
res['account_id'] = profile.receivable_account_id.id
res['type'] = 'general'
account_id = profile.receivable_account_id.id
ltype = 'general'
return res
# If partner -> take from him
if partner_id:
@@ -525,11 +525,12 @@ class AccountBankSatementLine(Model):
elif amount is not False:
if amount >= 0:
account_id = receiv_account
res['type'] = 'customer'
ltype = 'customer'
else:
account_id = pay_account
res['type'] = 'supplier'
ltype = 'supplier'
res['account_id'] = account_id if account_id else receiv_account
res['type'] = ltype
return res
def onchange_partner_id(self, cr, uid, ids, partner_id, profile_id=None, context=None):