CRM:
Adding possibility to enter partner instead of user for the portal bzr revid: fp@tinyerp.com-f914eb7b5895cd22639f1fe8ed4a65f1ad04a911
This commit is contained in:
parent
4fda5f8d79
commit
50a405a64c
|
@ -403,7 +403,6 @@
|
|||
src_model="account.analytic.account"
|
||||
view_type="form"
|
||||
view_mode="graph,tree,form"
|
||||
limit="12"
|
||||
id="act_acc_analytic_acc_2_report_hr_timesheet_invoice_journal"/>
|
||||
|
||||
</data>
|
||||
|
|
|
@ -275,9 +275,34 @@ class crm_case(osv.osv):
|
|||
'date_action_last': fields.datetime('Last Action', readonly=1),
|
||||
'date_action_next': fields.datetime('Next Action', readonly=1),
|
||||
}
|
||||
def _get_default_partner_address(self, cr, uid, context):
|
||||
if not context.get('portal',False):
|
||||
return False
|
||||
return self.pool.get('res.users').browse(cr, uid, uid, context).address_id.id
|
||||
def _get_default_partner(self, cr, uid, context):
|
||||
if not context.get('portal',False):
|
||||
return False
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context)
|
||||
if not user.address_id:
|
||||
return False
|
||||
return user.address_id.partner_id.id
|
||||
def _get_default_email(self, cr, uid, context):
|
||||
if not context.get('portal',False):
|
||||
return False
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context)
|
||||
if not user.address_id:
|
||||
return False
|
||||
return user.address_id.email
|
||||
def _get_default_user(self, cr, uid, context):
|
||||
if context.get('portal', False):
|
||||
return False
|
||||
return uid
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
'user_id': lambda s,cr,uid,c={}: uid,
|
||||
'user_id': _get_default_user,
|
||||
'partner_id': _get_default_partner,
|
||||
'partner_address_id': _get_default_partner_address,
|
||||
'email_from': _get_default_email,
|
||||
'state': lambda *a: 'draft',
|
||||
'priority': lambda *a: AVAILABLE_PRIORITIES[2][0],
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
|
|
|
@ -169,7 +169,7 @@ project_task_type()
|
|||
class task(osv.osv):
|
||||
_name = "project.task"
|
||||
_description = "Task"
|
||||
_date_name = "date_deadline"
|
||||
_date_name = "date_start"
|
||||
def _str_get(self, task, level=0, border='***', context={}):
|
||||
return border+' '+(task.user_id and task.user_id.name.upper() or '')+(level and (': L'+str(level)) or '')+(' - %.1fh / %.1fh'%(task.effective_hours or 0.0,task.planned_hours))+' '+border+'\n'+ \
|
||||
border[0]+' '+(task.name or '')+'\n'+ \
|
||||
|
|
Loading…
Reference in New Issue