diff --git a/pos_product_display_default_code/__manifest__.py b/pos_product_display_default_code/__manifest__.py
index 8abbd2ff40..8a64786175 100644
--- a/pos_product_display_default_code/__manifest__.py
+++ b/pos_product_display_default_code/__manifest__.py
@@ -4,11 +4,16 @@
"version": "16.0.1.0.0",
"category": "Point of Sale",
"website": "https://github.com/OCA/pos",
- "author": "Odoo Community Association (OCA), Akretion",
+ "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/i18n/pos_product_display_default_code.pot b/pos_product_display_default_code/i18n/pos_product_display_default_code.pot
deleted file mode 100644
index 78d58d53fe..0000000000
--- a/pos_product_display_default_code/i18n/pos_product_display_default_code.pot
+++ /dev/null
@@ -1,13 +0,0 @@
-# Translation of Odoo Server.
-# This file contains the translation of the following modules:
-#
-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"
diff --git a/pos_product_display_default_code/models/__init__.py b/pos_product_display_default_code/models/__init__.py
index 123e20ff54..806f250662 100644
--- a/pos_product_display_default_code/models/__init__.py
+++ b/pos_product_display_default_code/models/__init__.py
@@ -1,2 +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
index 83113c9ae1..2315fc014c 100644
--- a/pos_product_display_default_code/models/pos_session.py
+++ b/pos_product_display_default_code/models/pos_session.py
@@ -7,5 +7,6 @@ class PosSession(models.Model):
def _loader_params_product_product(self):
result = super()._loader_params_product_product()
- result["context"]["display_default_code"] = True
+ 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 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 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.PoS Product Display Default Code
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
Bug Tracker
Do not contact contributors directly about support or help with technical issues.
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.
+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.