تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
3430 أدوات العرض

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


الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
الكاتب

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.

الكاتب

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

الكاتب

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أغسطس 23
2211
1
سبتمبر 23
1718
1
أغسطس 23
1832
1
أغسطس 23
2536
1
أغسطس 23
3257