Merge lp:~openerp-dev/openobject-addons/6.1-opw-575274-skh into lp:openobject-addons/6.1

Proposed by Somesh Khare
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 6831
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-575274-skh
Merge into: lp:openobject-addons/6.1
Diff against target: 83 lines (+18/-23)
1 file modified
account_voucher/account_voucher.py (+18/-23)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-575274-skh
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Review via email: mp+108716@code.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Confirmed on Trunk (means still existing and reproducible). A Merge Proposal for trunk was created to fix it. Here is the link to follow the MP on Launchpad https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-575274-port-mma/+merge/132848 and be informed once it's been merged in trunk: ... If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

6831. By Somesh Khare

[FIX]account_voucher.py: journal entry not balancing from purchase reciept(Case: Ref 575274)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
345 if not voucher.tax_id:345 if not voucher.tax_id:
346 self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})346 self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
347 continue347 continue
348348
349 tax = [tax_pool.browse(cr, uid, voucher.tax_id.id, context=context)]349 tax = [tax_pool.browse(cr, uid, voucher.tax_id.id, context=context)]
350 partner = partner_pool.browse(cr, uid, voucher.partner_id.id, context=context) or False350 partner = partner_pool.browse(cr, uid, voucher.partner_id.id, context=context) or False
351 taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)351 taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
@@ -353,23 +353,21 @@
353353
354 total = voucher_amount354 total = voucher_amount
355 total_tax = 0.0355 total_tax = 0.0
356
357 if not tax[0].price_include:356 if not tax[0].price_include:
358 for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes', []):357 for line in voucher.line_ids:
359 total_tax += tax_line.get('amount', 0.0)358 for tax_line in tax_pool.compute_all(cr, uid, tax, line.amount, 1).get('taxes', []):
359 total_tax += tax_line.get('amount', 0.0)
360 total += total_tax360 total += total_tax
361 else:361 else:
362 for line in voucher.line_ids:362 for line in voucher.line_ids:
363 line_total = 0.0363 line_total = 0.0
364 line_tax = 0.0364 line_tax = 0.0
365
366 for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes', []):365 for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes', []):
367 line_tax += tax_line.get('amount', 0.0)366 line_tax += tax_line.get('amount', 0.0)
368 line_total += tax_line.get('price_unit')367 line_total += tax_line.get('price_unit')
369 total_tax += line_tax368 total_tax += line_tax
370 untax_amount = line.untax_amount or line.amount369 untax_amount = line.untax_amount or line.amount
371 voucher_line_pool.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount})370 voucher_line_pool.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount})
372
373 self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})371 self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
374 return True372 return True
375373
@@ -386,29 +384,26 @@
386 voucher_total = 0.0384 voucher_total = 0.0
387385
388 line_ids = resolve_o2m_operations(cr, uid, line_pool, line_ids, ["amount"], context)386 line_ids = resolve_o2m_operations(cr, uid, line_pool, line_ids, ["amount"], context)
389387 total_tax = 0.0
388 net_tax = 0.0
390 for line in line_ids:389 for line in line_ids:
391 line_amount = 0.0390 line_amount = 0.0
392 line_amount = line.get('amount',0.0)391 line_amount = line.get('amount',0.0)
392 if tax_id:
393 tax = [tax_pool.browse(cr, uid, tax_id, context=context)]
394 if partner_id:
395 partner = partner_pool.browse(cr, uid, partner_id, context=context) or False
396 taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
397 tax = tax_pool.browse(cr, uid, taxes, context=context)
398
399 if not tax[0].price_include:
400 for tax_line in tax_pool.compute_all(cr, uid, tax, line_amount, 1).get('taxes', []):
401 total_tax += tax_line.get('amount')
393 voucher_total += line_amount402 voucher_total += line_amount
394403 total = voucher_total + total_tax
395 total = voucher_total
396 total_tax = 0.0
397 if tax_id:
398 tax = [tax_pool.browse(cr, uid, tax_id, context=context)]
399 if partner_id:
400 partner = partner_pool.browse(cr, uid, partner_id, context=context) or False
401 taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
402 tax = tax_pool.browse(cr, uid, taxes, context=context)
403
404 if not tax[0].price_include:
405 for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes', []):
406 total_tax += tax_line.get('amount')
407 total += total_tax
408
409 res.update({404 res.update({
410 'amount':total or voucher_total,405 'amount':total or voucher_total,
411 'tax_amount':total_tax406 'tax_amount': total_tax
412 })407 })
413 return {408 return {
414 'value':res409 'value':res