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
1=== modified file 'account_voucher/account_voucher.py'
2--- account_voucher/account_voucher.py 2012-03-30 11:07:16 +0000
3+++ account_voucher/account_voucher.py 2012-06-05 10:42:19 +0000
4@@ -345,7 +345,7 @@
5 if not voucher.tax_id:
6 self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
7 continue
8-
9+
10 tax = [tax_pool.browse(cr, uid, voucher.tax_id.id, context=context)]
11 partner = partner_pool.browse(cr, uid, voucher.partner_id.id, context=context) or False
12 taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
13@@ -353,23 +353,21 @@
14
15 total = voucher_amount
16 total_tax = 0.0
17-
18 if not tax[0].price_include:
19- for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes', []):
20- total_tax += tax_line.get('amount', 0.0)
21+ for line in voucher.line_ids:
22+ for tax_line in tax_pool.compute_all(cr, uid, tax, line.amount, 1).get('taxes', []):
23+ total_tax += tax_line.get('amount', 0.0)
24 total += total_tax
25 else:
26 for line in voucher.line_ids:
27 line_total = 0.0
28 line_tax = 0.0
29-
30 for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes', []):
31 line_tax += tax_line.get('amount', 0.0)
32 line_total += tax_line.get('price_unit')
33 total_tax += line_tax
34 untax_amount = line.untax_amount or line.amount
35 voucher_line_pool.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount})
36-
37 self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
38 return True
39
40@@ -386,29 +384,26 @@
41 voucher_total = 0.0
42
43 line_ids = resolve_o2m_operations(cr, uid, line_pool, line_ids, ["amount"], context)
44-
45+ total_tax = 0.0
46+ net_tax = 0.0
47 for line in line_ids:
48 line_amount = 0.0
49 line_amount = line.get('amount',0.0)
50+ if tax_id:
51+ tax = [tax_pool.browse(cr, uid, tax_id, context=context)]
52+ if partner_id:
53+ partner = partner_pool.browse(cr, uid, partner_id, context=context) or False
54+ taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
55+ tax = tax_pool.browse(cr, uid, taxes, context=context)
56+
57+ if not tax[0].price_include:
58+ for tax_line in tax_pool.compute_all(cr, uid, tax, line_amount, 1).get('taxes', []):
59+ total_tax += tax_line.get('amount')
60 voucher_total += line_amount
61-
62- total = voucher_total
63- total_tax = 0.0
64- if tax_id:
65- tax = [tax_pool.browse(cr, uid, tax_id, context=context)]
66- if partner_id:
67- partner = partner_pool.browse(cr, uid, partner_id, context=context) or False
68- taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
69- tax = tax_pool.browse(cr, uid, taxes, context=context)
70-
71- if not tax[0].price_include:
72- for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes', []):
73- total_tax += tax_line.get('amount')
74- total += total_tax
75-
76+ total = voucher_total + total_tax
77 res.update({
78 'amount':total or voucher_total,
79- 'tax_amount':total_tax
80+ 'tax_amount': total_tax
81 })
82 return {
83 'value':res