Merge lp:~unifield-team/unifield-server/us-1251 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 3743
Proposed branch: lp:~unifield-team/unifield-server/us-1251
Merge into: lp:unifield-server
Diff against target: 68 lines (+17/-10)
2 files modified
bin/addons/msf_currency_revaluation/account.py (+12/-7)
bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py (+5/-3)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-1251
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+293279@code.launchpad.net
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 'bin/addons/msf_currency_revaluation/account.py'
2--- bin/addons/msf_currency_revaluation/account.py 2014-11-12 14:31:29 +0000
3+++ bin/addons/msf_currency_revaluation/account.py 2016-04-28 14:54:24 +0000
4@@ -66,17 +66,22 @@
5 'balance': "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance",
6 'debit': "COALESCE(SUM(l.debit), 0) as debit",
7 'credit': "COALESCE(SUM(l.credit), 0) as credit",
8- 'foreign_balance': "COALESCE(SUM(l.amount_currency), 0) as foreign_balance"}
9+ # US-1251: booking balance mapping: use directly booking balance vs JI amount_currency as we have discrepedencies
10+ 'foreign_balance': "COALESCE(SUM(l.debit_currency),0) - COALESCE(SUM(l.credit_currency), 0) as foreign_balance"
11+ #'foreign_balance': "COALESCE(SUM(l.amount_currency), 0) as foreign_balance"
12+ }
13
14 def _revaluation_query(self, cr, uid, ids, revaluation_date, context=None):
15 query = ("SELECT l.account_id as id, l.currency_id, " +
16 ', '.join(self._sql_mapping.values()) +
17- " FROM account_move_line l "
18- " WHERE l.account_id IN %(account_ids)s AND "
19- " l.date <= %(revaluation_date)s AND "
20- " l.currency_id IS NOT NULL AND "
21- " l.reconcile_id IS NULL AND "
22- " l.state <> 'draft' "
23+ " FROM account_move_line l"
24+ " inner join account_period p on p.id = l.period_id"
25+ " WHERE l.account_id IN %(account_ids)s AND"
26+ " l.date <= %(revaluation_date)s AND"
27+ " l.currency_id IS NOT NULL AND"
28+ " l.reconcile_id IS NULL AND"
29+ " l.state <> 'draft' AND"
30+ " p.number != 0" # US-1251 exclude IB entries period 0 for monthly and yearly
31 " GROUP BY l.account_id, l.currency_id")
32 params = {'revaluation_date': revaluation_date,
33 'account_ids': tuple(ids)}
34
35=== modified file 'bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py'
36--- bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py 2016-02-25 10:12:25 +0000
37+++ bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py 2016-04-28 14:54:24 +0000
38@@ -635,7 +635,8 @@
39 "Please check 'Included in revaluation' "
40 "for at least one account in account form."))
41
42- special_period_ids = [p.id for p in form.fiscalyear_id.period_ids if p.special == True]
43+ special_period_ids = [ p.id for p in form.fiscalyear_id.period_ids \
44+ if p.special == True and p.number != 0 ]
45 if not special_period_ids:
46 raise osv.except_osv(_('Error!'),
47 _('No special period found for the fiscalyear %s') %
48@@ -651,9 +652,10 @@
49 )
50 period_ids = [form.period_id.id]
51 else:
52+ # NOTE: US-1251 exclude IB entries period 0 for monthly and yearly
53 period_ids = []
54 for period in form.fiscalyear_id.period_ids:
55- if period.number < 13:
56+ if 0 < period.number < 13:
57 period_ids.append(period.id)
58 if not period_ids:
59 raise osv.except_osv(
60@@ -663,7 +665,7 @@
61 # Check periods state
62 periods_not_field_closed = []
63 for period in period_obj.browse(cr, uid, period_ids, context=context):
64- if period.state in ['created', 'draft']:
65+ if period.number != 0 and period.state in ['created', 'draft']:
66 periods_not_field_closed.append(period.name)
67
68 # check if revaluation has already been run for this period

Subscribers

People subscribed via source and target branches

to all changes: