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

Weekly Tasks in project

By
juan
on 8/27/13, 4:01 PM 604 views

Hello

Is it possible to (some how) create one task which could be automatically repeated each week or every certain period of time?

I need to create a project which starts and end in the same week, and it is repeated every week. This project includes over 100 tasks, which I don't want to create manually every week. Also I would like this to get dates automatically for next week.

Any help? I really need some guidance with this

Thanks for reading

0
Carlos Llamacho
On 8/27/13, 5:37 PM

Well, i think you could create a function in your module that uses ORM methods to create the records for the new tasks, and then create an action that calls said function every week. The problem i would see is that you could end up with repeated tasks.

If you would like an outline of the code i think it would look like more or less like this....

def custom_function(self, cr, uid, context=None):
        task_obj = self.pool.get('project.task') #This get the object that hold all tasks.
        for i in range(101): #This would run the 100 new tasks.
               task_obj.create(cr, uid, {fields:value, fields:value}, context=None) #This create 100 new task.

Then you can create a cron job that calls that function.

<record id="ir_cron_100_tasks" model="ir.cron">
        <field name="name">100 Tasks</field>
        <field name="active" eval="True"/>
        <field name="interval_number">1</field>
        <field name="interval_type">weeks</field>
        <field name="numbercall">-1</field>
        <field name="doall" eval="False"/>
        <field name="model">Your_Model_Here</field>
        <field name="function">custom_function</field>
        <field name="args">()</field>
    </record>

Hope it can help you.

Hello Carlos, I think I have no idea how to do that! Just saw your pic and its funny as the project I'm working on its scuba diving related

juan
on 8/28/13, 5:46 AM

Jajaja, really? No idea, scuba diving for me is a hobby, never thought of being related to programming. But anyhow, how can i help you? Is the code? Regarding what you need help?

Carlos Llamacho
on 8/28/13, 12:22 PM

Im starting up a site called http://www.scubacrowd.com and it would really help if you helpme somehow to fix this do you think its possible to do what im tring to do with the project module?

juan
on 8/28/13, 4:26 PM

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

0 follower(s)

Stats

Asked: 8/27/13, 4:01 PM
Seen: 604 times
Last updated: 3/16/15, 8:10 AM