자동화 규칙

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.

When creating an automation rule, it is possible to add conditions that must be met for the automation rule to run, e.g., the opportunity must be assigned to a specific salesperson, or the state of the record must not be Draft.

Odoo 스튜디오 에서 자동화 규칙을 생성하려면:

  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. Click Add an action in the Actions To Do tab.

    If no explicit name is entered, the name of the action will be automatically generated based on the action you define; the name can be updated at any time.

  5. Select the Type of action and complete the relevant fields based on the chosen action.

  6. Click Save & Close or, to define additional actions, Save & New.

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%.

Example of an automation rule on the Subscription model

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

  • To modify the model targeted by the automation rule, switch models before clicking Automations in Studio, or activate developer mode, create or edit an automation rule, and select the Model in the Automation Rules form.

  • Automation rules can be created from any kanban stage by clicking the (Settings) icon that appears when hovering over the kanban stage name, then selecting Automations. In this case, the Trigger is set to Stage is set to by default, but it can be changed if necessary.

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

자동 실행

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.

  • The Apply on domain defines 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, click Edit Domain then New Rule.

    If developer mode is not activated, to define an Apply on domain, click Add condition. Complete or delete the suggested condition. To add a condition, click 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

If the automated action should be executed when an email address is set for the first time (in contrast to modifying an email address) on an existing contact that is an individual rather than a company, use Email is not set and Is a Company is not set as the Before Update Domain and Email is set as the Apply on domain.

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

참고

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

값 업데이트

Trigger automated actions when specific changes happen in the database. The triggers available in this category depend on the model and are based on common changes, such as adding a specific tag (e.g., to a task) or setting a field’s value (e.g., setting the User field).

Select the trigger, then select a value if required.

행사 이메일

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

시간 조건

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 Delay: Specify the number of Minutes, Hours, Days, or Months after which the action should be triggered. If you selected the Based on date field trigger, the action can be triggered After or Before the selected date field.

    참고

    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.

    For delays of less than the equivalent of 2400 minutes, or 40 hours, the system recalculates the frequency of this check to ensure that more granular delays, e.g., 1 hour before the event start date and time, or 30 minutes after creation, can be respected as closely as possible.

    To view or manually edit the frequency of the scheduler for a time-triggered automation rule, with developer mode activated, click Scheduled action.

    자동화 예약 작업에 대한 바로가기 링크

    In the Automation Rules: check and execute scheduled action that opens, update the value of the Execute Every field, if desired. Clicking Run Manually triggers the scheduled action to run immediately. To return to the automation rule setup, click the automation rule name in the breadcrumbs.

  • 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.

사용자 정의

자동화 작업 트리거:

  • 저장 시: 레코드가 최초로 저장될 때.

  • On create and edit: when a record is saved for the first time and any subsequent time.

  • 삭제 시: 레코드가 삭제될 때.

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

For the On create and edit and On UI change triggers, you must then select the field(s) to be used to trigger the automation rule in the When updating field.

경고

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.

참고

The On UI change trigger can only be used with the Execute Code action and only works when a modification is made manually. The action is not executed if the field is changed through another automation rule.

외부

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(s) 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.

This means, for example, that if you define an Update record action and then a Send email action where the email references the field that was updated, the email uses the updated values. However, if the Send email action is defined before the Update record action, the email uses the values set before the record is updated.

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

레코드 업데이트

This action is used to update one of the record’s (related) fields. The following options are available:

  • Update: updates the selected field with the specified value.

  • Update with AI: updates the selected field dynamically based on the AI prompt provided. This option requires the Odoo AI app to be installed.

  • Sequence: update the selected field with a defined sequence.

  • Compute: updates the selected field dynamically using Python code.

활동을 지정하려면:

  1. With the Update, Update with AI, Sequence or Compute option selected, as relevant, select or search for the field to be updated or computed. If needed, click the (right arrow) next to the field name to access the list of related fields.

  2. Provide the relevant information based on the option selected.

업데이트

Select or enter the updated value for the field.

If a many2many field is being updated, 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 to be removed.

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

AI로 업데이트

Enter a prompt to instruct Odoo AI how to update the field. Type / to open the AI prompt tools; use Field Selector to tell Odoo AI which related fields to check for context, and Records Selector to provide possible values for the updated field.

Example

If you want the automation rule to update the Assignees field of a newly created task based on the employees’ expertise, you can write a prompt to instruct Odoo AI to check the Display Name field of the task for the context, then to assign the most suitable employee.

AI를 활용한 레코드 업데이트 예시

순서

Select an existing sequence or, to create a new sequence:

  1. 세부 검색 을 클릭한 후 신규 를 클릭합니다.

  2. In the window that opens, enter the Name of the sequence.

  3. Configure the sequence, adding a Prefix and/or Suffix as desired.

    Use dynamic placeholders like Current Year with Century: %(year)s in the Prefix and/or Suffix to create sequences with elements like current year, month, etc. Possible placeholders are shows at the bottom of the window.

  4. Click Save.

Example

If you want the automated action to create a sequential customer reference each time a new customer is created, set the Sequence field to Reference, then, in the dropdown, click Search more. Click New to create a new sequence.

In the example, each new customer receives a sequential reference with the prefix `

Example of an Update Record action using a sequence

계산

Enter the code to be used for computing the field’s value.

Example

If you want the automation rule to compute a custom datetime field, Escalated on, when a task’s priority is set to Very high (three stars), you can define the trigger Priority is set to to Very High and define the Update Record action as follows:

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

레코드 생성 및 레코드 복제하기

These actions are used to create a new or duplicated record on any model.

활동을 지정하려면:

  1. With Create Record or Duplicate Record selected as the Type of action, as relevant, select the required model in the Record to Create field; the field contains the current model by default.

  2. Specify a Name for the record, or, if the action duplicates a record, indicate the record being duplicated in the Duplicate from field.

  3. If the new or duplicated record is being created on another model, select a field in the Link Field field to link the record that triggered the creation of the new or duplicated record.

The Link Field dropdown menu only contains one2many fields existing on the current model that are linked to a many2one field on the target model.

Example

If you want the automation rule to duplicate a project, e.g. a project template with predefined tasks, when an opportunity is set to Won, add a custom Related opportunity many2one field field on the Project model and a custom Related project one2many field field on the Lead model, then provide the following details about the record being duplicated:

다른 모델에서 레코드 복제하기

You can create another automation rule with 레코드 업데이트 actions to update the fields of the new or duplicated record if necessary. For example, you can use a Create Record action to create a new project task and then assign it to a specific user using an Update Record action.

활동 생성

This action is used to schedule a new activity linked to the record.

활동을 지정하려면:

  1. With Create Activity selected as the Type of action, select the appropriate Activity Type from the dropdown menu.

  2. 제목 을 입력합니다.

  3. Indicate by when the activity should be completed by specifying a number of Days, Weeks, or Months in the Due Date In field.

  4. 사용자 유형 을 선택합니다:

    • 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). If needed, change the User Field by clicking on the placeholder field name then selecting or searching for the user field in the list that appears. Clicking the (right arrow) next to the field name allows you to access related fields if needed.

  5. Optionally, add a Note to provide more information about the activity.

Example

After a proposition is sent to a opportunity with a high expected revenue, you want to create an activity for the salesperson’s team leader to call the potential client to increase the chances of closing the deal.

To do so, set the Activity Type to Call and the User Type to Dynamic User (based on record). Click on the placeholder field and select Sales Team, then click the (right arrow) and select Team Leader.

활동 만들기 작업의 예시

이메일 보내기 및 SMS 보내기

These actions are used to send an email or a text message to a contact linked to a specific record.

활동을 지정하려면:

  1. With Send Email or Send SMS selected as the Type of action, as relevant, select or create an Email Template or SMS Template.

  2. In the Send Email As or Send SMS As field, choose how you want to send the email or text message.

    이메일의 경우 다음을 선택하세요:

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

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

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

    문자 메시지의 경우 다음을 선택하세요:

    • 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.

With Send WhatsApp selected as the Type of action, select the appropriate WhatsApp Template from the dropdown menu.

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

This action is used to subscribe/unsubscribe existing contacts as followers of the record.

With Add Followers or Remove Followers selected as the Type of action, as relevant, select a Followers Type:

  • To always add/remove the same contact(s), select Specific Followers then select the contact(s) from the dropdown menu. Multiple contacts can be added/removed.

  • To add/remove a contact linked to the record dynamically, select Dynamic Followers. If needed, change the Followers Field by clicking on the placeholder field name then selecting or searching for the partner field in the list that appears. Clicking the (right arrow) next to the field name allows you to access related fields if needed.

Example

To keep customers informed of progress on a project, this automated action adds the relevant customer as a follower when a project task is set to In progress.

Adding the customer as a follower when project task set to in progress

코드 실행

중요

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.

다중 작업

This action is used to trigger multiple actions (linked to the current model) at the same time.

활동을 정의하려면:

  1. With Multi Actions selected as the Type of action, click Add an action.

  2. 추가: 하위 작업 팝업창에서:

    • select one or more existing actions and click Select; or

    • click New, define the action to be executed, then click Save & Close or, to create additional actions, Save & New .

  3. 필요한 만큼 작업을 반복합니다.

다중 작업 실행 지정하기