Somesh Khare(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-575274-skh into
lp:openobject-addons/6.1.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575274-skh/+merge/108716
Hello Sir,
[FIX]account_voucher.py: journal entry not balancing from purchase reciept
Steps to reproduce:
1. Create a Tax Eg: 14% tax from "Accounting/Configuration/Financial
Accounting/Taxes/Taxes".
2. Create Purchase Reciept from "Accounting/Suppliers/Purchase Receipt" and
give the Expence lines as:
Account Description Amount Analytic Account
656 Water 375.35 False
656 refuse 47.13 False
656 Service fees 38.99 False
656 sewarages 273.99 False
3. Now select the tax "14% tax", compute tax and validate the Receipt.
You will see the Journal Item state as Unbalanced. Now open Accounting/Journal
Entries/Journal Entries, you will see that the Total Debit and Total Credit are
not balanced.
Reason:
On the Purchase Receipt form tax are calculated on the bases of Final Total of
the lines where in the Move line tax are calculated for each line and then the
total of the each line is summed up. Due to rounding it has very lower
difference into the debit and credit as a reason the Journal entries are not
balanced.
This branch fix this issue. Kindly review the branch and please share your
views on it.
Thanks,
Somesh Khare
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575274-skh/+merge/108716
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-575274-skh.
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py 2012-03-30 11:07:16 +0000
+++ account_voucher/account_voucher.py 2012-06-05 10:42:19 +0000
@@ -345,7 +345,7 @@
if not voucher.tax_id:
self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
continue
-
+
tax = [tax_pool.browse(cr, uid, voucher.tax_id.id, context=context)]
partner = partner_pool.browse(cr, uid, voucher.partner_id.id, context=context) or False
taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
@@ -353,23 +353,21 @@
total = voucher_amount
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:
line_total = 0.0
line_tax = 0.0
-
for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes', []):
line_tax += tax_line.get('amount', 0.0)
line_total += tax_line.get('price_unit')
total_tax += line_tax
untax_amount = line.untax_amount or line.amount
voucher_line_pool.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount})
-
self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
return True
@@ -386,29 +384,26 @@
voucher_total = 0.0
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, line_amount, 1).get('taxes', []):
+ total_tax += tax_line.get('amount')
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
+ 'tax_amount': total_tax
})
return {
'value':res
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp