콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
1166 화면

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
3302
1
7월 25
18
1
11월 24
6608