Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
1168 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
ago. 22
2260
1
mar. 15
5466
0
nov. 21
3303
1
jul. 25
18
1
nov. 24
6608