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

Proposed by jftempo
Status: Merged
Merged at revision: 2751
Proposed branch: lp:~unifield-team/unifield-wm/us-879
Merge into: lp:unifield-wm
Diff against target: 40 lines (+20/-2)
1 file modified
account_period_closing_level/account_year_end_closing.py (+20/-2)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/us-879
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+284467@code.launchpad.net
To post a comment you must log in.
lp:~unifield-team/unifield-wm/us-879 updated
2743. By Vincent GREINER

US-879 [FIX] year en closing: update periods state only if founds (no special period for FY14)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_period_closing_level/account_year_end_closing.py'
2--- account_period_closing_level/account_year_end_closing.py 2016-01-29 10:42:26 +0000
3+++ account_period_closing_level/account_year_end_closing.py 2016-01-29 16:27:33 +0000
4@@ -765,8 +765,11 @@
5 state = 'done'
6
7 if state:
8- vals = { 'state': state, }
9 # period 0 (FY+1)/16 state
10+
11+ # US-879: for periods update, set 'state_sync_flag' field first,
12+ # for adhoc sync state flow, like in account_period.action_set_state
13+ vals = { 'state_sync_flag': state, }
14 period_ids = self._get_periods_ids(cr, uid,
15 self._browse_fy(cr, uid, fy_id, context=context),
16 context=context)
17@@ -774,7 +777,22 @@
18 self.pool.get('account.period').write(cr, uid, period_ids, vals,
19 context=context)
20
21- # fy state
22+ # then after 'state_sync_flag' set, set account_journal_period state
23+ # and period true state
24+ # (DO NOT CHANGE 'state' in same write than 'state_sync_flag'
25+ if state == 'done':
26+ journal_state = 'done'
27+ else:
28+ journal_state = 'draft'
29+ cr.execute('UPDATE account_journal_period' \
30+ ' SET state=%s WHERE period_id IN %s', (
31+ journal_state, tuple(period_ids), ))
32+ vals = {'state': state, 'field_process': False}
33+ self.pool.get('account.period').write(cr, uid, period_ids, vals,
34+ context=context)
35+
36+ # then set FY state
37+ vals = { 'state': state, }
38 fy_obj.write(cr, uid, [fy_id], vals, context=context)
39
40 def _search_record(self, cr, uid, model, domain, context=None):

Subscribers

People subscribed via source and target branches