diff --git a/pos_product_display_default_code/README.rst b/pos_product_display_default_code/README.rst new file mode 100644 index 0000000000..930c656717 --- /dev/null +++ b/pos_product_display_default_code/README.rst @@ -0,0 +1,77 @@ +================================ +PoS Product Display Default Code +================================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/16.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-16-0/pos-16-0-pos_product_display_default_code + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/184/16.0 + :alt: Try me on Runbot + +|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 -> [FURN_0001] Desk Organizer + +**Table of contents** + +.. contents:: + :local: + +Known issues / Roadmap +====================== + +add an option in pos.config to activate/deactivate + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Akretion + +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..8a64786175 --- /dev/null +++ b/pos_product_display_default_code/__manifest__.py @@ -0,0 +1,19 @@ +{ + "name": "PoS Product Display Default Code", + "summary": "pos: display product default code before product name", + "version": "16.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", + ], + "demo": [], + "qweb": [], +} 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..fd765833d3 --- /dev/null +++ b/pos_product_display_default_code/i18n/es.po @@ -0,0 +1,43 @@ +# 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: 2023-02-14 15:18+0000\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 "Opciones de configuración" + +#. 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/models/__init__.py b/pos_product_display_default_code/models/__init__.py new file mode 100644 index 0000000000..806f250662 --- /dev/null +++ b/pos_product_display_default_code/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2023 FactorLibre - Juan Carlos Bonilla +from . import pos_session +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..16e6374bbf --- /dev/null +++ b/pos_product_display_default_code/models/pos_config.py @@ -0,0 +1,8 @@ +# 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) diff --git a/pos_product_display_default_code/models/pos_session.py b/pos_product_display_default_code/models/pos_session.py new file mode 100644 index 0000000000..2315fc014c --- /dev/null +++ b/pos_product_display_default_code/models/pos_session.py @@ -0,0 +1,12 @@ +# Copyright 2023 FactorLibre - Juan Carlos Bonilla +from odoo import models + + +class PosSession(models.Model): + _inherit = "pos.session" + + def _loader_params_product_product(self): + result = super()._loader_params_product_product() + if self.config_id and self.config_id.display_default_code: + result["context"]["display_default_code"] = True + return result 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/readme/CONFIGURE.rst b/pos_product_display_default_code/readme/CONFIGURE.rst new file mode 100644 index 0000000000..2ba885eaee --- /dev/null +++ b/pos_product_display_default_code/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +* Go to Point Of Sale / Configuration / Settings +* Check the box 'Display Default Code' in PoS Interface section + +.. image:: ../static/description/config.png + :width: 800 px diff --git a/pos_product_display_default_code/readme/CONTRIBUTORS.rst b/pos_product_display_default_code/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..93d0579d9d --- /dev/null +++ b/pos_product_display_default_code/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Juan Carlos Bonilla diff --git a/pos_product_display_default_code/readme/DESCRIPTION.rst b/pos_product_display_default_code/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..26fd541277 --- /dev/null +++ b/pos_product_display_default_code/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +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 -> [FURN_0001] 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..9be26344ca 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..40fc7e3d64 --- /dev/null +++ b/pos_product_display_default_code/static/description/index.html @@ -0,0 +1,419 @@ + + + + + + +PoS Product Display Default Code + + + +
+

PoS Product Display Default Code

+ + +

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

+

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 -> [FURN_0001] Desk Organizer

+

Table of contents

+ +
+

Known issues / Roadmap

+

add an option in pos.config to activate/deactivate

+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

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/tests/__init__.py b/pos_product_display_default_code/tests/__init__.py new file mode 100644 index 0000000000..5cfe7f9d6c --- /dev/null +++ b/pos_product_display_default_code/tests/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2023 FactorLibre - Juan Carlos Bonilla +from . import test_load_params_product diff --git a/pos_product_display_default_code/tests/test_load_params_product.py b/pos_product_display_default_code/tests/test_load_params_product.py new file mode 100644 index 0000000000..3122230423 --- /dev/null +++ b/pos_product_display_default_code/tests/test_load_params_product.py @@ -0,0 +1,18 @@ +# 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): + def setUp(self): + super(TestPosDisplayDefaultCode, self).setUp() + self.config = self.basic_config + self.config.display_default_code = True + self.pos_session = self.env["pos.session"].create({"config_id": self.config.id}) + + def test_load_params_products(self): + result = self.pos_session._loader_params_product_product() + self.assertTrue(result["context"]["display_default_code"]) 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..3466689d21 --- /dev/null +++ b/pos_product_display_default_code/views/res_config_settings_views.xml @@ -0,0 +1,29 @@ + + + + res.config.settings.default.code.view.form + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+
diff --git a/setup/pos_product_display_default_code/odoo/addons/pos_product_display_default_code b/setup/pos_product_display_default_code/odoo/addons/pos_product_display_default_code new file mode 120000 index 0000000000..a6e218ed50 --- /dev/null +++ b/setup/pos_product_display_default_code/odoo/addons/pos_product_display_default_code @@ -0,0 +1 @@ +../../../../pos_product_display_default_code \ No newline at end of file diff --git a/setup/pos_product_display_default_code/setup.py b/setup/pos_product_display_default_code/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/pos_product_display_default_code/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)