This question has been flagged
1 Reply
3008 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

Avatar
Discard
Best Answer

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.

Avatar
Discard
Author

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

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?

Author

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?