Merge lp:~unifield-team/unifield-wm/us-957 into lp:unifield-wm

Proposed by jftempo
Status: Needs review
Proposed branch: lp:~unifield-team/unifield-wm/us-957
Merge into: lp:unifield-wm
Diff against target: 56 lines (+17/-3)
1 file modified
msf_currency_revaluation/wizard/wizard_currency_revaluation.py (+17/-3)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/us-957
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+287060@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

2771. By Vincent GREINER

US-957 [FIX]

recording Jan FY+1 REV entries of yearly/other BS:
source_date <=> date of end of FY revaluated

source_date is used to mark yearly rev entries:
FY+1 Jan can be monthly revaluated if only previous FY revaluation entries found in Jan.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'msf_currency_revaluation/wizard/wizard_currency_revaluation.py'
2--- msf_currency_revaluation/wizard/wizard_currency_revaluation.py 2014-11-12 16:19:21 +0000
3+++ msf_currency_revaluation/wizard/wizard_currency_revaluation.py 2016-02-24 16:52:15 +0000
4@@ -749,7 +749,8 @@
5 # if the revaluation method is 'Other B/S'
6 if form.revaluation_method in ['liquidity_year', 'other_bs']:
7 move_id, rev_line_ids = self._reverse_other_bs_move_lines(
8- cr, uid, form, move_id, new_ids, context=context)
9+ cr, uid, form, move_id, new_ids, context=context,
10+ next_fiscalyear_id=next_fiscalyear_id)
11 created_ids.extend(rev_line_ids)
12
13 if created_ids:
14@@ -814,7 +815,8 @@
15 return period_ids[0]
16
17 def _reverse_other_bs_move_lines(
18- self, cr, uid, form, move_id, line_ids, context=None):
19+ self, cr, uid, form, move_id, line_ids, context=None,
20+ next_fiscalyear_id=False):
21 """Reverse 'Other B/S' revaluation entries."""
22 if context is None:
23 context = {}
24@@ -856,6 +858,17 @@
25 rev_line_id = line_obj.copy(cr, uid, line.id, vals, context=context)
26 # Do the reverse
27 amt = -1 * line.amount_currency
28+
29+ source_date = line.date
30+ if line.period_id.fiscalyear_id.id == next_fiscalyear_id \
31+ and line.period_id.number == 1:
32+ # US-957: recording Jan FY+1 REV entries of yearly/other BS:
33+ # source_date <=> date of end of FY revaluated
34+ # => source_date is used to mark yearly rev entries: FY+1 Jan
35+ # can be monthly revaluated if only previous FY revaluation
36+ # entries found in Jan.
37+ source_date = form.fiscalyear_id.date_stop
38+
39 vals.update({
40 'debit': line.credit,
41 'credit': line.debit,
42@@ -864,12 +877,13 @@
43 'name': line_obj.join_without_redundancy(line.name, 'REV'),
44 'reversal_line_id': line.id,
45 'account_id': line.account_id.id,
46- 'source_date': line.date,
47+ 'source_date': source_date,
48 'reversal': True,
49 'reference': line.move_id and line.move_id.name or '',
50 'ref': line.move_id and line.move_id.name or '',
51 })
52 line_obj.write(cr, uid, [rev_line_id], vals, context=context)
53+
54 # Keep lines to reconcile
55 if line.account_id.reconcile:
56 lines_to_reconcile.append((line.id, rev_line_id))

Subscribers

People subscribed via source and target branches