插入列表¶
重要
在电子表格中插入列表之前,请确保列表符合您的需求。考虑哪些字段应该可见,以及如何对记录进行筛选和/或排序。这会影响电子表格的加载时间和用户友好性。
插入列表:
在数据库中打开相关列表视图后,点击视图名称旁边的 (操作) 图标,然后点击 。
備註
要只插入特定记录,请选择相关记录,点击屏幕顶部中央的 操作 按钮,然后点击 :icon:`ioi-view-list`插入电子表格。
在打开的窗口中,根据需要编辑 列表名称。
The list name is used in the sheet name and in the list properties.
如有需要,可编辑要插入的记录数量(即行数)。
默认情况下,显示的数字是列表第一页可见的记录数量。例如,如果列表包含 150 条记录但只有 80 条可见,则该字段将显示 80。
備註
虽然通过与数据库的连接,列表中的数据可以保持更新,但已插入的列表不会自动扩展以容纳新的记录(例如,新的产品类别或新的销售人员)。
If you anticipate new records being added, consider adding extra rows when inserting the list. Records/rows can also be added manually after the spreadsheet has been inserted.
Example
您的公司目前有十个产品类别,您将此列表插入到电子表格中。如果创建了第11个产品类别,而您插入的列表只有十行,那么新类别将被插入到电子表格的适当位置,从而移除一个现有类别。
One way to avoid this is to add extra rows when inserting the list.
Click Blank spreadsheet to create a new spreadsheet, or select in which existing spreadsheet the list should be inserted.
備註
When inserting a list into a new spreadsheet, the spreadsheet is saved in the Odoo Documents app in the My Drive personal folder.
点击 确认。
The list is inserted into a new sheet in the spreadsheet. The sheet tab in the bottom bar shows the name of the list followed by the list ID, e.g., Quotations by Total (List #1). A panel on the right side of the screen shows the list properties.
小訣竅
To sever the link between an inserted list and your database, select the entire list, right-click and select Copy then right-click again and select .
Do not modify the list ID in the sheet name, as the inserted list retains this ID for the lifetime of the spreadsheet. This list ID is used in the spreadsheet functions that retrieve data from your database.
列表函数¶
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¶
After 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 from the menu bar, then select the appropriate list. In the pop-up window, indicate the number of records to insert and click Confirm. An updated list is inserted, overwriting the previous list.
小訣竅
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 then or from the menu bar, or right-click then Insert column left or Insert column right as appropriate.
Copy 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 panel 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.
删除列表¶
要彻底删除电子表格中的列表及其底层数据源,请按任意顺序执行以下步骤:
使用您偏好的方式(如键盘命令、电子表格菜单或删除工作表)删除表格。这将清除数据的可视化呈现。
From the properties panel of the relevant list, click the (gear) icon then Delete. This deletes the data source of the list from the spreadsheet.