Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions product_attribute_value_name_search/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
===================================
Product Attribute Value Name Search
===================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b0f80a0321559296df8bf766ddda6ab3aa8f884dad007e80da804fd6024fa40b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/18.0/product_attribute_value_name_search
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-product_attribute_value_name_search
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module enhances the name search of product template attribute
values to support the composite "Attribute: Value" display name format.

In standard Odoo, ``product.template.attribute.value`` records display
as "Attribute: Value" (e.g., "Color: Red"), but the search only looks at
the ``name`` field. This means attribute values with the same name under
different attributes (e.g., "Red" under both "Color" and "Size") cannot
be distinguished during import or name-based lookups.

With this module installed, searching for "Color: Red" will match only
the "Red" value under the "Color" attribute, enabling unambiguous
matching by display name.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_attribute_value_name_search%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Quartile

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-yostashiro| image:: https://github.com/yostashiro.png?size=40px
:target: https://github.com/yostashiro
:alt: yostashiro

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-yostashiro|

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/18.0/product_attribute_value_name_search>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions product_attribute_value_name_search/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions product_attribute_value_name_search/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2026 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Product Attribute Value Name Search",
"summary": "Search for product attribute values with display name",
"version": "18.0.1.0.0",
"category": "Product",
"license": "AGPL-3",
"website": "https://github.com/OCA/product-attribute",
"author": "Quartile, Odoo Community Association (OCA)",
"depends": ["product"],
"maintainers": ["yostashiro"],
"installable": True,
}
1 change: 1 addition & 0 deletions product_attribute_value_name_search/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_attribute_value
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2026 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models
from odoo.osv.expression import NEGATIVE_TERM_OPERATORS

SEPARATOR = ": "


class ProductTemplateAttributeValue(models.Model):
_inherit = "product.template.attribute.value"

@api.model
def _search_display_name(self, operator, value):
if value and SEPARATOR in str(value):
attr_name, val_name = str(value).split(SEPARATOR, 1)
if operator in NEGATIVE_TERM_OPERATORS:
return [
"|",
("attribute_id.name", operator, attr_name),
("name", operator, val_name),
]
return [
("attribute_id.name", operator, attr_name),
("name", operator, val_name),
]
return super()._search_display_name(operator, value)
3 changes: 3 additions & 0 deletions product_attribute_value_name_search/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
12 changes: 12 additions & 0 deletions product_attribute_value_name_search/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This module enhances the name search of product template attribute values to
support the composite "Attribute: Value" display name format.

In standard Odoo, ``product.template.attribute.value`` records display as
"Attribute: Value" (e.g., "Color: Red"), but the search only looks at the
``name`` field. This means attribute values with the same name under different
attributes (e.g., "Red" under both "Color" and "Size") cannot be distinguished
during import or name-based lookups.

With this module installed, searching for "Color: Red" will match only the
"Red" value under the "Color" attribute, enabling unambiguous matching by
display name.
Loading