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 to create sequence in task using project.

By
alex
on 7/7/16, 12:58 PM 312 views

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

     

0
Krupesh Laiya
On 7/9/16, 1:25 AM

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.


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: 7/7/16, 12:58 PM
Seen: 312 times
Last updated: 7/21/16, 1:49 AM