Anto has proposed merging 
lp:~openerp-dev/openobject-server/trunk-client_act_in_menuitems-abo into 
lp:openobject-server.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-client_act_in_menuitems-abo/+merge/120772
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-client_act_in_menuitems-abo/+merge/120772
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/trunk-client_act_in_menuitems-abo.
=== modified file 'openerp/tools/convert.py'
--- openerp/tools/convert.py	2012-08-16 13:04:06 +0000
+++ openerp/tools/convert.py	2012-08-22 13:37:43 +0000
@@ -591,7 +591,21 @@
 
         if rec.get('action'):
             a_action = rec.get('action','').encode('utf8')
-            a_type = rec.get('type','').encode('utf8') or 'act_window'
+
+            # determine the type of action
+            if ('.' in a_action):
+                # this is an action refering to another module: extract this module's name
+                a_action_module, a_action_name = a_action.split('.')
+            else:
+                # this is a local action: fetch the current module's name
+                a_action_module = self.module
+                a_action_name = a_action
+
+            # fetch the model and the res id
+            ir_action_ref = self.pool.get('ir.model.data').get_object_reference(cr, self.uid, a_action_module, a_action_name)
+            # get the part of the model we need
+            a_type = ir_action_ref[0].split('.')[-1]
+
             icons = {
                 "act_window": 'STOCK_NEW',
                 "report.xml": 'STOCK_PASTE',
@@ -601,6 +615,7 @@
                 "server": 'STOCK_EXECUTE',
             }
             values['icon'] = icons.get(a_type,'STOCK_NEW')
+
             if a_type=='act_window':
                 a_id = self.id_get(cr, a_action)
                 cr.execute('select view_type,view_mode,name,view_id,target from ir_act_window where id=%s', (int(a_id),))
@@ -627,7 +642,7 @@
                     values['icon'] = 'STOCK_EXECUTE'
                 if not values.get('name', False):
                     values['name'] = action_name
-            
+
             elif a_type in ['wizard', 'url', 'client', 'server'] and not values.get('name'):
                 a_id = self.id_get(cr, a_action)
                 a_table = 'ir_act_%s' % a_type

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to