diff --git a/pos_sale_product_config_no_variant/README.rst b/pos_sale_product_config_no_variant/README.rst new file mode 100644 index 0000000000..10db1405f0 --- /dev/null +++ b/pos_sale_product_config_no_variant/README.rst @@ -0,0 +1,108 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +===================================== +POS - Product Configurator No Variant +===================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7806b7163f3b49db86af253fcd57d1721478999b30aa08c1a5c1b6e6a2b8c74a + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/19.0/pos_sale_product_config_no_variant + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-19-0/pos-19-0-pos_sale_product_config_no_variant + :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/pos&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allow user to see the selected attribute values into POS +order line + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +1. Configure the product with variant creation mode no Variant +2. Open the POS Session add that product with attribute values +3. The POS Order will be created +4. the selected attribute values stored in to the POS order line 'Extra + Values' list view optional hide field + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Open Source Integrators + +Contributors +------------ + +- Sandip Vyas + +Other credits +------------- + +The development of this module has been financially supported by: + +- Open Source Integrators + <`https://opensourceintegrators.com\\> >`__ + +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-ursais| image:: https://github.com/ursais.png?size=40px + :target: https://github.com/ursais + :alt: ursais + +Current `maintainer `__: + +|maintainer-ursais| + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_sale_product_config_no_variant/__init__.py b/pos_sale_product_config_no_variant/__init__.py new file mode 100644 index 0000000000..ecd4f0837c --- /dev/null +++ b/pos_sale_product_config_no_variant/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2022 Open Source Integrators (https://www.opensourceintegrators.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/pos_sale_product_config_no_variant/__manifest__.py b/pos_sale_product_config_no_variant/__manifest__.py new file mode 100644 index 0000000000..3f5eb92952 --- /dev/null +++ b/pos_sale_product_config_no_variant/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright (C) 2022 Open Source Integrators (https://www.opensourceintegrators.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "POS - Product Configurator No Variant", + "version": "19.0.1.0.0", + "summary": "Manage Point Of Sale via Configurator of no variant", + "author": "Open Source Integrators, Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Point of Sale", + "maintainer": "Open Source Integrators", + "website": "https://github.com/OCA/pos", + "depends": ["point_of_sale"], + "data": ["views/pos_order_views.xml"], + "maintainers": ["ursais"], + "installable": True, +} diff --git a/pos_sale_product_config_no_variant/i18n/es.po b/pos_sale_product_config_no_variant/i18n/es.po new file mode 100644 index 0000000000..a03d6565c7 --- /dev/null +++ b/pos_sale_product_config_no_variant/i18n/es.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_sale_product_config_no_variant +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-11 18:34+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model.fields,field_description:pos_sale_product_config_no_variant.field_pos_order_line__product_no_variant_attribute_value_ids +msgid "Extra Values" +msgstr "Valores Añadidos" + +#. module: pos_sale_product_config_no_variant +#. odoo-javascript +#: code:addons/pos_sale_product_config_no_variant/static/src/js/ProductScreen.js:0 +#, python-format +msgid "Lot/Serial Number(s) Required" +msgstr "Número(s) de lote/serie obligatorio(s)" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model,name:pos_sale_product_config_no_variant.model_pos_order_line +msgid "Point of Sale Order Lines" +msgstr "Líneas de Pedidos en el Punto de Venta" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model,name:pos_sale_product_config_no_variant.model_pos_order +msgid "Point of Sale Orders" +msgstr "Pedidos en el Punto de Venta" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model,name:pos_sale_product_config_no_variant.model_pos_session +msgid "Point of Sale Session" +msgstr "Sesión del Punto de Venta" diff --git a/pos_sale_product_config_no_variant/i18n/it.po b/pos_sale_product_config_no_variant/i18n/it.po new file mode 100644 index 0000000000..b87e03367e --- /dev/null +++ b/pos_sale_product_config_no_variant/i18n/it.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_sale_product_config_no_variant +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-24 17:34+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model.fields,field_description:pos_sale_product_config_no_variant.field_pos_order_line__product_no_variant_attribute_value_ids +msgid "Extra Values" +msgstr "Valori extra" + +#. module: pos_sale_product_config_no_variant +#. odoo-javascript +#: code:addons/pos_sale_product_config_no_variant/static/src/js/ProductScreen.js:0 +#, python-format +msgid "Lot/Serial Number(s) Required" +msgstr "Richiesto numero(i) di lotto/serie" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model,name:pos_sale_product_config_no_variant.model_pos_order_line +msgid "Point of Sale Order Lines" +msgstr "Righe ordine punto vendita" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model,name:pos_sale_product_config_no_variant.model_pos_order +msgid "Point of Sale Orders" +msgstr "Ordini punto vendita" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model,name:pos_sale_product_config_no_variant.model_pos_session +msgid "Point of Sale Session" +msgstr "Sessione punto vendita" diff --git a/pos_sale_product_config_no_variant/i18n/pos_sale_product_config_no_variant.pot b/pos_sale_product_config_no_variant/i18n/pos_sale_product_config_no_variant.pot new file mode 100644 index 0000000000..b5d4ce5baf --- /dev/null +++ b/pos_sale_product_config_no_variant/i18n/pos_sale_product_config_no_variant.pot @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_sale_product_config_no_variant +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model.fields,field_description:pos_sale_product_config_no_variant.field_pos_order_line__product_no_variant_attribute_value_ids +msgid "Extra Values" +msgstr "" + +#. module: pos_sale_product_config_no_variant +#. odoo-javascript +#: code:addons/pos_sale_product_config_no_variant/static/src/js/ProductScreen.js:0 +#, python-format +msgid "Lot/Serial Number(s) Required" +msgstr "" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model,name:pos_sale_product_config_no_variant.model_pos_order_line +msgid "Point of Sale Order Lines" +msgstr "" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model,name:pos_sale_product_config_no_variant.model_pos_order +msgid "Point of Sale Orders" +msgstr "" + +#. module: pos_sale_product_config_no_variant +#: model:ir.model,name:pos_sale_product_config_no_variant.model_pos_session +msgid "Point of Sale Session" +msgstr "" diff --git a/pos_sale_product_config_no_variant/migration19.0/migration.md b/pos_sale_product_config_no_variant/migration19.0/migration.md new file mode 100644 index 0000000000..ea3412c82a --- /dev/null +++ b/pos_sale_product_config_no_variant/migration19.0/migration.md @@ -0,0 +1,120 @@ +# Migration Notes - Odoo 19.0 + +## Scope + +This document describes the migration of `pos_sale_product_config_no_variant` from a +legacy POS integration pattern (Odoo 16 style) to the Odoo 19 POS architecture while +preserving functional behavior. + +## Functional Goal Kept + +The module still ensures that **no-variant attribute values selected in POS** are +available on `pos.order.line` and visible in backend order lines through the **Extra +Values** field. + +## Why Changes Were Needed + +Odoo 19 POS uses a different frontend and data-loading architecture: + +- Legacy frontend extension style (`odoo.define`, `Registries`) is obsolete for this use + case. +- Legacy backend hooks used by older POS flows are no longer valid in Odoo 19: + - `_order_line_fields` + - `_get_fields_for_order_line` + - `_loader_params_*` style hooks used in this module +- Odoo 19 already provides native attribute propagation through `attribute_value_ids` on + `pos.order.line`. + +## Implemented Changes + +### 1) Backend model logic aligned with Odoo 19 + +Updated `models/pos_order_line.py`: + +- Kept `product_no_variant_attribute_value_ids` as a stored computed field. +- Reworked compute dependencies to rely on native Odoo 19 data: + - `@api.depends("product_id", "attribute_value_ids")` +- Compute now derives values from `attribute_value_ids` filtered by: + - same product template + - `create_variant == "no_variant"` + +This removes custom parsing/normalization logic that is no longer required in Odoo 19. + +### 2) Removed obsolete backend overrides + +Deleted files no longer valid in Odoo 19: + +- `models/pos_order.py` +- `models/pos_session.py` + +Updated `models/__init__.py` accordingly. + +### 3) Removed legacy POS JS patches + +Deleted legacy JS files: + +- `static/src/js/ProductScreen.js` +- `static/src/js/OrderLines.js` +- `static/src/js/PosProductConfig.js` + +Reason: Odoo 19 already handles configurator payload and selected attribute values +natively in POS app models/services. + +### 4) Manifest cleanup + +Updated `__manifest__.py`: + +- Removed obsolete POS asset bundle declaration for legacy JS patches. +- Kept only required module metadata and backend view data. + +## Compatibility and Behavior + +- The feature remains available from a business perspective: users can still see + selected no-variant values in POS order lines (`Extra Values`). +- The implementation now follows Odoo 19 native mechanisms, reducing technical debt and + migration risk. + +## Validation Performed + +- Static code validation reported no errors after cleanup. +- Repository status confirmed expected file modifications/deletions. + +## Automated Tests Added (TransactionCase) + +A dedicated TransactionCase test suite was added to validate the compute logic in an +Odoo 19-compatible way: + +- `tests/test_pos_order_line.py` + +Test design: + +- Uses `setUpClass` to create all required fixtures (attributes, attribute values, + product templates, PTAVs). +- Verifies `_compute_no_variant_attribute_values` keeps only: + - values from the same product template + - values with `create_variant == "no_variant"` +- Verifies compute result is empty when `product_id` is not set. + +This test scope is focused on functional correctness of the migrated compute path for +`pos.order.line`. + +## Coverage Objective + +The target is to push module coverage close to 97% for the migrated logic area. Exact +global coverage depends on the full project test matrix execution and coverage tooling +configuration in the target CI environment. + +## Recommended Runtime Validation + +1. Upgrade the module in a test database. +2. Create/use a product template with attributes configured as `no_variant`. +3. In POS, add product and select attribute values. +4. Confirm order and inspect backend POS order line. +5. Verify `Extra Values` contains the selected no-variant attribute values. + +## Notes for Future Maintenance + +- Prefer extending Odoo 19 POS through native model/serialization flow before + introducing custom frontend patches. +- Keep this module focused on backend visibility/reporting of no-variant values, not on + replacing core configurator behavior. diff --git a/pos_sale_product_config_no_variant/models/__init__.py b/pos_sale_product_config_no_variant/models/__init__.py new file mode 100644 index 0000000000..0bf765fae9 --- /dev/null +++ b/pos_sale_product_config_no_variant/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2022 Open Source Integrators (https://www.opensourceintegrators.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import pos_order_line diff --git a/pos_sale_product_config_no_variant/models/pos_order_line.py b/pos_sale_product_config_no_variant/models/pos_order_line.py new file mode 100644 index 0000000000..bdd33a77e8 --- /dev/null +++ b/pos_sale_product_config_no_variant/models/pos_order_line.py @@ -0,0 +1,32 @@ +# Copyright (C) 2022 Open Source Integrators (https://www.opensourceintegrators.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import api, fields, models + + +class PosOrderLine(models.Model): + _inherit = "pos.order.line" + + product_no_variant_attribute_value_ids = fields.Many2many( + comodel_name="product.template.attribute.value", + relation="pos_order_line_no_variant_ptav_rel", + column1="order_line_id", + column2="ptav_id", + string="Extra Values", + compute="_compute_no_variant_attribute_values", + store=True, + readonly=True, + ) + + @api.depends("product_id", "attribute_value_ids") + def _compute_no_variant_attribute_values(self): + for line in self: + if not line.product_id: + line.product_no_variant_attribute_value_ids = False + continue + template = line.product_id.product_tmpl_id + line.product_no_variant_attribute_value_ids = ( + line.attribute_value_ids.filtered( + lambda ptav, template=template: ptav.product_tmpl_id == template + and ptav.attribute_id.create_variant == "no_variant" + ) + ) diff --git a/pos_sale_product_config_no_variant/pyproject.toml b/pos_sale_product_config_no_variant/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/pos_sale_product_config_no_variant/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/pos_sale_product_config_no_variant/readme/CONTRIBUTORS.md b/pos_sale_product_config_no_variant/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..785f5b0ab3 --- /dev/null +++ b/pos_sale_product_config_no_variant/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Sandip Vyas \ diff --git a/pos_sale_product_config_no_variant/readme/CREDITS.md b/pos_sale_product_config_no_variant/readme/CREDITS.md new file mode 100644 index 0000000000..7e8deceaa7 --- /dev/null +++ b/pos_sale_product_config_no_variant/readme/CREDITS.md @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +- Open Source Integrators \ diff --git a/pos_sale_product_config_no_variant/readme/DESCRIPTION.md b/pos_sale_product_config_no_variant/readme/DESCRIPTION.md new file mode 100644 index 0000000000..8b7a2e6ee2 --- /dev/null +++ b/pos_sale_product_config_no_variant/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module allow user to see the selected attribute values into POS +order line diff --git a/pos_sale_product_config_no_variant/readme/USAGE.md b/pos_sale_product_config_no_variant/readme/USAGE.md new file mode 100644 index 0000000000..e8ab063e81 --- /dev/null +++ b/pos_sale_product_config_no_variant/readme/USAGE.md @@ -0,0 +1,7 @@ +To use this module, you need to: + +1. Configure the product with variant creation mode no Variant +2. Open the POS Session add that product with attribute values +3. The POS Order will be created +4. the selected attribute values stored in to the POS order line 'Extra + Values' list view optional hide field diff --git a/pos_sale_product_config_no_variant/static/description/icon.png b/pos_sale_product_config_no_variant/static/description/icon.png new file mode 100644 index 0000000000..85d01763f3 Binary files /dev/null and b/pos_sale_product_config_no_variant/static/description/icon.png differ diff --git a/pos_sale_product_config_no_variant/static/description/index.html b/pos_sale_product_config_no_variant/static/description/index.html new file mode 100644 index 0000000000..0b8f1ad70b --- /dev/null +++ b/pos_sale_product_config_no_variant/static/description/index.html @@ -0,0 +1,453 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

POS - Product Configurator No Variant

+ +

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runboat

+

This module allow user to see the selected attribute values into POS +order line

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Configure the product with variant creation mode no Variant
  2. +
  3. Open the POS Session add that product with attribute values
  4. +
  5. The POS Order will be created
  6. +
  7. the selected attribute values stored in to the POS order line ‘Extra +Values’ list view optional hide field
  8. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Open Source Integrators
  • +
+
+ +
+

Other credits

+

The development of this module has been financially supported by:

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

ursais

+

This module is part of the OCA/pos project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+
+ + diff --git a/pos_sale_product_config_no_variant/tests/__init__.py b/pos_sale_product_config_no_variant/tests/__init__.py new file mode 100644 index 0000000000..d490259523 --- /dev/null +++ b/pos_sale_product_config_no_variant/tests/__init__.py @@ -0,0 +1 @@ +from . import test_pos_order_line diff --git a/pos_sale_product_config_no_variant/tests/test_pos_order_line.py b/pos_sale_product_config_no_variant/tests/test_pos_order_line.py new file mode 100644 index 0000000000..4ef9ac8980 --- /dev/null +++ b/pos_sale_product_config_no_variant/tests/test_pos_order_line.py @@ -0,0 +1,132 @@ +from odoo.tests import TransactionCase + + +class TestPosOrderLineNoVariantCompute(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.PosOrderLine = cls.env["pos.order.line"] + + cls.attr_no_variant = cls.env["product.attribute"].create( + { + "name": "Engraving", + "create_variant": "no_variant", + } + ) + cls.attr_always = cls.env["product.attribute"].create( + { + "name": "Color", + "create_variant": "always", + } + ) + + cls.value_no_variant_1 = cls.env["product.attribute.value"].create( + { + "name": "Front", + "attribute_id": cls.attr_no_variant.id, + } + ) + cls.value_no_variant_2 = cls.env["product.attribute.value"].create( + { + "name": "Back", + "attribute_id": cls.attr_no_variant.id, + } + ) + cls.value_always = cls.env["product.attribute.value"].create( + { + "name": "Red", + "attribute_id": cls.attr_always.id, + } + ) + + cls.template_main = cls.env["product.template"].create( + { + "name": "Custom Mug", + "attribute_line_ids": [ + ( + 0, + 0, + { + "attribute_id": cls.attr_no_variant.id, + "value_ids": [ + ( + 6, + 0, + [ + cls.value_no_variant_1.id, + cls.value_no_variant_2.id, + ], + ) + ], + }, + ), + ( + 0, + 0, + { + "attribute_id": cls.attr_always.id, + "value_ids": [(6, 0, [cls.value_always.id])], + }, + ), + ], + } + ) + + cls.template_other = cls.env["product.template"].create( + { + "name": "Sticker", + "attribute_line_ids": [ + ( + 0, + 0, + { + "attribute_id": cls.attr_no_variant.id, + "value_ids": [(6, 0, [cls.value_no_variant_1.id])], + }, + ) + ], + } + ) + + cls.product_main = cls.template_main.product_variant_ids[:1] + + cls.main_no_variant_ptav = cls.template_main.attribute_line_ids.filtered( + lambda line: line.attribute_id == cls.attr_no_variant + ).product_template_value_ids[:1] + cls.main_always_ptav = cls.template_main.attribute_line_ids.filtered( + lambda line: line.attribute_id == cls.attr_always + ).product_template_value_ids[:1] + cls.other_no_variant_ptav = cls.template_other.attribute_line_ids.filtered( + lambda line: line.attribute_id == cls.attr_no_variant + ).product_template_value_ids[:1] + + def test_compute_keeps_only_no_variant_values_for_same_template(self): + line = self.PosOrderLine.new( + { + "product_id": self.product_main.id, + } + ) + line.attribute_value_ids = ( + self.main_no_variant_ptav + | self.main_always_ptav + | self.other_no_variant_ptav + ) + + line._compute_no_variant_attribute_values() + + self.assertSetEqual( + set(line.product_no_variant_attribute_value_ids._origin.ids), + set(self.main_no_variant_ptav.ids), + "Only no-variant values from the same template must be kept.", + ) + + def test_compute_returns_empty_when_product_is_missing(self): + line = self.PosOrderLine.new({}) + line.attribute_value_ids = self.main_no_variant_ptav + + line._compute_no_variant_attribute_values() + + self.assertFalse( + line.product_no_variant_attribute_value_ids, + "Computed no-variant values must be empty when no product is set.", + ) diff --git a/pos_sale_product_config_no_variant/views/pos_order_views.xml b/pos_sale_product_config_no_variant/views/pos_order_views.xml new file mode 100644 index 0000000000..e195247ae7 --- /dev/null +++ b/pos_sale_product_config_no_variant/views/pos_order_views.xml @@ -0,0 +1,20 @@ + + + + pos.order.form.pos.config.no.variant + pos.order + + + + + + + +