[MERGE] improve modules' descriptions

also properly render descriptions from RST into HTML

bzr revid: abo@openerp.com-20120822185057-dirf183dh83wgtjy
This commit is contained in:
Antonin Bourguignon 2012-08-22 20:50:57 +02:00
commit 459f45a53e
9 changed files with 40 additions and 15 deletions

View File

@ -25,20 +25,21 @@
'name': 'Base',
'version': '1.3',
'category': 'Hidden',
'description': """The kernel of OpenERP, needed for all installation.""",
'description': """
The kernel of OpenERP, needed for all installation.
===================================================
""",
'author': 'OpenERP SA',
'maintainer': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': [],
'init_xml': [
'data': [
'base_data.xml',
'security/base_security.xml',
'base_menu.xml',
'res/res_security.xml',
'res/res_config.xml',
'data/res.country.state.csv'
],
'update_xml': [
'data/res.country.state.csv',
'ir/wizard/wizard_menu_view.xml',
'ir/ir.xml',
'ir/ir_filters.xml',
@ -77,7 +78,7 @@
'res/res_widget_data.xml',
'publisher_warranty/publisher_warranty_data.xml',
],
'demo_xml': [
'demo': [
'base_demo.xml',
'res/res_partner_demo.xml',
'res/res_partner_demo.yml',

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<data noupdate="1">
<!-- Top menu item -->
<menuitem name="Reporting"

View File

@ -29,6 +29,7 @@ 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
from docutils.core import publish_string
_logger = logging.getLogger(__name__)
@ -94,6 +95,15 @@ class module(osv.osv):
'module %s', name, exc_info=True)
return info
def _get_desc(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):
desc = self.get_module_info(module.name).get('description', '')
overrides = dict(embed_stylesheet=False, doctitle_xform=False, output_encoding='unicode')
output = publish_string(source=desc, writer_name='html', settings_overrides=overrides)
res[module.id] = output
return res
def _get_latest_version(self, cr, uid, ids, field_name=None, arg=None, context=None):
res = dict.fromkeys(ids, '')
for m in self.browse(cr, uid, ids):
@ -182,7 +192,7 @@ class module(osv.osv):
'category_id': fields.many2one('ir.module.category', 'Category', readonly=True, select=True),
'shortdesc': fields.char('Module Name', size=64, readonly=True, translate=True),
'summary': fields.char('Summary', size=64, readonly=True, translate=True),
'description': fields.text("Description", readonly=True, translate=True),
'description': fields.function(_get_desc, string='Description', type='html', method=True, readonly=True, store=True),
'author': fields.char("Author", size=128, readonly=True),
'maintainer': fields.char('Maintainer', size=128, readonly=True),
'contributors': fields.text('Contributors', readonly=True),

View File

@ -38,7 +38,7 @@
<field name="model">ir.module.module</field>
<field name="arch" type="xml">
<search string="Search modules">
<field name="name" filter_domain="['|', '|', '|', ('description', 'ilike', self), ('summary', 'ilike', self), ('shortdesc', 'ilike', self), ('name',
<field name="name" filter_domain="['|', '|', ('summary', 'ilike', self), ('shortdesc', 'ilike', self), ('name',
'ilike', self)]"/>
<filter name="app" icon="terp-check" string="Apps" domain="[('application', '=', 1)]"/>
<filter name="extra" icon="terp-check" string="Extra" domain="[('application', '=', 0)]"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<data noupdate="1">
<record id="res_config_view_base" model="ir.ui.view">
<field name="name">res.config.view.base</field>
<field name="model">res.config</field>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<data noupdate="1">
<record model="res.groups" id="group_partner_manager">
<field name="name">Partner Manager</field>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="0">
<data noupdate="1">
<!--
Users Groups

View File

@ -185,7 +185,6 @@
<rng:optional> <rng:attribute name="string"/> </rng:optional>
<rng:optional> <rng:attribute name="sequence"/> </rng:optional>
<rng:optional> <rng:attribute name="groups"/> </rng:optional>
<rng:optional> <rng:attribute name="type"/> </rng:optional>
<rng:optional> <rng:attribute name="menu"/> </rng:optional>
<rng:empty />
</rng:element>

View File

@ -591,7 +591,21 @@ form: module.record_id""" % (xml_id,)
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:
# action referring to another module
a_action_module, a_action_name = a_action.split('.')
else:
# local action: use current module
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 @@ form: module.record_id""" % (xml_id,)
"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 @@ form: module.record_id""" % (xml_id,)
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