資料清除

The Odoo Data Cleaning app maintains data integrity and consistency with the following features:

  • Deduplicates: merges or removes duplicate entries to ensure data is unique.

  • Recycles: identifies outdated records to either archive or delete them.

  • Formats: standardizes text data by finding and replacing it according to specified needs.

Customizable rules ensure text data stays up-to-date, streamlined, consistently formatted, and aligned with company-specific formatting requirements.

安装模块

The Data Cleaning application consists of several modules. Install the following to access all available features:

名稱
Technical name

說明

Data Recycle
data_recycle

Base module to enable the recycle feature, available on Odoo Community edition.

Data Cleaning
data_cleaning

Enables field cleaning feature to format text data across multiple records, available only on Odoo Enterprise edition.

Data Cleaning (merge)
data_merge

Enables the deduplication feature to find similar (or duplicate) records, and merge them, available only on Odoo Enterprise edition.

CRM Deduplication
data_merge_crm

Enables the deduplication feature on the CRM app, and uses the CRM default merging feature.

Helpdesk Merge action
data_merge_helpdesk

Enables the merge feature for the Helpdesk app.

Project Merge action
data_merge_project

Enables the merge feature for the Projects app.

UTM Deduplication
data_merge_utm

Enables the merge feature for the UTM Tracker app.

WMS Accounting Merge
data_merge_stock_account

Creates a warning in cases of products merging that may affect inventory valuation, if the Inventory app is installed.

消除重複

The Duplicates dashboard groups similar records to be merged by matching conditions within the records set by the deduplication rules.

Navigate to this dashboard by going to Data Cleaning app ‣ Deduplication.

Deduplication dashboard in the Data Cleaning application.

The RULE sidebar lists each of the active deduplication rules, and displays the total number of duplicates detected beside each rule.

By default, the All rule is selected. Records are grouped by their rule, with a Similarity rating (out of 100%), with the following columns:

  • Created On: the date and time the original record was created.

  • Name: the name or title of the original record.

  • Field Values: the original record’s values for the fields used to detect duplicates.

  • Used In: lists other models referencing the original record.

  • ID: the original record’s unique ID.

  • Is Master: the duplicates are merged into the master record. There can only be one master record in a grouping of similar records.

Select a specific rule in the RULE sidebar to filter the duplicate records.

Merge duplicate records

To merge records, first choose a master record within the grouping of similar records. The master record acts as the base, at which any additional information from similar records are merged into.

Optionally, no master record can be set, leaving Odoo to choose a record at random to merge into.

Next, click the Merge button at the top of the similar records grouping. Then, click Ok to confirm the merge.

Once a record is merged, a message is logged in the chatter of the master record, describing the merge. Certain records, like Project tasks, are logged in the chatter with a link to the old record as a convenient reference of the merge.

小訣竅

点击 丢弃 按钮丢弃分组。这样,分组就会从列表中隐藏并存档。

从 :ref:`搜索栏 <search/filters>`中选择 :guilabel:`丢弃`筛选器,即可查看已丢弃的分组。

重复数据删除规则

*重复数据删除规则*设定了将记录检测为重复数据的条件。

这些规则可针对数据库中的每个模型进行配置,并具有不同程度的特殊性。要开始使用,请导航至 数据清理应用程序 ‣ 配置 ‣ 重复数据删除

小訣竅

重复数据删除规则默认每天运行一次,作为 cron 计划动作(数据合并:查找重复记录)的一部分。不过,每条规则都可以 :ref:` 随时手动 <data_cleaning/run-deduplication-rule>` 运行。

修改重复数据删除规则

Select a default rule to edit, or create a new rule by clicking on the New button.

First, choose a Model for this rule to target. Selecting a model updates the rule title to the chosen model.

Optionally, configure a Domain to specify the records eligible for this rule. The number of eligible records is shown in the # record(s) link.

Depending on the selected Model, the Duplicate Removal field appears. Choose whether to Archive or Delete merged records.

Next, select a Merge Mode:

  • Manual: requires each duplicate grouping to be manually merged, also enables the Notify Users field.

  • Automatic: automatically merges duplicate groupings, without notifying users, based on the records with a similarity percentage above the threshold set in the Similarity Threshold field.

Enable the Active toggle to start capturing duplicates with this rule as soon as it is saved.

Lastly, create at least one deduplication rule in the Deduplication Rules field, by clicking Add a line, under the Unique ID Field column.

  • Select a field in the model from the Unique ID Field drop-down menu. This field is referenced for similar records.

  • Select a matching condition in the Match If field to apply the deduplication rule, depending on the text in the Unique ID Field:

    • Exact Match: the characters in the text match exactly.

    • Case/Accent Insensitive Match: the characters in the text match, regardless of casing and language-specific accent differences.

重要

At least one Deduplication Rules must be set for the rule to capture duplicates.

小訣竅

A few more fields are available for an advanced configuration.

If on a multi-company database, the Cross-Company field is available. When enabled, duplicates across different companies are suggested.

Activate 開發人員模式(除錯模式) to display the Suggestion Threshold field. Duplicates with a similarity below the threshold set in this field are not suggested.

With the rule’s configuration complete, either close the rule form, or run the rule manually to instantly capture duplicate records.

Manually run a deduplication rule

To manually run a specific deduplication rule at any time, navigate to Data Cleaning app ‣ Configuration ‣ Deduplication, and select the rule to run.

Then, on the rule form, select the Deduplicate button on the top-left. Upon doing so, the Duplicates smart button displays the number of duplicates captured.

Click on the Duplicates smart button to manage these records.

Recycle records

Use the recycle records feature to rid the database of old and outdated records.

The Field Recycle Records dashboard displays records that can be archived or deleted, by matching conditions within the records set by the recycle record’s rules.

Navigate to this dashboard by going to Data Cleaning app ‣ Recycle Records.

Field Recycle Records dashboard in the Data Cleaning application.

The RECYCLE RULES sidebar lists each of the active recycle record rules.

By default, the All option is selected. Records are displayed with the following columns:

  • Record ID: the ID of the original record.

  • Record Name: the name or title of the original record.

Select a specific rule in the RECYCLE RULES sidebar to filter the records.

To recycle records, click the Validate button on the row of the record.

Upon doing so, the record is recycled, depending on how the rule is configured, to be either archived or deleted from the database.

小訣竅

Discard groupings by clicking the Discard button. Upon doing so, the record is hidden from the list, and is not detected by the recycle rule again in the future.

View discarded records by selecting the Discarded filter from the search bar drop-down menu.

Recycle record rules

The Recycle Records Rules set the conditions for how records are recycled.

These rules can be configured for each model in the database, and with varying levels of specificity. To get started, navigate to Data Cleaning app ‣ Configuration ‣ Recycle Records.

小訣竅

Recycle rules run once a day, by default, as part of a scheduled action cron (Data Recycle: Clean Records). However, each rule can be run manually anytime.

By default, no recycle record rules exist. Click the New button to create a new rule.

On the recycle record rule form, first choose a Model for this rule to target. Selecting a model updates the rule title to the chosen model.

Optionally, configure a Filter to specify the records eligible for this rule. The number of eligible records is shown in the # record(s) link.

Next, configure the field and time range for how the rule detects the records to recycle:

  • Time Field: select a field from the model to base the time (Delta).

  • Delta: type the length of time, which must be a whole number (e.g. 7).

  • Delta Unit: select the unit of time (Days, Weeks, Months, or Years).

Then, select a Recycle Mode:

  • 手动:要求手动回收每条检测到的记录,并启用 通知用户 字段。

  • 自动:自动合并回收的分组,无需通知用户。

最后,选择 回收操作存档删除 记录。如果选择 删除,请选择是否在规则中包含 存档 记录。

完成规则配置后,关闭规则表单,或 手动运行规则 立即捕获要回收的记录。

Example

可以使用以下配置来配置回收规则,以删除一年前最后一次更新的存档线索和机会,并注明特定的丢失原因:

  • Model: Lead/Opportunity

  • 筛选项

    • Active is not set

    • Lost Reason is in Too expensive

  • Time Field: Last Updated on (Lead/Opportunity)

  • Delta: 1

  • Delta Unit: Years

  • Recycle Mode: Automatic

  • Recycle Action: Delete

  • Include Archived:

Recycle records rule form for a lead/opportunity.

Manually run a recycle rule

要随时手动运行特定回收规则,请导航至 数据清理应用程序 ‣ 配置 ‣ 回收记录,然后选择要运行的规则。

Then, on the rule form, click the Run Now button on the top-left. Upon doing so, the Records smart button displays the number of records captured.

Click the Records smart button to manage these records.

Field cleaning

Use the field cleaning feature to maintain consistent formatting of names, phone numbers, IDs and other fields throughout a database.

The Field Cleaning Records dashboard displays formatting changes to data in fields of a record, to follow a convention set by the field cleaning rules.

Navigate to this dashboard by going to Data Cleaning app ‣ Field Cleaning.

Field Cleaning Records dashboard in the Data Cleaning application.

The CLEANING RULES sidebar lists each of the active cleaning rules.

By default, the All rule is selected. Records are listed with the following columns:

  • Record ID: the ID of the original record.

  • Record Name: the name or title of the original record.

  • Field: the original record’s field that contains the value to format.

  • guilabel:Current:原始记录字段中的当前值。

  • guilabel:Suggested:原始记录字段中的建议格式化值。

要清理和格式化记录,请点击记录行上的 :guilabel:`验证`按钮。

这样,记录就会被格式化和/或清理。

小訣竅

点击 :`丢弃`按钮丢弃记录。这样,该记录就会从列表中隐藏,今后将不会再被字段清理规则检测到。

View discarded records by selecting the Discarded filter from the search bar.

Field cleaning rules

*字段清理规则*设置字段清理和/或格式化的条件。

这些规则可针对数据库中的每个模型进行配置,并具有不同程度的特殊性。要开始使用,请导航至 数据清理应用程序 ‣ 配置 ‣ 字段清理

小訣竅

字段清理规则默认每天运行一次,作为 cron(数据清理:清理记录)计划行动的一部分。不过,每条规则都可以 随时手动 运行。

默认情况下,联系人`规则用于格式化和清理**联系人**应用程序记录。选择 :guilabel:`联系人 记录进行编辑,或选择 新建 按钮创建新规则。

在字段清理规则表单中,首先为该规则选择一个 模型 目标。选择一个模型会将规则标题更新为所选模型。

接下来,点击 规则 部分中的 添加行,至少配置一条规则。

这样,就会出现一个 创建规则 弹出窗口,其中有以下需要配置的字段:

  • 从模型中选择一个 待清洁字段 指定给一个操作。

  • 选择下列 操作 选项之一:

    • Trim Spaces reveals the Trim field to select the All Spaces or Superfluous Spaces option. Leading, trailing, and successive spaces are considered superfluous.

      Example

      The contact name Dr.  John   Doe can be formatted with the following Trim options:

      • All Spaces: DR.JohnDoe

      • Superfluous Spaces: DR. John Doe

    • Set Type Case reveals the Case field to select either First Letters to Uppercase, All Uppercase, or All Lowercase.

      Example

      The lead/opportunity title lumber inc, Lorraine douglas can be formatted with the following Case options:

      • First Letters to Uppercase: Lumber Inc, Lorraine Douglas

      • All Uppercase: LUMBER INC, LORRAINE DOUGLAS

      • All Lowercase: lumber inc, lorraine douglas

    • Format Phone converts the phone number to an international country format.

      Example

      • Belgium: 061928374 +32 61 92 83 74

      • United States: 800 555-0101 +1 800-555-0101

    • Scrap HTML converts HTML to plain text.

      Example

      HTML text
      <h1>John Doe</h1>
      <p>Lorem ipsum dolor sit <a href="https://example.com">amet</a>.</p>
      
      純文字
      **John Doe** Lorem ipsum dolor sit amet [1] .[1] https://example.com
      

    Once a field and action are selected, click Save to close the Create Rules popover window.

Then, select a Cleaning Mode:

  • Manual: requires each detected field to be manually cleaned and enables the Notify Users field.

  • Automatic: automatically cleans fields without notifying users.

With the rule’s configuration complete, either close the rule form, or run the rule manually to instantly capture fields to clean.

Manually run a field cleaning rule

To manually run a specific field cleaning rule at any time, navigate to Data Cleaning app ‣ Configuration ‣ Field Cleaning, and select the rule to run.

Then, on the rule form, select the Clean button on the top-left. Upon doing so, the Records smart button displays the number of records captured.

Click on the Records smart button to manage these records.

Merge action manager

The Merge Action Manager enables or disables the Merge action available in the Actions menu for models in the database.

Enable 開發人員模式(除錯模式) and navigate to Data Cleaning app ‣ Configuration ‣ Merge Action Manager.

Models are listed with the following columns:

  • Model: technical name of the model.

  • Model Description: display name of the model.

  • Type: whether the model is of the Base Object or Custom Object type.

  • Transient Model: the model handles temporary data that does not need to be stored long-term in the database.

  • Can Be Merged: enables the Merge action for the model.

To view which models are enabled by default, use the search bar to filter models that Can Be Merged.

也參考

合併聯絡人