Merge lp:~jfb-tempo-consulting/unifield-server/US-12195 into lp:unifield-server
- US-12195
- Merge into trunk
Proposed by
jftempo
Status: | Needs review |
---|---|
Proposed branch: | lp:~jfb-tempo-consulting/unifield-server/US-12195 |
Merge into: | lp:unifield-server |
Diff against target: |
382 lines (+252/-41) (has conflicts) 4 files modified
bin/addons/msf_audittrail/data/audittrail_data_asset.yml (+233/-41) bin/addons/msf_profile/data/patches.xml (+3/-0) bin/addons/msf_profile/msf_profile.py (+10/-0) bin/addons/product_asset/product_asset.py (+6/-0) Text conflict in bin/addons/msf_profile/msf_profile.py |
To merge this branch: | bzr merge lp:~jfb-tempo-consulting/unifield-server/US-12195 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+465679@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_audittrail/data/audittrail_data_asset.yml' |
2 | --- bin/addons/msf_audittrail/data/audittrail_data_asset.yml 2023-10-18 12:00:54 +0000 |
3 | +++ bin/addons/msf_audittrail/data/audittrail_data_asset.yml 2024-05-07 10:17:41 +0000 |
4 | @@ -1,52 +1,244 @@ |
5 | - |
6 | - Asset Form Creation / Deletion |
7 | -- |
8 | - !python {model: audittrail.rule}: | |
9 | - name = 'Asset Form Creation' |
10 | - object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'product.asset')], context=context) |
11 | - rule_id = self.search(cr, uid, [('object_id', 'in', object_ids), ('log_create', '=', True)], context=context) |
12 | - if object_ids: |
13 | - fields = ['name'] |
14 | - fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'product.asset'), ('name', 'in', fields)], context=context) |
15 | - |
16 | - |
17 | - vals = { |
18 | - 'name': name, |
19 | - 'object_id': object_ids[0], |
20 | - 'log_write': False, |
21 | - 'log_unlink': True, |
22 | - 'log_create': True, |
23 | - 'field_ids': [(6, 0, fields_ids)], |
24 | - } |
25 | - |
26 | - if not rule_id: |
27 | - rule_id = self.create(cr, uid, vals, context=context) |
28 | - elif rule_id: |
29 | - self.write(cr, uid, rule_id, vals, context=context) |
30 | - # Subscribe to the rule |
31 | - self.subscribe(cr, uid, rule_id) |
32 | -- |
33 | - Asset Form Write |
34 | -- |
35 | - !python {model: audittrail.rule}: | |
36 | - name = 'Asset Form Write' |
37 | + For Asset Forms (product.asset), track the creation, modif and delete |
38 | +- |
39 | + !python {model: audittrail.rule}: | |
40 | + name = 'Asset Forms' |
41 | object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'product.asset')], context=context) |
42 | rule_id = self.search(cr, uid, [('object_id', 'in', object_ids), ('log_write', '=', True)], context=context) |
43 | if object_ids: |
44 | - fields = ['name', 'state', 'product_id', 'asset_type_id', 'userful_life_id', 'serial_nb', 'brand', 'type', 'model', 'year', 'move_line_id', 'invo_value', 'invo_date', 'asset_bs_depreciation_account_id', 'asset_pl_account_id', 'start_date'] |
45 | + fields = ['name', 'state', 'product_id', 'instance_id', 'asset_type_id', 'useful_life_id', 'description', 'hq_ref', 'local_ref', 'serial_nb', 'brand', 'type', 'model', 'year', 'comment', 'project_po', 'international_po', 'arrival_date', 'receipt_place', 'move_line_id', 'quantity_divisor', 'invo_value', 'invo_currency', 'invo_date', 'invo_supplier_id', 'invo_donator_code', 'invo_certif_depreciation', 'from_invoice', 'state', 'start_date', 'depreciation_amount', 'disposal_amount', 'asset_pl_account_id'] |
46 | fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'product.asset'), ('name', 'in', fields)], context=context) |
47 | vals = { |
48 | 'name': name, |
49 | 'object_id': object_ids[0], |
50 | 'log_write': True, |
51 | - 'log_unlink': False, |
52 | - 'log_create': False, |
53 | - 'field_ids': [(6, 0, fields_ids)], |
54 | - } |
55 | - |
56 | - if not rule_id: |
57 | - rule_id = self.create(cr, uid, vals, context=context) |
58 | - elif rule_id: |
59 | - self.write(cr, uid, rule_id, vals, context=context) |
60 | + 'log_unlink': True, |
61 | + 'log_create': True, |
62 | + 'field_ids': [(6, 0, fields_ids)], |
63 | + } |
64 | + |
65 | + if not rule_id: |
66 | + rule_id = self.create(cr, uid, vals, context=context) |
67 | + elif rule_id: |
68 | + self.write(cr, uid, rule_id, vals, context=context) |
69 | + # Subscribe to the rule |
70 | + self.subscribe(cr, uid, rule_id) |
71 | + |
72 | +- |
73 | + For Asset Types (product.asset.type), track the creation, modif and delete |
74 | +- |
75 | + !python {model: audittrail.rule}: | |
76 | + name = 'Asset Types' |
77 | + object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'product.asset.type')], context=context) |
78 | + rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context) |
79 | + if object_ids: |
80 | + # Create the rule |
81 | + fields = ['name','description', 'active', 'useful_life_id'] |
82 | + fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'product.asset.type'), ('name', 'in', fields)], context=context) |
83 | + |
84 | + vals = { |
85 | + 'name': name, |
86 | + 'object_id': object_ids[0], |
87 | + 'log_write': True, |
88 | + 'log_unlink': True, |
89 | + 'log_create': True, |
90 | + 'field_ids': [(6, 0, fields_ids)], |
91 | + } |
92 | + |
93 | + if not rule_id: |
94 | + rule_id = self.create(cr, uid, vals, context=context) |
95 | + elif rule_id: |
96 | + self.write(cr, uid, rule_id, vals, context=context) |
97 | + # Subscribe to the rule |
98 | + self.subscribe(cr, uid, rule_id) |
99 | +- |
100 | + For Useful Life (product.asset.useful.life), track the creation and modif, delete |
101 | +- |
102 | + !python {model: audittrail.rule}: | |
103 | + name = 'Useful Life' |
104 | + object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'product.asset.useful.life')], context=context) |
105 | + rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context) |
106 | + if object_ids: |
107 | + # Create the rule |
108 | + fields = ['year', 'is_active', 'asset_type_id'] |
109 | + fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'product.asset.useful.life'), ('name', 'in', fields)], context=context) |
110 | + field_name = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'product.asset.useful.life'), ('name', '=', 'year')], context=context) |
111 | + field_parent = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'product.asset.useful.life'), ('name', '=', 'asset_type_id')], context=context) |
112 | + |
113 | + name_id = False |
114 | + parent_id = False |
115 | + |
116 | + if field_parent: |
117 | + parent_id = field_parent[0] |
118 | + if field_name: |
119 | + name_id = field_name[0] |
120 | + |
121 | + vals = { |
122 | + 'name': name, |
123 | + 'object_id': object_ids[0], |
124 | + 'log_write': True, |
125 | + 'log_unlink': True, |
126 | + 'log_create': True, |
127 | + 'field_ids': [(6, 0, fields_ids)], |
128 | + 'parent_field_id': parent_id, |
129 | + 'name_get_field_id': name_id, |
130 | + } |
131 | + |
132 | + if not rule_id: |
133 | + rule_id = self.create(cr, uid, vals, context=context) |
134 | + elif rule_id: |
135 | + self.write(cr, uid, rule_id, vals, context=context) |
136 | + # Subscribe to the rule |
137 | + self.subscribe(cr, uid, rule_id) |
138 | + |
139 | + |
140 | +- |
141 | + For Asset Events (product.asset.event), track the creation, modif and delete |
142 | +- |
143 | + !python {model: audittrail.rule}: | |
144 | + name = 'Asset Events' |
145 | + object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'product.asset.event')], context=context) |
146 | + rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context) |
147 | + if object_ids: |
148 | + # Create the rule |
149 | + fields = ['date','event_type_id', 'asset_id', 'location', 'proj_code', 'product_id', 'comment'] |
150 | + fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'product.asset.event'), ('name', 'in', fields)], context=context) |
151 | + field_name = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'product.asset.event'), ('name', '=', 'date')], context=context) |
152 | + field_parent = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'product.asset.event'), ('name', '=', 'asset_id')], context=context) |
153 | + |
154 | + name_id = False |
155 | + parent_id = False |
156 | + |
157 | + if field_parent: |
158 | + parent_id = field_parent[0] |
159 | + if field_name: |
160 | + name_id = field_name[0] |
161 | + |
162 | + vals = { |
163 | + 'name': name, |
164 | + 'object_id': object_ids[0], |
165 | + 'log_write': True, |
166 | + 'log_unlink': True, |
167 | + 'log_create': True, |
168 | + 'field_ids': [ (6, 0, fields_ids) ], |
169 | + 'parent_field_id': parent_id, |
170 | + 'name_get_field_id': name_id, |
171 | + } |
172 | + |
173 | + if not rule_id: |
174 | + rule_id = self.create(cr, uid, vals, context=context) |
175 | + elif rule_id: |
176 | + self.write(cr, uid, rule_id, vals, context=context) |
177 | + # Subscribe to the rule |
178 | + self.subscribe(cr, uid, rule_id) |
179 | + |
180 | + |
181 | +- |
182 | + For Asset Event Types (product.asset.event.type), track the creation, modif and delete |
183 | +- |
184 | + !python {model: audittrail.rule}: | |
185 | + name = 'Asset Event Types' |
186 | + object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'product.asset.event.type')], context=context) |
187 | + rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context) |
188 | + if object_ids: |
189 | + # Create the rule |
190 | + fields = ['name','is_disposal', 'active', 'expense_account_id'] |
191 | + fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'product.asset.event.type'), ('name', 'in', fields)], context=context) |
192 | + |
193 | + vals = { |
194 | + 'name': name, |
195 | + 'object_id': object_ids[0], |
196 | + 'log_write': True, |
197 | + 'log_unlink': True, |
198 | + 'log_create': True, |
199 | + 'field_ids': [(6, 0, fields_ids)], |
200 | + } |
201 | + |
202 | + if not rule_id: |
203 | + rule_id = self.create(cr, uid, vals, context=context) |
204 | + elif rule_id: |
205 | + self.write(cr, uid, rule_id, vals, context=context) |
206 | + # Subscribe to the rule |
207 | + self.subscribe(cr, uid, rule_id) |
208 | + |
209 | + |
210 | +- |
211 | + For Depreciation Lines (product.asset.line), track the creation, modif and delete |
212 | +- |
213 | + !python {model: audittrail.rule}: | |
214 | + name = 'Depreciation Lines' |
215 | + object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'product.asset.line')], context=context) |
216 | + rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context) |
217 | + if object_ids: |
218 | + # Create the rule |
219 | + fields = ['date','depreciation_amount', 'remaining_amount', 'amount', 'asset_bs_depreciation_account_id', 'asset_pl_account_id', 'analytic_distribution_id', 'move_id', 'move_state'] |
220 | + fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'product.asset.line'), ('name', 'in', fields)], context=context) |
221 | + field_name = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'product.asset.line'), ('name', '=', 'date')], context=context) |
222 | + field_parent = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'product.asset.line'), ('name', '=', 'asset_id')], context=context) |
223 | + |
224 | + name_id = False |
225 | + parent_id = False |
226 | + |
227 | + if field_parent: |
228 | + parent_id = field_parent[0] |
229 | + if field_name: |
230 | + name_id = field_name[0] |
231 | + |
232 | + vals = { |
233 | + 'name': name, |
234 | + 'object_id': object_ids[0], |
235 | + 'log_write': True, |
236 | + 'log_unlink': True, |
237 | + 'log_create': True, |
238 | + 'field_ids': [ (6, 0, fields_ids) ], |
239 | + 'parent_field_id': parent_id, |
240 | + 'name_get_field_id': name_id, |
241 | + } |
242 | + |
243 | + if not rule_id: |
244 | + rule_id = self.create(cr, uid, vals, context=context) |
245 | + elif rule_id: |
246 | + self.write(cr, uid, rule_id, vals, context=context) |
247 | + # Subscribe to the rule |
248 | + self.subscribe(cr, uid, rule_id) |
249 | + |
250 | + |
251 | +- |
252 | + For Asset Dispose (product.asset.disposal), track the creation, modif and delete |
253 | +- |
254 | + !python {model: audittrail.rule}: | |
255 | + name = 'Asset Dispose' |
256 | + object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'product.asset.disposal')], context=context) |
257 | + rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context) |
258 | + if object_ids: |
259 | + # Create the rule |
260 | + fields = ['disposal_date','event_type_id', 'location', 'proj_code', 'comment'] |
261 | + fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'product.asset.disposal'), ('name', 'in', fields)], context=context) |
262 | + field_name = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'product.asset.disposal'), ('name', '=', 'disposal_date')], context=context) |
263 | + field_parent = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'product.asset.disposal'), ('name', '=', 'asset_id')], context=context) |
264 | + |
265 | + name_id = False |
266 | + parent_id = False |
267 | + |
268 | + if field_parent: |
269 | + parent_id = field_parent[0] |
270 | + if field_name: |
271 | + name_id = field_name[0] |
272 | + |
273 | + vals = { |
274 | + 'name': name, |
275 | + 'object_id': object_ids[0], |
276 | + 'log_write': True, |
277 | + 'log_unlink': True, |
278 | + 'log_create': True, |
279 | + 'field_ids': [ (6, 0, fields_ids) ], |
280 | + 'parent_field_id': parent_id, |
281 | + 'name_get_field_id': name_id, |
282 | + } |
283 | + |
284 | + if not rule_id: |
285 | + rule_id = self.create(cr, uid, vals, context=context) |
286 | + elif rule_id: |
287 | + self.write(cr, uid, rule_id, vals, context=context) |
288 | # Subscribe to the rule |
289 | self.subscribe(cr, uid, rule_id) |
290 | |
291 | === modified file 'bin/addons/msf_profile/data/patches.xml' |
292 | --- bin/addons/msf_profile/data/patches.xml 2024-05-02 13:19:58 +0000 |
293 | +++ bin/addons/msf_profile/data/patches.xml 2024-05-07 10:17:41 +0000 |
294 | @@ -1054,5 +1054,8 @@ |
295 | </record> |
296 | |
297 | |
298 | + <record id="us_12195_deactivate_asset_creation_rule" model="patch.scripts"> |
299 | + <field name="method">us_12195_deactivate_asset_creation_rule</field> |
300 | + </record> |
301 | </data> |
302 | </openerp> |
303 | |
304 | === modified file 'bin/addons/msf_profile/msf_profile.py' |
305 | --- bin/addons/msf_profile/msf_profile.py 2024-05-02 13:19:58 +0000 |
306 | +++ bin/addons/msf_profile/msf_profile.py 2024-05-07 10:17:41 +0000 |
307 | @@ -57,6 +57,7 @@ |
308 | 'model': lambda *a: 'patch.scripts', |
309 | } |
310 | |
311 | +<<<<<<< TREE |
312 | # UF33.0 |
313 | def us_12074_gdpr_remove_personal_data_from_track_changes(self, cr, uid, *a, **b): |
314 | ''' |
315 | @@ -180,6 +181,15 @@ |
316 | return True |
317 | |
318 | |
319 | +======= |
320 | + def us_12195_deactivate_asset_creation_rule(self, cr, uid, *a, **b): |
321 | + asset_obj = self.pool.get('audittrail.rule') |
322 | + asset_ids = asset_obj.search(cr, uid, [('name', '=', 'Asset Form Creation')]) |
323 | + if asset_ids: |
324 | + asset_obj.write(cr, uid, asset_ids, {'state': 'draft'}) |
325 | + return True |
326 | + |
327 | +>>>>>>> MERGE-SOURCE |
328 | # UF32.0 |
329 | def us_12273_remove_never_exp_password(self, cr, uid, *a, **b): |
330 | instance = self.pool.get('res.users').browse(cr, uid, uid).company_id.instance_id |
331 | |
332 | === modified file 'bin/addons/product_asset/product_asset.py' |
333 | --- bin/addons/product_asset/product_asset.py 2023-11-16 13:03:16 +0000 |
334 | +++ bin/addons/product_asset/product_asset.py 2024-05-07 10:17:41 +0000 |
335 | @@ -15,6 +15,7 @@ |
336 | _name = "product.asset.type" |
337 | _description = "Specify the type of asset at product level" |
338 | _order = 'name, id' |
339 | + _trace = True |
340 | |
341 | _columns = { |
342 | 'name': fields.char('Name', size=64, required=True, translate=1), |
343 | @@ -36,6 +37,7 @@ |
344 | _name = 'product.asset.event.type' |
345 | _description = 'Event Type' |
346 | _order = 'name, id' |
347 | + _trace = True |
348 | |
349 | _columns = { |
350 | 'name': fields.char('Name', size=512, required=True, translate=1), |
351 | @@ -57,6 +59,7 @@ |
352 | _description = 'Asset Useful Life' |
353 | _rec_name = 'year' |
354 | _order = 'year, id' |
355 | + _trace = True |
356 | |
357 | _columns = { |
358 | 'asset_type_id': fields.many2one('product.asset.type', 'Asset Type', required=1), |
359 | @@ -853,6 +856,7 @@ |
360 | _rec_name = 'asset_id' |
361 | _description = "Event for asset follow up" |
362 | _order = 'date desc, id desc' |
363 | + _trace = True |
364 | |
365 | eventTypeSelection = [('reception', 'Reception'), |
366 | ('startUse', 'Start Use'), |
367 | @@ -972,6 +976,7 @@ |
368 | _rec_name = 'date' |
369 | _order = 'date, id' |
370 | _description = "Depreciation Lines" |
371 | + _trace = True |
372 | |
373 | def copy(self, cr, uid, id, default=None, context=None): |
374 | if not default: |
375 | @@ -1230,6 +1235,7 @@ |
376 | _name = 'product.asset.disposal' |
377 | _description = 'Asset Dispose' |
378 | _rec_name = 'asset_id' |
379 | + _trace = True |
380 | _columns = { |
381 | 'asset_id': fields.many2one('product.asset', 'Asset', required=1), |
382 | 'event_type_id': fields.many2one('product.asset.event.type', 'Event Type', required=1, domain=[('is_disposal', '=', True)], add_empty=True), |