← Back to team overview

credativ team mailing list archive

[Merge] lp:~arthru/openupgrade-server/sort-xmlids-by-model-state-name into lp:openupgrade-server

 

arthru has proposed merging lp:~arthru/openupgrade-server/sort-xmlids-by-model-state-name into lp:openupgrade-server.

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~arthru/openupgrade-server/sort-xmlids-by-model-state-name/+merge/174255
-- 
https://code.launchpad.net/~arthru/openupgrade-server/sort-xmlids-by-model-state-name/+merge/174255
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~arthru/openupgrade-server/sort-xmlids-by-model-state-name into lp:openupgrade-server.
=== modified file 'openerp/addons/openupgrade_records/lib/compare.py'
--- openerp/addons/openupgrade_records/lib/compare.py	2012-11-24 22:32:46 +0000
+++ openerp/addons/openupgrade_records/lib/compare.py	2013-07-11 17:16:28 +0000
@@ -229,12 +229,22 @@
         if found:
             old_records.remove(column)
             new_records.remove(found)
-    for entry in sorted(
-        old_records, key=lambda k: '%s%s' % (k['model'].ljust(128), k['name'])):
-        reprs.setdefault(module_map(entry['module']), []).append(
-            'deleted xml-id of model %s: %s' % (entry['model'], entry['name']))
-    for entry in sorted(
-        new_records, key=lambda k: '%s%s' % (k['model'].ljust(128), k['name'])):
-        reprs.setdefault(module_map(entry['module']), []).append(
-            'new xml-id of model %s: %s' % (entry['model'], entry['name']))
+
+    for record in old_records:
+        record['old'] = True
+    for record in new_records:
+        record['new'] = True
+
+    sorted_records = sorted(
+        old_records + new_records,
+        key=lambda k: '%s%s%s' % (k['model'].ljust(128), 'old' in k, k['name'])
+    )
+    for entry in sorted_records:
+        if 'old' in entry:
+            content = 'deleted xml-id of model %s: %s' % (entry['model'],
+                                                          entry['name'])
+        elif 'new' in entry:
+            content = 'new xml-id of model %s: %s' % (entry['model'],
+                                                      entry['name'])
+        reprs.setdefault(module_map(entry['module']), []).append(content)
     return reprs

=== modified file 'openerp/addons/openupgrade_records/model/analysis_wizard.py'
--- openerp/addons/openupgrade_records/model/analysis_wizard.py	2012-11-24 22:32:46 +0000
+++ openerp/addons/openupgrade_records/model/analysis_wizard.py	2013-07-11 17:16:28 +0000
@@ -131,7 +131,7 @@
                 if res[key]:
                     contents += '\n'
             if key in res_xml:
-                contents += '\n'.join([unicode(line) for line in sorted(res_xml[key])])
+                contents += '\n'.join([unicode(line) for line in res_xml[key]])
                 if res_xml[key]:
                     contents += '\n'
             if key == 'general':


Follow ups