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

We are on-boarding new Users to our system and noticing that changes to Customer master data are being made. 

We like more information about for the purposes of understanding if we need additional training or if there are edge cases in our business processes that we have not captured.

Contacts:

  • Individual versus Company 
  • Payment Terms
  • Tags

We understand that each field can be redefined via a module so that the tracking property can be set and Odoo will then automatically track changes via Chatter, but we can't create modules since we are SaaS users.

Is there a way via an Automation Rule to achieve this?

形象
丢弃
最佳答案

One approach that may work is an Automation Rule like this:

Code would be something like this:

fields_to_track = ['category_id', 'property_payment_term_id', 'is_company']
mail_tracking = env['mail.tracking.value']

for record in records:
    if env.context.get('old_values'):
        old_vals = env.context['old_values'].get(record.id, {})
        tracking_value_ids = []

        for field_name in fields_to_track:
            if field_name in old_vals:
                old_value = old_vals[field_name]
                new_value = record[field_name]
               
                tracking_value = mail_tracking._create_tracking_values(
                    old_value, new_value,
                    field_name, record._fields[field_name].get_description(env),
                    record
                )
                if tracking_value:
                    tracking_value_ids.append((0, 0, tracking_value))
                   
        if tracking_value_ids:
            record.message_post(tracking_value_ids=tracking_value_ids)


Note: this is just a proof of concept and the code may need adjustments (there is no error checking here, and this has only been tested with Odoo 18.0). Your Odoo Advisor or Odoo Partner can help if you don't have the skills to do this, or encounter issues with this approach.


You would then see this in the Chatter:

形象
丢弃
相关帖文 回复 查看 活动
1
8月 22
2260
1
3月 15
5466
0
11月 21
3303
1
7月 25
18
1
11月 24
6610