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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def setUpClassAttribute(cls):
cls.value_model = cls.env["product.attribute.value"]
cls.attribute_line_model = cls.env["product.template.attribute.line"]
cls.attribute_value_model = cls.env["product.template.attribute.value"]
cls.attribute = cls.attribute_model.create({"name": "color"})
cls.attribute = cls.attribute_model.create({"name": "AT_color"})
cls.values = cls.env["product.attribute.value"]
for color in ["red", "blue", "green", "black"]:
value = cls.value_model.create(
Expand Down Expand Up @@ -122,7 +122,7 @@ def test_value_archive(self):
self._create_sale_order_lines(self.red_products)
# Trying to unlink the value here should raise an exception
# since it's still referenced by the car and pen product templates
regex = f"You cannot delete the value color: {self.red.name}"
regex = f"You cannot delete the value {self.attribute.name}: {self.red.name}"
with self.assertRaisesRegex(UserError, regex):
self.red.unlink()
# Remove the value from the set
Expand All @@ -145,7 +145,7 @@ def test_value_non_archiveable(self):
# to archive or unlink the value, and odoo should raise
# an exception saying that red is still referenced by car
regex = (
f"You cannot delete the value color: {self.red.name} "
f"You cannot delete the value {self.attribute.name}: {self.red.name} "
f"because it is used on the following products:\n{self.car.name}"
)
with self.assertRaisesRegex(UserError, regex):
Expand Down
95 changes: 95 additions & 0 deletions product_matrix_show_color/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
=========================
Product Matrix Show Color
=========================

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

.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--variant-lightgray.png?logo=github
:target: https://github.com/OCA/product-variant/tree/18.0/product_matrix_show_color
:alt: OCA/product-variant
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-variant-18-0/product-variant-18-0-product_matrix_show_color
: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-variant&target_branch=18.0
:alt: Try me on Runboat

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

This module shows colors of product variants in matrix table

|image|

.. |image| image:: https://raw.githubusercontent.com/OCA/product-variant/18.0/product_matrix_show_color/static/img/screenshot.png

**Table of contents**

.. contents::
:local:

Usage
=====



Known issues / Roadmap
======================



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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-variant/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-variant/issues/new?body=module:%20product_matrix_show_color%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
-------

* Nextev S.r.l
* Studio73

Contributors
------------

- Nextev Srl <`https://nextev.it\\> <https://nextev.it\>>`__:
- Studio73 <studio73.es>:
- `Studio73 <https://studio73.es>`__:

- Miguel Gandia

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.

This module is part of the `OCA/product-variant <https://github.com/OCA/product-variant/tree/18.0/product_matrix_show_color>`_ 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_matrix_show_color/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions product_matrix_show_color/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2020 Studio73 - Miguel Gandia
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "Product Matrix Show Color",
"summary": """
Technical module: Show attribute color in product matrix table
""",
"category": "Sales/Sales",
"version": "18.0.1.0.0",
"license": "LGPL-3",
"author": "Nextev S.r.l, Studio73," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/product-variant",
"depends": ["product_matrix"],
"installable": True,
"assets": {
"web.assets_backend": [
"product_matrix_show_color/static/src/scss/product_matrix.scss",
"product_matrix_show_color/static/src/xml/product_matrix.xml",
],
},
}
1 change: 1 addition & 0 deletions product_matrix_show_color/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_template_attribute_value
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020 Studio73 - Miguel Gandia

from odoo import models


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

def _grid_header_cell(self, fro_currency, to_currency, company, display_extra=True):
header_cell = super()._grid_header_cell(
fro_currency, to_currency, company, display_extra=display_extra
)
header_cell.update(
{"html_color": self[0].html_color if self and self[0].html_color else False}
)
return header_cell
3 changes: 3 additions & 0 deletions product_matrix_show_color/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Empty file.
4 changes: 4 additions & 0 deletions product_matrix_show_color/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Nextev Srl \<https://nextev.it\>:
- Studio73 \<studio73.es\>:
- [Studio73](https://studio73.es):
- Miguel Gandia
3 changes: 3 additions & 0 deletions product_matrix_show_color/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module shows colors of product variants in matrix table

![image](../static/img/screenshot.png)
1 change: 1 addition & 0 deletions product_matrix_show_color/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions product_matrix_show_color/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading