插入并链接 Odoo 数据¶
可将 Odoo 数据库中的多个元素插入 Odoo 电子表格,即:
Each time a list, pivot table, or chart is inserted, a data source is created. This data source connects the spreadsheet to your Odoo database, retrieving up-to-date information every time the spreadsheet is opened, the browser page is reloaded, or data is manually refreshed by clicking from the menu bar.
插入列表 和 插入数据透视表 使用带有 Odoo 特定的 列表功能 和 数据透视表功能 的公式从数据库检索数据,并可在电子表格中进一步操作。可以修改 插入图表 的某些元素,但不能进行数据操作或计算。
注解
来自不同应用程序和模型的列表、透视表和图表可以插入到同一个电子表格中。
小技巧
If you intend to use global filters to dynamically filter Odoo data in a spreadsheet or dashboard, do not use the same conditions to establish the initial list, pivot table, or chart in your database.
也有可能:
添加可点击链接 至 Odoo 菜单项、同一电子表格的其他工作表或外部 URL
insert financial data from your Odoo database using Odoo-specific spreadsheet functions
将数据从另一个 Odoo 电子表格、Excel 电子表格或 Google 电子表格直接粘贴到任何 Odoo 电子表格中
数据源¶
每次在 Odoo 电子表格中插入 列表, pivot table 或 图表 时,都会创建数据源,连接电子表格和数据库中的相关 模型 ,使电子表格中的数据保持最新。
每个数据源都由可通过 数据 菜单访问的属性定义。数据源由各自的 (数据透视表)、 (列表) 或 (图表) 图标标识,后跟 ID 和名称,例如, (#1)产品销售分析。

点击数据源可在电子表格右侧的窗格中打开相关属性。
小技巧
右键点击插入的列表或透视表的任意单元格,然后点击 :icon:`ioi-view-list` 查看列表属性 或 :icon:`ioi-view-pivot` 查看枢轴属性,或点击插入的图表右上方的 (菜单) 图标,然后点击 编辑 也可打开属性窗格。
打开特定数据源的属性后,即使在电子表格选项卡之间导航,也会保持打开状态。要关闭属性窗格,请点击窗格右上角的 (关闭) 图标。
注解
删除插入的列表或数据透视表,或删除插入该列表或数据透视表的工作表,不会删除底层数据源。插入列表或数据透视表的数据源只能通过数据源的属性删除。
在 数据 菜单中的警告会指出电子表格中不再出现相应列表或透视表的任何数据源。

另一方面,删除插入的图表也会删除底层数据源。
插入列表¶
重要
在电子表格中插入列表之前,请确保列表符合您的需求。考虑哪些字段应该可见,以及如何对记录进行筛选和/或排序。这会影响电子表格的加载时间和用户友好性。
插入列表:
在数据库中打开相关列表视图后,点击视图名称旁边的 (操作) 图标,然后点击 。
注解
要只插入特定记录,请选择相关记录,点击屏幕顶部中央的 操作 按钮,然后点击 :icon:`ioi-view-list`插入电子表格。
在打开的窗口中,根据需要编辑 列表名称。
列表名称用于工作表名称以及 列表属性 中。
如有需要,可编辑要插入的记录数量(即行数)。
默认情况下,显示的数字是列表第一页可见的记录数量。例如,如果列表包含 150 条记录但只有 80 条可见,则该字段将显示 80。
点击 空白电子表格 或选择应在哪个现有电子表格中插入列表。
注解
新的电子表格会保存在 Odoo 文件管理 应用程序中的 我的云盘 个人工作区,或者,如果电子表格已启用 文件集中化 ,则会保存在 电子表格 工作区。
点击 确认。
列表会插入电子表格中的一个新工作表。底栏的工作表选项卡显示列表名称,后跟列表 ID,如 按总数计算的报价(列表 #1)。屏幕右侧的窗格显示 :ref:` 列表属性 <spreadsheet/insert/list-properties>`。
小技巧
To view an individual record of an inserted list, right-click on any cell of the relevant row, then click See record. To return to the spreadsheet, click the name of the spreadsheet in the breadcrumbs at the top of the view.
要切断插入列表与数据库之间的联系,请选择整个列表,点击右键并选择 :
guilabel:`复制
,然后再次点击右键并选择 。请勿修改工作表名称中的列表 ID,因为已插入的列表会在电子表格的整个生命周期中保留此 ID。该列表 ID 将用于从数据库中检索数据的 电子表格函数。
列表函数¶
When a list is inserted into a spreadsheet, the following functions are used to retrieve the header and field values, respectively:
=ODOO.LIST.HEADER(list_id, field_name)
=ODOO.LIST(list_id, index, field_name)
The arguments of the function are as follows:
list_id
:插入列表时分配的 ID。电子表格中插入的第一个列表被分配为列表 ID1
,第二个被分配为列表 ID2
,等等。索引
:标识插入前记录在列表中出现的行。第一行的索引为1
,第二行的索引为2
,等等。field_name
:字段的技术名称。
小技巧
点击单个单元格后,相关公式会显示在公式栏中。要同时显示电子表格中的所有公式,请点击菜单栏上的
。下面的示例显示了用于检索列表标题和数值的函数。
列表属性¶
插入列表时,列表属性会显示在屏幕右侧。您可以随时通过 数据 菜单访问这些属性,方法是点击相关列表(前缀为 (列表) 图标,或右键点击列表上的任意位置并点击 查看列表属性。
下面显示的是列表属性,其中一些属性可以编辑:
列表 #:列表 ID。在电子表格中插入其他列表时,会按顺序分配列表 ID。
列表名称:列表名称。如有需要,可对其进行编辑。请注意,编辑列表属性中的列表名称不会修改工作表名称中显示的列表名称,反之亦然。
模型:从中提取数据的模型。
列:插入列表时可见的模型字段。
域:用于确定显示哪些记录的规则。点击 编辑 domain 添加或编辑规则。
注解
When global filters are used, this domain is combined with the selected values of the global filter before the data is loaded into the spreadsheet.
排序:数据的排序方式(如适用)。要添加排序规则,请点击 添加,选择字段,然后选择排序方式是 升序 还是 降序。点击 (删除) 图标,删除排序规则。
To duplicate or delete a list’s data source, click the (gear) icon, then click Duplicate or Delete as relevant.
Manage an inserted list¶
Once a list from an Odoo database has been inserted into an Odoo spreadsheet, you can:
add records, i.e., rows
add fields, i.e., columns
duplicate the list to create a new, identical data source
Add records/rows to a list¶
To add records to a list, use one of the following methods:
Select the last row of the table, then hover over the blue square until the plus icon appears. Click and drag down to add the desired number of rows. The cells of the new rows are populated with the appropriate formula to retrieve the list values. If there is corresponding data in your database, the cells are populated.
Position your cursor in the top left cell of the sheet, click Confirm. An updated list is inserted, overwriting the previous list.
from the menu bar, then select the appropriate list. In the pop-up window, indicate the number of records to insert and click
小技巧
The above methods can also be used to add additional blank rows to your spreadsheet table. This may be useful for lists where you expect additional records to be generated in your database, e.g., new product categories or new salespersons.
Add fields/columns to a list¶
To add fields/columns to a list:
Select the column to the right or left of where the new column should be inserted.
Click Insert column left or Insert column right as appropriate.
then or from the menu bar, or right-click thenCopy the header cell of any column, paste it into the header cell of the new column, and press
Enter
.Double-click the new header cell then click on the field name that appears in quotation marks at the end of the formula; a list of all the technical names of the fields of the related model appears.
Select the appropriate field name and press
Enter
. The field’s label appears in the header.小技巧
To know a field’s technical name, navigate to the relevant view, activate developer mode, then check the field name by hovering over the question mark beside a field’s label.
With the header cell selected, double-click on the blue square in the bottom-right corner. The cells of the column are populated with the appropriate formula to retrieve the list values. If there is corresponding data in your database, the cells are populated.
Duplicate a list¶
Duplicating a list via the list’s properties creates an additional data source. This allows for different manipulations to be performed on the same data within one spreadsheet.
With the list properties open, click the (gear) icon then Duplicate.
The new data source is assigned the next available list ID. For example, if no other lists have been inserted in the meantime, duplicating List #1 results in the creation of List #2.
Unlike when you insert a list, a duplicated list is not automatically inserted into the spreadsheet. To insert it, perform the following steps:
Add a new sheet by clicking the (add sheet) icon at the bottom left of the spreadsheet.
Click
from the menu bar, then select the appropriate list.Define the number of records to insert and click Confirm.
Edit the List Name in the properties pane if needed.
Rename the sheet by right-clicking on the sheet tab, selecting Rename, and entering the new sheet name.
注解
Duplicating an inserted list by copying and pasting it or by duplicating the sheet into which it has been inserted does not create a new data source. Any changes made to the list’s properties would therefore impact any copies of the list.
删除列表¶
要彻底删除电子表格中的列表及其底层数据源,请按任意顺序执行以下步骤:
使用您偏好的方式(如键盘命令、电子表格菜单或删除工作表)删除表格。这将清除数据的可视化呈现。
在相关列表的 属性面板 中,点击 (齿轮) 图标,然后点击 删除。这将从电子表格中删除列表的数据源。
插入数据透视表¶
小技巧
Converting an inserted pivot table to a dynamic pivot table allows you to add, remove, and manipulate dimensions (i.e., columns and rows) and measures. It is therefore possible to insert a basic pivot table with minimal configuration, convert it to a dynamic pivot table, then refine it directly in the spreadsheet.
插入数据透视表:
在数据库中打开相关透视图后,点击 在电子表格中插入。
在弹出的窗口中,按需编辑 透视表名称。
该名称用于工作表名称和 数据透视表属性。
点击 空白电子表格,或选择目标现有电子表格。
注解
新的电子表格会保存在 Odoo 文件管理 应用程序中的 我的云盘 个人工作区,或者,如果电子表格已启用 文件集中化 ,则会保存在 电子表格 工作区。
点击 确认。
数据透视表插入电子表格中的新工作表。据透视表的名称,后跟数据透视表 ID,如 按销售团队进行销售分析(透视 #1)。屏幕右侧的窗格显示:ref:数据透视表属性<spreadsheet/insert/pivot-table-properties>
。
小技巧
To view the records referenced by an individual cell of a pivot table, right-click on the cell, then click See record. To return to the spreadsheet, click the name of the spreadsheet in the breadcrumbs at the top of the view.
要切断插入的数据透视表和数据库之间的联系,请选择整个数据透视表,点击右键并选择 :
guilabel:`复制
,然后再次点击右键并选择 。请勿修改工作表名称中的数据透视表 ID,因为插入的数据透视表会在电子表格的整个生命周期中保留此 ID。该数据透视表 ID 将用于从数据库检索数据的 电子表格函数 中。
透视表函数¶
An inserted pivot table that has not been converted to a dynamic pivot table uses the following functions to retrieve the header and field values, respectively:
=PIVOT.HEADER(pivot_id, [domain_field_name, …], [domain_value, …]) =PIVOT.VALUE(pivot_id, measure_name, [domain_field_name, …], [domain_value, …])
函数参数说明如下:
pivot_id
: the ID assigned when the pivot table is inserted. The first pivot table inserted in a spreadsheet is assigned pivot ID1
, the second, pivot ID2
, etc.measure_name
:被测量指标的技术名称,后跟聚合类型,例如`product__qty:sum`。domain_field_name
:用作维度的字段技术名称,例如`user_id`;若维度是时间段,则为日期字段技术名称后跟时间段,例如`date_order:month`。domain_value
:记录的ID;若维度是时间段,则为目标日期或时间段。
小技巧
点击单个单元格时,公式栏会显示相关公式(如适用)。要同时显示电子表格中的所有公式,请点击菜单栏中的
。以下示例展示了用于获取静态数据透视表标题和值的函数。
数据透视表属性¶
插入数据透视表后,数据透视表属性会显示在屏幕右侧。您可以随时通过 数据 菜单访问这些属性,方法是点击相关的数据透视表,前面有 (数据透视表) 图标,或右击数据透视表上的任意位置并点击 查看数据透视表属性。
可查看(部分可编辑)的透视表属性包括:
透视表#:数据透视表ID。随着在电子表格中插入更多透视表,ID会按顺序分配。
名称:数据透视表名称。可按需编辑。注意:在属性中修改名称不会改变工作表标签显示的名称,反之亦然。
模型:从中提取数据的模型。
列`和 :guilabel:`行:用于分类或分组模型数据的维度。
度量值:基于所选维度进行测量或分析的内容。
域:用于确定显示哪些记录的规则。点击 编辑 domain 添加或编辑规则。
注解
When global filters are used, this domain is combined with the selected values of the global filter before the data is loaded into the spreadsheet.
要 复制 或 删除 数据透视表的数据源,请点击 (齿轮) 图标,然后点击 复制`或 :icon:`fa-trash删除。
管理插入的数据透视表¶
将 Odoo 数据库中的数据透视表插入 Odoo 电子表格后,您可以:
:ref:` 将其转换为动态透视表 <spreadsheet/dynamic-pivot-tables/create>` 以便能够操作尺寸和度量值
复制数据透视表 以创建新的相同数据源
复制数据透视表¶
通过数据透视表的属性复制数据透视表,可创建一个额外的数据源。这样就可以在一个电子表格中对相同的数据进行不同的操作。
For example, you can see the same data aggregated by different dimensions or use global filters to offset the date and create pivot tables that compare the current period’s data with a previous period.
要复制数据透视表,请执行以下步骤:
打开 数据透视表属性 时,点击 (齿轮) 图标,然后点击 复制。
复制的数据透视表会自动插入电子表格中的新工作表,并在右窗格中打开数据透视表属性。
如果需要,在属性窗格和工作表选项卡中编辑 名称 。
新数据源被分配给下一个可用的数据透视表 ID。例如,若期间未插入其他数据透视表,复制*透视表#1*将创建*透视表#2*。
注解
通过复制粘贴或复制工作表来复制已插入的数据透视表时,不会创建新的数据源。因此,对数据透视表属性所做的任何修改都会影响其所有副本。
When a pivot table is duplicated, the new pivot table is by default a dynamic pivot table.
删除数据透视表¶
要彻底删除电子表格中的数据透视表及其底层数据源,请按任意顺序执行以下步骤:
使用您偏好的方式(如键盘命令、电子表格菜单或删除工作表)删除表格。这将清除数据的可视化呈现。
在相关数据透视表的 属性面板 中,点击 (齿轮) 图标,然后点击 删除。此操作将移除数据透视表的数据源。
插入图表¶
将 Odoo 数据库中的图表插入电子表格的操作流程:
在数据库中打开目标图表视图,点击 插入到电子表格。
在弹出的窗口中编辑 :guilabel:`图表名称`(可选)。
点击 空白电子表格 或选择目标现有电子表格。
注解
新的电子表格会保存在 Odoo 文件管理 应用程序中的 我的云盘 个人工作区,或者,如果电子表格已启用 文件集中化 ,则会保存在 电子表格 工作区。
点击 确认。
Charts are inserted on the first sheet of the spreadsheet. A pane on the right side of the screen shows the chart properties, where various aspects of the chart’s configuration and design can be modified.
小技巧
点击图表数据点(如 Jessica Childs)可打开数据库中对应的列表视图。

Insert clickable links¶
Adding links to related or supporting information can make your report or dashboard more user-friendly and effective.
You can insert a clickable link from any spreadsheet cell to:
an Odoo menu item
another sheet inside the same spreadsheet
an external URL
注解
Clicking a link to a menu item provides the same result as navigating via the Odoo menu within an app, e.g., the menu item Sales/Orders/Quotations corresponds to the default view when navigating to .
It is also possible to insert a clickable link to a specific view of a model in a spreadsheet starting from the view itself. However, as this method inserts each new link in a new sheet, it is more efficient to create links to specific views starting from the spreadsheet.
You can insert a clickable link from any chart to an Odoo menu item.
Insert a clickable link from a cell¶
To insert a clickable link from a cell:
Click Insert link. Next, depending on the desired outcome, perform one of the following actions:
from the menu bar or right-click on the cell, then clickClick the (menu) icon, then Link an Odoo menu. Select the relevant menu item from the list or click Search more to choose from a list of all menu items. Click Confirm.
Click the (menu) icon, then Link sheet, then choose the relevant sheet from the current spreadsheet.
Under Link, type a URL.
Enter or edit the label for the link in the Text field.
点击 确认。
Insert a clickable link from a chart¶
To insert a clickable link from a chart to an Odoo menu item:
Hover over the top right of the chart’s box, then click the (menu) icon, then Edit. The chart properties appear at the right of the screen.
At the bottom of the Configuration tab of the chart properties pane, click under Link to Odoo menu, then select a menu.
Hover over the top right of the chart’s box to see that a new (external link) icon has been added.
Insert financial data¶
When building reports and dashboards, it may be useful to include certain accounting-related data, such as account IDs, credits and debits for specific accounts, and dates of the start and end of the tax year.
Odoo-specific spreadsheet functions allow you to retrieve such accounting data from your database and insert it into a spreadsheet.