Odoo 15 Development Essentials by Daniel Reis

Odoo 15 Development Essentials by Daniel Reis

Author:Daniel Reis
Language: eng
Format: epub
Publisher: Packt Publishing Pvt Ltd
Published: 2022-01-04T00:00:00+00:00


Recordset comparisons

There are cases where we need to compare the content of a recordset to decide what further action is needed. Recordsets support the expected comparison operations.

To check if a <rec> record is an element of a <my_recordset> recordset, the following code can be used:

<rec> in <my_recordset>

<rec> not in <my_recordset>

Recordsets can also be compared to check if one is contained in another. To compare two recordsets, use set1 and set2:

Using set1 <= set2 and set1 < set2 returns True if all of the elements in set1 are also in set2. The < operators return False if both recordsets have the same elements.

Using set1 >= set2 and set1 > set2 returns True if all of the elements in set2 are also in set1. The > operators return False if both recordsets have the same elements.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.