This addon provides a new field type called "Vector" that allows you to store and manage vector into your Odoo database.
auto_awesome What this module does
AI-generated from the code · Odoo 19.0Adds a new "Vector" field type that lets you store lists of numbers (vectors) directly in Odoo records, for example for embeddings or numeric profiles.
This module is a technical building block: it does not add any menu or screen by itself. It extends the list of available field types in Odoo's technical settings, so when a developer creates a custom field they can choose "Vector" as the field type.
- A vector field has a fixed size (number of values) defined when the field is created; the size must be a positive whole number.
- Values can be entered as a list of numbers; if the list is shorter than the field size, it is automatically completed with zeros (unless auto-padding is turned off).
- If the list is longer than the field size, Odoo refuses to save it and shows an error.
- The module checks the database column and, if the stored vector size no longer matches the field definition, it converts the column to the new size.
- It relies on the PostgreSQL vector extension and the Python numpy library; during installation it tries to enable the database extension automatically and shows a clear error message if that is not possible.
It touches the ir.model.fields model (the technical model that describes fields) and the underlying database storage. No business documents, reports, emails or scheduled actions are added.
Depends on
Models and fields (1)
- ir.model.fields · extends an existing modelttype
Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub
Availability by version
Reviewed: 2026-11-03Confirmation status: 3 confirmed, 6 with no information of 9 versions.
Sources · Odoo 16.0
Confirmed on 2026-11-03 in branch 16.0 of OCA/server-tools.
terminal Installation and usage
OCA documentation · Odoo 19.0Installation
Source · Odoo 19.0To install this module, you need to ensure that the pgvector extension is installed and available in your PostgreSQL instance.
Usage
Source · Odoo 19.0> ⚠️ Warning > This addon is not compatible with the Python pgvector library. Please ensure that you do not use this library alongside the addon to avoid potential issues. This is mainly due to the fact that numpy arrays can't be stored into the odoo cache since they are not comparable with the default '==' or '!=' operators.
The module is a technical module providing a new field type called "Vector". It's intended to be used by developers who want to store and manage vector data in their Odoo database when they develop their own modules.
Field declaration
To declare a field of type vector, you can use the following syntax:
from odoo.addons.field_vector.fields import Vector
class YourModel(models.Model):
_name = 'your.model'
vector_field = Vector(dimensions=3)The dimensions parameter is required and specifies the number of dimensions of the vector. The field will be stored as a vector type in PostgreSQL, which is a native type for storing vectors.
By default the field is declared as no prefetch=False and with autopad=True. You can override these parameters by passing them as arguments to the field:
from odoo.addons.field_vector.fields import Vector
class YourModel(models.Model):
_name = 'your.model'
vector_field = Vector(dimensions=3, prefetch=True, autopad=False)The prefetch parameter allows you to enable or disable prefetching of the field when loading records. If set to True, the field will be prefetched when loading records, which can improve performance when accessing the field frequently. If set to False, the field will not be prefetched, which can save memory and improve performance when accessing the field infrequently (which would be the common case).
The autopad parameter allows you to enable or disable automatic padding of the vector when storing it in the database. If set to True, the vector will be automatically padded with zeros to match the specified dimensions. If set to False, the vector will not be padded but if the vector is shorter than the specified dimensions an error will be raised.
Field usage
The vector field can be used like any other field in Odoo. When accessing the field, it will always return an odoo.addons.field_vector.fields.VectorValue object, which is a wrapper around value stored into the database. This object provides a convenient way to get the value of the vector as a numpy array.
import numpy as np
from odoo.addons.field_vector.fields import VectorValue
record = self.env['your.model'].create({
'vector_field': [1.0, 2.0, 3.0]
})
assert isinstance(record.vector_field, VectorValue)
assert isinstance(record.vector_field.value, np.ndarray)When setting the field, you can pass a list of values or a numpy array or a VectorValue object or a list/tuple of values. The field will automatically convert the value to a VectorValue and store it in the database into the vector format.
record.vector_field = [1.0, 2.0, 3.0]
assert isinstance(record.vector_field, VectorValue)
record.vector_field = np.array([1.0, 2.0, 3.0])
assert isinstance(record.vector_field, VectorValue)
record.vector_field = VectorValue([1.0, 2.0, 3.0])
assert isinstance(record.vector_field, VectorValue)Plain SQL queries
When reading the field in plain SQL queries, the field will be returned as a VectorValue object. You can use the value property to get the value of the vector as a numpy array.
env.cr.execute('SELECT vector_field FROM your_model WHERE id = 1')
record = env.cr.fetchone()
vector_value = record[0]
assert isinstance(vector_value, VectorValue)When writing the field in plain SQL queries, you can pass a numpy array or a list of values or a VectorValue object as the value of the field (in this specific case tuples are not supported).
env.cr.execute('UPDATE your_model SET vector_field = %s WHERE id = 1', (np.array([1.0, 2.0, 3.0]),))
env.cr.execute('UPDATE your_model SET vector_field = %s WHERE id = 1', ([1.0, 2.0, 3.0],))
env.cr.execute('UPDATE your_model SET vector_field = %s WHERE id = 1', (VectorValue([1.0, 2.0, 3.0]),))No verified information in OCA: Configuration.
Installation instructions, the distribution package, dependencies and configuration steps are not shown because they have not yet been verified in the module documentation for any version.
Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.