Cmdlets for Odoo

Build 24.0.9060

ExpandReferences Parameter (Connect-Odoo Cmdlet)

Boolean determining if multi-valued Many2Many and One2Many fields are expanded into separate rows.

Syntax

Connect-Odoo -ExpandReferences SwitchParameter

Data Type

bool

Default Value

false

Remarks

By default Many2Many and One2Many fields are collapsed into single values separated by commas. For example, a record in calendar_event IDs will generate a result like this if partners 13 and 57 are attending.

SELECT id, name,                           partner_ids, x_custom_ids FROM calendar_event
--      1  'Meet With Potential Customer'  '13,57'      '1,2'

With this option enabled, the cmdlet will expand each combination of multi-valued field values across multiple rows. This means that row data will be duplicated but makes it simpler to JOIN between tables that are linked by multi-valued references.

In addition, the cmdlet will use a separate primary key called id:multi since id) not unique when rows are duplciated. This primary key is generated client-side and its use should be avoided in filters, since it depends upon the exact rows returned by any filters evaluated by Odoo.

SELECT "id:multi", id, name,                          partner_ids, x_custom_ids FROM calendar_event
--      1:1        1  'Meet With Potential Customer'  13           1
--      1:2        1  'Meet With Potential Customer'  57           1
--      1:3        1  'Meet With Potential Customer'  13           2
--      1:4        1  'Meet With Potential Customer'  57           2

Note that this option does not affect how INSERTs are processed. If you want to insert a record containing a multi-valued field you must always insert using a comma-separated value.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060