diff --git a/total_quantity_pos/README.rst b/total_quantity_pos/README.rst index 7c2c5db39..e4ae50bd1 100644 --- a/total_quantity_pos/README.rst +++ b/total_quantity_pos/README.rst @@ -1,5 +1,5 @@ -.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg - :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 Total Items and Total Quantity in POS @@ -8,7 +8,7 @@ This module allows to show the total items and total quantities of products alon Installation ============ - - www.odoo.com/documentation/17.0/setup/install.html + - www.odoo.com/documentation/16.0/setup/install.html - Install our custom addon License diff --git a/total_quantity_pos/__init__.py b/total_quantity_pos/__init__.py index 90082e841..7055292ad 100644 --- a/total_quantity_pos/__init__.py +++ b/total_quantity_pos/__init__.py @@ -19,4 +19,3 @@ # If not, see . # ############################################################################### -from . import models diff --git a/total_quantity_pos/__manifest__.py b/total_quantity_pos/__manifest__.py index 508a4cb7a..c05983d42 100644 --- a/total_quantity_pos/__manifest__.py +++ b/total_quantity_pos/__manifest__.py @@ -24,22 +24,24 @@ 'version': '17.0.1.0.0', 'category': 'Point of Sale', 'summary': "To Show the Total Quantity and Total Items Ordered in POS", - 'description': "This app will shows the number of products ordered and the" - " total quantity of products in the order summary in the pos" - " screen and bill.", + 'description': "This app will shows the number of " + "products ordered and the total quantity" + " of products in the order summary in" + " the pos screen and bill.", 'author': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', 'website': 'https://www.cybrosys.com', 'depends': ['point_of_sale'], 'data': [ - 'views/res_config_settings.views.xml' ], 'assets': { 'point_of_sale._assets_pos': [ - 'total_quantity_pos/static/src/xml/product_screen.xml', - 'total_quantity_pos/static/src/xml/order_receipt.xml', - ], + 'total_quantity_pos/static/src/overrides/components/order_widget.xml', + 'total_quantity_pos/static/src/overrides/components/order_receipt.xml', + 'total_quantity_pos/static/src/overrides/components/order_widget.js', + 'total_quantity_pos/static/src/overrides/models/models.js', + ], }, 'images': ['static/description/banner.jpg'], 'license': 'AGPL-3', diff --git a/total_quantity_pos/doc/RELEASE_NOTES.md b/total_quantity_pos/doc/RELEASE_NOTES.md index dfabf9a9e..e41c3f714 100644 --- a/total_quantity_pos/doc/RELEASE_NOTES.md +++ b/total_quantity_pos/doc/RELEASE_NOTES.md @@ -3,4 +3,4 @@ #### 15.05.2024 #### Version 17.0.1.0.0 #### ADD -- Initial Commit for Total Items and Total Quantity in POS. +Initial Commit for Total Items and Total Quantity in POS. diff --git a/total_quantity_pos/models/__init__.py b/total_quantity_pos/models/__init__.py deleted file mode 100644 index 28fefe517..000000000 --- a/total_quantity_pos/models/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################### -# -# Cybrosys Technologies Pvt. Ltd. -# -# Copyright (C) 2024-TODAY Cybrosys Technologies() -# Author: Subina P (odoo@cybrosys.com) -# -# You can modify it under the terms of the GNU AFFERO -# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. -# -# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE -# (AGPL v3) along with this program. -# If not, see . -# -############################################################################### -from . import pos_config -from . import res_config_settings diff --git a/total_quantity_pos/models/pos_config.py b/total_quantity_pos/models/pos_config.py deleted file mode 100644 index fc881c08d..000000000 --- a/total_quantity_pos/models/pos_config.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################### -# -# Cybrosys Technologies Pvt. Ltd. -# -# Copyright (C) 2024-TODAY Cybrosys Technologies() -# Author: Subina P (odoo@cybrosys.com) -# -# You can modify it under the terms of the GNU AFFERO -# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. -# -# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE -# (AGPL v3) along with this program. -# If not, see . -# -############################################################################### -from odoo import fields, models - - -class PosConfig(models.Model): - """ Class for adding the fields in the pos config""" - _inherit = "pos.config" - - pos_total_items = fields.Boolean(string="Total Items", - help="The boolean field" - " in pos.config respective" - " to the total_items field" - " in res.config.settings") - pos_total_quantity = fields.Boolean(string="Total Quantity", - help="The boolean field" - " in pos.config respective" - " to the total_quantity field" - " in res.config.settings") diff --git a/total_quantity_pos/models/res_config_settings.py b/total_quantity_pos/models/res_config_settings.py deleted file mode 100644 index 23aa39ed7..000000000 --- a/total_quantity_pos/models/res_config_settings.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################### -# -# Cybrosys Technologies Pvt. Ltd. -# -# Copyright (C) 2024-TODAY Cybrosys Technologies() -# Author: Subina P (odoo@cybrosys.com) -# -# You can modify it under the terms of the GNU AFFERO -# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. -# -# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE -# (AGPL v3) along with this program. -# If not, see . -# -############################################################################### -from odoo import fields, models - - -class ConfigSettings(models.TransientModel): - """Class for adding the fields in res.config.settings""" - _inherit = 'res.config.settings' - - total_items = fields.Boolean(string="Enable Total Items", - related="pos_config_id.pos_total_items", - readonly=False, help="Enable this option " - "will show the total" - " number of items and" - " total quantities of" - " product in the " - "PoS screen.") - total_quantity = fields.Boolean(string="Enable Total Quantity", - related="pos_config_id.pos_total_quantity", - readonly=False, help="Enable this option " - "will show the total" - " number of items and" - " total quantities of" - " product in the" - " receipt.") diff --git a/total_quantity_pos/static/description/assets/screenshots.zip b/total_quantity_pos/static/description/assets/screenshots.zip deleted file mode 100644 index 9f920a986..000000000 Binary files a/total_quantity_pos/static/description/assets/screenshots.zip and /dev/null differ diff --git a/total_quantity_pos/static/description/index.html b/total_quantity_pos/static/description/index.html index e37f96096..c5b51b7af 100644 --- a/total_quantity_pos/static/description/index.html +++ b/total_quantity_pos/static/description/index.html @@ -138,38 +138,6 @@
-
-
-
- -
-
-

- Option to make the feature available in PoS screen.

-
-
-
-
-
-
-
-
- -
-
-

- Option to make the feature available in Bill.

-
-
-
-
-
diff --git a/total_quantity_pos/static/src/overrides/components/order_receipt.xml b/total_quantity_pos/static/src/overrides/components/order_receipt.xml new file mode 100755 index 000000000..39315c7a0 --- /dev/null +++ b/total_quantity_pos/static/src/overrides/components/order_receipt.xml @@ -0,0 +1,17 @@ + + + + + +
Total Items: + +
+ +
+ Total Quantity: + +
+
+
+
diff --git a/total_quantity_pos/static/src/overrides/components/order_widget.js b/total_quantity_pos/static/src/overrides/components/order_widget.js new file mode 100755 index 000000000..e3a2d05d7 --- /dev/null +++ b/total_quantity_pos/static/src/overrides/components/order_widget.js @@ -0,0 +1,26 @@ +/** @odoo-module */ + +import { OrderWidget } from "@point_of_sale/app/generic_components/order_widget/order_widget"; +import { patch } from "@web/core/utils/patch"; + +// Patch the OrderSummary to add custom properties +patch(OrderWidget.prototype, { + /** + * Get the total number of items in the order. + * + * @returns {number} The total number of items in the order. + */ + get ItemCount(){ + return this.props.lines.length + }, + /** + * Get the total quantity of items in the order. + * + * @returns {number} The total quantity of items in the order. + */ + get TotalQuantity(){ + var totalQuantity = 0; + this.props.lines.forEach(line => totalQuantity += line.quantity); + return totalQuantity + } +}); diff --git a/total_quantity_pos/static/src/overrides/components/order_widget.xml b/total_quantity_pos/static/src/overrides/components/order_widget.xml new file mode 100755 index 000000000..54968feaf --- /dev/null +++ b/total_quantity_pos/static/src/overrides/components/order_widget.xml @@ -0,0 +1,29 @@ + + + + + + + +
+
+ Item Count: + + + + +
+ +
+ Total Quantity: + + + + +
+
+
+
+
diff --git a/total_quantity_pos/static/src/overrides/models/models.js b/total_quantity_pos/static/src/overrides/models/models.js new file mode 100755 index 000000000..55eaefa5a --- /dev/null +++ b/total_quantity_pos/static/src/overrides/models/models.js @@ -0,0 +1,18 @@ +/** @odoo-module */ + +import { Order } from "@point_of_sale/app/store/models"; +import { patch } from "@web/core/utils/patch"; + +patch(Order.prototype, { + /** + * Extends the export_for_printing method to customize the printing data. + * Removes the 'removeLine' property from each order line. + * @returns {Object} The modified printing data. + */ + export_for_printing() { + const result = super.export_for_printing(...arguments); + result.TotalQuantity = this.orderlines.map(item => parseFloat(item["quantity"])).reduce((acc, value) => acc + value, 0); + result.ItemCount = this.orderlines.length; + return result; + }, +}); diff --git a/total_quantity_pos/static/src/xml/product_screen.xml b/total_quantity_pos/static/src/xml/product_screen.xml index 1bda2435a..e177c3dc5 100644 --- a/total_quantity_pos/static/src/xml/product_screen.xml +++ b/total_quantity_pos/static/src/xml/product_screen.xml @@ -21,6 +21,7 @@ t-value="total_qty + line.quantity"/> +

diff --git a/total_quantity_pos/views/res_config_settings.views.xml b/total_quantity_pos/views/res_config_settings.views.xml deleted file mode 100644 index 683e4fc8a..000000000 --- a/total_quantity_pos/views/res_config_settings.views.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - res.config.settings.view.form.inherit.total.quantity.pos - res.config.settings - - - -
-
-
- -
-
-
-
-
-
- - -
-
-
- -
-
-
-
-
-
-
-
-