# -*- coding: utf-8 -*- import openobject.templating class ShareActionEditor(openobject.templating.TemplateEditor): templates = ['/openerp/widgets/templates/sidebar.mako'] ADD_SHARE_SECTION = u'id="sidebar"' def insert_share_link(self, output): # Insert the link on the line right after the link to open the # attachment form share_opener_insertion = output.index( '\n', output.index(self.ADD_SHARE_SECTION)) + 1 return output[:share_opener_insertion] + \ '''
\n''' + \ output[share_opener_insertion:] def edit(self, template, template_text): return self.insert_share_link( super(ShareActionEditor, self).edit(template, template_text))