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

ex. if i create project then sequence is 001.now i want to create task sequence as per selected project.

project1-001

     task1-001, task2-002

project2-002

     task1-001, task2-002

     

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You can achieve this thing using overriding the create method in odoo.

def create(self, cr, uid, vals, context={}):

     if vals.get('project_id'):

         project_obj  = self.pool.get('project.project').browse(cr, uid, vals.get('project_id'), context=context)

         task_sequence = (self.pool.get('ir.sequence').get(

cr, uid, 'project.task.new', context=context) or '/' )+ (str(project_obj.SEQUENCE_FIELD_name)  or '')

         vals.update({'TASK SEQENCE FIELD': task_sequence})

     return  super(CLASS NAME, self).create(cr, uid, vals=vals, context=context)

Hope this will help you.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ต.ค. 20
2831
3
พ.ย. 17
3794
2
เม.ย. 16
5861
0
มี.ค. 15
3480
2
ส.ค. 23
3404