Merge lp:~jfb-tempo-consulting/unifield-server/US-9869 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 6312
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/US-9869
Merge into: lp:unifield-server
Diff against target: 215 lines (+92/-3)
7 files modified
bin/addons/msf_homere_interface/hr.py (+21/-0)
bin/addons/msf_homere_interface/hr_view.xml (+1/-0)
bin/addons/msf_profile/data/patches.xml (+4/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+9/-1)
bin/addons/msf_profile/msf_profile.py (+53/-0)
bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv (+3/-2)
bin/addons/sync_common/common.py (+1/-0)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/US-9869
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+430436@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/msf_homere_interface/hr.py'
2--- bin/addons/msf_homere_interface/hr.py 2022-06-20 09:31:19 +0000
3+++ bin/addons/msf_homere_interface/hr.py 2022-09-26 07:25:06 +0000
4@@ -150,6 +150,7 @@
5 'payment_method_id': fields.many2one('hr.payment.method', string='Payment Method', required=False, ondelete='restrict'),
6 'bank_name': fields.char('Bank Name', size=256, required=False),
7 'bank_account_number': fields.char('Bank Account Number', size=128, required=False),
8+ 'instance_creator': fields.char('Instance creator of the employee', size=64, readonly=1),
9 }
10
11 _defaults = {
12@@ -238,6 +239,13 @@
13 # Some verifications
14 if not context:
15 context = {}
16+ if not context.get('sync_update_execution') and not vals.get('instance_creator'):
17+ c = self.pool.get('res.users').browse(cr, uid, uid).company_id
18+ instance_code = c and c.instance_id and c.instance_id.code
19+
20+ if instance_code:
21+ vals['instance_creator'] = instance_code
22+
23 if vals.get('name'):
24 vals['name'] = vals['name'].strip()
25 allow_edition = False
26@@ -267,6 +275,10 @@
27 # Some verifications
28 if not context:
29 context = {}
30+
31+ if 'instance_creator' in vals:
32+ del(vals['instance_creator'])
33+
34 # Prepare some values
35 local = False
36 ex = False
37@@ -416,5 +428,14 @@
38 processed, rejected, headers = import_obj.button_validate(cr, uid, [import_id], auto_import=True)
39 return processed, rejected, headers
40
41+ def update_exported_fields(self, cr, uid, fields):
42+ res = super(hr_employee, self).update_exported_fields(cr, uid, fields)
43+ if res:
44+ res += [
45+ ['company_id', _('Company')],
46+ ['instance_creator', _('Instance creator of the employee')]
47+ ]
48+ return res
49+
50 hr_employee()
51 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
52
53=== modified file 'bin/addons/msf_homere_interface/hr_view.xml'
54--- bin/addons/msf_homere_interface/hr_view.xml 2020-09-01 08:22:26 +0000
55+++ bin/addons/msf_homere_interface/hr_view.xml 2022-09-26 07:25:06 +0000
56@@ -19,6 +19,7 @@
57 <field colspan="6" name="name" attrs="{'readonly': [('employee_type', '=', 'local'), ('allow_edition', '=', False)]}"/>
58 <field name="user_id" on_change="onchange_user(user_id)" attrs="{'readonly': [('employee_type', '=', 'local'), ('allow_edition', '=', False)]}"/>
59 <field name="company_id" widget="selection" on_change="onchange_company(company_id)" attrs="{'readonly': [('employee_type', '=', 'local'), ('allow_edition', '=', False)]}"/>
60+ <field name="instance_creator" />
61 <field name="active" />
62 <field name="employee_type" attrs="{'readonly': [('employee_type', '=', 'local'), ('allow_edition', '=', False)]}" on_change="onchange_type(employee_type)"/>
63 <newline/>
64
65=== modified file 'bin/addons/msf_profile/data/patches.xml'
66--- bin/addons/msf_profile/data/patches.xml 2022-08-05 15:36:47 +0000
67+++ bin/addons/msf_profile/data/patches.xml 2022-09-26 07:25:06 +0000
68@@ -811,5 +811,9 @@
69 <record id="us_9229_fix_rt" model="patch.scripts">
70 <field name="method">us_9229_fix_rt</field>
71 </record>
72+
73+ <record id="set_creator_on_employee" model="patch.scripts">
74+ <field name="method">set_creator_on_employee</field>
75+ </record>
76 </data>
77 </openerp>
78
79=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
80--- bin/addons/msf_profile/i18n/fr_MF.po 2022-08-23 13:15:58 +0000
81+++ bin/addons/msf_profile/i18n/fr_MF.po 2022-09-26 07:25:06 +0000
82@@ -32538,7 +32538,7 @@
83 msgid "MSF Financing Module"
84 msgstr "MSF Financing Module"
85
86-#. modules: tender_flow, account_override, account_journal, register_accounting, procurement_cycle, finance, base_setup, stock_override, analytic, purchase_followup, report_webkit, stock, product, procurement_request, hr, consumption_calculation, msf_instance, purchase_override, specific_rules, base, purchase, account, resource, procurement_auto, sale, sales_followup, procurement, msf_profile, msf_supply_doc_export
87+#. modules: tender_flow, account_override, account_journal, register_accounting, procurement_cycle, finance, base_setup, stock_override, analytic, purchase_followup, report_webkit, stock, product, procurement_request, hr, consumption_calculation, msf_instance, purchase_override, specific_rules, base, purchase, account, resource, procurement_auto, sale, sales_followup, procurement, msf_profile, msf_supply_doc_export, msf_homere_interface
88 #: field:account.account,company_id:0
89 #: field:account.analytic.journal,company_id:0
90 #: field:account.bank.statement,company_id:0
91@@ -32654,6 +32654,7 @@
92 #: field:stock.delivery.wizard,company_id:0
93 #: field:supplier.performance.wizard,company_id:0
94 #: report:addons/finance/report/account_employee_balance_tree_xls.mako:266
95+#: code:addons/msf_homere_interface/hr.py:435
96 msgid "Company"
97 msgstr "Société"
98
99@@ -115817,3 +115818,10 @@
100 msgid "Force Date and time of next execution"
101 msgstr "Date et heure forcée de la prochiane exécution plannifiée"
102
103+#. module: msf_homere_interface
104+#: code:addons/msf_homere_interface/hr.py:436
105+#: field:hr.employee,instance_creator:0
106+#, python-format
107+msgid "Instance creator of the employee"
108+msgstr "Instance de Création de l'employé"
109+
110
111=== modified file 'bin/addons/msf_profile/msf_profile.py'
112--- bin/addons/msf_profile/msf_profile.py 2022-08-05 15:36:47 +0000
113+++ bin/addons/msf_profile/msf_profile.py 2022-09-26 07:25:06 +0000
114@@ -56,6 +56,12 @@
115 'model': lambda *a: 'patch.scripts',
116 }
117
118+ def set_creator_on_employee(self, cr, uid, *a, **b):
119+ current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
120+ if current_instance: # existing instances only
121+ self.pool.get('sync.trigger.something.bidir_mission').create(cr, uid, {'name': 'instance_creator_employee', 'args': current_instance.code})
122+ return True
123+
124 # UF26.0
125 def fix_us_10163_ocbhq_funct_amount(self, cr, uid, *a, **b):
126 ''' OCBHQ: fix amounts on EOY-2021-14020-OCBVE101-VES'''
127@@ -5669,3 +5675,50 @@
128 return super(sync_tigger_something_up, self).create(cr, uid, vals, context)
129
130 sync_tigger_something_up()
131+
132+class sync_tigger_something_bidir_mission(osv.osv):
133+ _name = 'sync.trigger.something.bidir_mission'
134+
135+ _columns = {
136+ 'name': fields.char('Name', size=256),
137+ 'args': fields.text('Args'),
138+ }
139+
140+ def create(self, cr, uid, vals, context=None):
141+ if context is None:
142+ context = {}
143+ if vals.get('name') == 'instance_creator_employee' and vals.get('args'):
144+ # populate instance_creator on hr.employee
145+ # triggered from sync to process sync in-pipe employee or after init sync
146+ entity = self.pool.get('sync.client.entity')
147+ if entity:
148+ b = time.time()
149+ cr.execute("""
150+ update hr_employee hr
151+ set instance_creator=instance.code
152+ from
153+ ir_model_data d,
154+ msf_instance instance
155+ where
156+ d.module = 'sd' and
157+ d.model = 'hr.employee' and
158+ d.res_id = hr.id and
159+ instance.instance_identifier = split_part(d.name, '/', 1) and
160+ coalesce(hr.instance_creator, '') = '' and
161+ hr.employee_type='local'
162+ """)
163+ self.pool.get('patch.scripts').log_info(cr, uid, 'Instance creator set on %d local employees in %d sec' % (cr.rowcount, time.time() - b))
164+
165+ c = self.pool.get('res.users').browse(cr, uid, uid).company_id
166+ instance = c and c.instance_id and c.instance_id
167+ main_parent = instance.code
168+ if instance.parent_id:
169+ main_parent = instance.parent_id.code
170+ if instance.parent_id.parent_id:
171+ main_parent = instance.parent_id.parent_id.code
172+ cr.execute("update hr_employee set instance_creator=%s where employee_type='ex' and coalesce(instance_creator, '') = ''", (main_parent, ))
173+ self.pool.get('patch.scripts').log_info(cr, uid, 'Instance creator set on %d expat employees' % (cr.rowcount, ))
174+
175+ return super(sync_tigger_something_bidir_mission, self).create(cr, uid, vals, context)
176+
177+sync_tigger_something_bidir_mission()
178
179=== modified file 'bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv'
180--- bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2022-06-22 13:46:44 +0000
181+++ bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2022-09-26 07:25:06 +0000
182@@ -71,11 +71,11 @@
183 msf_sync_data_server.payment_method,FALSE,TRUE,FALSE,TRUE,bidirectional,Bidirectional,"[]","['name']",HQ + MISSION,hr.payment.method,,Payment Method,Valid,,328
184 msf_sync_data_server.payment_method2,TRUE,TRUE,TRUE,TRUE,bidirectional,Down,"[]","['name']",OC,hr.payment.method,,Payment Method,Valid,,329
185 msf_sync_data_server.job_description,TRUE,TRUE,FALSE,TRUE,bidirectional,Bidirectional,[],"['code', 'description', 'expected_employees', 'name', 'requirements', 'state']",HQ + MISSION,hr.job,,Job Description,Valid,,330
186-msf_sync_data_server.expatriate_employees,TRUE,TRUE,FALSE,TRUE,bidirectional,Down,"[('employee_type','=','ex'),('name','!=','Administrator')]","['birthday', 'code', 'cost_center_id/id', 'country_id/id', 'destination_id/id','employee_type', 'filter_for_third_party', 'free1_id/id', 'free2_id/id', 'funding_pool_id/id', 'gender', 'homere_codeterrain', 'homere_id_staff', 'homere_id_unique', 'homere_uuid_key', 'identification_id', 'job_id/id', 'marital/id', 'mobile_phone', 'name', 'name_resource', 'notes', 'passport_id', 'private_phone', 'resource_type', 'sinid', 'ssnid', 'work_email', 'work_location', 'work_phone']",HQ + MISSION,hr.employee,,Expatriate Employees,Valid,,331
187+msf_sync_data_server.expatriate_employees,TRUE,TRUE,FALSE,TRUE,bidirectional,Down,"[('employee_type','=','ex'),('name','!=','Administrator')]","['birthday', 'code', 'cost_center_id/id', 'country_id/id', 'destination_id/id','employee_type', 'filter_for_third_party', 'free1_id/id', 'free2_id/id', 'funding_pool_id/id', 'gender', 'homere_codeterrain', 'homere_id_staff', 'homere_id_unique', 'homere_uuid_key', 'identification_id', 'job_id/id', 'marital/id', 'mobile_phone', 'name', 'name_resource', 'notes', 'passport_id', 'private_phone', 'resource_type', 'sinid', 'ssnid', 'work_email', 'work_location', 'work_phone', 'instance_creator']",HQ + MISSION,hr.employee,,Expatriate Employees,Valid,,331
188 msf_sync_data_server.expatriate_employees_tree,FALSE,TRUE,FALSE,TRUE,bidirectional,Bidirectional,"[('parent_id', '!=', '')]",['parent_id/id'],HQ + MISSION,hr.employee,,Expatriate Employees Tree,Valid,,332
189 msf_sync_data_server.expatriate_employees_activation,TRUE,TRUE,FALSE,TRUE,bidirectional,Down,"[('employee_type','=','ex'),('name','!=','Administrator')]",['active'],MISSION,hr.employee,,Expatriate Employees Activation,Valid,,333
190 msf_sync_data_server.expatriate_employees_coach,FALSE,TRUE,FALSE,FALSE,bidirectional,Bidirectional,"[('coach_id', '!=', '')]",['coach_id/id'],HQ + MISSION,hr.employee,,Expatriate Employees Coach,Valid,,334
191-msf_sync_data_server.local_employees,TRUE,TRUE,FALSE,TRUE,bidirectional,Bidirectional,"[('employee_type','=','local'),('name','!=','Administrator')]","['birthday', 'code', 'cost_center_id/id', 'destination_id/id', 'employee_type', 'filter_for_third_party', 'free1_id/id', 'free2_id/id', 'funding_pool_id/id', 'gender', 'homere_codeterrain', 'homere_id_staff', 'homere_id_unique', 'homere_uuid_key', 'identification_id', 'job_id/id', 'marital/id', 'mobile_phone', 'name', 'name_resource', 'notes', 'passport_id', 'private_phone', 'resource_type', 'sinid', 'ssnid', 'work_email', 'work_location', 'work_phone', 'contract_start_date', 'contract_end_date', 'payment_method_id/id', 'bank_name', 'bank_account_number']",HQ + MISSION,hr.employee,,Local Employees,Valid,"{'active': False}",335
192+msf_sync_data_server.local_employees,TRUE,TRUE,FALSE,TRUE,bidirectional,Bidirectional,"[('employee_type','=','local'),('name','!=','Administrator')]","['birthday', 'code', 'cost_center_id/id', 'destination_id/id', 'employee_type', 'filter_for_third_party', 'free1_id/id', 'free2_id/id', 'funding_pool_id/id', 'gender', 'homere_codeterrain', 'homere_id_staff', 'homere_id_unique', 'homere_uuid_key', 'identification_id', 'job_id/id', 'marital/id', 'mobile_phone', 'name', 'name_resource', 'notes', 'passport_id', 'private_phone', 'resource_type', 'sinid', 'ssnid', 'work_email', 'work_location', 'work_phone', 'contract_start_date', 'contract_end_date', 'payment_method_id/id', 'bank_name', 'bank_account_number', 'instance_creator']",HQ + MISSION,hr.employee,,Local Employees,Valid,"{'active': False}",335
193 msf_sync_data_server.register,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,"[('state','!=','draft'),('instance_id' , 'in' , ('msf.instance' , 'id' , [('level' , '=' , 'project')]))]","['balance_end_real', 'balance_start', 'closing_date', 'comments', 'date', 'instance_id/id', 'journal_id/id', 'name', 'notes', 'open_advance_amount', 'period_id/id','closing_balance_frozen','closing_balance_frozen_date','unrecorded_expenses_amount', 'register_closed_by']",MISSION,account.bank.statement,instance_id,Register,Valid,,400
194 msf_sync_data_server.register_line,TRUE,TRUE,TRUE,FALSE,bidirectional,Bidirectional-Private,"[('instance_id' , 'in' , ('msf.instance' , 'id' , [('level' , '=' , 'project')])),('statement_id','in',('account.bank.statement','id',[('state','!=','draft')])),'!',('state','=','draft')]","['account_id/id', 'amount_in', 'amount_out', 'analytic_distribution_id/id', 'cheque_number', 'date', 'direct_invoice', 'direct_state', 'document_date', 'employee_id/id', 'instance_id/id', 'name', 'note', 'partner_id/id', 'reconciled', 'ref', 'sequence', 'statement_id/id', 'transfer_amount','transfer_journal_id/id', 'type', 'from_cash_return']",MISSION,account.bank.statement.line,instance_id,Register Line,Valid,,401
195 msf_sync_data_server.register_cashbox_line_starting,TRUE,TRUE,TRUE,FALSE,bidirectional,Bidirectional-Private,"[('instance_id' , 'in' , ('msf.instance' , 'id' , [('level' , '=' , 'project')])),('starting_id','in',('account.bank.statement','id',[('state','!=','draft')])),('starting_id', '!=', ''),('ending_id', '=', '')]","['instance_id/id', 'number', 'pieces', 'starting_id/id']",MISSION,account.cashbox.line,instance_id,Register Cashbox Line (starting),Valid,,402
196@@ -156,6 +156,7 @@
197 msf_sync_data.sync_monitor,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('status', '=', 'ok'),('instance_id', '!=', False)]","['instance_id/id', 'nb_msg_pull', 'nb_data_pull', 'nb_msg_push', 'nb_data_push', 'nb_msg_not_run', 'nb_data_not_run', 'start', 'end', 'destination_instance_id/id']",OC,sync.monitor,destination_instance_id,Sync Monitor,Valid,,720
198 msf_sync_data.sync_version_instance_monitor,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,[],"['backup_date', 'backup_path', 'backup_size', 'instance_id/id', 'version', 'postgresql_disk_space', 'unifield_disk_space', 'cloud_date', 'cloud_backup', 'cloud_size', 'nb_late_vi', 'vi_details', 'backup_type', 'wal_directory', 'ssh_config_dir', 'basebackup_date', 'rsync_date', 'machine', 'platform', 'processor']",OC,sync.version.instance.monitor,,Sync Version Instance Monitor,Valid,,725
199 msf_sync_data_server.trigger_something,TRUE,TRUE,TRUE,TRUE,cp_to_rw,Down,"[]","['name']",OC,sync.trigger.something,,Trigger Something,Valid,,11
200+msf_sync_data_server.trigger_something_bidir_mission,TRUE,TRUE,TRUE,TRUE,bidirectional,Bidirectional,"[]","['name', 'args']",HQ + MISSION,sync.trigger.something.bidir_mission,,Trigger Something Bidir Mission,Valid,,1210
201 msf_sync_data.msf_instance_cloud,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,[],"['cloud_url', 'cloud_login', 'cloud_password', 'cloud_schedule_time', 'instance', 'cloud_retry_from', 'cloud_retry_to']",OC,msf.instance.cloud,instance,Cloud backup config,Valid,,728
202 msf_sync_data_server.ir_translation,TRUE,TRUE,TRUE,TRUE,cp_to_rw,Down,"[('res_id', '!=', 0), ('src', '!=', False), ('xml_id', '!=', False), ('lang', '!=', 'en_US'), ('type', '=', 'model'), ('name', 'in', ['res.partner.category,name','product.uom,name','product.template,description_purchase','product.template,description','product.template,description_sale','product.uom.categ,name','product.pricelist,name','product.category,name','product.nomenclature,name','product.product,form_value','product.product,function_value','product.product,fit_value','res.currency,currency_name','res.country,name','product.ul,name','product.price.type,name','product.pricelist.type,name','product.pricelist.version,name','account.analytic.account,name','account.fiscal.position,note','hr.employee.marital.status,name','account.period,name','account.tax.code,name','account.journal,name','account.tax,name','account.analytic.journal,name','account.account,name','stock.reason.type,name','product.template,name','product.justification.code,code'])]","['lang', 'src', 'name', 'value', 'type', 'xml_id']",OC,ir.translation,,Translations,Valid,,730
203 msf_sync_data_server.ir_translation_journal_up,TRUE,TRUE,FALSE,TRUE,bidirectional,Bidirectional,"[('res_id', '!=', 0), ('src', '!=', False), ('xml_id', '!=', False), ('lang', '!=', 'en_US'), ('type', '=', 'model'), ('name', 'in', ['account.journal,name', 'account.analytic.journal,name'])]","['lang', 'src', 'name', 'value', 'type', 'xml_id']",HQ + MISSION,ir.translation,,Translations,Valid,,731
204
205=== modified file 'bin/addons/sync_common/common.py'
206--- bin/addons/sync_common/common.py 2021-03-30 12:22:59 +0000
207+++ bin/addons/sync_common/common.py 2022-09-26 07:25:06 +0000
208@@ -150,6 +150,7 @@
209 'sync.trigger.something.up',
210 'sync.trigger.something.target',
211 'sync.trigger.something.target.lower',
212+ 'sync.trigger.something.bidir_mission',
213 'sync.version.instance.monitor',
214 'tender',
215 'tender.line',

Subscribers

People subscribed via source and target branches