Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4238 มุมมอง

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 ?

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ย. 22
3351
0
มิ.ย. 21
5907
0
มี.ค. 21
2739
2
ม.ค. 20
21672
2
พ.ค. 18
4039