Merge lp:~fabien-morin/unifield-server/fm-us-2940 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 4436
Proposed branch: lp:~fabien-morin/unifield-server/fm-us-2940
Merge into: lp:unifield-server
Diff against target: 81 lines (+55/-0)
3 files modified
bin/addons/msf_audittrail/__openerp__.py (+1/-0)
bin/addons/msf_audittrail/audittrail.py (+8/-0)
bin/addons/msf_audittrail/data/audittrail_hr_employee.yml (+46/-0)
To merge this branch: bzr merge lp:~fabien-morin/unifield-server/fm-us-2940
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+327704@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
=== modified file 'bin/addons/msf_audittrail/__openerp__.py'
--- bin/addons/msf_audittrail/__openerp__.py 2017-01-19 08:43:05 +0000
+++ bin/addons/msf_audittrail/__openerp__.py 2017-07-19 11:47:49 +0000
@@ -47,6 +47,7 @@
47 'data/audittrail_data_products.yml',47 'data/audittrail_data_products.yml',
48 'data/audittrail_data_JI.yml',48 'data/audittrail_data_JI.yml',
49 'data/audittrail_res_users.yml',49 'data/audittrail_res_users.yml',
50 'data/audittrail_hr_employee.yml',
50 'audittrail_report.xml',51 'audittrail_report.xml',
51 'audittrail_invoice_data.yml',52 'audittrail_invoice_data.yml',
52 ],53 ],
5354
=== modified file 'bin/addons/msf_audittrail/audittrail.py'
--- bin/addons/msf_audittrail/audittrail.py 2017-03-02 09:07:25 +0000
+++ bin/addons/msf_audittrail/audittrail.py 2017-07-19 11:47:49 +0000
@@ -331,6 +331,14 @@
331account_move_line()331account_move_line()
332332
333333
334class hr_employee(osv.osv):
335 _name = 'hr.employee'
336 _inherit = 'hr.employee'
337 _trace = True
338
339hr_employee()
340
341
334class ir_module(osv.osv):342class ir_module(osv.osv):
335 _inherit = 'ir.module.module'343 _inherit = 'ir.module.module'
336344
337345
=== added file 'bin/addons/msf_audittrail/data/audittrail_hr_employee.yml'
--- bin/addons/msf_audittrail/data/audittrail_hr_employee.yml 1970-01-01 00:00:00 +0000
+++ bin/addons/msf_audittrail/data/audittrail_hr_employee.yml 2017-07-19 11:47:49 +0000
@@ -0,0 +1,46 @@
1-
2 For EMPLOYEE, rule for the CREATE of objects with the list of fields to track
3-
4 !python {model: audittrail.rule}: |
5 name = 'EMPLOYEE CREATE WRITE'
6 object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'hr.employee')], context=context)
7 rule_id = self.search(cr, uid, [('name', '=', name)], context=context)
8 if object_ids:
9 fields = ['active', 'birthday', 'code', 'cost_center_id', 'country_id', 'destination_id', 'employee_type', 'free1_id', 'free2_id', 'funding_pool_id', 'gender', 'homere_codeterrain', 'homere_id_staff', 'homere_id_unique', 'identification_id', 'job_id', 'marital', 'mobile_phone', 'name', 'name_resource', 'notes', 'passport_id', 'private_phone', 'resource_type', 'sinid', 'ssnid', 'work_email', 'work_location', 'work_phone']
10 fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', 'in' , ('hr.employee', 'resource.resource')), ('name', 'in', fields)], context=context)
11 vals = {'name': name,
12 'object_id': object_ids[0],
13 'log_create': True,
14 'log_write': True,
15 'log_unlink': False,
16 'field_ids': [(6, 0, fields_ids)],
17 }
18 if not rule_id:
19 rule_id = self.create(cr, uid, vals, context=context)
20 elif rule_id:
21 self.write(cr, uid, rule_id, vals, context=context)
22 # Subscribe to the rule
23 self.subscribe(cr, uid, rule_id)
24-
25 For EMPLOYEE, rule for the DELETE of objects with the list of fields to track
26-
27 !python {model: audittrail.rule}: |
28 name = 'EMPLOYEE DELETE'
29 object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'hr.employee')], context=context)
30 rule_id = self.search(cr, uid, [('name', '=', name)], context=context)
31 if object_ids:
32 fields = ['name']
33 fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'hr.employee'), ('name', 'in', fields)], context=context)
34 vals = {'name': name,
35 'object_id': object_ids[0],
36 'log_create': False,
37 'log_write': False,
38 'log_unlink': True,
39 'field_ids': [(6, 0, fields_ids)],
40 }
41 if not rule_id:
42 rule_id = self.create(cr, uid, vals, context=context)
43 elif rule_id:
44 self.write(cr, uid, rule_id, vals, context=context)
45 # Subscribe to the rule
46 self.subscribe(cr, uid, rule_id)

Subscribers

People subscribed via source and target branches