Skip to content
Health
90/100
good
  • Security25/25
    No findings
  • Activity20/25
    Last human commit 11 months ago
  • Required by20/25
    3 modules depend on it
  • Maturity25/25
    In 4 Odoo series since 16.0

Heuristic over the facts below, not an audit · How it's computed

Security findings
Grave / minor (static analysis)
Required by
3
Modules depending on it
External deps
0 pip · 0 bin
Python packages / system binaries
License
LGPL-3
No conflicts with its dependencies
Folder size
0.04 MB
Module directory on disk
Code analysis 0 migration notes 1 model 0 views 0 HTTP endpoints

Description

This module adds a partition(self, accessor) method to every model. It accepts for accessor any parameter that would be accepted by mapped, i.e. a string "field(.subfield)*" or a function (lambda x: not x.b). It returns a dictionary with keys that are equal to set(record.mapped(accessor)), and with values that are recordsets (these recordsets forming a partition of the initial recordset, conveniently).

So if we have a recordset (x | y | z ) such that x.f == True, y.f == z.f == False, then (x | y | z ).partition("f") == {True: x, False: (y | z)}.

Dependencies

Odoo dependencies
odoo/odoo:
Python dependencies
None
System dependencies
None
Required by
partner_invoicing_mode, sale_invoice_policy, sale_partner_address_restrict

Code analysis

Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.

Views touched 0

No views found for this module.

HTTP endpoints 0

No HTTP endpoints found for this module.

Models touched 1

New fields (0)

No new fields.

Public methods (3)
  • batch(self, batch_size=None)
    Yield successive batches of size batch_size, or .
  • partition(self, accessor)
    Returns a dictionary forming a partition of self into a dictionary value/recordset for each value obtained from the accessor. The accessor itself can be either a string that can be passed to mapped, or an arbitrary function. Note that it is always at least as fast to pass a function, hence the current implementation. If we have a 'field.subfield' accessor such that subfield is not a relational then the result is a list (not hashable). Then the str(key) are used. In the general case a value could both not be hashable nor stringifiable, in a which case this function would crash.
  • read_per_record(self, fields=None, load='_classic_read')

Loading…

Loading…

Loading…

Loading…