[MERGE] html module description
bzr revid: al@openerp.com-20130628100407-3k5wy3767lbc3788
This commit is contained in:
commit
3d6a073acb
|
@ -32,6 +32,7 @@ import urllib
|
||||||
import urllib2
|
import urllib2
|
||||||
import zipfile
|
import zipfile
|
||||||
import zipimport
|
import zipimport
|
||||||
|
import lxml.html
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
@ -152,9 +153,19 @@ class module(osv.osv):
|
||||||
def _get_desc(self, cr, uid, ids, field_name=None, arg=None, context=None):
|
def _get_desc(self, cr, uid, ids, field_name=None, arg=None, context=None):
|
||||||
res = dict.fromkeys(ids, '')
|
res = dict.fromkeys(ids, '')
|
||||||
for module in self.browse(cr, uid, ids, context=context):
|
for module in self.browse(cr, uid, ids, context=context):
|
||||||
overrides = dict(embed_stylesheet=False, doctitle_xform=False, output_encoding='unicode')
|
path = addons.get_module_resource(module.name, 'static/description/index.html')
|
||||||
output = publish_string(source=module.description, settings_overrides=overrides, writer=MyWriter())
|
if path:
|
||||||
res[module.id] = output
|
with tools.file_open(path, 'rb') as desc_file:
|
||||||
|
doc = desc_file.read()
|
||||||
|
html = lxml.html.document_fromstring(doc)
|
||||||
|
for element, attribute, link, pos in html.iterlinks():
|
||||||
|
if element.get('src') and not '//' in element.get('src') and not 'static/' in element.get('src'):
|
||||||
|
element.set('src', "/%s/static/description/%s" % (module.name, element.get('src')))
|
||||||
|
res[module.id] = lxml.html.tostring(html)
|
||||||
|
else:
|
||||||
|
overrides = dict(embed_stylesheet=False, doctitle_xform=False, output_encoding='unicode')
|
||||||
|
output = publish_string(source=module.description, settings_overrides=overrides, writer=MyWriter())
|
||||||
|
res[module.id] = output
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_latest_version(self, cr, uid, ids, field_name=None, arg=None, context=None):
|
def _get_latest_version(self, cr, uid, ids, field_name=None, arg=None, context=None):
|
||||||
|
@ -232,7 +243,7 @@ class module(osv.osv):
|
||||||
def _get_icon_image(self, cr, uid, ids, field_name=None, arg=None, context=None):
|
def _get_icon_image(self, cr, uid, ids, field_name=None, arg=None, context=None):
|
||||||
res = dict.fromkeys(ids, '')
|
res = dict.fromkeys(ids, '')
|
||||||
for module in self.browse(cr, uid, ids, context=context):
|
for module in self.browse(cr, uid, ids, context=context):
|
||||||
path = addons.get_module_resource(module.name, 'static', 'src', 'img', 'icon.png')
|
path = addons.get_module_resource(module.name, 'static', 'description', 'icon.png')
|
||||||
if path:
|
if path:
|
||||||
image_file = tools.file_open(path, 'rb')
|
image_file = tools.file_open(path, 'rb')
|
||||||
try:
|
try:
|
||||||
|
@ -472,7 +483,6 @@ class module(osv.osv):
|
||||||
function(cr, uid, ids, context=context)
|
function(cr, uid, ids, context=context)
|
||||||
|
|
||||||
cr.commit()
|
cr.commit()
|
||||||
openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)
|
|
||||||
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
|
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
|
||||||
|
|
||||||
config = registry['res.config'].next(cr, uid, [], context=context) or {}
|
config = registry['res.config'].next(cr, uid, [], context=context) or {}
|
||||||
|
|
|
@ -37,15 +37,15 @@
|
||||||
<search string="Search modules">
|
<search string="Search modules">
|
||||||
<field name="name" filter_domain="['|', '|', ('summary', 'ilike', self), ('shortdesc', 'ilike', self), ('name',
|
<field name="name" filter_domain="['|', '|', ('summary', 'ilike', self), ('shortdesc', 'ilike', self), ('name',
|
||||||
'ilike', self)]" string="Module"/>
|
'ilike', self)]" string="Module"/>
|
||||||
<filter name="app" icon="terp-check" string="Apps" domain="[('application', '=', 1)]"/>
|
<filter name="app" string="Apps" domain="[('application', '=', 1)]"/>
|
||||||
<filter name="extra" icon="terp-check" string="Extra" domain="[('application', '=', 0)]"/>
|
<filter name="extra" string="Extra" domain="[('application', '=', 0)]"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
<filter name="installed" icon="terp-check" string="Installed" domain="[('state', 'in', ['installed', 'to upgrade', 'to remove'])]"/>
|
<filter name="installed" string="Installed" domain="[('state', 'in', ['installed', 'to upgrade', 'to remove'])]"/>
|
||||||
<filter icon="terp-dialog-close" string="Not Installed" domain="[('state', 'in', ['uninstalled', 'uninstallable', 'to install'])]"/>
|
<filter string="Not Installed" domain="[('state', 'in', ['uninstalled', 'uninstallable', 'to install'])]"/>
|
||||||
<field name="category_id"/>
|
<field name="category_id"/>
|
||||||
<group expand="0" string="Group By...">
|
<group expand="0" string="Group By...">
|
||||||
<filter string="Author" icon="terp-personal" domain="[]" context="{'group_by':'author'}"/>
|
<filter string="Author" domain="[]" context="{'group_by':'author'}"/>
|
||||||
<filter string="Category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'category_id'}"/>
|
<filter string="Category" domain="[]" context="{'group_by':'category_id'}"/>
|
||||||
</group>
|
</group>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
|
@ -70,37 +70,41 @@
|
||||||
<field name="name">ir.module.module.form</field>
|
<field name="name">ir.module.module.form</field>
|
||||||
<field name="model">ir.module.module</field>
|
<field name="model">ir.module.module</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form create="0" edit="0" string="Module" version="7.0">
|
<form create="0" edit="0" string="Module" version="7.0" class='oe_styling_v8'>
|
||||||
<sheet>
|
<sheet>
|
||||||
<field name="icon_image" widget="image" class="oe_avatar oe_left"/>
|
<field name="icon_image" widget="image" class="oe_avatar oe_left"/>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<h1><field name="shortdesc"/></h1>
|
<h1><field name="shortdesc"/></h1>
|
||||||
<h2 class="oe_fade"><field name="summary"/></h2>
|
<h3 class="oe_fade">
|
||||||
<button name="button_immediate_install" states="uninstalled" string="Install" type="object" class="oe_highlight"/>
|
By <field name="author" class="oe_inline"/>
|
||||||
<button name="button_immediate_upgrade" states="installed" string="Upgrade" type="object" class="oe_highlight"/>
|
</h3>
|
||||||
<button name="button_immediate_uninstall" states="installed" string="Uninstall" type="object"
|
<div>
|
||||||
confirm="Do you confirm the uninstallation of this module? This will permanently erase all data currently stored by the module!"/>
|
<button name="button_immediate_install" states="uninstalled" string="Install" type="object" class="oe_highlight"/>
|
||||||
<button name="button_uninstall_cancel" states="to remove" string="Cancel Uninstall" type="object"/>
|
<button name="button_immediate_upgrade" states="installed" string="Upgrade" type="object" class="oe_highlight"/>
|
||||||
<button name="button_upgrade_cancel" states="to upgrade" string="Cancel Upgrade" type="object"/>
|
<button name="button_immediate_uninstall" states="installed" string="Uninstall" type="object"
|
||||||
<button name="button_install_cancel" states="to install" string="Cancel Install" 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" type="object"/>
|
||||||
|
<button name="button_upgrade_cancel" states="to upgrade" string="Cancel Upgrade" type="object"/>
|
||||||
|
<button name="button_install_cancel" states="to install" string="Cancel Install" type="object"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<group>
|
<div class="oe_clear"/>
|
||||||
<group>
|
<notebook groups="base.group_no_one">
|
||||||
<field name="author"/>
|
<page string="Information">
|
||||||
<field name="website" widget="url" attrs="{'invisible':[('website','=',False)]}"/>
|
<group>
|
||||||
<field name="category_id" widget="selection"/>
|
<group>
|
||||||
</group>
|
<field name="website" widget="url" attrs="{'invisible':[('website','=',False)]}"/>
|
||||||
<group>
|
<field name="category_id" widget="selection"/>
|
||||||
<field name="name"/>
|
<field name="summary"/>
|
||||||
<field name="license"/>
|
</group>
|
||||||
<field name="installed_version"/>
|
<group>
|
||||||
</group>
|
<field name="name"/>
|
||||||
</group>
|
<field name="license"/>
|
||||||
<notebook>
|
<field name="installed_version"/>
|
||||||
<page string="Description">
|
</group>
|
||||||
<field name="description_html"/>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
<page string="Technical Data" groups="base.group_no_one">
|
<page string="Technical Data">
|
||||||
<group col="4">
|
<group col="4">
|
||||||
<field name="demo"/>
|
<field name="demo"/>
|
||||||
<field name="application"/>
|
<field name="application"/>
|
||||||
|
@ -116,7 +120,7 @@
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
<page string="Features" attrs="{'invisible':[('state','!=','installed')]}">
|
<page string="Installed Features" attrs="{'invisible':[('state','!=','installed')]}">
|
||||||
<label for="menus_by_module" string="Created Menus"/>
|
<label for="menus_by_module" string="Created Menus"/>
|
||||||
<field name="menus_by_module"/>
|
<field name="menus_by_module"/>
|
||||||
<label for="reports_by_module" string="Defined Reports"/>
|
<label for="reports_by_module" string="Defined Reports"/>
|
||||||
|
@ -124,6 +128,8 @@
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</sheet>
|
</sheet>
|
||||||
|
<field name="description_html" class='oe_app_description oe_styling_v8'/>
|
||||||
|
<button name="button_immediate_install" states="uninstalled" string="Install" type="object" class="oe_highlight oe_center"/>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
Loading…
Reference in New Issue