diff --git a/pos_product_display_default_code/README.rst b/pos_product_display_default_code/README.rst new file mode 100644 index 0000000000..6aeb395e84 --- /dev/null +++ b/pos_product_display_default_code/README.rst @@ -0,0 +1,100 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +================================ +PoS Product Display Default Code +================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:1ad717dfbd45ebbc7f1819902d6740233d0c6415d1e7ca0b5411523a84215bab + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_product_display_default_code + :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_product_display_default_code + :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 makes Odoo show the internal reference of the product in the +Point of Sale. + +The reference will appear in the products list, in the orderlines and in +the receipt. + +example: Desk Organizer -> [FURN0001] Desk Organizer + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +- Go to Point Of Sale / Configuration / Settings +- Check the box 'Display Default Code' in Product & PoS categories + +|image| + +.. |image| image:: https://raw.githubusercontent.com/OCA/pos/19.0/pos_product_display_default_code/static/description/config.png + +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 +------- + +* Akretion +* FactorLibre + +Contributors +------------ + +- Juan Carlos Bonilla +- CIT-Services <> + + - Prayag + +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/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_product_display_default_code/__init__.py b/pos_product_display_default_code/__init__.py new file mode 100644 index 0000000000..d3c39c0180 --- /dev/null +++ b/pos_product_display_default_code/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2023 FactorLibre - Juan Carlos Bonilla +from . import models diff --git a/pos_product_display_default_code/__manifest__.py b/pos_product_display_default_code/__manifest__.py new file mode 100644 index 0000000000..71bab80fcf --- /dev/null +++ b/pos_product_display_default_code/__manifest__.py @@ -0,0 +1,27 @@ +{ + "name": "PoS Product Display Default Code", + "summary": "pos: display product default code before product name", + "version": "19.0.1.0.0", + "category": "Point of Sale", + "website": "https://github.com/OCA/pos", + "author": "Odoo Community Association (OCA), Akretion, FactorLibre", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "point_of_sale", + ], + "data": [ + "views/res_config_settings_views.xml", + ], + "assets": { + "web.assets_tests": [ + "pos_product_display_default_code/static/tests/pos/tours/**/*", + ], + "point_of_sale._assets_pos": [ + "pos_product_display_default_code/static/src/product_display.esm.js", + ], + }, + "demo": [], + "qweb": [], +} diff --git a/pos_product_display_default_code/i18n/de.po b/pos_product_display_default_code/i18n/de.po new file mode 100644 index 0000000000..aa991ad6c5 --- /dev/null +++ b/pos_product_display_default_code/i18n/de.po @@ -0,0 +1,46 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_product_display_default_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-10-22 10:42+0000\n" +"Last-Translator: Bastian Günther \n" +"Language-Team: none\n" +"Language: de\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 5.10.4\n" + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_res_config_settings +msgid "Config Settings" +msgstr "Konfigurationseinstellungen" + +#. module: pos_product_display_default_code +#: model:ir.model.fields,field_description:pos_product_display_default_code.field_pos_config__display_default_code +#: model:ir.model.fields,field_description:pos_product_display_default_code.field_res_config_settings__pos_display_default_code +#: model_terms:ir.ui.view,arch_db:pos_product_display_default_code.res_config_settings_default_code_view_form +msgid "Display Default Code" +msgstr "Standardcode anzeigen" + +#. module: pos_product_display_default_code +#: model_terms:ir.ui.view,arch_db:pos_product_display_default_code.res_config_settings_default_code_view_form +msgid "Display products' internal reference in the PoS interface and tickets." +msgstr "" +"Interne Referenz der Produkte in der PoS-Oberfläche und auf den Belegen " +"anzeigen." + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Kassensystem-Konfiguration" + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_pos_session +msgid "Point of Sale Session" +msgstr "Kassensitzung" diff --git a/pos_product_display_default_code/i18n/es.po b/pos_product_display_default_code/i18n/es.po new file mode 100644 index 0000000000..59dc134228 --- /dev/null +++ b/pos_product_display_default_code/i18n/es.po @@ -0,0 +1,46 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_product_display_default_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-02-14 15:18+0000\n" +"PO-Revision-Date: 2026-05-10 17:55+0000\n" +"Last-Translator: Ed-Spain \n" +"Language-Team: \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 5.15.2\n" + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_res_config_settings +msgid "Config Settings" +msgstr "Configurar ajustes" + +#. module: pos_product_display_default_code +#: model:ir.model.fields,field_description:pos_product_display_default_code.field_pos_config__display_default_code +#: model:ir.model.fields,field_description:pos_product_display_default_code.field_res_config_settings__pos_display_default_code +#: model_terms:ir.ui.view,arch_db:pos_product_display_default_code.res_config_settings_default_code_view_form +msgid "Display Default Code" +msgstr "Mostrar referencia interna" + +#. module: pos_product_display_default_code +#: model_terms:ir.ui.view,arch_db:pos_product_display_default_code.res_config_settings_default_code_view_form +msgid "Display products' internal reference in the PoS interface and tickets." +msgstr "" +"Mostrar referencia interna del producto en la interfaz del TPV y tickets." + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuración del TPV" + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_pos_session +msgid "Point of Sale Session" +msgstr "Sesión TPV" diff --git a/pos_product_display_default_code/i18n/it.po b/pos_product_display_default_code/i18n/it.po new file mode 100644 index 0000000000..7ebdf2c0ac --- /dev/null +++ b/pos_product_display_default_code/i18n/it.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_product_display_default_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-03-09 13:22+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.14.1\n" + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_res_config_settings +msgid "Config Settings" +msgstr "Impostazioni configurazione" + +#. module: pos_product_display_default_code +#: model:ir.model.fields,field_description:pos_product_display_default_code.field_pos_config__display_default_code +#: model:ir.model.fields,field_description:pos_product_display_default_code.field_res_config_settings__pos_display_default_code +#: model_terms:ir.ui.view,arch_db:pos_product_display_default_code.res_config_settings_default_code_view_form +msgid "Display Default Code" +msgstr "Visualizza codice predefinito" + +#. module: pos_product_display_default_code +#: model_terms:ir.ui.view,arch_db:pos_product_display_default_code.res_config_settings_default_code_view_form +msgid "Display products' internal reference in the PoS interface and tickets." +msgstr "" +"Visualizza riferimento interno del prodotto nell'interfaccia e scontrini PoS." + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configurazione punto vendita" + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_pos_session +msgid "Point of Sale Session" +msgstr "Sessione punto vendita" diff --git a/pos_product_display_default_code/i18n/pos_product_display_default_code.pot b/pos_product_display_default_code/i18n/pos_product_display_default_code.pot new file mode 100644 index 0000000000..d7bb2eac4e --- /dev/null +++ b/pos_product_display_default_code/i18n/pos_product_display_default_code.pot @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_product_display_default_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: pos_product_display_default_code +#: model:ir.model.fields,field_description:pos_product_display_default_code.field_pos_config__display_default_code +#: model:ir.model.fields,field_description:pos_product_display_default_code.field_res_config_settings__pos_display_default_code +#: model_terms:ir.ui.view,arch_db:pos_product_display_default_code.res_config_settings_default_code_view_form +msgid "Display Default Code" +msgstr "" + +#. module: pos_product_display_default_code +#: model_terms:ir.ui.view,arch_db:pos_product_display_default_code.res_config_settings_default_code_view_form +msgid "Display products' internal reference in the PoS interface and tickets." +msgstr "" + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_product_display_default_code +#: model:ir.model,name:pos_product_display_default_code.model_product_product +msgid "Product Variant" +msgstr "" diff --git a/pos_product_display_default_code/models/__init__.py b/pos_product_display_default_code/models/__init__.py new file mode 100644 index 0000000000..92e4511675 --- /dev/null +++ b/pos_product_display_default_code/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2023 FactorLibre - Juan Carlos Bonilla +from . import product_product +from . import product_template +from . import pos_config +from . import res_config_settings diff --git a/pos_product_display_default_code/models/pos_config.py b/pos_product_display_default_code/models/pos_config.py new file mode 100644 index 0000000000..023dbb6b08 --- /dev/null +++ b/pos_product_display_default_code/models/pos_config.py @@ -0,0 +1,10 @@ +# Copyright 2023 FactorLibre - Juan Carlos Bonilla +from odoo import fields, models + + +class PosConfig(models.Model): + _inherit = "pos.config" + + display_default_code = fields.Boolean( + default=False, help="Display default code along with name inside PoS." + ) diff --git a/pos_product_display_default_code/models/product_product.py b/pos_product_display_default_code/models/product_product.py new file mode 100644 index 0000000000..531b7694cf --- /dev/null +++ b/pos_product_display_default_code/models/product_product.py @@ -0,0 +1,13 @@ +from odoo import api, models + + +class ProductProduct(models.Model): + _inherit = "product.product" + + @api.model + def _load_pos_data_read(self, records, config): + if config.display_default_code: + records = records.with_context(display_default_code=True) + else: + records = records.with_context(display_default_code=False) + return super()._load_pos_data_read(records, config) diff --git a/pos_product_display_default_code/models/product_template.py b/pos_product_display_default_code/models/product_template.py new file mode 100644 index 0000000000..c139d977fb --- /dev/null +++ b/pos_product_display_default_code/models/product_template.py @@ -0,0 +1,13 @@ +from odoo import api, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + @api.model + def _load_pos_data_read(self, records, config): + if config.display_default_code: + records = records.with_context(display_default_code=True) + else: + records = records.with_context(display_default_code=False) + return super()._load_pos_data_read(records, config) diff --git a/pos_product_display_default_code/models/res_config_settings.py b/pos_product_display_default_code/models/res_config_settings.py new file mode 100644 index 0000000000..3a29982410 --- /dev/null +++ b/pos_product_display_default_code/models/res_config_settings.py @@ -0,0 +1,10 @@ +# Copyright 2023 FactorLibre - Juan Carlos Bonilla +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + pos_display_default_code = fields.Boolean( + related="pos_config_id.display_default_code", readonly=False + ) diff --git a/pos_product_display_default_code/pyproject.toml b/pos_product_display_default_code/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/pos_product_display_default_code/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/pos_product_display_default_code/readme/CONFIGURE.md b/pos_product_display_default_code/readme/CONFIGURE.md new file mode 100644 index 0000000000..b4e1ccd556 --- /dev/null +++ b/pos_product_display_default_code/readme/CONFIGURE.md @@ -0,0 +1,4 @@ +- Go to Point Of Sale / Configuration / Settings +- Check the box 'Display Default Code' in Product & PoS categories + +![image](../static/description/config.png) diff --git a/pos_product_display_default_code/readme/CONTRIBUTORS.md b/pos_product_display_default_code/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..9cf1b0c575 --- /dev/null +++ b/pos_product_display_default_code/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Juan Carlos Bonilla \<\> +- CIT-Services \<\> + - Prayag \<\> diff --git a/pos_product_display_default_code/readme/DESCRIPTION.md b/pos_product_display_default_code/readme/DESCRIPTION.md new file mode 100644 index 0000000000..bf8d3cba90 --- /dev/null +++ b/pos_product_display_default_code/readme/DESCRIPTION.md @@ -0,0 +1,7 @@ +This module makes Odoo show the internal reference of the product in the +Point of Sale. + +The reference will appear in the products list, in the orderlines and in +the receipt. + +example: Desk Organizer -\> \[FURN0001\] Desk Organizer diff --git a/pos_product_display_default_code/static/description/config.png b/pos_product_display_default_code/static/description/config.png new file mode 100644 index 0000000000..b013b69beb Binary files /dev/null and b/pos_product_display_default_code/static/description/config.png differ diff --git a/pos_product_display_default_code/static/description/icon.png b/pos_product_display_default_code/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_product_display_default_code/static/description/icon.png differ diff --git a/pos_product_display_default_code/static/description/index.html b/pos_product_display_default_code/static/description/index.html new file mode 100644 index 0000000000..216e7895ad --- /dev/null +++ b/pos_product_display_default_code/static/description/index.html @@ -0,0 +1,447 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

PoS Product Display Default Code

+ +

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

+

This module makes Odoo show the internal reference of the product in the +Point of Sale.

+

The reference will appear in the products list, in the orderlines and in +the receipt.

+

example: Desk Organizer -> [FURN0001] Desk Organizer

+

Table of contents

+ +
+

Configuration

+
    +
  • Go to Point Of Sale / Configuration / Settings
  • +
  • Check the box ‘Display Default Code’ in Product & PoS categories
  • +
+

image

+
+
+

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

+
    +
  • Akretion
  • +
  • FactorLibre
  • +
+
+
+

Contributors

+ +
+
+

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.

+

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_product_display_default_code/static/src/product_display.esm.js b/pos_product_display_default_code/static/src/product_display.esm.js new file mode 100644 index 0000000000..925bdd1fa7 --- /dev/null +++ b/pos_product_display_default_code/static/src/product_display.esm.js @@ -0,0 +1,29 @@ +import {PosOrderline} from "@point_of_sale/app/models/pos_order_line"; +import {ProductScreen} from "@point_of_sale/app/screens/product_screen/product_screen"; +import {patch} from "@web/core/utils/patch"; + +patch(ProductScreen.prototype, { + getProductName(product) { + if (this.pos?.config?.display_default_code && product?.display_name) { + return product.display_name; + } + return super.getProductName(product); + }, +}); + +patch(PosOrderline.prototype, { + get orderDisplayProductName() { + const res = super.orderDisplayProductName; + if (this.config?.display_default_code && this.product_id?.display_name) { + return {...res, name: this.product_id.display_name}; + } + return res; + }, + + setFullProductName() { + super.setFullProductName(); + if (this.config?.display_default_code && this.product_id?.display_name) { + this.full_product_name = this.product_id.display_name; + } + }, +}); diff --git a/pos_product_display_default_code/static/tests/pos/tours/product_screen_tour.esm.js b/pos_product_display_default_code/static/tests/pos/tours/product_screen_tour.esm.js new file mode 100644 index 0000000000..d8cdf82c65 --- /dev/null +++ b/pos_product_display_default_code/static/tests/pos/tours/product_screen_tour.esm.js @@ -0,0 +1,13 @@ +import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util"; +import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util"; +import {registry} from "@web/core/registry"; + +registry.category("web_tour.tours").add("SearchProductByDefaultCode", { + steps: () => + [ + Chrome.startPoS(), + ProductScreen.searchProduct("CHAIR_01"), + ProductScreen.clickDisplayedProduct("[CHAIR_01] Test sofa", true, "1.0"), + ProductScreen.closePos(), + ].flat(), +}); diff --git a/pos_product_display_default_code/tests/__init__.py b/pos_product_display_default_code/tests/__init__.py new file mode 100644 index 0000000000..99610dbcca --- /dev/null +++ b/pos_product_display_default_code/tests/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2023 FactorLibre - Juan Carlos Bonilla +from . import test_config_display_default_code +from . import test_frontend diff --git a/pos_product_display_default_code/tests/test_config_display_default_code.py b/pos_product_display_default_code/tests/test_config_display_default_code.py new file mode 100644 index 0000000000..e8ae1341c7 --- /dev/null +++ b/pos_product_display_default_code/tests/test_config_display_default_code.py @@ -0,0 +1,64 @@ +# Copyright 2023 FactorLibre - Juan Carlos Bonilla + +import odoo + +from odoo.addons.point_of_sale.tests.common import TestPoSCommon + + +@odoo.tests.tagged("post_install", "-at_install") +class TestPosDisplayDefaultCode(TestPoSCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.config = cls.basic_config + cls.config.display_default_code = True + cls.product_test = cls.env["product.product"].create( + { + "name": "Test sofa", + "available_in_pos": True, + "default_code": "CHAIR_01", + } + ) + + def test_config_display_default_code(self): + result = self.config.display_default_code + self.assertTrue(result) + + def test_product_load_pos_data_read_with_default_code(self): + self.config.display_default_code = True + res_product = self.env["product.product"]._load_pos_data_read( + self.product_test, self.config + ) + self.assertTrue(len(res_product) > 0) + self.assertEqual(res_product[0]["display_name"], "[CHAIR_01] Test sofa") + + res_template = self.env["product.template"]._load_pos_data_read( + self.product_test.product_tmpl_id, self.config + ) + self.assertTrue(len(res_template) > 0) + + def test_product_load_pos_data_read_without_default_code(self): + self.config.display_default_code = False + res_product = self.env["product.product"]._load_pos_data_read( + self.product_test, self.config + ) + self.assertTrue(len(res_product) > 0) + self.assertEqual(res_product[0]["display_name"], "Test sofa") + + res_template = self.env["product.template"]._load_pos_data_read( + self.product_test.product_tmpl_id, self.config + ) + self.assertTrue(len(res_template) > 0) + + def test_res_config_settings(self): + res_config = ( + self.env["res.config.settings"] + .with_context(default_pos_config_id=self.config.id) + .create( + { + "pos_display_default_code": True, + } + ) + ) + res_config.execute() + self.assertTrue(self.config.display_default_code) diff --git a/pos_product_display_default_code/tests/test_frontend.py b/pos_product_display_default_code/tests/test_frontend.py new file mode 100644 index 0000000000..989af82b28 --- /dev/null +++ b/pos_product_display_default_code/tests/test_frontend.py @@ -0,0 +1,19 @@ +import odoo.tests + +from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon + + +@odoo.tests.tagged("post_install", "-at_install") +class TestUi(TestPointOfSaleHttpCommon): + def test_product_search_by_default_code(self): + self.env["product.product"].create( + { + "name": "Test sofa", + "available_in_pos": True, + "default_code": "CHAIR_01", + } + ) + self.main_pos_config.display_default_code = True + self.main_pos_config.with_user(self.pos_user).open_ui() + self.main_pos_config.current_session_id.set_opening_control(0, "") + self.start_pos_tour("SearchProductByDefaultCode") diff --git a/pos_product_display_default_code/views/res_config_settings_views.xml b/pos_product_display_default_code/views/res_config_settings_views.xml new file mode 100644 index 0000000000..be0144a911 --- /dev/null +++ b/pos_product_display_default_code/views/res_config_settings_views.xml @@ -0,0 +1,21 @@ + + + + res.config.settings.default.code.view.form + res.config.settings + + + + + +
+ Display products' internal reference in the PoS interface and tickets. +
+
+
+
+
+