[FIX] Account : Wrong calculation for payment date corrected

bzr revid: jvo@tinyerp.com-20100601105022-2ifz2piufgu3r79v
This commit is contained in:
EDA(Axelor) 2010-06-01 16:20:22 +05:30 committed by Jay (Open ERP)
parent 40fd622559
commit 7470d1da1a
1 changed files with 4 additions and 5 deletions

View File

@ -530,9 +530,8 @@ class account_move_line(osv.osv):
date = datetime.now().strftime('%Y-%m-%d')
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
if part.property_payment_term and part.property_payment_term.line_ids:
payterm = part.property_payment_term.line_ids[0]
res = self.pool.get('account.payment.term').compute(cr, uid, payterm.id, 100, date)
if part.property_payment_term:
res = self.pool.get('account.payment.term').compute(cr, uid, part.property_payment_term.id, 100, date)
if res:
val['date_maturity'] = res[0][0]
if not account_id:
@ -540,10 +539,10 @@ class account_move_line(osv.osv):
id2 = part.property_account_receivable.id
if journal:
jt = self.pool.get('account.journal').browse(cr, uid, journal).type
if jt=='sale':
if jt == 'sale':
val['account_id'] = self.pool.get('account.fiscal.position').map_account(cr, uid, part and part.property_account_position or False, id2)
elif jt=='purchase':
elif jt == 'purchase':
val['account_id'] = self.pool.get('account.fiscal.position').map_account(cr, uid, part and part.property_account_position or False, id1)
if val.get('account_id', False):
d = self.onchange_account_id(cr, uid, ids, val['account_id'])