O'Reilly logo

Odoo Development Cookbook by Daniel Reis, Alexandre Fayolle, Holger Brunn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Combining recordsets

Sometimes, you will find that you have obtained recordsets which are not exactly what you need. This recipe shows various ways of combining them.

Getting ready

To use this recipe, you need to have two or more recordsets for the same model.

How to do it…

Here is the way to achieve common operations on recordsets:

  1. To merge two recordsets into one while preserving their order, use the following operation:
    result = recordset1 + recordset2
  2. To merge two recordsets into one ensuring that there are no duplicates in the result, use the following operation:
    result = recordset1 | recordset2
  3. To find the records that are common to two recordsets, use the following operation:
    result = recordset1 & recordset2

How it works…

The class for recordsets implements ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required