[FIX] account: pay_and_reconcile() function fixed as per new behavior (accounting entries are created for the parent company if needed)
bzr revid: qdp-launchpad@openerp.com-20121128111252-1m37zos11iwg9xyr
This commit is contained in:
parent
928f7ecfe9
commit
8dbdbf713f
|
@ -1245,12 +1245,15 @@ class account_invoice(osv.osv):
|
|||
ref = invoice.reference
|
||||
else:
|
||||
ref = self._convert_ref(cr, uid, invoice.number)
|
||||
partner = invoice.partner_id
|
||||
if partner.parent_id and not partner.is_company:
|
||||
partner = partner.parent_id
|
||||
# Pay attention to the sign for both debit/credit AND amount_currency
|
||||
l1 = {
|
||||
'debit': direction * pay_amount>0 and direction * pay_amount,
|
||||
'credit': direction * pay_amount<0 and - direction * pay_amount,
|
||||
'account_id': src_account_id,
|
||||
'partner_id': invoice.partner_id.id,
|
||||
'partner_id': partner.id,
|
||||
'ref':ref,
|
||||
'date': date,
|
||||
'currency_id':currency_id,
|
||||
|
@ -1261,7 +1264,7 @@ class account_invoice(osv.osv):
|
|||
'debit': direction * pay_amount<0 and - direction * pay_amount,
|
||||
'credit': direction * pay_amount>0 and direction * pay_amount,
|
||||
'account_id': pay_account_id,
|
||||
'partner_id': invoice.partner_id.id,
|
||||
'partner_id': partner.id,
|
||||
'ref':ref,
|
||||
'date': date,
|
||||
'currency_id':currency_id,
|
||||
|
|
Loading…
Reference in New Issue