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 | 2 | <openerp> | 2 | <openerp> |
6 | 3 | <data> | 3 | <data> |
7 | 4 | <!-- UF12.0 --> | 4 | <!-- UF12.0 --> |
8 | 5 | <record id="us_5724_set_previous_fy_dates_allowed" model="patch.scripts"> | ||
9 | 6 | <field name="method">us_5724_set_previous_fy_dates_allowed</field> | ||
10 | 7 | </record> | ||
11 | 8 | |||
12 | 5 | <record id="us_2896_volume_ocbprod" model="patch.scripts"> | 9 | <record id="us_2896_volume_ocbprod" model="patch.scripts"> |
13 | 6 | <field name="method">us_2896_volume_ocbprod</field> | 10 | <field name="method">us_2896_volume_ocbprod</field> |
14 | 7 | </record> | 11 | </record> |
15 | 8 | 12 | ||
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 | 105270 | #: field:wizard.pick.import,import_file:0 | 105270 | #: field:wizard.pick.import,import_file:0 |
21 | 105271 | msgid "PICK import file" | 105271 | msgid "PICK import file" |
22 | 105272 | msgstr "Fichier d'import de PICK" | 105272 | msgstr "Fichier d'import de PICK" |
23 | 105273 | |||
24 | 105274 | #. module: unifield_setup | ||
25 | 105275 | #: field:previous.fy.dates.setup,previous_fy_dates_allowed:0 | ||
26 | 105276 | #: field:unifield.setup.configuration,previous_fy_dates_allowed:0 | ||
27 | 105277 | msgid "Does the system allow document dates on previous Fiscal Year?" | ||
28 | 105278 | msgstr "Le système autorise-t-il les dates des documents sur l'Exercice Comptable précédent ?" | ||
29 | 105279 | |||
30 | 105280 | #. module: unifield_setup | ||
31 | 105281 | #: code:addons/unifield_setup/installer/previous_fy_dates_setup.py:52 | ||
32 | 105282 | #, python-format | ||
33 | 105283 | msgid "An error has occurred with the item retrieved from the form. Please contact an administrator if the problem persists." | ||
34 | 105284 | 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 | 105285 | |||
36 | 105286 | #. module: unifield_setup | ||
37 | 105287 | #: view:previous.fy.dates.setup:0 | ||
38 | 105288 | #: model:ir.actions.act_window,name:unifield_setup.action_previous_fy_dates_setup | ||
39 | 105289 | msgid "Allow previous Fiscal Year dates" | ||
40 | 105290 | msgstr "Autoriser les dates de l'Exercice Comptable précédent" | ||
41 | 105291 | |||
42 | 105292 | #. module: unifield_setup | ||
43 | 105293 | #: view:previous.fy.dates.setup:0 | ||
44 | 105294 | msgid "Allow document dates on previous Fiscal Year" | ||
45 | 105295 | msgstr "Autoriser les dates des documents sur l'Exercice Comptable précédent" | ||
46 | 105296 | |||
47 | 105297 | #. module: unifield_setup | ||
48 | 105298 | #: view:previous.fy.dates.setup:0 | ||
49 | 105299 | msgid "Determines whether document dates and posting dates can be on different Fiscal Years." | ||
50 | 105300 | msgstr "Détermine si les dates des documents et les dates de comptabilisation peuvent être sur des Exercices Comptables différents." | ||
51 | 105301 | |||
52 | 105302 | #. module: msf_tools | ||
53 | 105303 | #: code:addons/msf_tools/msf_tools.py:909 | ||
54 | 105304 | #, python-format | ||
55 | 105305 | msgid "Document date should be in posting date FY" | ||
56 | 105306 | msgstr "La date du document doit être dans le même exercice comptable que la date de comptabilisation" | ||
57 | 105307 | |||
58 | 105308 | #. module: msf_tools | ||
59 | 105309 | #: code:addons/msf_tools/msf_tools.py:907 | ||
60 | 105310 | #, python-format | ||
61 | 105311 | msgid "Document date (%s) should be in posting date FY" | ||
62 | 105312 | msgstr "La date du document (%s) doit être dans le même exercice comptable que la date de comptabilisation" | ||
63 | 105273 | 105313 | ||
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 | 53 | } | 53 | } |
69 | 54 | 54 | ||
70 | 55 | # UF12.0 | 55 | # UF12.0 |
71 | 56 | def us_5724_set_previous_fy_dates_allowed(self, cr, uid, *a, **b): | ||
72 | 57 | """ | ||
73 | 58 | Sets the field "previous_fy_dates_allowed" to True in the UniField Setup Configuration for all OCB and OCP instances | ||
74 | 59 | """ | ||
75 | 60 | user_obj = self.pool.get('res.users') | ||
76 | 61 | current_instance = user_obj.browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id | ||
77 | 62 | if current_instance and (current_instance.name.startswith('OCB') or current_instance.name.startswith('OCP')): | ||
78 | 63 | cr.execute("UPDATE unifield_setup_configuration SET previous_fy_dates_allowed = 't';") | ||
79 | 64 | return True | ||
80 | 65 | |||
81 | 56 | def us_2896_volume_ocbprod(self, cr, uid, *a, **b): | 66 | def us_2896_volume_ocbprod(self, cr, uid, *a, **b): |
82 | 57 | ''' OCBHQ: volume has not been converted to dm3 on instances ''' | 67 | ''' OCBHQ: volume has not been converted to dm3 on instances ''' |
83 | 58 | instance = self.pool.get('res.users').browse(cr, uid, uid).company_id.instance_id | 68 | instance = self.pool.get('res.users').browse(cr, uid, uid).company_id.instance_id |
84 | 59 | 69 | ||
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 | 871 | show_date=False, custom_msg=False, context=None): | 871 | show_date=False, custom_msg=False, context=None): |
90 | 872 | """ | 872 | """ |
91 | 873 | Checks that posting date >= document date | 873 | Checks that posting date >= document date |
92 | 874 | Depending on the config made in the Reconfigure Wizard, can also check that the document date is included | ||
93 | 875 | in the same FY as the related posting date. | ||
94 | 874 | 876 | ||
95 | 875 | :type document_date: orm date | 877 | :type document_date: orm date |
96 | 876 | :type posting_date: orm date | 878 | :type posting_date: orm date |
97 | @@ -895,6 +897,20 @@ | |||
98 | 895 | 'Posting date should be later than Document Date.') | 897 | 'Posting date should be later than Document Date.') |
99 | 896 | raise osv.except_osv(_('Error'), msg) | 898 | raise osv.except_osv(_('Error'), msg) |
100 | 897 | 899 | ||
101 | 900 | # if the system doesn't allow doc dates from previous FY, check that this condition is met | ||
102 | 901 | setup = self.pool.get('unifield.setup.configuration').get_config(cr, uid) | ||
103 | 902 | if not setup or not setup.previous_fy_dates_allowed: | ||
104 | 903 | # 01/01/FY <= document date <= 31/12/FY | ||
105 | 904 | posting_date_obj = self.pool.get('date.tools').orm2date(posting_date) | ||
106 | 905 | check_range_start = self.get_orm_date(1, 1, year=posting_date_obj.year) | ||
107 | 906 | check_range_end = self.get_orm_date(31, 12, year=posting_date_obj.year) | ||
108 | 907 | if not (check_range_start <= document_date <= check_range_end): | ||
109 | 908 | if show_date: | ||
110 | 909 | msg = _('Document date (%s) should be in posting date FY') % (document_date, ) | ||
111 | 910 | else: | ||
112 | 911 | msg = _('Document date should be in posting date FY') | ||
113 | 912 | raise osv.except_osv(_('Error'), msg) | ||
114 | 913 | |||
115 | 898 | def truncate_amount(self, amount, digits): | 914 | def truncate_amount(self, amount, digits): |
116 | 899 | stepper = pow(10.0, digits) | 915 | stepper = pow(10.0, digits) |
117 | 900 | return math.trunc(stepper * amount) / stepper | 916 | return math.trunc(stepper * amount) / stepper |
118 | 901 | 917 | ||
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 | 59 | "installer/payroll_view.xml", | 59 | "installer/payroll_view.xml", |
124 | 60 | "installer/commitment_import_view.xml", | 60 | "installer/commitment_import_view.xml", |
125 | 61 | "installer/vat_setup_view.xml", | 61 | "installer/vat_setup_view.xml", |
126 | 62 | "installer/previous_fy_dates_setup_view.xml", | ||
127 | 62 | # Security and access rights | 63 | # Security and access rights |
128 | 63 | "security/ir.model.access.csv", | 64 | "security/ir.model.access.csv", |
129 | 64 | "view/product_view.xml", | 65 | "view/product_view.xml", |
130 | 65 | 66 | ||
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 | 32 | import payroll | 32 | import payroll |
136 | 33 | import commitment_import | 33 | import commitment_import |
137 | 34 | import vat_setup | 34 | import vat_setup |
138 | 35 | import previous_fy_dates_setup | ||
139 | 35 | 36 | ||
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 | 1 | # -*- coding: utf-8 -*- | ||
145 | 2 | ############################################################################## | ||
146 | 3 | # | ||
147 | 4 | # OpenERP, Open Source Management Solution | ||
148 | 5 | # Copyright (C) 2019 TeMPO Consulting, MSF | ||
149 | 6 | # | ||
150 | 7 | # This program is free software: you can redistribute it and/or modify | ||
151 | 8 | # it under the terms of the GNU Affero General Public License as | ||
152 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
153 | 10 | # License, or (at your option) any later version. | ||
154 | 11 | # | ||
155 | 12 | # This program is distributed in the hope that it will be useful, | ||
156 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
157 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
158 | 15 | # GNU Affero General Public License for more details. | ||
159 | 16 | # | ||
160 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
161 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
162 | 19 | # | ||
163 | 20 | ############################################################################## | ||
164 | 21 | |||
165 | 22 | from osv import osv | ||
166 | 23 | from osv import fields | ||
167 | 24 | |||
168 | 25 | from tools.translate import _ | ||
169 | 26 | |||
170 | 27 | |||
171 | 28 | class previous_fy_dates_setup(osv.osv_memory): | ||
172 | 29 | _name = 'previous.fy.dates.setup' | ||
173 | 30 | _inherit = 'res.config' | ||
174 | 31 | |||
175 | 32 | _columns = { | ||
176 | 33 | 'previous_fy_dates_allowed': fields.boolean(string='Does the system allow document dates on previous Fiscal Year?'), | ||
177 | 34 | } | ||
178 | 35 | |||
179 | 36 | def default_get(self, cr, uid, fields, context=None): | ||
180 | 37 | """ | ||
181 | 38 | Display the default/current value regarding the allowing of previous FY dates | ||
182 | 39 | """ | ||
183 | 40 | if context is None: | ||
184 | 41 | context = {} | ||
185 | 42 | setup = self.pool.get('unifield.setup.configuration').get_config(cr, uid) | ||
186 | 43 | res = super(previous_fy_dates_setup, self).default_get(cr, uid, fields, context=context) | ||
187 | 44 | res['previous_fy_dates_allowed'] = setup.previous_fy_dates_allowed | ||
188 | 45 | return res | ||
189 | 46 | |||
190 | 47 | def execute(self, cr, uid, ids, context=None): | ||
191 | 48 | """ | ||
192 | 49 | Fills in the previous_fy_dates_allowed field and activate/de-activate the allowing of Doc dates booked in previous FY | ||
193 | 50 | """ | ||
194 | 51 | if context is None: | ||
195 | 52 | context = {} | ||
196 | 53 | if not isinstance(ids, list) or len(ids) != 1: | ||
197 | 54 | 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 | 55 | payload = self.browse(cr, uid, ids[0], fields_to_fetch=['previous_fy_dates_allowed'], context=context) | ||
199 | 56 | setup_obj = self.pool.get('unifield.setup.configuration') | ||
200 | 57 | setup = setup_obj.get_config(cr, uid) | ||
201 | 58 | if setup: | ||
202 | 59 | setup_obj.write(cr, uid, [setup.id], {'previous_fy_dates_allowed': payload.previous_fy_dates_allowed}, context=context) | ||
203 | 60 | |||
204 | 61 | |||
205 | 62 | previous_fy_dates_setup() | ||
206 | 0 | 63 | ||
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 | 1 | <openerp> | ||
212 | 2 | <data> | ||
213 | 3 | <record id="view_previous_fy_dates_setup" model="ir.ui.view"> | ||
214 | 4 | <field name="name">Allow previous Fiscal Year dates</field> | ||
215 | 5 | <field name="model">previous.fy.dates.setup</field> | ||
216 | 6 | <field name="type">form</field> | ||
217 | 7 | <field name="inherit_id" ref="base.res_config_view_base"/> | ||
218 | 8 | <field name="arch" type="xml"> | ||
219 | 9 | <data> | ||
220 | 10 | <form position="attributes"> | ||
221 | 11 | <attribute name="string">Allow previous Fiscal Year dates</attribute> | ||
222 | 12 | </form> | ||
223 | 13 | <xpath expr="//label[@string='description']" position="attributes"> | ||
224 | 14 | <attribute name="string">Determines whether document dates and posting dates can be on different Fiscal Years.</attribute> | ||
225 | 15 | </xpath> | ||
226 | 16 | <xpath expr='//separator[@string="title"]' position='attributes'> | ||
227 | 17 | <attribute name='string'>Allow document dates on previous Fiscal Year</attribute> | ||
228 | 18 | </xpath> | ||
229 | 19 | <xpath expr='//separator[@string="vsep"]' position='attributes'> | ||
230 | 20 | <attribute name='rowspan'>25</attribute> | ||
231 | 21 | <attribute name='string'></attribute> | ||
232 | 22 | </xpath> | ||
233 | 23 | <group string="res_config_contents" position="replace"> | ||
234 | 24 | <group colspan="5"> | ||
235 | 25 | <field name="previous_fy_dates_allowed"/> | ||
236 | 26 | </group> | ||
237 | 27 | </group> | ||
238 | 28 | </data> | ||
239 | 29 | </field> | ||
240 | 30 | </record> | ||
241 | 31 | |||
242 | 32 | <record id="action_previous_fy_dates_setup" model="ir.actions.act_window"> | ||
243 | 33 | <field name="name">Allow previous Fiscal Year dates</field> | ||
244 | 34 | <field name="type">ir.actions.act_window</field> | ||
245 | 35 | <field name="res_model">previous.fy.dates.setup</field> | ||
246 | 36 | <field name="view_id" ref="view_previous_fy_dates_setup"/> | ||
247 | 37 | <field name="view_type">form</field> | ||
248 | 38 | <field name="view_mode">form</field> | ||
249 | 39 | <field name="target">new</field> | ||
250 | 40 | </record> | ||
251 | 41 | |||
252 | 42 | <record id="previous_fy_dates_setup_todo" model="ir.actions.todo"> | ||
253 | 43 | <field name="action_id" ref="action_previous_fy_dates_setup"/> | ||
254 | 44 | <field name="sequence">30</field> | ||
255 | 45 | <field name="restart">always</field> | ||
256 | 46 | </record> | ||
257 | 47 | </data> | ||
258 | 48 | </openerp> | ||
259 | 0 | 49 | ||
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 | 59 | 'payroll_ok': fields.boolean(string='System manages payrolls ?'), | 59 | 'payroll_ok': fields.boolean(string='System manages payrolls ?'), |
265 | 60 | 'import_commitments': fields.boolean(string='Manage commitments corresponding to international order through specific import ?'), | 60 | 'import_commitments': fields.boolean(string='Manage commitments corresponding to international order through specific import ?'), |
266 | 61 | 'vat_ok': fields.boolean(string='System manages VAT locally ?'), | 61 | 'vat_ok': fields.boolean(string='System manages VAT locally ?'), |
267 | 62 | 'previous_fy_dates_allowed': fields.boolean(string='Does the system allow document dates on previous Fiscal Year?'), | ||
268 | 62 | } | 63 | } |
269 | 63 | 64 | ||
270 | 64 | _defaults = { | 65 | _defaults = { |
271 | @@ -73,6 +74,7 @@ | |||
272 | 73 | 'payroll_ok': lambda *a: True, | 74 | 'payroll_ok': lambda *a: True, |
273 | 74 | 'import_commitments': lambda *a: True, | 75 | 'import_commitments': lambda *a: True, |
274 | 75 | 'vat_ok': lambda *a: True, | 76 | 'vat_ok': lambda *a: True, |
275 | 77 | 'previous_fy_dates_allowed': lambda *a: False, | ||
276 | 76 | } | 78 | } |
277 | 77 | 79 | ||
278 | 78 | _constraints = [ | 80 | _constraints = [ |