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
1160 Zobrazení

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?

Avatar
Zrušit
Nejlepší odpověď

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:

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 22
2260
1
bře 15
5466
0
lis 21
3301
1
čvc 25
18
1
lis 24
6608