Merge lp:~jfb-tempo-consulting/unifield-wm/UF-2462 into lp:unifield-wm/sync

Proposed by jftempo
Status: Merged
Merged at revision: 497
Proposed branch: lp:~jfb-tempo-consulting/unifield-wm/UF-2462
Merge into: lp:unifield-wm/sync
Diff against target: 42 lines (+13/-9)
1 file modified
sync_so/specific_xml_id.py (+13/-9)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-wm/UF-2462
Reviewer Review Type Date Requested Status
UniField Sync Reviewer Pending
Review via email: mp+237029@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 'sync_so/specific_xml_id.py'
2--- sync_so/specific_xml_id.py 2014-09-26 13:31:31 +0000
3+++ sync_so/specific_xml_id.py 2014-10-03 09:56:08 +0000
4@@ -340,6 +340,8 @@
5
6 # Generate delete message for AJI at Project
7 def generate_delete_message_at_project(self, cr, uid, ids, vals, context):
8+ if context is None:
9+ context = {}
10 # NEED REFACTORING FOR THIS METHOD, if the action write on Analytic.line happens often!
11 msf_instance_obj = self.pool.get('msf.instance')
12 msg_to_send_obj = self.pool.get("sync.client.message_to_send")
13@@ -368,18 +370,20 @@
14
15 # UF-1011: generate delete msg if correction is made on coordo CC coming from project
16 old_destination_level = self.get_instance_level_from_cost_center(cr, uid, old_cost_center_id, context=context)
17- if old_destination_level == 'coordo' and not xml_id_record.name.startswith(instance_identifier) and instance_level == 'coordo':
18+ if not context.get('sync_update_execution') and old_destination_level == 'coordo' and not xml_id_record.name.startswith(instance_identifier) and instance_level == 'coordo':
19 creation_instance_ids = msf_instance_obj.search(cr, uid, [('instance_identifier', '=', xml_id_record.name.split('/')[0]), ('level', '=', 'project')])
20 if creation_instance_ids:
21 msf_instance = msf_instance_obj.browse(cr, uid, creation_instance_ids[0])
22- now = fields.datetime.now()
23- message_data = {'identifier':'delete_%s' % (xml_id,),
24- 'sent':False,
25- 'generate_message':True,
26- 'remote_call':self._name + ".message_unlink_analytic_line",
27- 'arguments':"[{'model' : '%s', 'xml_id' : '%s', 'correction_date' : '%s'}]" % (self._name, xml_id, now),
28- 'destination_name': msf_instance.name}
29- msg_to_send_obj.create(cr, uid, message_data)
30+ new_destination_name = self.get_instance_name_from_cost_center(cr, uid, new_cost_center_id, context=context)
31+ if new_destination_name != msf_instance.name:
32+ now = fields.datetime.now()
33+ message_data = {'identifier':'delete_%s' % (xml_id,),
34+ 'sent':False,
35+ 'generate_message':True,
36+ 'remote_call':self._name + ".message_unlink_analytic_line",
37+ 'arguments':"[{'model' : '%s', 'xml_id' : '%s', 'correction_date' : '%s'}]" % (self._name, xml_id, now),
38+ 'destination_name': msf_instance.name}
39+ msg_to_send_obj.create(cr, uid, message_data)
40
41 # UF-2342: only generate delete message if the instance is at Project level
42 if old_destination_level == 'project':

Subscribers

People subscribed via source and target branches

to all changes: