[IMP] Added a button on the ir.actions.report.xml form view to allow direct access of the QWeb views associated and edit them

bzr revid: sle@openerp.com-20140224170839-7nqv07vp1tx5ou38
This commit is contained in:
Simon Lejeune 2014-02-24 18:08:39 +01:00
parent d64c4a3f17
commit 1cf57507c0
2 changed files with 24 additions and 1 deletions

View File

@ -118,4 +118,20 @@ class res_company(osv.Model):
class ir_actions_report(osv.Model):
_inherit = 'ir.actions.report.xml'
def associated_view(self, cr, uid, ids, context):
"""Used in the ir.actions.report.xml form view in order to search naively after the view(s)
used in the rendering.
"""
if context is None:
context = {}
try:
report_name = self.browse(cr, uid, ids[0], context).report_name
act_window_obj = self.pool.get('ir.actions.act_window')
view_action = act_window_obj.for_xml_id(cr, uid, 'base', 'action_ui_view', context=context)
view_action['context'] = context
view_action['domain'] = [('name', 'ilike', report_name.split('.')[1]), ('type', '=', 'qweb')]
return view_action
except:
return False
_columns = {'paperformat_id': fields.many2one('report.paperformat', 'Paper format')}

View File

@ -10,12 +10,19 @@
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='report_file']" position="after">
<field name="paperformat_id" />
<field name="paperformat_id"/>
<button
type="object"
class="oe_link"
string="Search associated QWeb views"
name="associated_view"
/>
</xpath>
</data>
</field>
</record>
<record id="paperformat_view_tree" model="ir.ui.view">
<field name="name">paper_format_view_tree</field>
<field name="model">report.paperformat</field>