Skip to Content
Menu
This question has been flagged
4 Replies
2397 Views

Hello all,

When I am in a task, if I change the stage of this task, a log is generated in the journal at the bottom on the task page like this :

http://reho.st/self/e17d8c40b5ef23a7918cd6b6b1af6af310f2b31c.png

Now, I would like to do the same thing using postgreSQL query :

I succeed to update the current stage of the task (in table project_task, then I insert a line in the table project_task_history to save the action of "stage changed", but when I refresh the page, the stage change is not saved in the journal ar the bottom of the task page ...

Do I miss something so that the task change is inserted in this journal ?

Can someone help me please ?

Thanks a lot in advance.

Avatar
Discard

why do you want to do it in sql ? At first view, It's seems a bad idea !

Author

Thanks Jérémy Kersten for helping me.

I would like to do this, so that I can generate a report based on the database later. I will need to calculate duration between two stages, so I need to log these stage-changes. Of course I can let the users of the project do it themselves with their mouse/keyboard using the UI, but it'll be better for me to automatically change stage of tasks once their deadline_date is over.

Also, sometimes we will have a lot of tasks to stage-change, so it would be great if I can do it automatically. Actually I can do it, but my problem is that no log is generated to say "previous stage => next stage", and I need a date to create a report in the future.

Thanks a lot.

Author Best Answer

Thanks Jeremy. 

You mean create a scheduled action via odoo ? 

Because I already do it using postgreSQL queries, it's working but like I said, the link "previous stage > new stage" is not done ... 




Avatar
Discard

when you do it in sql, you bybass the write function of odoo which do the job...

You can do it in sql, with a message post, and reimplementing the logic of tracked field, but it is a really bad idea according to me...

One scheduled action that check a domain and change the stage is probably 3 lines of code... And workflow will be always ok... And you keep the logic in Odoo, you let Odoo do HIS job and you don't need to maintains 2 logics

Best Answer

Ok... so

Why not add a scheduled action that will check all deadline_date > now and stage != your_new_stage, and if needed change the stage...

Like that, you let Odoo make the job with all the workflow, and tracked fields will be correctly set...

Seems  the right way...

Avatar
Discard
Related Posts Replies Views Activity
2
Mar 15
4854
18
Aug 18
18955
1
Mar 15
6724
0
Dec 24
7643
3
Sep 24
19197