[FIX]account_voucher : journal entry not balancing from purchase reciept

bzr revid: mma@tinyerp.com-20121105065106-195oyhgl3x266r9t
This commit is contained in:
Somesh Khare(OpenERP)
2012-11-05 12:21:06 +05:30
committed by Mayur Maheshwari (OpenERP)
parent 29fffbc97d
commit 1dde3091d2
+21 -19
View File
@@ -381,8 +381,9 @@ class account_voucher(osv.osv):
total_tax = 0.0
if not tax[0].price_include:
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes', []):
total_tax += tax_line.get('amount', 0.0)
for line in voucher.line_ids:
for tax_line in tax_pool.compute_all(cr, uid, tax, line.amount, 1).get('taxes', []):
total_tax += tax_line.get('amount', 0.0)
total += total_tax
else:
for line in voucher.line_ids:
@@ -413,31 +414,32 @@ class account_voucher(osv.osv):
line_ids = resolve_o2m_operations(cr, uid, line_pool, line_ids, ["amount"], context)
total_tax = 0.0
net_tax = 0.0
for line in line_ids:
line_amount = 0.0
line_amount = line.get('amount',0.0)
if tax_id:
tax = [tax_pool.browse(cr, uid, tax_id, context=context)]
if partner_id:
partner = partner_pool.browse(cr, uid, partner_id, context=context) or False
taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
tax = tax_pool.browse(cr, uid, taxes, context=context)
if not tax[0].price_include:
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes', []):
total_tax += tax_line.get('amount')
total += total_tax
voucher_total += line_amount
total = voucher_total
total_tax = 0.0
if tax_id:
tax = [tax_pool.browse(cr, uid, tax_id, context=context)]
if partner_id:
partner = partner_pool.browse(cr, uid, partner_id, context=context) or False
taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
tax = tax_pool.browse(cr, uid, taxes, context=context)
if not tax[0].price_include:
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes', []):
total_tax += tax_line.get('amount')
total += total_tax
total = voucher_total + total_tax
res.update({
'amount':total or voucher_total,
'tax_amount':total_tax
'amount': total or voucher_total,
'tax_amount': total_tax
})
return {
'value':res
'value': res
}
def onchange_term_id(self, cr, uid, ids, term_id, amount):