diff --git a/pos_environment/__manifest__.py b/pos_environment/__manifest__.py index 4528dfb68..48e643b72 100644 --- a/pos_environment/__manifest__.py +++ b/pos_environment/__manifest__.py @@ -4,9 +4,10 @@ { "name": "Point of Sale - Custom Bill by Environment", "summary": "Custom messages on the bill depending on the environment", - "version": "12.0.1.0.1", + "version": "16.0.1.0.1", "category": "Point of Sale", "author": "GRAP,Odoo Community Association (OCA)", + "maintainers": ["legalsylvain"], "website": "https://github.com/OCA/server-env", "license": "AGPL-3", "depends": [ @@ -14,11 +15,12 @@ "server_environment", ], "data": [ - "views/templates.xml", - "views/view_pos_config.xml", - ], - "qweb": [ - "static/src/xml/pos_environment.xml", + "views/res_config_settings_views.xml", ], + "assets": { + "point_of_sale.assets": [ + "pos_environment/static/src/xml/ReceiptScreen.xml", + ], + }, "installable": True, } diff --git a/pos_environment/models/__init__.py b/pos_environment/models/__init__.py index db8634ade..2b92809a3 100644 --- a/pos_environment/models/__init__.py +++ b/pos_environment/models/__init__.py @@ -1 +1,2 @@ from . import pos_config +from . import res_config_settings diff --git a/pos_environment/models/pos_config.py b/pos_environment/models/pos_config.py index a8f6c00b1..097d53cf2 100644 --- a/pos_environment/models/pos_config.py +++ b/pos_environment/models/pos_config.py @@ -9,25 +9,20 @@ class PosConfig(models.Model): _inherit = "pos.config" - # Columns section receipt_environment_header = fields.Text( - string="Receipt Environment Header", compute="_compute_receipt_environment_header", ) receipt_environment_footer = fields.Text( - string="Receipt Environment Footer", compute="_compute_receipt_environment_footer", ) - @api.multi def _compute_receipt_environment_header(self): for config in self: config.receipt_environment_header = self._get_receipt_environment_part( "header" ) - @api.multi def _compute_receipt_environment_footer(self): for config in self: config.receipt_environment_footer = self._get_receipt_environment_part( diff --git a/pos_environment/models/res_config_settings.py b/pos_environment/models/res_config_settings.py new file mode 100644 index 000000000..fb1fe8d2a --- /dev/null +++ b/pos_environment/models/res_config_settings.py @@ -0,0 +1,16 @@ +# Copyright (C) 2023 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + receipt_environment_header = fields.Text( + related="pos_config_id.receipt_environment_header" + ) + + receipt_environment_footer = fields.Text( + related="pos_config_id.receipt_environment_footer" + ) diff --git a/pos_environment/readme/CONFIGURE.rst b/pos_environment/readme/CONFIGURE.rst index d41180bcd..156361dda 100644 --- a/pos_environment/readme/CONFIGURE.rst +++ b/pos_environment/readme/CONFIGURE.rst @@ -42,4 +42,4 @@ To be sure that your server is correctly configured, you can check the settings in the Point of Sale configuration. -.. figure:: ../static/description/pos_config_form.png +.. figure:: ../static/description/res_config_settings_form.png diff --git a/pos_environment/readme/DESCRIPTION.rst b/pos_environment/readme/DESCRIPTION.rst index 58ab5cf72..f60e59ccc 100644 --- a/pos_environment/readme/DESCRIPTION.rst +++ b/pos_environment/readme/DESCRIPTION.rst @@ -2,9 +2,15 @@ This module extends the Odoo point of sale module to allow administrator to customize the bill printed by the point of sale, with a text depending on your environment. (Development, , Pre Production, Production, etc...) +The displayed and printed bill will display the custom message + +.. figure:: ../static/description/receipt.png + This module is based on the mechanism introduced by the ``server_environment`` module. **Note** -This module works with or without IoT Box. +This module provides a feature that is legally required in some countries +(such as France, under the law on accounting certification) +where test and production receipts must be distinguishable. diff --git a/pos_environment/readme/USAGE.rst b/pos_environment/readme/USAGE.rst deleted file mode 100644 index 8f348e8a4..000000000 --- a/pos_environment/readme/USAGE.rst +++ /dev/null @@ -1,7 +0,0 @@ -* Open Your Point of Sale - -* Realize a sale - -* The printed bill will display the custom message - -.. figure:: ../static/description/receipt.png diff --git a/pos_environment/static/description/pos_config_form.png b/pos_environment/static/description/pos_config_form.png deleted file mode 100644 index 277049a17..000000000 Binary files a/pos_environment/static/description/pos_config_form.png and /dev/null differ diff --git a/pos_environment/static/description/receipt.png b/pos_environment/static/description/receipt.png index f52221628..79efd99c6 100644 Binary files a/pos_environment/static/description/receipt.png and b/pos_environment/static/description/receipt.png differ diff --git a/pos_environment/static/description/res_config_settings_form.png b/pos_environment/static/description/res_config_settings_form.png new file mode 100644 index 000000000..128f56ed0 Binary files /dev/null and b/pos_environment/static/description/res_config_settings_form.png differ diff --git a/pos_environment/static/src/js/models.js b/pos_environment/static/src/js/models.js deleted file mode 100644 index 6b5ff4b23..000000000 --- a/pos_environment/static/src/js/models.js +++ /dev/null @@ -1,22 +0,0 @@ -/** **************************************************************************** - Copyright (C) 2019 - Today: GRAP (http://www.grap.coop) - @author: Sylvain LE GAL (https://twitter.com/legalsylvain) - License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - *****************************************************************************/ - -odoo.define("pos_environment.models", function (require) { - "use strict"; - - var models = require("point_of_sale.models"); - - var order_super = models.Order.prototype; - - models.Order = models.Order.extend({ - export_for_printing: function () { - var res = order_super.export_for_printing.apply(this, arguments); - res.receipt_environment_header = this.pos.config.receipt_environment_header; - res.receipt_environment_footer = this.pos.config.receipt_environment_footer; - return res; - }, - }); -}); diff --git a/pos_environment/static/src/xml/ReceiptScreen.xml b/pos_environment/static/src/xml/ReceiptScreen.xml new file mode 100644 index 000000000..4c5911c10 --- /dev/null +++ b/pos_environment/static/src/xml/ReceiptScreen.xml @@ -0,0 +1,30 @@ + + + + + + +
+
+
+ + + +
+
+
+ +
+
diff --git a/pos_environment/static/src/xml/pos_environment.xml b/pos_environment/static/src/xml/pos_environment.xml deleted file mode 100644 index da0f96d28..000000000 --- a/pos_environment/static/src/xml/pos_environment.xml +++ /dev/null @@ -1,71 +0,0 @@ - - diff --git a/pos_environment/views/view_pos_config.xml b/pos_environment/views/res_config_settings_views.xml similarity index 82% rename from pos_environment/views/view_pos_config.xml rename to pos_environment/views/res_config_settings_views.xml index 4d2fc2e51..a7aa58cfb 100644 --- a/pos_environment/views/view_pos_config.xml +++ b/pos_environment/views/res_config_settings_views.xml @@ -6,11 +6,11 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> - - pos.config - + + res.config.settings + - +

Environment Settings

diff --git a/pos_environment/views/templates.xml b/pos_environment/views/templates.xml deleted file mode 100644 index 1421522b0..000000000 --- a/pos_environment/views/templates.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - -