This question has been flagged

I'm working with the project module with hr_timesheet module.

I would like to use the subtypes to log changes on fields from timesheets and show them on the form view of project.task. The timesheets are tree view in the tasks form view with relation m2o. The project.task model inherits the mail.thread model.

I would like to log  who changed on what timesheet, what field, old and new value. Is it possible and how? 

Avatar
Discard
Best Answer

Hi Samo Arko,

From my knowledge, it is not possible directly.

The Log model (mail.tracking.value) have field Changed Field. It will create the log data according to this field.

In the current case there is no Changed Fields in the Task Model. Field is in account.analytic.line model.

But there are some solutions for this. if you only just want to see the changes.

If you are a developer, try to do one of the following solution.

Inherit the write function in account.analytic.line model. You will get enough information from write function.

Like Field Name, Old Value, New Value, Write uid etc.

Try with your skill to make the data's in a beautiful form(body) and post that in Related Task Model.

Eg : - self.task_id.message_post(subject="Field value in One2many Changed", body=body, message_type='comment', author_id= self.env.user.partner_id.id)

body should be like this : body = "Field Name : Old Value --> New Value"

Thank You.

Avatar
Discard
Author

thanks for the idea... I'll try the way you suggested.

Samo Arko did you ever solve this? Do you mind sharing some tips?

Author

I did it like Avinash Nk suggested. It works great.