[MERGE] [IMP] Misc view improvements using better name_get / name_search.

bzr revid: tde@openerp.com-20140509094920-94z2i7hfao3xxu4n
This commit is contained in:
Jitendra Prajapati 2014-05-09 11:49:20 +02:00 committed by Thibault Delavallée
commit 9b15769a71
9 changed files with 67 additions and 12 deletions

View File

@ -1057,6 +1057,18 @@ Launch Manually Once: after having been launched manually, it sets automatically
}
_order="sequence,id"
def name_get(self, cr, uid, ids, context=None):
return [(rec.id, rec.action_id.name) for rec in self.browse(cr, uid, ids, context=context)]
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if args is None:
args = []
if name:
ids = self.search(cr, user, [('action_id', operator, name)] + args, limit=limit)
return self.name_get(cr, user, ids, context=context)
return super(ir_actions_todo, self).name_search(cr, user, name, args=args, operator=operator, context=context, limit=limit)
def action_launch(self, cr, uid, ids, context=None):
""" Launch Action of Wizard"""
wizard_id = ids and ids[0] or False

View File

@ -42,6 +42,7 @@ class ir_config_parameter(osv.osv):
"""Per-database storage of configuration key-value pairs."""
_name = 'ir.config_parameter'
_rec_name = 'key'
_columns = {
'key': fields.char('Key', size=256, required=True, select=1),

View File

@ -68,6 +68,18 @@ class view_custom(osv.osv):
'arch': fields.text('View Architecture', required=True),
}
def name_get(self, cr, uid, ids, context=None):
return [(rec.id, rec.user_id.name) for rec in self.browse(cr, uid, ids, context=context)]
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if args is None:
args = []
if name:
ids = self.search(cr, user, [('user_id', operator, name)] + args, limit=limit)
return self.name_get(cr, user, ids, context=context)
return super(view_custom, self).name_search(cr, user, name, args=args, operator=operator, context=context, limit=limit)
def _auto_init(self, cr, context=None):
super(view_custom, self)._auto_init(cr, context)
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_ui_view_custom_user_id_ref_id\'')

View File

@ -86,6 +86,7 @@
<group col="4">
<field name="user_id"/>
<field name="ref_id"/>
<separator string="View Architecture" colspan="4" />
<field name="arch" colspan="4" nolabel="1"/>
</group>
</sheet>
@ -114,7 +115,7 @@
<field name="name">Customized Views</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.ui.view.custom</field>
<field name="help">Customized views are used when users reorganize the content of their dashboard views (via web client)</field>
<field name="help" type="html"><p class="oe_view_nocontent_create">Click here to create a customized view</p><p>Customized views are used when users reorganize the content of their dashboard views (via web client)</p></field>
</record>
<menuitem id="menu_action_ui_view_custom" action="action_ui_view_custom" parent="base.next_id_2" sequence="3"/>

View File

@ -34,13 +34,14 @@
<field name="name"/>
<field name="model"/>
<field name="model_id" on_change="onchange_object_id(model_id)"/>
<field name="value_unpickle" nolabel="1"/>
</group>
<group>
<field name="key2" string="Condition"/>
<field name="user_id"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<separator string="Default value or action reference"/>
<field name="value_unpickle" nolabel="1" colspan="2"/>
</group>
</form>
</field>

View File

@ -144,6 +144,15 @@ class module(osv.osv):
_rec_name = "shortdesc"
_description = "Module"
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(module, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
result = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'action_server_module_immediate_install')[1]
if view_type == 'form':
if res.get('toolbar',False):
list = [rec for rec in res['toolbar']['action'] if rec.get('id', False) != result]
res['toolbar'] = {'action': list}
return res
@classmethod
def get_module_info(cls, name):
info = {}

View File

@ -111,9 +111,11 @@
<field name="application"/>
<field name="state"/>
</group>
<label for="views_by_module" string="Created Views"/>
<group string="Created Views" attrs="{'invisible':[('state','!=','installed')]}"/>
<p class="oe_grey" attrs="{'invisible': ['|',('views_by_module','not in',[None,False]),('state','!=','installed')]}"> -This module does not create views.</p>
<field name="views_by_module"/>
<label for="dependencies_id"/>
<group string="Dependencies"/>
<p class="oe_grey" attrs="{'invisible': [('dependencies_id','not in',[None,False])]}"> -This module does not depends on any other module.</p>
<field name="dependencies_id">
<tree string="Dependencies">
<field name="name"/>
@ -122,9 +124,11 @@
</field>
</page>
<page string="Installed Features" attrs="{'invisible':[('state','!=','installed')]}">
<label for="menus_by_module" string="Created Menus"/>
<group string="Created Menus"/>
<p class="oe_grey" attrs="{'invisible': [('menus_by_module','not in',[None,False])]}"> -This module does not create menu.</p>
<field name="menus_by_module"/>
<label for="reports_by_module" string="Defined Reports"/>
<group string="Defined Reports"/>
<p class="oe_grey" attrs="{'invisible': [('reports_by_module','not in',[None,False])]}"> -This module does not create report.</p>
<field name="reports_by_module"/>
</page>
</notebook>

View File

@ -31,12 +31,14 @@
<field name="type"/>
<field name="res_id"/>
</group>
<field name="value_integer" attrs="{'invisible' : [('type', 'not in', ('integer', 'boolean'))]}"/>
<field name="value_float" attrs="{'invisible' : [('type', '!=', 'float')]}"/>
<field name="value_datetime" attrs="{'invisible' : [('type', 'not in', ('date', 'datetime'))]}"/>
<field name="value_text" attrs="{'invisible' : [('type', 'not in', ('char', 'text'))]}"/>
<field name="value_reference" attrs="{'invisible' : [('type', '!=', 'many2one')]}"/>
<field name="value_binary" attrs="{'invisible' : [('type', '!=', 'binary')]}"/>
<group>
<field name="value_integer" attrs="{'invisible' : [('type', 'not in', ('integer', 'boolean'))]}"/>
<field name="value_float" attrs="{'invisible' : [('type', '!=', 'float')]}"/>
<field name="value_datetime" attrs="{'invisible' : [('type', 'not in', ('date', 'datetime'))]}"/>
<field name="value_text" attrs="{'invisible' : [('type', 'not in', ('char', 'text'))]}"/>
<field name="value_reference" attrs="{'invisible' : [('type', '!=', 'many2one')]}"/>
<field name="value_binary" attrs="{'invisible' : [('type', '!=', 'binary')]}"/>
</group>
</sheet>
</form>
</field>

View File

@ -123,6 +123,19 @@ class wkf_transition(osv.osv):
_defaults = {
'condition': lambda *a: 'True',
}
def name_get(self, cr, uid, ids, context=None):
return [(line.id, (line.act_from.name) + '+' + (line.act_to.name)) if line.signal == False else (line.id, line.signal) for line in self.browse(cr, uid, ids, context=context)]
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if args is None:
args = []
if name:
ids = self.search(cr, user, ['|',('act_from', operator, name),('act_to', operator, name)] + args, limit=limit)
return self.name_get(cr, user, ids, context=context)
return super(wkf_transition, self).name_search(cr, user, name, args=args, operator=operator, context=context, limit=limit)
wkf_transition()
class wkf_instance(osv.osv):