Merge lp:~openerp-dev/openobject-addons/trunk-opw-575274-port-mma into lp:openobject-addons

Proposed by Mayur Maheshwari(OpenERP)
Status: Merged
Merged at revision: 8035
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-opw-575274-port-mma
Merge into: lp:openobject-addons
Diff against target: 64 lines (+20/-19)
1 file modified
account_voucher/account_voucher.py (+20/-19)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-opw-575274-port-mma
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+132848@code.launchpad.net

Description of the change

Hello,

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

Steps to reproduce:
1. Create a Tax Ex: 14% tax from "Accounting/Configuration/Financial Accounting/Taxes/Taxes".
2. Create Purchase Receipt from "Accounting/Suppliers/Purchase Receipt" and give the Expense lines as:
Account Description Amount Analytic Account
656 Water 375.35 False
656 refuse 47.13 False
656 Service fees 38.99 False
656 sewerages 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.
    Code is forward port from 6.1

Thanks,
Mayur

To post a comment you must log in.

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-10-29 09:17:13 +0000
3+++ account_voucher/account_voucher.py 2012-11-05 08:42:22 +0000
4@@ -381,8 +381,9 @@
5 total_tax = 0.0
6
7 if not tax[0].price_include:
8- for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes', []):
9- total_tax += tax_line.get('amount', 0.0)
10+ for line in voucher.line_ids:
11+ for tax_line in tax_pool.compute_all(cr, uid, tax, line.amount, 1).get('taxes', []):
12+ total_tax += tax_line.get('amount', 0.0)
13 total += total_tax
14 else:
15 for line in voucher.line_ids:
16@@ -413,31 +414,31 @@
17
18 line_ids = resolve_o2m_operations(cr, uid, line_pool, line_ids, ["amount"], context)
19
20+ total_tax = 0.0
21 for line in line_ids:
22 line_amount = 0.0
23 line_amount = line.get('amount',0.0)
24+
25+ if tax_id:
26+ tax = [tax_pool.browse(cr, uid, tax_id, context=context)]
27+ if partner_id:
28+ partner = partner_pool.browse(cr, uid, partner_id, context=context) or False
29+ taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
30+ tax = tax_pool.browse(cr, uid, taxes, context=context)
31+
32+ if not tax[0].price_include:
33+ for tax_line in tax_pool.compute_all(cr, uid, tax, line_amount, 1).get('taxes', []):
34+ total_tax += tax_line.get('amount')
35+
36 voucher_total += line_amount
37-
38- total = voucher_total
39- total_tax = 0.0
40- if tax_id:
41- tax = [tax_pool.browse(cr, uid, tax_id, context=context)]
42- if partner_id:
43- partner = partner_pool.browse(cr, uid, partner_id, context=context) or False
44- taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
45- tax = tax_pool.browse(cr, uid, taxes, context=context)
46-
47- if not tax[0].price_include:
48- for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes', []):
49- total_tax += tax_line.get('amount')
50- total += total_tax
51+ total = voucher_total + total_tax
52
53 res.update({
54- 'amount':total or voucher_total,
55- 'tax_amount':total_tax
56+ 'amount': total or voucher_total,
57+ 'tax_amount': total_tax
58 })
59 return {
60- 'value':res
61+ 'value': res
62 }
63
64 def onchange_term_id(self, cr, uid, ids, term_id, amount):

Subscribers

People subscribed via source and target branches

to all changes: