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

Proposed by jftempo
Status: Merged
Merged at revision: 5371
Proposed branch: lp:~julie-w/unifield-server/US-5625
Merge into: lp:unifield-server
Diff against target: 104 lines (+61/-0)
3 files modified
bin/addons/account_override/account.py (+17/-0)
bin/addons/analytic_override/analytic_account.py (+26/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+18/-0)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-5625
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+364809@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_override/account.py'
2--- bin/addons/account_override/account.py 2019-02-06 09:25:31 +0000
3+++ bin/addons/account_override/account.py 2019-03-20 14:43:47 +0000
4@@ -516,6 +516,22 @@
5 raise osv.except_osv(_('Warning !'),
6 _('An account set as "Included in revaluation" must be set as "Reconcile".'))
7
8+ def _check_existing_entries(self, cr, uid, account_id, context=None):
9+ """
10+ Displays a message visible on top of the page in case some JI booked on the account_id have a posting date
11+ outside the account activation time interval
12+ """
13+ if context is None:
14+ context = {}
15+ aml_obj = self.pool.get('account.move.line')
16+ if account_id and not context.get('sync_update_execution'):
17+ account_fields = ['activation_date', 'inactivation_date', 'code', 'name']
18+ account = self.browse(cr, uid, account_id, fields_to_fetch=account_fields, context=context)
19+ aml_dom = [('account_id', '=', account_id), '|', ('date', '<', account.activation_date), ('date', '>=', account.inactivation_date)]
20+ if aml_obj.search_exist(cr, uid, aml_dom, context=context):
21+ self.log(cr, uid, account_id, _('At least one Journal Item using the Account "%s - %s" has a Posting Date '
22+ 'outside the activation dates selected.') % (account.code, account.name))
23+
24 def create(self, cr, uid, vals, context=None):
25 self._check_date(vals)
26 self._check_allowed_partner_type(vals)
27@@ -541,6 +557,7 @@
28 res = res and super(account_account, self).write(cr, uid, [acc.id], newvals, context=context)
29 for account_id in ids:
30 self._check_reconcile_status(cr, uid, account_id, context=context)
31+ self._check_existing_entries(cr, uid, account_id, context=context)
32 return res
33
34 def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
35
36=== modified file 'bin/addons/analytic_override/analytic_account.py'
37--- bin/addons/analytic_override/analytic_account.py 2019-02-14 14:44:01 +0000
38+++ bin/addons/analytic_override/analytic_account.py 2019-03-20 14:43:47 +0000
39@@ -442,6 +442,30 @@
40 raise osv.except_osv(_('Warning !'), _('You cannot have the same name between analytic accounts in the same category!'))
41 return True
42
43+ def _check_existing_entries(self, cr, uid, analytic_account_id, context=None):
44+ """
45+ Checks if some AJI booked on the analytic_account_id are outside the account activation time interval.
46+ For FP and Free accounts: check is done on Doc Date. If AJI are found an error is raised to prevent Saving the account.
47+ For other accounts: check is done on Posting Date. If AJI are found only a message is displayed on top of the page.
48+ """
49+ if context is None:
50+ context = {}
51+ aal_obj = self.pool.get('account.analytic.line')
52+ if analytic_account_id:
53+ analytic_acc_fields = ['date_start', 'date', 'code']
54+ analytic_acc = self.browse(cr, uid, analytic_account_id, fields_to_fetch=analytic_acc_fields, context=context)
55+ aal_dom_fp_free = [('account_id', '=', analytic_account_id),
56+ '|', ('document_date', '<', analytic_acc.date_start), ('document_date', '>=', analytic_acc.date)]
57+ if aal_obj.search_exist(cr, uid, aal_dom_fp_free, context=context):
58+ raise osv.except_osv(_('Error'), _('At least one Analytic Journal Item using the Analytic Account %s '
59+ 'has a Document Date outside the activation dates selected.') % (analytic_acc.code))
60+ if not context.get('sync_update_execution'):
61+ aal_dom_cc_dest = ['|', ('cost_center_id', '=', analytic_account_id), ('destination_id', '=', analytic_account_id),
62+ '|', ('date', '<', analytic_acc.date_start), ('date', '>=', analytic_acc.date)]
63+ if aal_obj.search_exist(cr, uid, aal_dom_cc_dest, context=context):
64+ self.log(cr, uid, analytic_account_id, _('At least one Analytic Journal Item using the Analytic Account %s '
65+ 'has a Posting Date outside the activation dates selected.') % (analytic_acc.code))
66+
67 def create(self, cr, uid, vals, context=None):
68 """
69 Some verifications before analytic account creation
70@@ -485,6 +509,8 @@
71 if cat_instance:
72 self.check_fp(cr, uid, cat_instance, context=context)
73 self._check_name_unicity(cr, uid, ids, context=context)
74+ for analytic_acc_id in ids:
75+ self._check_existing_entries(cr, uid, analytic_acc_id, context=context)
76 return res
77
78 def unlink(self, cr, uid, ids, context=None):
79
80=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
81--- bin/addons/msf_profile/i18n/fr_MF.po 2019-03-04 11:05:48 +0000
82+++ bin/addons/msf_profile/i18n/fr_MF.po 2019-03-20 14:43:47 +0000
83@@ -105335,3 +105335,21 @@
84 msgstr "\n"
85 " Attention: Les lignes suivantes ont des qté ou des montants sur plus de 15 chiffres. Veuillez vérifier la qté et le prix unitaire pour éviter des pertes d'information:\n"
86 " "
87+
88+#. module: analytic_override
89+#: code:addons/analytic_override/analytic_account.py:460
90+#, python-format
91+msgid "At least one Analytic Journal Item using the Analytic Account %s has a Document Date outside the activation dates selected."
92+msgstr "Au moins une Ligne d'Ecriture Analytique utilisant le Compte Analytique %s a une Date de Document en dehors des dates d'activation sélectionnées."
93+
94+#. module: analytic_override
95+#: code:addons/analytic_override/analytic_account.py:466
96+#, python-format
97+msgid "At least one Analytic Journal Item using the Analytic Account %s has a Posting Date outside the activation dates selected."
98+msgstr "Au moins une Ligne d'Ecriture Analytique utilisant le Compte Analytique %s a une Date de Comptabilisation en dehors des dates d'activation sélectionnées."
99+
100+#. module: account_override
101+#: code:addons/account_override/account.py:532
102+#, python-format
103+msgid "At least one Journal Item using the Account \"%s - %s\" has a Posting Date outside the activation dates selected."
104+msgstr "Au moins une Ligne d'Ecriture Comptable utilisant le Compte \"%s - %s\" a une Date de Comptabilisation en dehors des dates d'activation sélectionnées."

Subscribers

People subscribed via source and target branches