자동화 규칙

Automation rules allow the execution of one or more predefined actions in response to a specific trigger, e.g., create an activity when a field is set to a specific value, or archive a record 7 days after its last update.

자동화 규칙 생성 시 도메인 필터 를 활용하면 자동화 규칙에 대한 필수 실행 조건을 추가할 수 있습니다. 예를 들어, 영업 기회를 반드시 지정된 영업 담당자에게 배정해야 하거나 레코드 상태가 초안 이어서는 안되는 등의 조건을 추가합니다.

To create an automation rule with Odoo Studio, proceed as follows:

  1. 스튜디오를 열고 자동화 를 클릭한 다음 신규 를 클릭합니다.

  2. Give the automation rule a clear, meaningful name that identifies its purpose.

  3. Select the trigger and, if necessary, fill in the fields that appear on the screen based on the chosen trigger.

  4. 활동 추가 를 클릭한 다음 활동 유형 을 선택하고 선택한 활동에 따라 화면에 표시되는 필드에 입력합니다.

  5. 저장 후 닫기 또는 저장 후 새로 만들기 를 클릭합니다.

Example

To ensure follow-up on less satisfied clients, this automation rule creates an activity 3 months after a sales order is created for clients with a satisfaction percentage lower than 30%.

구독 모델에 대한 자동화 규칙의 예시

  • Use the Notes tab to document the purpose and functioning of automation rules. This makes rules easier to maintain and facilitates collaboration between users.

  • 자동화 규칙이 적용되는 모델 을 수정하려면 스튜디오 앱에서 모델을 전환한 후 자동화 를 클릭하여 작업을 진행하거나, 개발자 모드 활성화 를 클릭한 후 자동화 규칙을 생성 또는 편집한 후 자동화 규칙 양식에서 모델 을 선택합니다.

  • 자동화 규칙은 어느 칸반 단계에서나 생성할 수 있습니다. 칸반 단계 이름 위에 마우스를 가져가면 나타나는 (설정) 아이콘을 클릭한 다음 자동화 를 선택합니다. 이 경우 트리거 는 기본적으로 단계 설정됨 으로 설정되어 있으나 필요한 경우 변경할 수 있습니다.

    칸반 단계에서 자동화 만들기

자동 실행

The Trigger is used to define what kind of event needs to occur for the automation rule to run. The available triggers depend on the model. Five trigger categories are available overall:

조건 추가

Domain filters allow you to determine the records an automation rule should target or exclude. Efficient filtering enhances overall performance as it avoids unnecessary processing on records that are not impacted by the rule.

Activate developer mode before creating an automation rule to have the most flexibility in adding domain filters.

Depending on the trigger chosen, it is possible to define one or more conditions a record must meet before and/or after a trigger occurs.

  • The Before Update Domain defines the conditions a record must meet before the trigger event occurs, e.g., the record must have Type = Customer Invoice and Status = Posted.

    With developer mode activated, click Edit Domain, if available, then New Rule.

  • Extra Conditions, or in some cases Apply on filters, define the conditions a record must meet after the trigger event occurs, e.g., the customer invoice must have Payment Status = Partially Paid.

    With developer mode activated if needed, click Add conditions or Edit Domain, as relevant, then New Rule.

When a trigger occurs, e.g., the payment status of a posted customer invoice is updated, the automation rule checks the defined conditions and only executes the action if the record matches those conditions.

Example

자동 작업을 통하여 이메일 주소를 처음 설정하려는 경우(이메일 주소 수정과는 다름) 특히 회사가 아닌 개인 기존 연락처에 실행하려면, 도메인 업데이트 전이메일이 설정되지 않음회사가 설정되지 않음 을 선택하고, 적용 대상 도메인에 이메일이 설정됨 을 지정하세요.

업데이트 전 도메인 트리거의 예시

참고

The Before Update Domain is not checked upon the creation of a record.

값 업데이트

데이터베이스에 일정한 변경 사항이 발생하면 작업이 자동으로 트리거되도록 할 수 있습니다. 이 카테고리에서 선택할 수 있는 트리거는 모델에 따라 다르며 특정 태그를 추가하거나(예: 작업에 태그 추가) 필드 값을 설정(예: 사용자 필드 설정)하는 것과 같은 일반적인 변경 사항이 기준이 됩니다.

필요한 경우 트리거를 선택한 다음 값을 선택합니다.

행사 이메일

이메일을 수발신할 때 자동화된 작업을 트리거합니다.

시간 조건

Trigger automated actions at a point in time relative to a date field or to the creation or update of a record. The following triggers are available:

  • Based on date field: The action is triggered a defined period of time before or after the date of the selected date field.

  • After creation: The action is triggered a defined period of time after a record is created and saved.

  • After last update: The action is triggered a defined period of time after an existing record is edited and saved.

그런 다음 다음 내용을 지정할 수 있습니다.

  • a 지연: 분, 시간, 일 또는 월 단위로 시간을 지정합니다. 작업이 트리거되는 날짜 전에 실행되게 하려면 음수 값을 지정합니다. 날짜 필드 기준 트리거를 선택할 경우, 지연 시간을 결정하는 데 이용할 날짜 필드도 반드시 선택해야 합니다.

    참고

    By default, the scheduler checks for time-triggered automation rules every 240 minutes, or 4 hours. This frequency is generally sufficient for delays such as 3 months after the order date or 7 days after the last update.

    지연 시간이 2400분 또는 40시간 미만인 경우, 시스템에서는 이러한 상황이 발생하는 빈도를 다시 계산하여 지연 시간을 더욱 세분화시켜서 파악합니다. 예를 들어 행사 시작 일시를 기준으로 1시간 전 또는 행사 생성 후 30분 후와 같이 지연 시간을 최대한 정확히 반영할 수 있도록 합니다.

    An on-screen message indicates the possible delay after the scheduled triggering of the rule.

    예약 항목 실행 후 지연될 가능성에 대한 메시지입니다.

    To view or manually edit the frequency of the scheduler, with developer mode activated, go to Settings ‣ Technical ‣ Scheduled Actions to see all scheduled actions for your database.

    Enter Automation in the search bar, then, in the list of results, click Automation Rules: check and execute. If desired, update the value of the Execute Every field. Click Run Manually at any time to manually trigger this scheduled action.

  • Extra Conditions: Click Add condition, then specify the conditions to be met for the automation rule to run. Click New Rule to add another condition.

The action is executed when the delay is reached and the conditions are met.

Example

To send a reminder email 30 minutes before the start of a calendar event, select Start (Calendar Event) as the date field for the Trigger and set the Delay to -30 Minutes.

날짜 필드 기준 트리거 예시

사용자 정의

자동화 작업 트리거:

  • 저장 시: 레코드 저장 시 실행됩니다.

  • 삭제 시: 레코드 삭제 시 실행됩니다.

  • On UI change: when a field’s value is changed on the Form view, even before the record is saved.

저장 시UI 변경 시 트리거가 되게 하는 경우 반드시 업데이트 시 에서 자동화 규칙을 트리거하는 데 사용할 필드를 선택해야 합니다.

경고

If no field is selected in the When updating field, the automated action may be executed multiple times per record.

Optionally, you can also define additional conditions to be met to trigger the automation rule in the Apply on field.

Example

레코드가 생성되면 이에 따라 자동으로 작업이 시작되도록 설정하려면(예: 새로 연락처를 생성하는 경우) 저장 시 자동 작동을 선택하고 도메인 업데이트 전 항목에는 ID가 설정되지 않음 을, 적용 도메인으로 ID가 설정됨 을 지정합니다. 업데이트 시 필드에 알맞은 필드가 선택되었는지 확인하세요.

When a new contact is saved, it is automatically assigned a database ID, thereby triggering the automation rule.

Example of a triggering an action upon creation of a record

참고

UI 변경 시 트리거 기능은 코드 실행 작업과 함께 실행하는 경우에만 구동되며 수동으로 수정하는 경우에만 작동하는 기능입니다. 다른 자동화 규칙으로 인해 필드가 변경된 경우에는 작업이 실행되지 않습니다.

외부

Trigger automated actions based on a specific event in an external system or application using a webhook.

After the webhook is configured in Odoo, where the webhook’s URL is generated and the target record defined, it needs to be implemented in the external system.

경고

개발자, 솔루션 설계자 또는 기타 기술 담당자와 웹훅 사용 시기 및 구현 프로세스 전반에 대한 내용을 상의하는 것을 강력히 권장합니다. 웹훅이 제대로 구성되지 않으면 Odoo 데이터베이스가 중단될 수 있으며 복구까지 장시간이 소요될 수 있습니다.

날짜 필드 기준 트리거 예시

참고

It is also possible to set up an automated action that sends data to a external system’s webhook when an event occurs in your Odoo database.

활동

Once you have defined the automation rule’s trigger, click Add an action in the Actions To Do tab to define the action to be executed.

You can define multiple actions for the same automation rule. By default, actions are executed in the order in which they were defined.

즉, 예를 들어 레코드 업데이트 작업에 대해 정의한 후 이메일 보내기 작업을 해당 이메일이 업데이트 필드를 참조하도록 정의하면 이메일에는 업데이트된 값이 적용됩니다. 그러나 이메일 보내기 작업이 레코드 업데이트 작업 보다 먼저 정의된 경우 이메일은 레코드가 업데이트되기 전에 설정된 값이 사용됩니다.

To change the order of defined actions, click the (drag handle) icon beside an action and drag it to the desired position.

레코드 업데이트

이 작업으로 레코드의 (관련) 필드 중 하나를 업데이트할 수 있습니다. 업데이트 필드를 클릭하여 목록이 나타나면 업데이트할 필드를 선택하거나 검색합니다. 필요한 경우 필드명 옆에 있는 (오른쪽 화살표) 를 클릭하여 관련 필드 목록에 액세스합니다.

If you selected a many2many field, choose whether the field must be updated by Adding, Removing, or Setting it to the selected value or by Clearing it.

Example

If you want the automated action to remove a tag from the customer record, set the Update field to Customer > Tags, select by Removing, then select the tag.

업데이트 레코드 작업의 예시

또는 Python 코드를 활용하여 레코드 필드를 동적으로 설정할 수도 있습니다. 이렇게 하려면 업데이트 대신 계산 을 선택한 다음 필드 값을 계산할 때 적용할 코드를 입력합니다. 예를 들어 작업의 우선순위가 ‘높음’으로 설정되어 있는 경우(작업에 별표 표시) 자동화 규칙을 통해 사용자 지정된 날짜 및 시간 필드 를 계산하려면, 우선순위 설정높음`으로 살장하고 :guilabel:`레코드 업데이트 동작을 다음과 같이 지정합니다:

Python 표현식을 사용하여 사용자 지정 일시 필드 계산하기

활동 생성

이 작업은 레코드에 연결된 새 활동을 예약하는 데 사용됩니다. 활동 유형 을 선택하여 제목 과 설명을 입력한 다음 기한까지 남은 날짜 필드에서 활동을 예약할 시기를 지정하고 사용자 유형 을 선택합니다.

  • To always assign the activity to the same user, select Specific User, then add the user in the Responsible field;

  • To target a user linked to the record dynamically, select Dynamic User (based on record) and change the User Field if necessary.

Example

영업제안이 영업기회로 전환된 후에는 자동화 작업을 통해 영업제안 담당자에게 전화를 걸도록 설정할 수 있습니다. 진행하려면 활동 유형통화 로 설정하고 사용자 유형동적 사용자 (레코드 기반) 으로 설정합니다.

활동 만들기 작업의 예시

이메일 보내기 및 SMS 보내기

이러한 활동으로 특정 레코드에 연결된 연락처로 이메일이나 문자 메시지를 보냅니다. 그진행하려면 이메일 템플릿 또는 SMS 템플릿 을 선택하거나 생성한 다음 다른 이름으로 이메일 보내기 또는 다른 이름으로 SMS 보내기 필드에서 이메일 또는 문자 메시지를 전송할 방법을 선택합니다.

  • 이메일: 이메일 템플릿 수신자에게 이메일로 메시지를 전송합니다.

  • 메시지: 레코드에 메시지를 게시하고 레코드 팔로워에게 안내합니다.

  • 메모: 내부 메모로 내부 사용자에게 표시되는 메시지를 메시지창에서 전송합니다.

  • SMS (without note): to send the message as a text message to the recipients of the SMS template.

  • SMS(메모 포함): 문자 메시지로 SMS 템플릿 수신자에게 메시지를 보내고 내부 메모로 메시지창에 게시합니다.

  • 메모 전용: 메시지창에서 내부용 메모로만 메시지를 게시합니다.

WhatsApp 전송

중요

To automate the sending of WhatsApp messages, one or more WhatsApp templates must be created.

This action is used to send a WhatsApp message to a contact linked to a specific record. To do so, select the appropriate WhatsApp Template from the dropdown menu.

팔로워 추가 및 팔로워 제거하기

This action is used to subscribe/unsubscribe existing contacts to/from the record.

레코드 생성

이 작업은 모델에서 새 레코드를 생성할 때 적용됩니다.

만들 레코드 필드에서 필요한 모델을 선택합니다. 기본적으로 현재 모델로 되어 있습니다. 레코드 이름 을 지정한 다음, 다른 모델에서 레코드를 생성하려면 필드 링크 에서 필드를 선택하여 새 레코드가 만들어지도록 트리거하는 레코드에 연결합니다.

참고

필드 연결 필드와 관련된 드롭다운 목록에는 현재 사용 중인 모델에 대한 일대다 필드 만 있으며, 대상 모델의 다대일 항목 에 연결되어 있습니다.

필요한 경우 레코드 업데이트 작업으로 다른 자동화 규칙을 생성하여 새 레코드에 있는 필드를 업데이트할 수 있습니다. 예를 들어, 레코드 만들기 작업으로 신규 프로젝트 작업을 생성한 다음 레코드 업데이트 작업을 통해 특정 사용자에게 배정할 수 있습니다.

코드 실행

중요

For automation rules that require the execution of custom code, note that maintenance of custom code is not included in the Standard or Custom pricing plans and incurs additional fees.

This action is used to execute Python code. You can write your code into the Code tab using the following variables:

  • env: 작업이 트리거되는 환경

  • model: 활동을 작동시키는 레코드의 모델입니다. 무효 레코드 세트입니다.

  • record: 작업이 트리거되는 레코드입니다. 레코드는 무효일 수 있습니다.

  • records: recordset of all records on which the action is triggered in multi-mode; this may be left empty

  • time, datetime, dateutil, timezone: 유용한 Python 라이브러리

  • float_compare: 특정 정밀도를 기준으로 소수점을 비교하는 유틸리티 함수

  • log(message, level='info'): ir.logging 테이블에 디버그 정보를 기록하는 로깅 함수입니다.

  • _logger.info(message): 서버 로그로 메시지를 내보내는 로거

  • UserError: 사용자에게 경고 메시지를 발생시키는 예외 클래스

  • 명령어: x2many 명령어 입력 공간

  • action = {...}: 작업을 반환합니다.

사용이 가능한 변수는 코드도움말 탭에 모두 설명되어 있습니다.

더 보기

Odoo ORM 기능

웹훅 알림 보내기

This action is used to send a POST API request with the values of the selected Fields to the webhook URL specified in the URL field.

The Sample Payload provides a preview of the data included in the request using a random record’s data or dummy data if no record is available.

참고

It is also possible to set up an automated action that uses a webhook to receive data from an external system when a predefined event occurs in that system.

기존 작업 실행

활동은 여러 개의 활동 (현재 모델에 연결)을 동시에 트리거하는 데 사용합니다. 이렇게 하려면 줄 추가 를 클릭한 다음 추가: 하위 활동 팝업에서 기존 활동을 선택하거나 새로 만들기 를 클릭하여 새 활동을 만듭니다.