odoo/ext/custom-addons/cam_custom/cam_custom.py

81 lines
3.2 KiB
Python

# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, osv
from openerp import api
from openerp.tools.translate import _
from openerp import SUPERUSER_ID
from openerp import tools
from lxml import etree
class res_partner(osv.osv):
_inherit = 'res.partner'
@api.model
def fields_view_get_address(self, arch):
""" verhindert das Überschreiben von address_format """
return arch
class mail_notification(osv.Model):
_inherit = 'mail.notification'
# override original function
def get_signature_footer(self, cr, uid, user_id, res_model=None, res_id=None, context=None, user_signature=True):
""" Format a standard footer for notification emails (such as pushed messages
notification or invite emails).
Format:
<p>--<br />
Administrator
</p>
<div>
<small>Sent from <a ...>Your Company</a> 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:
if user.signature:
signature = user.signature
else:
signature = "--<br />%s" % user.name
footer = tools.append_content_to_html(footer, signature, plaintext=False)
# 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 = '<br /><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