Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How change default state for crm.phonecall

By
dark
on 4/17/15, 5:47 AM 503 views

I try to modify module crm.phonecall. Currently, a phone call is create with done state but i want to this phone call start in open if date start is greater to date now. But it's not work
I overwrite the state field with a custom class : 
My code :

class PhoneCallPlus(osv.osv):

_inherit = 'crm.phonecall'

_columns = {

'state': fields.selection(

[('open', 'Confirmed'),

('cancel', 'Cancelled'),

('pending', 'Pending'),

('done', 'Held')

], string='Status', readonly=True, track_visibility='onchange',

help='The status is set to Confirmed, when a case is created.\n'

'When the call is over, the status is set to Held.\n'

'If the callis not applicable anymore, the status can be set to Cancelled.')

}

def _cap_get_default_state(self, cr, uid, context=None):

import datetime

if self.date > datetime.date.today():

return 'open'

else:

return 'done'

_defaults = {

'state': _cap_get_default_state

}.


Have you an idea ?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/17/15, 5:47 AM
Seen: 503 times
Last updated: 4/17/15, 5:47 AM