Merge lp:~mukunde/unifield-server/US-9770 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 6343
Proposed branch: lp:~mukunde/unifield-server/US-9770
Merge into: lp:unifield-server
Diff against target: 318 lines (+103/-59) (has conflicts)
4 files modified
bin/addons/account/account_view.xml (+2/-0)
bin/addons/account_period_closing_level/account_period.py (+12/-1)
bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py (+34/-58)
bin/addons/msf_profile/i18n/fr_MF.po (+55/-0)
Text conflict in bin/addons/msf_profile/i18n/fr_MF.po
To merge this branch: bzr merge lp:~mukunde/unifield-server/US-9770
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+425060@code.launchpad.net
To post a comment you must log in.
lp:~mukunde/unifield-server/US-9770 updated
6240. By Gaël Mukunde

US-9770 [IMP] is_revaluated method code reduction

6241. By Gaël Mukunde

US-9770 [IMP] Block the possibility to do annual revaluation in periods P13 and P14.

6242. By Gaël Mukunde

US-9770 [IMP] Block the possibility to do monthly revaluation in periods P13, P14 and P15.

6243. By Gaël Mukunde

US-9770 [IMP] Adapt warning message when no revaluation entries are found to signal that the period is revaluated anyway and that the user can proceed with the period closing process.

6244. By Gaël Mukunde

US-9770 [IMP] Translation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/account/account_view.xml'
2--- bin/addons/account/account_view.xml 2022-07-11 09:11:32 +0000
3+++ bin/addons/account/account_view.xml 2022-10-14 13:37:01 +0000
4@@ -107,6 +107,8 @@
5 <separator colspan="4" string="States"/>
6 <field name="state"/>
7 <field name="is_revaluated" invisible="1"/> <!-- exportable field -->
8+ <field name="is_eoy_liquidity_revaluated" invisible="1"/> <!-- exportable field -->
9+ <field name="is_eoy_regular_bs_revaluated" invisible="1"/> <!-- exportable field -->
10 <button name="action_draft" states="done" string="Set to Draft" type="object" icon="gtk-convert" groups="account.group_account_manager"/>
11 </form>
12 </field>
13
14=== modified file 'bin/addons/account_period_closing_level/account_period.py'
15--- bin/addons/account_period_closing_level/account_period.py 2022-05-08 13:40:59 +0000
16+++ bin/addons/account_period_closing_level/account_period.py 2022-10-14 13:37:01 +0000
17@@ -197,7 +197,14 @@
18 if level == 'coordo' and not period.special and company.revaluation_default_account:
19 if not period.is_revaluated:
20 raise osv.except_osv(_('Warning'), _('You should run the month-end revaluation before closing the period.'))
21-
22+ # US-9770: check that the EoY revals have been processed in coordo before closing period P15
23+ if level == 'coordo' and period.number == 15 and company.revaluation_default_account:
24+ if not period.is_eoy_liquidity_revaluated and not period.is_eoy_regular_bs_revaluated:
25+ raise osv.except_osv(_('Warning'), _('You should run the year-end revaluation liquidity and regular balance before closing P15.'))
26+ if not period.is_eoy_liquidity_revaluated:
27+ raise osv.except_osv(_('Warning'), _('You should run the year-end revaluation liquidity before closing P15.'))
28+ if not period.is_eoy_regular_bs_revaluated:
29+ raise osv.except_osv(_('Warning'), _('You should run the year-end revaluation regular balance before closing P15.'))
30 # first verify that all existent registers for this period are closed
31 reg_ids = reg_obj.search(cr, uid, [('period_id', '=', period.id)], context=context)
32 journal_ok = []
33@@ -341,6 +348,8 @@
34 'payroll_ok': fields.function(_get_payroll_ok, method=True, type='boolean', store=False, string="Permit to know if payrolls are active", readonly=True),
35 'is_system': fields.function(_get_is_system, fnct_search=_get_search_is_system, method=True, type='boolean', string="System period ?", readonly=True),
36 'is_revaluated': fields.boolean('Revaluation run for the period', readonly=True), # field used at coordo level
37+ 'is_eoy_liquidity_revaluated': fields.boolean('Revaluation EoY liquidity', readonly=True), # US-9770 For Year End revaluation checks before P15 closing
38+ 'is_eoy_regular_bs_revaluated': fields.boolean('Revaluation EoY regular B/S', readonly=True), # US-9770 For Year End revaluation checks before P15 closing
39 }
40
41 _order = 'date_start DESC, number DESC'
42@@ -412,6 +421,8 @@
43 'state_sync_flag': lambda *a: 'none',
44 'is_system': False,
45 'is_revaluated': False,
46+ 'is_eoy_liquidity_revaluated': False,
47+ 'is_eoy_regular_bs_revaluated': False,
48 }
49
50 def action_reopen_field(self, cr, uid, ids, context=None):
51
52=== modified file 'bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py'
53--- bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py 2022-01-26 17:39:41 +0000
54+++ bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py 2022-10-14 13:37:01 +0000
55@@ -44,7 +44,7 @@
56 required=True),
57 'period_id': fields.many2one(
58 'account.period', string=_("Period"),
59- domain="[('fiscalyear_id', '=', fiscalyear_id)]"),
60+ domain="[('fiscalyear_id', '=', fiscalyear_id), ('number', '<=', 12)]"),
61 'currency_table_id': fields.many2one(
62 'res.currency.table', string=_("Currency table"),
63 domain=[('state', '=', 'valid')]),
64@@ -109,12 +109,11 @@
65 ('instance_id', '=', instance_id),
66 ]
67
68- # get potential target periods (13, 14, 15)
69+ # Since US-9770 yearly revaluation restricted to period 15
70 domain = [
71 ('fiscalyear_id', '=', fy_id),
72 ('state', '!=', 'created'),
73- ('number', '>', 12),
74- ('number', '<', 16),
75+ ('number', '=', 15),
76 ]
77 period_ids = self.pool.get('account.period').search(
78 cr, uid, domain, context=context)
79@@ -137,55 +136,19 @@
80 def _is_revaluated(self, cr, uid, period_id, revaluation_method=False,
81 context=None):
82 """
83- check if the revaluation has already been run by checking
84- for a non-zero entry in the REV journal in the current instance
85- and according to reval method filter by account type liquidity or not
86- at line level
87+ Since US-9770: check the tags is_eoy_liquidity_revaluated and is_eoy_regular_bs_revaluated for year-end reval
88
89 Since US-7448: check the tag is_revaluated for month-end reval.
90 """
91 if context is None:
92 context = {}
93 is_revaluated = False
94- journal_obj = self.pool.get('account.journal')
95 period_obj = self.pool.get('account.period')
96
97 if revaluation_method in ('liquidity_year', 'other_bs'):
98- comp_id = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id'], context=context).company_id
99- instance_id = comp_id.instance_id and comp_id.instance_id.id or False
100-
101- # get the revaluation journal of the instance
102- rev_journal_ids = journal_obj.search(cr, uid, [('type', '=', 'revaluation'), ('instance_id', '=', instance_id)],
103- limit=1, context=context)
104- rev_journal_id = rev_journal_ids and rev_journal_ids[0] or False
105-
106- domain = [
107- ('journal_id', '=', rev_journal_id),
108- ('period_id', '=', period_id),
109- ]
110-
111- # filter by liquidity account type or not for end year methods
112- # => to filter by account type we are at line level
113- account_liquidity_ids = self.pool.get('account.account').search(cr,
114- uid, [('type', '=', 'liquidity')], context=context)
115- if comp_id.revaluation_default_account:
116- # do not count rev default account itself
117- account_ids_domain = [
118- ('account_id', '!=',
119- comp_id.revaluation_default_account.id),
120- ]
121- else:
122- account_ids_domain = []
123- if account_liquidity_ids:
124- op = 'in' if revaluation_method == 'liquidity_year' \
125- else 'not in'
126- account_ids_domain += [
127- ('account_id', op, account_liquidity_ids),
128- ]
129- if account_ids_domain:
130- domain += account_ids_domain
131- reval_move_count = self.pool.get('account.move.line').search(cr, uid, domain, count=True, context=context)
132- is_revaluated = reval_move_count > 0
133+ liquidity_reval = period_obj.browse(cr, uid, [period_id], fields_to_fetch=['is_eoy_liquidity_revaluated'], context=context)[0].is_eoy_liquidity_revaluated
134+ bs_reval = period_obj.browse(cr, uid, [period_id], fields_to_fetch=['is_eoy_regular_bs_revaluated'], context=context)[0].is_eoy_regular_bs_revaluated
135+ is_revaluated = liquidity_reval if revaluation_method == 'liquidity_year' else bs_reval
136 # Monthly reval
137 elif period_obj.browse(cr, uid, [period_id], fields_to_fetch=['is_revaluated'], context=context)[0].is_revaluated:
138 is_revaluated = True
139@@ -306,7 +269,7 @@
140 value['posting_date'] = fiscalyear.date_stop
141
142 # get last 1st yearly reval period (liquidity or bs)
143- period_number = 13
144+ period_number = 15
145 last_reval_period = self._get_last_yearly_reval_period_id(
146 cr, uid, fiscalyear_id)
147 if last_reval_period:
148@@ -323,10 +286,9 @@
149 'title': _('Warning!'),
150 'message': check_period_res[2]
151 }
152- # US-816: end year reval restrict to periods 13, 14, 15
153+ # US-9770: end year reval restrict to period 15
154 domain['result_period_id'] += [
155- ('number', '>', 12),
156- ('number', '<', 16),
157+ ('number', '=', 15),
158 ]
159 # pre-select the period if it is opened
160 value['result_period_id'] = check_period_res[0] and check_period_res[1] or False
161@@ -616,8 +578,7 @@
162 if form.revaluation_method in ('liquidity_year', 'other_bs'):
163 period_check_id = form.result_period_internal_id.id
164
165- # since US-816, end year reval entries period is extended from
166- # period 13, to 13, 14, 15
167+ # since US-9770, end year reval entries period is restricted to period 15
168
169 # check if entry period is valid for end year reval
170 # (must exist and must be opened)
171@@ -631,7 +592,7 @@
172 check_period_end_year_res[2])
173 year_end_entry_period_id = check_period_end_year_res[1]
174
175- # period 13 is opened but check if N+1 FY 1st period is opened
176+ # period 15 is opened but check if N+1 FY 1st period is opened
177 # as it is used for reversal lines
178 next_fy_ok = False
179 next_fiscalyear_id = self._get_next_fiscalyear_id(
180@@ -771,26 +732,24 @@
181 # check if revaluation has already been run for this period
182 # UFTP-385 not checked for year end as is it over months revaluation
183 # in this case to check revaluation year already done we check only
184- # period 13 AND 14, 15 since US-816
185+ # period 15 since US-9770
186 if form.revaluation_method == 'liquidity_month':
187 revalcheck_period_ids = period_ids
188 else:
189 domain = [
190 ('fiscalyear_id', '=', form.fiscalyear_id.id),
191- ('number', '>', 12),
192- ('number', '<', 16),
193+ ('number', '=', 15),
194 ]
195 revalcheck_period_ids = period_obj.search(cr, uid, domain,
196 context=context)
197 for period_id in revalcheck_period_ids:
198 if self._is_revaluated(cr, uid, period_id, form.revaluation_method,
199 context=None):
200+ period_name = period_obj.browse(cr, uid, period_id, context=context).name
201 if form.revaluation_method == 'liquidity_month':
202- period_name = period_obj.browse(cr, uid, period_id,
203- context=context).name
204 msg = _(u"%s has already been revaluated") % (period_name, )
205 else:
206- msg = _(u"End year revaluation already performed")
207+ msg = _(u"End year revaluation already performed in %s") % (period_name, )
208 raise osv.except_osv(_(u"Error"), msg)
209
210 # Get balance sums and entries included in the reval
211@@ -861,6 +820,10 @@
212 'WHERE id IN %s', (tuple(created_ids),))
213 if form.revaluation_method == 'liquidity_month' and form.period_id:
214 period_obj.write(cr, uid, form.period_id.id, {'is_revaluated': True}, context=context)
215+ if form.revaluation_method == 'liquidity_year' and form.period_id:
216+ period_obj.write(cr, uid, form.period_id.id, {'is_eoy_liquidity_revaluated': True}, context=context)
217+ if form.revaluation_method == 'other_bs' and form.period_id:
218+ period_obj.write(cr, uid, form.period_id.id, {'is_eoy_regular_bs_revaluated': True}, context=context)
219 # Return the view
220 return {'domain': "[('id','in', %s)]" % (created_ids,),
221 'name': _("Created revaluation lines"),
222@@ -872,12 +835,25 @@
223 'search_view_id': False,
224 'type': 'ir.actions.act_window'}
225 else:
226+ rev_type = ''
227 if form.revaluation_method == 'liquidity_month' and form.period_id:
228 # Month-end reval: set the period as revaluated even if no entries have been generated
229 period_obj.write(cr, uid, form.period_id.id, {'is_revaluated': True}, context=context)
230 cr.commit() # so that the tag is kept despite the warning raised
231+ rev_type = _('Month-end Liquidity')
232+ if form.revaluation_method == 'liquidity_year' and form.period_id:
233+ # Year-end reval: set the period as revaluated even if no entries have been generated
234+ period_obj.write(cr, uid, form.period_id.id, {'is_eoy_liquidity_revaluated': True}, context=context)
235+ cr.commit() # so that the tag is kept despite the warning raised
236+ rev_type = _('Year-end Liquidity')
237+ if form.revaluation_method == 'other_bs' and form.period_id:
238+ # Year-end reval: set the period as revaluated even if no entries have been generated
239+ period_obj.write(cr, uid, form.period_id.id, {'is_eoy_regular_bs_revaluated': True}, context=context)
240+ cr.commit() # so that the tag is kept despite the warning raised
241+ rev_type = _('Year-end Other B/S')
242 raise osv.except_osv(_("Warning"),
243- _("No revaluation accounting entry have been posted."))
244+ _("No revaluation accounting entries found to book: the period is now marked as "
245+ "revaluated for %s, you can proceed with the period closing process.") % rev_type)
246
247 def _get_next_fiscalyear_id(self, cr, uid, fiscalyear_id, context=None):
248 """Return the next fiscal year ID."""
249
250=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
251--- bin/addons/msf_profile/i18n/fr_MF.po 2022-10-13 07:58:52 +0000
252+++ bin/addons/msf_profile/i18n/fr_MF.po 2022-10-14 13:37:01 +0000
253@@ -115430,6 +115430,7 @@
254 "%s"
255 msgstr "Attention ces lignes ne peuvent pas être importées car il y a trop de chiffres dans le champ Qté. Veuillez vérifier:\n"
256 "%s"
257+<<<<<<< TREE
258
259 #. module: msf_outgoing
260 #: code:addons/msf_outgoing/wizard/incoming_shipment_processor.py:362
261@@ -116258,3 +116259,57 @@
262 #, python-format
263 msgid "Line %s: the internal id is missing."
264 msgstr "Ligne %s: champ ID Interne manquant."
265+=======
266+
267+#. module: account_period_closing_level
268+#: field:account.period,is_eoy_liquidity_revaluated:0
269+msgid "Revaluation EoY liquidity"
270+msgstr "Réévaluation de la Trésorerie de fin d'année"
271+
272+#. module: account_period_closing_level
273+#: field:account.period,is_eoy_regular_bs_revaluated:0
274+msgid "Revaluation EoY regular B/S"
275+msgstr "Réévaluation de la Balance de Bilan de fin d'année"
276+
277+#. module: account_period_closing_level
278+#: code:addons/account_period_closing_level/account_period.py:203
279+#, python-format
280+msgid "You should run the year-end revaluation liquidity and regular balance before closing P15."
281+msgstr "Veuillez lancer les réévaluations de la trésorerie et de la balance de bilan de fin d'année avant de fermer la période P15."
282+
283+#. module: account_period_closing_level
284+#: code:addons/account_period_closing_level/account_period.py:205
285+#, python-format
286+msgid "You should run the year-end revaluation liquidity before closing P15."
287+msgstr "Veuillez lancer la réévaluation de la trésorerie de fin d'année avant de fermer la période P15."
288+
289+#. module: account_period_closing_level
290+#: code:addons/account_period_closing_level/account_period.py:207
291+#, python-format
292+msgid "You should run the year-end revaluation regular balance before closing P15."
293+msgstr "Veuillez lancer la réévaluation de la balance de bilan de fin d'année avant de fermer la période P15."
294+
295+#. module: msf_currency_revaluation
296+#: code:addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py:855
297+#, python-format
298+msgid "No revaluation accounting entries found to book: the period is now marked as revaluated for %s, you can proceed with the period closing process."
299+msgstr "Pas d'entrées de réévaluation trouvées: La période est maintenant marquée comme réévaluée pour %s, vous pouvez continuer le processus de clôture de periode."
300+
301+#. module: msf_currency_revaluation
302+#: code:addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py:843
303+#, python-format
304+msgid "Month-end Liquidity"
305+msgstr "la trésorerie de fin de mois"
306+
307+#. module: msf_currency_revaluation
308+#: code:addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py:848
309+#, python-format
310+msgid "Year-end Liquidity"
311+msgstr "la trésorerie de fin d'année"
312+
313+#. module: msf_currency_revaluation
314+#: code:addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py:853
315+#, python-format
316+msgid "Year-end Other B/S"
317+msgstr "la balance de bilan de fin d'année"
318+>>>>>>> MERGE-SOURCE

Subscribers

People subscribed via source and target branches