Skip to main content

OdooTools

Set of tools for Odoo developpement

.. code:: python

import OdooTools

Debug

Debug utilities

.. code:: python

from odoo.ONS import debug
  • print_func_code: print function code and its inheritance (considering loading order)

python print_func_code(env, model, function)

  • env: odoo environnement

  • model: model _name value, e.g. "sale.order"

  • function: function to analyse, e.g. "onchange_partner_id"

  • printTraceBack: print the call path up to this function call

python printTraceBack(printer)

  • printer: display function, default is "print", we can use the logger from logging library

    .. code:: python

    printTraceBack(_logger.critical)
    
  • get_depends_methods: return a list of dict containing trigger keys and function object of all "api.depends" of a model

python for depends in get_onchange_methods(env, model): print(x["keys"], x["function"])

  • env: environnement odoo

  • model: model from which to extract depends methods, e.g. "sale.order"

  • get_onchange_methods: same as get_depends_methods but for "api.onchange"

  • analyse_depends: call print_func_code on get_depends_methods result

python analyse_depends(env, model)

  • analyse_onchange: call print_func_code on get_onchange_methods result

python analyse_onchange(env, model)

Records

Tools to handle recordset

  • groupby: group recordset according to list of key (or key getter)

python groupby(records, attributes)

  • records: recordset to group

  • attributes: list of grouping key, that can be either:

    • an object attribute's name as string, e.g. "name"
    • a function taking a record and returning the key, e.g. lambda line: line.move_id.sale_line_id.order_id

Example:

python lines = self.mapped("move_line_ids").filtered("result_package_id") grouped = groupby(lines, [ "result_package_id", "picking_id", lambda line: line.move_id.sale_line_id.order_id, ]) for package, package_data in grouped.items(): for picking_id, picking_id_data in package_data.items(): for sale_id, records in package_data.items(): print(records)

Datetime

Tools to handle date and datetime.

  • client_specific_to_utc: There 's some cases where you need to convert a datetime for the write, for example a datetime built from the controller

python utc_date = client_specific_to_utc(env, mydate)

Metadata

Release files for odoo-utilities 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for odoo-utilities 0.2
File Size Uploaded Provenance Actions
odoo_utilities-0.2.tar.gz 5.0 kB Without provenance Details for odoo_utilities-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for odoo-utilities 0.2
File Interpreter ABI Platform Actions
odoo_utilities-0.2-py3-none-any.whl Python 3 none any Details for odoo_utilities-0.2-py3-none-any.whl

Total release size: 23.8 kB

Release files / odoo_utilities-0.2.tar.gz

Download URL odoo_utilities-0.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0b84ceba3e7bad9e2cdcaa51cdc0865e28e9c691d8a0c444c18c66a475f283a2
BLAKE2b-256 checksum
How to use checksums
cb98153d883e4c04b1742abbbaaf5432f35684860c007c7c98d7ba413bf03df2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

Release files / odoo_utilities-0.2-py3-none-any.whl

Download URL odoo_utilities-0.2-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e38eb85b76a0a807e196c6ef9fce5506578aa81a53513d11e276fc4b283d1f68
BLAKE2b-256 checksum
How to use checksums
7b53868c3871513e241317c2cf28422b5eb15fd470bd3871adc337a29ae914fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

Security for odoo-utilities 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page