Merge lp:~julie-w/unifield-server/US-6232 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5490
Proposed branch: lp:~julie-w/unifield-server/US-6232
Merge into: lp:unifield-server
Diff against target: 92 lines (+29/-5)
2 files modified
bin/addons/account_period_closing_level/account_period.py (+17/-5)
bin/addons/msf_profile/i18n/fr_MF.po (+12/-0)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-6232
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+372347@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/account_period_closing_level/account_period.py'
2--- bin/addons/account_period_closing_level/account_period.py 2018-11-12 10:16:05 +0000
3+++ bin/addons/account_period_closing_level/account_period.py 2019-09-05 13:46:48 +0000
4@@ -73,11 +73,16 @@
5 sub_line_obj = self.pool.get('account.subscription.line')
6 curr_obj = self.pool.get('res.currency')
7 curr_rate_obj = self.pool.get('res.currency.rate')
8+ user_obj = self.pool.get('res.users')
9+ journal_obj = self.pool.get('account.journal')
10+ move_line_obj = self.pool.get('account.move.line')
11
12 # previous state of the period
13 ap_dict = self.read(cr, uid, ids, ['state'])[0]
14 previous_state = ap_dict['state']
15
16+ company = user_obj.browse(cr, uid, uid, fields_to_fetch=['company_id'], context=context).company_id
17+ level = company.instance_id and company.instance_id.level or ''
18
19 # Ticket utp913 set state_sync_flag for conditional sync of state
20 # 'none' : no update to the state field via a sync (data is still sent but not updated in target instance)
21@@ -85,8 +90,6 @@
22 # note that 'draft' = 'Open' and 'created' = 'Draft' ... see ACCOUNT_PERIOD_STATE_SELECTION in init
23
24 if context.get('sync_update_execution') is None:
25- user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
26- level = user.company_id.instance_id.level
27
28 if level == 'section': # section = HQ
29 if previous_state == 'created' and context['state'] == 'draft':
30@@ -183,7 +186,7 @@
31 "All next periods must be at a lower state."))
32 # / Check state consistency
33
34- if period.state == 'draft':
35+ if period.state == 'draft': # Open
36 # check if there are draft payroll entries in the period. Ticket uftp-89
37 if context['state'] == 'field-closed':
38 hr_payroll_msf_obj = self.pool.get('hr.payroll.msf')
39@@ -193,6 +196,16 @@
40 # UFTP-351: Check that no Journal Entries are Unposted for this period
41 self.check_unposted_entries(cr, uid, period.id, context=context)
42
43+ # check that the reval has been processed in coordo IF a revaluation account has been set in the Company form
44+ if level == 'coordo' and not period.special and company.revaluation_default_account:
45+ reval_journal_ids = journal_obj.search(cr, uid, [('type', '=', 'revaluation'), ('is_current_instance', '=', True)], context=context)
46+ if not reval_journal_ids:
47+ raise osv.except_osv(_('Warning'), _('Impossible to check the revaluation entries of the period: '
48+ 'Revaluation Journal not found.'))
49+ move_line_dom = [('journal_id', 'in', reval_journal_ids), ('period_id', '=', period.id)]
50+ if not move_line_obj.search_exist(cr, uid, move_line_dom, context=context):
51+ raise osv.except_osv(_('Warning'), _('You should run the month-end revaluation before closing the period.'))
52+
53 # first verify that all existent registers for this period are closed
54 reg_ids = reg_obj.search(cr, uid, [('period_id', '=', period.id)], context=context)
55 journal_ok = []
56@@ -242,7 +255,7 @@
57 WHERE period_id = %s"""
58 cr.execute(sql, (period.id,))
59 res = [x[0] for x in cr.fetchall()]
60- comp_curr_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
61+ comp_curr_id = company.currency_id.id
62 # for each currency do a verification about fx rate
63 for period_id in res:
64 # search for company currency_id if ID is None
65@@ -278,7 +291,6 @@
66 self.check_unposted_entries(cr, uid, period.id, context=context)
67
68 # check if unposted move lines are linked to this period
69- move_line_obj = self.pool.get('account.move.line')
70 move_lines = move_line_obj.search(cr, uid, [('period_id', 'in', ids)])
71 for move_line in move_line_obj.browse(cr, uid, move_lines):
72 if move_line.state != 'valid':
73
74=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
75--- bin/addons/msf_profile/i18n/fr_MF.po 2019-08-22 10:11:24 +0000
76+++ bin/addons/msf_profile/i18n/fr_MF.po 2019-09-05 13:46:48 +0000
77@@ -107372,3 +107372,15 @@
78 #: report:purchase.order.merged:0
79 msgid "Functional total cost :"
80 msgstr "Total Coût Fonctionnel :"
81+
82+#. module: account_period_closing_level
83+#: code:addons/account_period_closing_level/account_period.py:203
84+#, python-format
85+msgid "Impossible to check the revaluation entries of the period: Revaluation Journal not found."
86+msgstr "Impossible de vérifier les écritures de réévaluation de la période : Journal de Réévaluation non trouvé."
87+
88+#. module: account_period_closing_level
89+#: code:addons/account_period_closing_level/account_period.py:207
90+#, python-format
91+msgid "You should run the month-end revaluation before closing the period."
92+msgstr "Veuillez lancer la réévaluation de fin de mois avant de fermer la période."

Subscribers

People subscribed via source and target branches