TIP: You can type at any time to perform a new search.
Attribute Set
attribute_set · OCA/odoo-pim
- Repository
- OCA/odoo-pim · module folder · Try on Runboat
- Module version
- 1.1.3
- Category
- Generic Modules/Others
- Folder size
- 0.33 MB
- License
- AGPL-3
- Application
- No
- Auto-installable
- No
- Website
- https://github.com/OCA/odoo-pim
- Last tracking update
- 2026-08-07 09:06:36
- Authors
- Akretion, Odoo Community Association (OCA)
- Maintainers
- Akretion, Odoo Community Association (OCA)
- Committers
- Jordi Ballester Alomar, Miquel Raïch, AaronHForgeFlow, Weblate, OCA-git-bot, oca-ci
- Odoo dependencies
- Python dependencies
- unidecode
- System dependencies
- None
- Required by
- product_attribute_set, website_attribute_set
- Description
This module allows the user to create Attributes to any model. This is a basic module in the way that **it does not provide views to display these new Attributes.** Each Attribute created will be related to an **existing field** (in case of a *"native"* Attribute) or to a newly **created field** (in case of a *"custom"* Attribute). A *"custom"* Attribute can be of any type : Char, Text, Boolean, Date, Binary... but also Many2one or Many2many. In case of m2o or m2m, these attributes can be related to **custom options** created for the Attribute, or to **existing Odoo objects** from other models. Last but not least an Attribute can be **serialized** using the Odoo SA module [base_sparse_field](https://github.com/odoo/odoo/tree/16.0/addons/base_sparse_field) . It means that all the serialized attributes will be stored in a single "JSON serialization field" and will not create new columns in the database (and better, it will not create new SQL tables in case of Many2many Attributes), **increasing significantly the requests speed** when dealing with thousands of Attributes.
Code Analysis ⓘ
Views touched (14)
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
attribute_attribute_form_view |
attribute.attribute.form | attribute.attribute | form | New |
attribute_attribute_tree_view |
attribute.attribute.list | attribute.attribute | list | New |
attribute_group_form_view |
attribute.group | form | New | |
attribute_group_search_view |
attribute.group | search | New | |
attribute_group_tree_view |
attribute.group | list | New | |
attribute_option_form_popup_view |
attribute.option.form.popup | attribute.option | form | New |
attribute_option_form_view |
attribute.option.form | attribute.option | form | New |
attribute_option_tree_view |
attribute.option.list | attribute.option | list | New |
attribute_option_wizard_form_view |
attribute.option.wizard | attribute.option.wizard | form | New |
attribute_set_form_view |
attribute.set.form | attribute.set | form | New |
attribute_set_tree_view |
attribute.set.list | attribute.set | list | New |
view_attribute_attribute_search |
attribute.attribute.list | attribute.attribute | search | New |
view_attribute_option_search |
attribute.option.list | attribute.option | search | New |
view_attribute_set_search |
attribute.set.list | attribute.set | search | New |
HTTP endpoints (0)
No HTTP endpoints found for this module.
Models touched (8)
New fields (14)
-
allowed_attribute_set_idsMany2many → attribute.setcomodel_name='attribute.set'compute='_compute_allowed_attribute_set_ids' -
attribute_group_idMany2one → attribute.groupondelete='cascade'required=True args: 'attribute.group', 'Attribute Group' -
attribute_set_idsMany2many → attribute.setcolumn1='attribute_id'column2='attribute_set_id'comodel_name='attribute.set'relation='rel_attribute_set'string='Attribute Sets' -
attribute_typeSelectionargs: [('char', 'Char'), ('text', 'Text'), ('select', 'Select'), ('multiselect', 'Multiselect'), ('boolean', 'Boolean'), ('integer', 'Integer'), ('float', 'Float'), ('date', 'Date'), ('datetime', 'Datetime'), ('binary', 'Binary (file)'), ('image', 'Image')] -
create_dateDatetimereadonly=True args: 'Created date' -
field_idMany2one → ir.model.fieldsondelete='cascade'required=True args: 'ir.model.fields', 'Ir Model Fields' -
natureSelectiondefault='custom'required=Truestring='Attribute Nature' args: [('custom', 'Custom'), ('native', 'Native')] -
option_idsOne2many → attribute.optionargs: 'attribute.option', 'attribute_id', 'Attribute Options' -
relation_model_idMany2one → ir.modelondelete='cascade' args: 'ir.model', 'Relational Model' -
required_on_viewsBooleanhelp='If activated, the attribute will be mandatory on the views, but not in the database' args: 'Required (on views)' -
sequenceIntegerhelp="The attribute's order in his group" args: 'Sequence in Group' -
sequence_groupIntegerhelp='The sequence of the group'related='attribute_group_id.sequence'store='True' args: 'Sequence of the Group' -
serializedBooleanhelp="If serialized, the attribute's field will be stored in the serialization\n field 'x_custom_json_attrs' (i.e. a JSON containing all the serialized\n fields values) instead of creating a new SQL column for this\n attribute's field. Useful to increase speed requests if creating a\n high number of attributes." -
widgetCharhelp='Specify widget to add to the field on the views.'
-
button_add_options(self) -
copy(self, default=None)Ensure unique name when duplicating attribute. -
create(self, vals_list)@api.model_create_multiCreate an attribute.attribute - In case of a new "custom" attribute, a new field object 'ir.model.fields' will be created as this model "_inherits" 'ir.model.fields'. So we need to add here the mandatory 'ir.model.fields' instance's attributes to the new 'attribute.attribute'. - In case of a new "native" attribute, it will be linked to an existing field object 'ir.model.fields' (through "field_id") that cannot be modified. That's why we remove all the 'ir.model.fields' instance's attributes values from `vals` before creating our new 'attribute.attribute'. -
onchange_attribute_type(self)@api.onchange('attribute_type') -
onchange_field_description(self)@api.onchange('field_description') -
onchange_model_id(self)@api.onchange('model_id') -
onchange_name(self)@api.onchange('name') -
unlink(self)Delete the Attribute's related field when deleting a custom Attribute -
write(self, vals)
New fields (4)
-
attribute_idsOne2many → attribute.attributeargs: 'attribute.attribute', 'attribute_group_id', 'Attributes' -
model_idMany2one → ir.modelondelete='cascade'required=True args: 'ir.model', 'Model' -
nameCharrequired=Truetranslate=True -
sequenceIntegerhelp="The Group order in his attribute's Set" args: 'Sequence in Set'
No public methods.
New fields (5)
-
attribute_idMany2one → attribute.attributeondelete='cascade'required=True args: 'attribute.attribute', 'Product Attribute' -
nameCharrequired=Truetranslate=True -
relation_model_idMany2one → ir.modelondelete='cascade'related='attribute_id.relation_model_id' args: 'ir.model', 'Relational Model' -
sequenceInteger -
value_refReferenceselection='_selection_model_list'string='Reference'
No public methods.
New fields (2)
-
attribute_idMany2one → attribute.attributedefault=<expr>ondelete='cascade'required=True args: 'attribute.attribute', 'Product Attribute' -
option_idsMany2many → attribute.optionstring='Attribute Options' args: 'attribute.option'
-
create(self, vals_list)@api.model_create_multi -
get_views(self, views, options=None)@api.model -
validate(self)
New fields (8)
-
attribute_idsMany2many → attribute.attributecolumn1='attribute_set_id'column2='attribute_id'comodel_name='attribute.attribute'relation='rel_attribute_set'string='Attributes' -
child_idsOne2many → attribute.setcomodel_name='attribute.set'inverse_name='parent_id'string='Child Sets' -
complete_attribute_idsMany2many → attribute.attributecomodel_name='attribute.attribute'compute='_compute_complete_attribute_ids'recursive=Truestring='All Attributes (inherited)' -
modelCharhelp='This is a technical field in order to build filters on this one to avoidaccess on ir.model'related='model_id.model'store=Truestring='Model Name' -
model_idMany2one → ir.modelondelete='cascade'required=True args: 'ir.model', 'Model' -
nameCharrequired=Truetranslate=True -
parent_idMany2one → attribute.setcomodel_name='attribute.set'domain="[('model_id', '=', model_id)]"index=Trueondelete='restrict'string='Parent Set' -
parent_pathCharindex=True
No public methods.
New fields (1)
-
attribute_set_idMany2one → attribute.setdomain=<expr> args: 'attribute.set', 'Attribute Set'
-
get_view(self, view_id=None, view_type='form', **options) -
remove_native_fields(self, eview)@api.modelRemove native fields related to native attributes from eview
New fields (0)
No new fields.
Public methods (0)No public methods.
New fields (0)
No new fields.
Public methods (0)No public methods.
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…