def get_signature_footer(self, cr, uid, user_id, res_model=None, res_id=None, context=None): """ Format a standard footer for notification emails (such as pushed messages notification or invite emails). Format: <p>--<br /> Administrator </p> <div> <small>Sent by <a ...>Your Company</a> using <a ...>OpenERP</a>.</small> OR <small>Sent by Administrator using <a ...>OpenERP</a>.</small> </div> """ footer = "" if not user_id: return footer # add user signature user = self.pool.get("res.users").browse(cr, SUPERUSER_ID, [user_id], context=context)[0] if user.signature: signature = plaintext2html(user.signature) else: signature = "--<br />%s" % user.name footer = tools.append_content_to_html(footer, signature, plaintext=False, container_tag='p') # add company signature if user.company_id.website: website_url = ('http://%s' % user.company_id.website) if not user.company_id.website.lower().startswith(('http:', 'https:')) \ else user.company_id.website company = "<a style='color:inherit' href='%s'>%s</a>" % ( website_url, user.company_id.name) else: company = user.company_id.name sent_by = _('Sent by %(company)s using %(odoo)s.') signature_company = '<small>%s</small>' % (sent_by % { 'company': company, 'odoo': "<a style='color:inherit' href='https://www.odoo.com/'>Odoo</a>" }) footer = tools.append_content_to_html(footer, signature_company, plaintext=False, container_tag='div') return footer
def convert_field_to_html(cr, table, field_name, html_field_name): """ Convert field value to HTML value. """ cr.execute( "SELECT id, %(field)s FROM %(table)s WHERE %(field)s IS NOT NULL" % { 'field': field_name, 'table': table, }) for row in cr.fetchall(): logged_query( cr, "UPDATE %(table)s SET %(field)s = %s WHERE id = %s" % { 'field': html_field_name, 'table': table, }, (plaintext2html(row[1]), row[0]))
def convert_field_to_html(cr, table, field_name, html_field_name): """ Convert field value to HTML value. """ cr.execute( "SELECT id, %(field)s FROM %(table)s WHERE %(field)s IS NOT NULL" % { 'field': field_name, 'table': table, } ) for row in cr.fetchall(): logged_query( cr, "UPDATE %(table)s SET %(field)s = %s WHERE id = %s" % { 'field': html_field_name, 'table': table, }, (plaintext2html(row[1]), row[0]) )
def convert_field_to_html(cr, table, field_name, html_field_name): """ Convert field value to HTML value. .. versionadded:: 7.0 """ if release.version_info[0] < 7: logger.error("You cannot use this method in an OpenUpgrade version " "prior to 7.0.") return cr.execute( "SELECT id, %(field)s FROM %(table)s WHERE %(field)s IS NOT NULL" % {"field": field_name, "table": table} ) for row in cr.fetchall(): logged_query( cr, "UPDATE %(table)s SET %(field)s = %s WHERE id = %s" % {"field": html_field_name, "table": table}, (plaintext2html(row[1]), row[0]), )
def convert_field_to_html(cr, table, field_name, html_field_name): """ Convert field value to HTML value. .. versionadded:: 7.0 """ if version_info[0] < 7: logger.error("You cannot use this method in an OpenUpgrade version " "prior to 7.0.") return cr.execute( "SELECT id, %(field)s FROM %(table)s WHERE %(field)s IS NOT NULL" % { 'field': field_name, 'table': table, }) for row in cr.fetchall(): logged_query( cr, "UPDATE %(table)s SET %(field)s = %%s WHERE id = %%s" % { 'field': html_field_name, 'table': table, }, (plaintext2html(row[1]), row[0]))
def get_signature_footer(self, cr, uid, user_id, res_model=None, res_id=None, context=None): """ Format a standard footer for notification emails (such as pushed messages notification or invite emails). Format: <p>--<br /> Administrator </p> <div> <small>Sent by <a ...>Your Company</a> using <a ...>OpenERP</a>.</small> OR <small>Sent by Administrator using <a ...>OpenERP</a>.</small> </div> """ footer = "" if not user_id: return footer # add user signature user = self.pool.get("res.users").browse(cr, SUPERUSER_ID, [user_id], context=context)[0] if user.signature: signature = plaintext2html(user.signature) else: signature = "--<br />%s" % user.name footer = tools.append_content_to_html(footer, signature, plaintext=False, container_tag='p') # add company signature if user.company_id.website: website_url = ('http://%s' % user.company_id.website) if not user.company_id.website.lower().startswith(('http:', 'https:')) \ else user.company_id.website company = "<a style='color:inherit' href='%s'>%s</a>" % (website_url, user.company_id.name) else: company = user.company_id.name sent_by = _('Sent by %(company)s using %(openerp)s.') signature_company = '<small>%s</small>' % (sent_by % { 'company': company, 'openerp': "<a style='color:inherit' href='https://www.openerp.com/'>OpenERP</a>" }) footer = tools.append_content_to_html(footer, signature_company, plaintext=False, container_tag='div') return footer