Merge lp:~julie-w/unifield-server/US-5724 into lp:unifield-server
- US-5724
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 5292 |
Proposed branch: | lp:~julie-w/unifield-server/US-5724 |
Merge into: | lp:unifield-server |
Diff against target: |
278 lines (+184/-0) 9 files modified
bin/addons/msf_profile/data/patches.xml (+4/-0) bin/addons/msf_profile/i18n/fr_MF.po (+40/-0) bin/addons/msf_profile/msf_profile.py (+10/-0) bin/addons/msf_tools/msf_tools.py (+16/-0) bin/addons/unifield_setup/__openerp__.py (+1/-0) bin/addons/unifield_setup/installer/__init__.py (+1/-0) bin/addons/unifield_setup/installer/previous_fy_dates_setup.py (+62/-0) bin/addons/unifield_setup/installer/previous_fy_dates_setup_view.xml (+48/-0) bin/addons/unifield_setup/setup_configuration.py (+2/-0) |
To merge this branch: | bzr merge lp:~julie-w/unifield-server/US-5724 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+363468@code.launchpad.net |
Commit message
Description of the change
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/msf_profile/data/patches.xml' |
2 | --- bin/addons/msf_profile/data/patches.xml 2019-02-06 13:36:14 +0000 |
3 | +++ bin/addons/msf_profile/data/patches.xml 2019-02-21 09:14:56 +0000 |
4 | @@ -2,6 +2,10 @@ |
5 | <openerp> |
6 | <data> |
7 | <!-- UF12.0 --> |
8 | + <record id="us_5724_set_previous_fy_dates_allowed" model="patch.scripts"> |
9 | + <field name="method">us_5724_set_previous_fy_dates_allowed</field> |
10 | + </record> |
11 | + |
12 | <record id="us_2896_volume_ocbprod" model="patch.scripts"> |
13 | <field name="method">us_2896_volume_ocbprod</field> |
14 | </record> |
15 | |
16 | === modified file 'bin/addons/msf_profile/i18n/fr_MF.po' |
17 | --- bin/addons/msf_profile/i18n/fr_MF.po 2019-02-15 10:46:11 +0000 |
18 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2019-02-21 09:14:56 +0000 |
19 | @@ -105270,3 +105270,43 @@ |
20 | #: field:wizard.pick.import,import_file:0 |
21 | msgid "PICK import file" |
22 | msgstr "Fichier d'import de PICK" |
23 | + |
24 | +#. module: unifield_setup |
25 | +#: field:previous.fy.dates.setup,previous_fy_dates_allowed:0 |
26 | +#: field:unifield.setup.configuration,previous_fy_dates_allowed:0 |
27 | +msgid "Does the system allow document dates on previous Fiscal Year?" |
28 | +msgstr "Le système autorise-t-il les dates des documents sur l'Exercice Comptable précédent ?" |
29 | + |
30 | +#. module: unifield_setup |
31 | +#: code:addons/unifield_setup/installer/previous_fy_dates_setup.py:52 |
32 | +#, python-format |
33 | +msgid "An error has occurred with the item retrieved from the form. Please contact an administrator if the problem persists." |
34 | +msgstr "Une erreur est survenue avec l'élément récupéré depuis le formulaire. Veuillez contacter un administrateur si le problème persiste." |
35 | + |
36 | +#. module: unifield_setup |
37 | +#: view:previous.fy.dates.setup:0 |
38 | +#: model:ir.actions.act_window,name:unifield_setup.action_previous_fy_dates_setup |
39 | +msgid "Allow previous Fiscal Year dates" |
40 | +msgstr "Autoriser les dates de l'Exercice Comptable précédent" |
41 | + |
42 | +#. module: unifield_setup |
43 | +#: view:previous.fy.dates.setup:0 |
44 | +msgid "Allow document dates on previous Fiscal Year" |
45 | +msgstr "Autoriser les dates des documents sur l'Exercice Comptable précédent" |
46 | + |
47 | +#. module: unifield_setup |
48 | +#: view:previous.fy.dates.setup:0 |
49 | +msgid "Determines whether document dates and posting dates can be on different Fiscal Years." |
50 | +msgstr "Détermine si les dates des documents et les dates de comptabilisation peuvent être sur des Exercices Comptables différents." |
51 | + |
52 | +#. module: msf_tools |
53 | +#: code:addons/msf_tools/msf_tools.py:909 |
54 | +#, python-format |
55 | +msgid "Document date should be in posting date FY" |
56 | +msgstr "La date du document doit être dans le même exercice comptable que la date de comptabilisation" |
57 | + |
58 | +#. module: msf_tools |
59 | +#: code:addons/msf_tools/msf_tools.py:907 |
60 | +#, python-format |
61 | +msgid "Document date (%s) should be in posting date FY" |
62 | +msgstr "La date du document (%s) doit être dans le même exercice comptable que la date de comptabilisation" |
63 | |
64 | === modified file 'bin/addons/msf_profile/msf_profile.py' |
65 | --- bin/addons/msf_profile/msf_profile.py 2019-02-06 13:36:14 +0000 |
66 | +++ bin/addons/msf_profile/msf_profile.py 2019-02-21 09:14:56 +0000 |
67 | @@ -53,6 +53,16 @@ |
68 | } |
69 | |
70 | # UF12.0 |
71 | + def us_5724_set_previous_fy_dates_allowed(self, cr, uid, *a, **b): |
72 | + """ |
73 | + Sets the field "previous_fy_dates_allowed" to True in the UniField Setup Configuration for all OCB and OCP instances |
74 | + """ |
75 | + user_obj = self.pool.get('res.users') |
76 | + current_instance = user_obj.browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id |
77 | + if current_instance and (current_instance.name.startswith('OCB') or current_instance.name.startswith('OCP')): |
78 | + cr.execute("UPDATE unifield_setup_configuration SET previous_fy_dates_allowed = 't';") |
79 | + return True |
80 | + |
81 | def us_2896_volume_ocbprod(self, cr, uid, *a, **b): |
82 | ''' OCBHQ: volume has not been converted to dm3 on instances ''' |
83 | instance = self.pool.get('res.users').browse(cr, uid, uid).company_id.instance_id |
84 | |
85 | === modified file 'bin/addons/msf_tools/msf_tools.py' |
86 | --- bin/addons/msf_tools/msf_tools.py 2018-12-10 14:01:47 +0000 |
87 | +++ bin/addons/msf_tools/msf_tools.py 2019-02-21 09:14:56 +0000 |
88 | @@ -871,6 +871,8 @@ |
89 | show_date=False, custom_msg=False, context=None): |
90 | """ |
91 | Checks that posting date >= document date |
92 | + Depending on the config made in the Reconfigure Wizard, can also check that the document date is included |
93 | + in the same FY as the related posting date. |
94 | |
95 | :type document_date: orm date |
96 | :type posting_date: orm date |
97 | @@ -895,6 +897,20 @@ |
98 | 'Posting date should be later than Document Date.') |
99 | raise osv.except_osv(_('Error'), msg) |
100 | |
101 | + # if the system doesn't allow doc dates from previous FY, check that this condition is met |
102 | + setup = self.pool.get('unifield.setup.configuration').get_config(cr, uid) |
103 | + if not setup or not setup.previous_fy_dates_allowed: |
104 | + # 01/01/FY <= document date <= 31/12/FY |
105 | + posting_date_obj = self.pool.get('date.tools').orm2date(posting_date) |
106 | + check_range_start = self.get_orm_date(1, 1, year=posting_date_obj.year) |
107 | + check_range_end = self.get_orm_date(31, 12, year=posting_date_obj.year) |
108 | + if not (check_range_start <= document_date <= check_range_end): |
109 | + if show_date: |
110 | + msg = _('Document date (%s) should be in posting date FY') % (document_date, ) |
111 | + else: |
112 | + msg = _('Document date should be in posting date FY') |
113 | + raise osv.except_osv(_('Error'), msg) |
114 | + |
115 | def truncate_amount(self, amount, digits): |
116 | stepper = pow(10.0, digits) |
117 | return math.trunc(stepper * amount) / stepper |
118 | |
119 | === modified file 'bin/addons/unifield_setup/__openerp__.py' |
120 | --- bin/addons/unifield_setup/__openerp__.py 2014-05-13 11:58:37 +0000 |
121 | +++ bin/addons/unifield_setup/__openerp__.py 2019-02-21 09:14:56 +0000 |
122 | @@ -59,6 +59,7 @@ |
123 | "installer/payroll_view.xml", |
124 | "installer/commitment_import_view.xml", |
125 | "installer/vat_setup_view.xml", |
126 | + "installer/previous_fy_dates_setup_view.xml", |
127 | # Security and access rights |
128 | "security/ir.model.access.csv", |
129 | "view/product_view.xml", |
130 | |
131 | === modified file 'bin/addons/unifield_setup/installer/__init__.py' |
132 | --- bin/addons/unifield_setup/installer/__init__.py 2014-05-13 11:58:37 +0000 |
133 | +++ bin/addons/unifield_setup/installer/__init__.py 2019-02-21 09:14:56 +0000 |
134 | @@ -32,3 +32,4 @@ |
135 | import payroll |
136 | import commitment_import |
137 | import vat_setup |
138 | +import previous_fy_dates_setup |
139 | |
140 | === added file 'bin/addons/unifield_setup/installer/previous_fy_dates_setup.py' |
141 | --- bin/addons/unifield_setup/installer/previous_fy_dates_setup.py 1970-01-01 00:00:00 +0000 |
142 | +++ bin/addons/unifield_setup/installer/previous_fy_dates_setup.py 2019-02-21 09:14:56 +0000 |
143 | @@ -0,0 +1,62 @@ |
144 | +# -*- coding: utf-8 -*- |
145 | +############################################################################## |
146 | +# |
147 | +# OpenERP, Open Source Management Solution |
148 | +# Copyright (C) 2019 TeMPO Consulting, MSF |
149 | +# |
150 | +# This program is free software: you can redistribute it and/or modify |
151 | +# it under the terms of the GNU Affero General Public License as |
152 | +# published by the Free Software Foundation, either version 3 of the |
153 | +# License, or (at your option) any later version. |
154 | +# |
155 | +# This program is distributed in the hope that it will be useful, |
156 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
157 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
158 | +# GNU Affero General Public License for more details. |
159 | +# |
160 | +# You should have received a copy of the GNU Affero General Public License |
161 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
162 | +# |
163 | +############################################################################## |
164 | + |
165 | +from osv import osv |
166 | +from osv import fields |
167 | + |
168 | +from tools.translate import _ |
169 | + |
170 | + |
171 | +class previous_fy_dates_setup(osv.osv_memory): |
172 | + _name = 'previous.fy.dates.setup' |
173 | + _inherit = 'res.config' |
174 | + |
175 | + _columns = { |
176 | + 'previous_fy_dates_allowed': fields.boolean(string='Does the system allow document dates on previous Fiscal Year?'), |
177 | + } |
178 | + |
179 | + def default_get(self, cr, uid, fields, context=None): |
180 | + """ |
181 | + Display the default/current value regarding the allowing of previous FY dates |
182 | + """ |
183 | + if context is None: |
184 | + context = {} |
185 | + setup = self.pool.get('unifield.setup.configuration').get_config(cr, uid) |
186 | + res = super(previous_fy_dates_setup, self).default_get(cr, uid, fields, context=context) |
187 | + res['previous_fy_dates_allowed'] = setup.previous_fy_dates_allowed |
188 | + return res |
189 | + |
190 | + def execute(self, cr, uid, ids, context=None): |
191 | + """ |
192 | + Fills in the previous_fy_dates_allowed field and activate/de-activate the allowing of Doc dates booked in previous FY |
193 | + """ |
194 | + if context is None: |
195 | + context = {} |
196 | + if not isinstance(ids, list) or len(ids) != 1: |
197 | + raise osv.except_osv(_('Error'), _('An error has occurred with the item retrieved from the form. Please contact an administrator if the problem persists.')) |
198 | + payload = self.browse(cr, uid, ids[0], fields_to_fetch=['previous_fy_dates_allowed'], context=context) |
199 | + setup_obj = self.pool.get('unifield.setup.configuration') |
200 | + setup = setup_obj.get_config(cr, uid) |
201 | + if setup: |
202 | + setup_obj.write(cr, uid, [setup.id], {'previous_fy_dates_allowed': payload.previous_fy_dates_allowed}, context=context) |
203 | + |
204 | + |
205 | +previous_fy_dates_setup() |
206 | |
207 | === added file 'bin/addons/unifield_setup/installer/previous_fy_dates_setup_view.xml' |
208 | --- bin/addons/unifield_setup/installer/previous_fy_dates_setup_view.xml 1970-01-01 00:00:00 +0000 |
209 | +++ bin/addons/unifield_setup/installer/previous_fy_dates_setup_view.xml 2019-02-21 09:14:56 +0000 |
210 | @@ -0,0 +1,48 @@ |
211 | +<openerp> |
212 | + <data> |
213 | + <record id="view_previous_fy_dates_setup" model="ir.ui.view"> |
214 | + <field name="name">Allow previous Fiscal Year dates</field> |
215 | + <field name="model">previous.fy.dates.setup</field> |
216 | + <field name="type">form</field> |
217 | + <field name="inherit_id" ref="base.res_config_view_base"/> |
218 | + <field name="arch" type="xml"> |
219 | + <data> |
220 | + <form position="attributes"> |
221 | + <attribute name="string">Allow previous Fiscal Year dates</attribute> |
222 | + </form> |
223 | + <xpath expr="//label[@string='description']" position="attributes"> |
224 | + <attribute name="string">Determines whether document dates and posting dates can be on different Fiscal Years.</attribute> |
225 | + </xpath> |
226 | + <xpath expr='//separator[@string="title"]' position='attributes'> |
227 | + <attribute name='string'>Allow document dates on previous Fiscal Year</attribute> |
228 | + </xpath> |
229 | + <xpath expr='//separator[@string="vsep"]' position='attributes'> |
230 | + <attribute name='rowspan'>25</attribute> |
231 | + <attribute name='string'></attribute> |
232 | + </xpath> |
233 | + <group string="res_config_contents" position="replace"> |
234 | + <group colspan="5"> |
235 | + <field name="previous_fy_dates_allowed"/> |
236 | + </group> |
237 | + </group> |
238 | + </data> |
239 | + </field> |
240 | + </record> |
241 | + |
242 | + <record id="action_previous_fy_dates_setup" model="ir.actions.act_window"> |
243 | + <field name="name">Allow previous Fiscal Year dates</field> |
244 | + <field name="type">ir.actions.act_window</field> |
245 | + <field name="res_model">previous.fy.dates.setup</field> |
246 | + <field name="view_id" ref="view_previous_fy_dates_setup"/> |
247 | + <field name="view_type">form</field> |
248 | + <field name="view_mode">form</field> |
249 | + <field name="target">new</field> |
250 | + </record> |
251 | + |
252 | + <record id="previous_fy_dates_setup_todo" model="ir.actions.todo"> |
253 | + <field name="action_id" ref="action_previous_fy_dates_setup"/> |
254 | + <field name="sequence">30</field> |
255 | + <field name="restart">always</field> |
256 | + </record> |
257 | + </data> |
258 | +</openerp> |
259 | |
260 | === modified file 'bin/addons/unifield_setup/setup_configuration.py' |
261 | --- bin/addons/unifield_setup/setup_configuration.py 2017-09-28 14:58:54 +0000 |
262 | +++ bin/addons/unifield_setup/setup_configuration.py 2019-02-21 09:14:56 +0000 |
263 | @@ -59,6 +59,7 @@ |
264 | 'payroll_ok': fields.boolean(string='System manages payrolls ?'), |
265 | 'import_commitments': fields.boolean(string='Manage commitments corresponding to international order through specific import ?'), |
266 | 'vat_ok': fields.boolean(string='System manages VAT locally ?'), |
267 | + 'previous_fy_dates_allowed': fields.boolean(string='Does the system allow document dates on previous Fiscal Year?'), |
268 | } |
269 | |
270 | _defaults = { |
271 | @@ -73,6 +74,7 @@ |
272 | 'payroll_ok': lambda *a: True, |
273 | 'import_commitments': lambda *a: True, |
274 | 'vat_ok': lambda *a: True, |
275 | + 'previous_fy_dates_allowed': lambda *a: False, |
276 | } |
277 | |
278 | _constraints = [ |