跳至内容
菜单
此问题已终结
2 回复
1428 查看

Is there a way for Odoo 14 Enterprise edition to track activities changes after creation on the chatter of the same related document?.

Want to achieve something like this:

Example of an opportunity stage change:

( - Stage: New -> Contact) [changed the stage of an opportunity in the kanban] 

But for this case it would be:

{User that made the changes} (Hope is like the user doing the changes would be automatically added as the user for a note in the chatter, I believe that that is the native flow)

- Assigned to: {previous_user} -> {new_user}
- Due date: {date_before} -> {new_date}
- etc..

Hope it is understandable.

Thanks in advance,
Rodrigo

形象
丢弃
最佳答案

The Cybrosys answer explains how you can do this with development.

If that's not possible, there is another approach with a computed field.  It's slightly easier if you have Studio, but that's not essential.  

This tracks the delivery address on a sales order

  1. Create a new text field
  2. Set dependencies to be the fields to be tracked
  3. Add Python code to write a log to the new text field


for record in self:
     if record['partner_shipping_id']:
         record['x_studio_history'] = record.name + ' / Delivery address: ' + record.partner_shipping_id.name

Fuller explanation here: https://odootricks.tips/tracking-existing-fields-using-odoo-studio/

It's not the most elegant solution, but it does work!

形象
丢弃
编写者

I have managed to do that in other records for their own module, I have tried this way but haven't been able to solve it since mail.activity is a separate model from others, sale.order in your example, and I believe the chatter in that case is connected to sale.order and not mail.activity following your example.

I'll check a workaround doing this maybe with an automated action, but still haven't find a solution for this.

Hi Rodrigo. I think I was misled by the other answer. You want to track the activities that are created for an opportunity. You are right that this can be done with an automated action, but will require some Python code to relate that back to the parent item (e.g. Opportunity). A related answer is here: https://www.odoo.com/forum/help-1/re-studio-automations-for-the-non-programmer-246730/#answer-246730 but need help on the Python code.

最佳答案

Hi,

To track the changes you can add the attribute tracking=True 

in the field example:

state = fields.Selection(string='Status',  tracking=True, selection=[
            ('open', 'New'),
            ('posted', 'Processing'),
            ('confirm', 'Validated'),
        ])


Hope it helps

形象
丢弃
编写者

Mind expanding a lil bit in this?

相关帖文 回复 查看 活动
0
1月 24
664
0
4月 24
812
1
12月 22
2497
2
10月 20
7341
0
12月 19
1856