Merge lp:~openerp-dev/openobject-addons/trunk-bug-1182119-bde into lp:openobject-addons

Proposed by Bharat Devnani (Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1182119-bde
Merge into: lp:openobject-addons
Diff against target: 67 lines (+14/-4)
2 files modified
account/account_move_line.py (+11/-1)
account/account_view.xml (+3/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1182119-bde
Reviewer Review Type Date Requested Status
Lorenzo Battistini (community) Needs Information
OpenERP Core Team Pending
Review via email: mp+200046@code.launchpad.net

Description of the change

Hello,

I have checked and applied patch of Lorenzo Battistini - Agile BG
which fixes the issue of foreign currency journal entry does not compute base currency amount.

Thanks & Regards,
Devnani Bharat R.

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :
review: Needs Information
Revision history for this message
Bharat Devnani (Open ERP) (bde-openerp) wrote :

Becuase your branch https://code.launchpad.net/~elbati/openobject-addons/7-bug-1182119-elbati/+merge/164756 is for version 7.0, and this fixes the issue for trunk.

Unmerged revisions

9027. By Lorenzo Battistini - Agile BG

[FIX] : foreign currency journal entry does not compute base currency amount

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_move_line.py'
2--- account/account_move_line.py 2013-12-09 10:50:31 +0000
3+++ account/account_move_line.py 2013-12-26 06:19:30 +0000
4@@ -246,6 +246,7 @@
5 data = super(account_move_line, self).default_get(cr, uid, fields, context=context)
6 if context.get('journal_id'):
7 total = 0.0
8+ currency_total = 0.0
9 #in account.move form view, it is not possible to compute total debit and credit using
10 #a browse record. So we must use the context to pass the whole one2many field and compute the total
11 if context.get('line_id'):
12@@ -253,6 +254,7 @@
13 data['name'] = data.get('name') or move_line_dict.get('name')
14 data['partner_id'] = data.get('partner_id') or move_line_dict.get('partner_id')
15 total += move_line_dict.get('debit', 0.0) - move_line_dict.get('credit', 0.0)
16+ currency_total -= move_line_dict.get('amount_currency', 0.0)
17 elif context.get('period_id'):
18 #find the date and the ID of the last unbalanced account.move encoded by the current user in that journal and period
19 move_id = False
20@@ -272,6 +274,7 @@
21 data['partner_id'] = data.get('partner_id') or l.partner_id.id
22 data['ref'] = data.get('ref') or l.ref
23 total += (l.debit or 0.0) - (l.credit or 0.0)
24+ currency_total -= l.amount_currency
25
26 #compute the total of current move
27 data['debit'] = total < 0 and -total or 0.0
28@@ -298,7 +301,14 @@
29 })
30 if data.get('date'):
31 compute_ctx.update({'date': data['date']})
32- data['amount_currency'] = currency_obj.compute(cr, uid, account.company_id.currency_id.id, data['currency_id'], -total, context=compute_ctx)
33+ elif context.get('date'):
34+ compute_ctx.update({'date': context['date']})
35+ if currency_total:
36+ data['amount_currency'] = currency_total
37+ else:
38+ data['amount_currency'] = currency_obj.compute(cr, uid,
39+ account.company_id.currency_id.id, data['currency_id'],
40+ -total, context=compute_ctx)
41 data = self._default_get_move_form_hook(cr, uid, data)
42 return data
43
44
45=== modified file 'account/account_view.xml'
46--- account/account_view.xml 2013-10-27 12:31:04 +0000
47+++ account/account_view.xml 2013-12-26 06:19:30 +0000
48@@ -1296,7 +1296,7 @@
49 <notebook>
50 <page string="Journal Items">
51 <field name="line_id" widget="one2many_list"
52- context="{'line_id': line_id , 'journal_id': journal_id }">
53+ context="{'line_id': line_id , 'journal_id': journal_id, 'date': date}">
54 <form string="Journal Item" version="7.0">
55 <group col="6" colspan="4">
56 <field name="name"/>
57@@ -1371,8 +1371,8 @@
58 <field name="debit" sum="Total Debit"/>
59 <field name="credit" sum="Total Credit"/>
60 <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
61- <field name="amount_currency"/>
62- <field name="currency_id" groups="base.group_multi_currency"/>
63+ <field name="amount_currency" on_change="onchange_currency(account_id, amount_currency, currency_id, parent.date, parent.journal_id)"/>
64+ <field name="currency_id" groups="base.group_multi_currency" on_change="onchange_currency(account_id, amount_currency, currency_id, parent.date, parent.journal_id)"/>
65 <field name="tax_code_id"/>
66 <field name="tax_amount"/>
67 <field name="state"/>

Subscribers

People subscribed via source and target branches

to all changes: