Purnendu Singh (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/trunk-module_image_on_form-psi into 
lp:openobject-server.

Requested reviews:
  Raphael Collet (OpenERP) (rco-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-module_image_on_form-psi/+merge/108306

Hello,

Set the image to the right on the module form.


Thanks,
purnendu Singh
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-module_image_on_form-psi/+merge/108306
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/trunk-module_image_on_form-psi.
=== modified file 'openerp/addons/base/module/module.py'
--- openerp/addons/base/module/module.py	2012-06-09 12:40:45 +0000
+++ openerp/addons/base/module/module.py	2012-06-12 09:13:20 +0000
@@ -23,8 +23,9 @@
 import re
 import urllib
 import zipimport
+import base64
 
-from openerp import modules, pooler, release, tools
+from openerp import modules, pooler, release, tools, addons
 from openerp.tools.parse_version import parse_version
 from openerp.tools.translate import _
 from openerp.osv import fields, osv, orm
@@ -160,6 +161,18 @@
                 res[key][k] = "\n".join(sorted(v))
         return res
 
+    def _get_icon_image(self, cr, uid, ids, field_name=None, arg=None, context=None):
+        res = dict.fromkeys(ids, '')
+        for module in self.browse(cr, uid, ids, context=context):
+            path = addons.get_module_resource(module.name, 'static', 'src', 'img', 'icon.png')
+            if path:
+                image_file = tools.file_open(path, 'rb')
+                try:
+                    res[module.id] = image_file.read().encode('base64')
+                finally:
+                    image_file.close()
+        return res
+
     _columns = {
         'name': fields.char("Technical Name", size=128, readonly=True, required=True, select=True),
         'category_id': fields.many2one('ir.module.category', 'Category', readonly=True, select=True),
@@ -211,6 +224,7 @@
         'certificate' : fields.char('Quality Certificate', size=64, readonly=True),
         'application': fields.boolean('Application', readonly=True),
         'icon': fields.char('Icon URL', size=128),
+        'icon_image': fields.function(_get_icon_image, string='Icon', type="binary"),
     }
 
     _defaults = {

=== modified file 'openerp/addons/base/module/module_view.xml'
--- openerp/addons/base/module/module_view.xml	2012-06-09 12:40:45 +0000
+++ openerp/addons/base/module/module_view.xml	2012-06-12 09:13:20 +0000
@@ -123,9 +123,8 @@
                 <header>
                     <button name="button_install" states="uninstalled" string="Install" icon="terp-gtk-jump-to-ltr" type="object" class="oe_form_button_hi"/>
                     <button name="button_upgrade" states="installed" string="Upgrade" icon="terp-gtk-go-back-rtl" type="object" class="oe_form_button_hi"/>
-                    <button name="button_uninstall" states="installed" string="Uninstall (beta)"
-                                        icon="terp-dialog-close" type="object"
-                                        confirm="Do you confirm the uninstallation of this module? This will permanently erase all data currently stored by the module!"/>
+                    <button name="button_uninstall" states="installed" string="Uninstall (beta)" icon="terp-dialog-close" type="object"
+                        confirm="Do you confirm the uninstallation of this module? This will permanently erase all data currently stored by the module!"/>
                     <button name="button_uninstall_cancel" states="to remove" string="Cancel Uninstall" icon="gtk-cancel" type="object"/>
                     <button name="button_upgrade_cancel" states="to upgrade" string="Cancel Upgrade" icon="gtk-cancel" type="object"/>
                     <button name="button_install_cancel" states="to install" string="Cancel Install" icon="gtk-cancel" type="object"/>
@@ -133,7 +132,7 @@
                 </header>
                 <sheet>
                     <div class="oe_right oe_form_button_box">
-                        <field name="icon" widget='image'/>
+                        <field name="icon_image" widget="image"/>
                     </div>
                     <div class="oe_form_title">
                         <label for="shortdesc" class="oe_form_readonly_hidden"/>
@@ -158,7 +157,6 @@
                         </page>
                         <page string="Technical Data">
                             <group col="4">
-                                <field name="name"/>
                                 <field name="demo"/>
                                 <field name="application"/>
                             </group>
@@ -170,11 +168,11 @@
                             </field>
                         </page>
                         <page string="Features" attrs="{'invisible':[('state','!=','installed')]}">
-                            <separator string="Created Menus"/>
+                            <label for="menus_by_module" string="Created Menus"/>
                             <field name="menus_by_module"/>
-                            <separator string="Created Views"/>
+                            <label for="views_by_module" string="Created Views"/>
                             <field name="views_by_module"/>
-                            <separator string="Defined Reports"/>
+                            <label for="reports_by_module" string="Defined Reports"/>
                             <field name="reports_by_module"/>
                         </page>
                     </notebook>

_______________________________________________
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