Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3423 Zobrazení

when user MARK AS DONE or DONE & SCHEDULE NEXT a Schedule Activity i want to create a record in a custom model (table) through functions in mail.activity.


function name is action_done and action_done_schedule_next, if it success then required record should be created with below mentioned attributes from mail.activity.   i want it because when a user marked activity as DONE, Odoo delete from activity and i want to check it, if its DONE then create next default sheduled activity. (if you have a better idea, please advise)


the fields required from mail.activity are: (please add fields which required necessarily for activity marked as DONE)

id, res_id, res_model, summary, write_date


my custom model (table) 'mail_activity_done' contains fields:

ma_id, ma_res_id, ma_res_model, ma_summary, ma_write_date


all types of DONE activity will be recorded here for later use.


regards


Avatar
Zrušit
Nejlepší odpověď

You can override the _action_done method which is a common method called whenever from action_done and action_done_schedule_next as follows


Adjust the field names and data stored in them as per your implementation.


Automated action to create record:


Regards,

Karan BK

Avatar
Zrušit
Autor

thank you @Karan , but i am restricted to customize through Odoo frontend only, i am not allowed to add a custom module to do this. how to achieve this through Odoo frontend in Developer mode using Settings -> Technical?

regards

Okay, in that case you can use an automated action which will be triggered whenever an activity is deleted. One limitation of this approach is since there is no way of knowing whether activity was deleted manually or by system when it was marked as done, it will create new record for all activitives.

I have updated the answer to include automated action. See if this is something you can work with.

Autor

thank you very much for your concerns, highly appreciated for your help. will check it how it can be beneficial.

as mentioned in my opening post, main reason is to create Next Schedule Activity when user 'mark as done' or 'done & schedule next' . the same problem is here when a record deleted i don't know if its actually Done or something else? if you have any solution for this problem, please guide.

regards

Hello karan,
do you know what method will be triggered when the user clicks cancel? Now I have written the corresponding method in unlink, but there is an obvious problem: if the user clicks MARK AS DONE, my method will also be triggered. Looking forward to your reply

Autor

@tang you should create new topic, as this one is marked Answer so rare chance a senior can visit to Answer.

Related Posts Odpovědi Zobrazení Aktivita
1
srp 23
2207
1
zář 23
1715
1
srp 23
1829
1
srp 23
2527
1
srp 23
3245