2014-08-06 10:47:40 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
from openerp import SUPERUSER_ID
|
|
|
|
from openerp.osv import osv
|
|
|
|
|
|
|
|
|
2014-08-06 11:06:20 +00:00
|
|
|
class crm_claim(osv.osv):
|
2014-08-06 10:47:40 +00:00
|
|
|
_inherit = "crm.claim"
|
|
|
|
|
2014-08-06 11:06:20 +00:00
|
|
|
def _get_default_partner_id(self, cr, uid, context=None):
|
|
|
|
""" Gives default partner_id """
|
|
|
|
if context is None:
|
|
|
|
context = {}
|
|
|
|
if context.get('portal'):
|
|
|
|
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
2014-08-06 10:47:40 +00:00
|
|
|
# Special case for portal users, as they are not allowed to call name_get on res.partner
|
|
|
|
# We save this call for the web client by returning it in default get
|
2014-08-06 11:06:20 +00:00
|
|
|
return self.pool['res.partner'].name_get(cr, SUPERUSER_ID, [user.partner_id.id], context=context)[0]
|
|
|
|
return False
|
|
|
|
|
|
|
|
_defaults = {
|
|
|
|
'partner_id': lambda s, cr, uid, c: s._get_default_partner_id(cr, uid, c),
|
|
|
|
}
|
2014-08-06 10:47:40 +00:00
|
|
|
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|