diff --git a/pos_product_stock/README.rst b/pos_product_stock/README.rst new file mode 100644 index 000000000..1613781a0 --- /dev/null +++ b/pos_product_stock/README.rst @@ -0,0 +1,46 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +POS Product Stock +================= +This module helps you to show Product quantity based on location in POS and also deny order if the quantity reaches its limit. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +======= +General Public License, version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +Developer : (V18) Nivedhya T, Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/pos_product_stock/__init__.py b/pos_product_stock/__init__.py new file mode 100644 index 000000000..d96aecdec --- /dev/null +++ b/pos_product_stock/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 models diff --git a/pos_product_stock/__manifest__.py b/pos_product_stock/__manifest__.py new file mode 100644 index 000000000..022e5c635 --- /dev/null +++ b/pos_product_stock/__manifest__.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 . +# +############################################################################# +{ + 'name': 'POS Product Stock', + 'version': "18.0.1.0.0", + 'category': 'Point Of Sale', + 'summary': "Quantity of all Products in each Warehouse", + 'description': "Shows Stock quantity in POS for all Products in each Warehouse, Odoo 18", + 'author': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['base','point_of_sale','stock'], + 'data': [ + 'views/res_cofig_settings_views.xml', + 'views/product_template_views.xml', + ], + 'assets': { + 'point_of_sale._assets_pos': [ + 'pos_product_stock/static/src/xml/product_item.xml', + 'pos_product_stock/static/src/css/product_quantity.scss', + 'pos_product_stock/static/src/js/pos_location.js', + 'pos_product_stock/static/src/js/pos_payment_screen.js', + 'pos_product_stock/static/src/js/pos_session.js', + 'pos_product_stock/static/src/js/deny_order.js', + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/pos_product_stock/doc/RELEASE_NOTES.md b/pos_product_stock/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..f94c13e33 --- /dev/null +++ b/pos_product_stock/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 03.12.2024 +#### Version 18.0.1.0.0 +#### ADD +- Initial Commit for POS Product Stock diff --git a/pos_product_stock/models/__init__.py b/pos_product_stock/models/__init__.py new file mode 100644 index 000000000..808e679db --- /dev/null +++ b/pos_product_stock/models/__init__.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 pos_session +from . import product_template +from . import res_config_settings +from . import stock_move_line +from . import stock_quant diff --git a/pos_product_stock/models/pos_config.py b/pos_product_stock/models/pos_config.py new file mode 100644 index 000000000..6d3a57c06 --- /dev/null +++ b/pos_product_stock/models/pos_config.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 api, fields, models + + +class PosConfig(models.Model): + """inherit pos.config to add fields.""" + _inherit = 'pos.config' + + pos_stock_location_id = fields.Many2one('stock.location', string='Stock Location', + help="This field helps to hold the location") + location_from = fields.Selection([('all_warehouse', 'All Location'), + ('current_warehouse', 'Current Location')], + string="Show Stock Of", + help="can choose the location where you want to display the stock ") + display_stock_setting = fields.Boolean(string="Display Stock", + help="By enabling you can view quantity in Point Of Sale", + default=False) + stock_product = fields.Selection([('on_hand', 'On Hand Quantity'), + ('incoming_qty', 'Incoming Quantity'), + ('outgoing_qty', 'Outgoing Quantity')], + string="Stock Type", + help="Help you to choose the quantity you want to visible in pos") + + @api.onchange('location_from') + def _onchange_location_from(self): + """ Adjust the stock_location_id when stock_from is changed. """ + if self.location_from == 'all_warehouse': + self.stock_location_id = False + elif self.location_from == 'current_warehouse': + self.stock_location_id = self.pos_config_id.pos_stock_location_id diff --git a/pos_product_stock/models/pos_session.py b/pos_product_stock/models/pos_session.py new file mode 100644 index 000000000..935f2beb9 --- /dev/null +++ b/pos_product_stock/models/pos_session.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 api, models + + +class PosSession(models.Model): + """inherit pos.session to add fields and modules in session.""" + _inherit = 'pos.session' + + @api.model + def _load_pos_data_models(self, config_id): + """The list of models to be loaded for POS data.""" + data = super()._load_pos_data_models(config_id) + data += ['res.config.settings','stock.quant','stock.move.line'] + return data diff --git a/pos_product_stock/models/product_template.py b/pos_product_stock/models/product_template.py new file mode 100644 index 000000000..9c5707a11 --- /dev/null +++ b/pos_product_stock/models/product_template.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 api, fields, models + + +class ProductTemplate(models.Model): + """inherit product.template to add field.""" + _inherit = "product.template" + + deny = fields.Integer(string="Deny POS Order", default=0, + help="Set a limit so that you can deny POS Order") + + +class ProductProduct(models.Model): + """inherit product.product to load field in pos.""" + _name = 'product.product' + _inherit = ['product.product','pos.load.mixin'] + + @api.model + def _load_pos_data_fields(self, config_id): + """Returns the fields to be loaded for POS data.""" + result = super()._load_pos_data_fields(config_id) + result.append('qty_available') + result.append('incoming_qty') + result.append('outgoing_qty') + result.append('deny') + return result diff --git a/pos_product_stock/models/res_config_settings.py b/pos_product_stock/models/res_config_settings.py new file mode 100644 index 000000000..4347a4af0 --- /dev/null +++ b/pos_product_stock/models/res_config_settings.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 api, fields, models + + +class ResConfigSettings(models.TransientModel): + """ Inherit the base settings to add field. """ + _name = 'res.config.settings' + _inherit = ['res.config.settings','pos.load.mixin'] + + display_stock = fields.Boolean(string="Display Stock", + readonly=False, help="By enabling you can " + "view quantity in Point Of Sale", + default=False, config_parameter='pos_product_stock.display_stock') + stock_type = fields.Selection(related='pos_config_id.stock_product', + string="Stock Type", readonly=False, + required=True, help="Help you to choose " + "the quantity you want to visible in pos") + stock_from = fields.Selection(related='pos_config_id.location_from', + string="Show Stock Of", readonly=False, + required=True, help="can choose the location " + "where you want to display the stock ") + stock_location_id = fields.Many2one(related='pos_config_id.pos_stock_location_id', + string="Stock Location", readonly=False, + help="This field helps to hold the location") + + @api.model + def _load_pos_data_fields(self, config_id): + """Returns the list of fields to be loaded for POS data.""" + return [ + 'display_stock', 'stock_type', 'stock_from', 'stock_location_id' + ] diff --git a/pos_product_stock/models/stock_move_line.py b/pos_product_stock/models/stock_move_line.py new file mode 100644 index 000000000..4f70cdeea --- /dev/null +++ b/pos_product_stock/models/stock_move_line.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 api, models + + +class StockMoveLine(models.Model): + """Inherits model "stock.move.line to load pos data fields""" + _name = 'stock.move.line' + _inherit = ['stock.move.line','pos.load.mixin'] + + @api.model + def _load_pos_data_fields(self, config_id): + """Returns the list of fields to be loaded for POS data.""" + return [ + 'product_id', 'location_dest_id', 'quantity', 'location_id' + ] diff --git a/pos_product_stock/models/stock_quant.py b/pos_product_stock/models/stock_quant.py new file mode 100644 index 000000000..5c77a44df --- /dev/null +++ b/pos_product_stock/models/stock_quant.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 api, models + + +class StockQuant(models.Model): + """Inherits model "stock.quant to load pos data""" + _name = 'stock.quant' + _inherit = ['stock.quant','pos.load.mixin'] + + @api.model + def _load_pos_data_fields(self, config_id): + """Returns the list of fields to be loaded for POS data.""" + return [ + 'product_id', 'available_quantity', 'quantity', 'location_id' + ] + + @api.model + def _load_pos_data_domain(self, data): + """Constructs the domain for loading POS data based on the POS configuration.""" + config_id = self.env['pos.config'].browse(data['pos.config']['data'][0]['id']) + if config_id.location_from == 'all_warehouse': + location_ids = self.env['stock.location'].search([]) + domain = [('location_id', 'in', location_ids.ids)] + else: + location_id = config_id.pos_stock_location_id + domain = ['|', ('location_id', '=', location_id.id), ('location_id', 'in', location_id.child_ids.ids)] + return domain diff --git a/pos_product_stock/static/description/assets/cybro-icon.png b/pos_product_stock/static/description/assets/cybro-icon.png new file mode 100644 index 000000000..06e73e11d Binary files /dev/null and b/pos_product_stock/static/description/assets/cybro-icon.png differ diff --git a/pos_product_stock/static/description/assets/cybro-odoo.png b/pos_product_stock/static/description/assets/cybro-odoo.png new file mode 100644 index 000000000..ed02e07a4 Binary files /dev/null and b/pos_product_stock/static/description/assets/cybro-odoo.png differ diff --git a/pos_product_stock/static/description/assets/icons/arrows-repeat.svg b/pos_product_stock/static/description/assets/icons/arrows-repeat.svg new file mode 100644 index 000000000..1d7efabc5 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/arrows-repeat.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/banner-1.png b/pos_product_stock/static/description/assets/icons/banner-1.png new file mode 100644 index 000000000..c180db172 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/banner-1.png differ diff --git a/pos_product_stock/static/description/assets/icons/banner-2.svg b/pos_product_stock/static/description/assets/icons/banner-2.svg new file mode 100644 index 000000000..e606d97d9 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/banner-2.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/banner-bg.png b/pos_product_stock/static/description/assets/icons/banner-bg.png new file mode 100644 index 000000000..a8238d3c0 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/banner-bg.png differ diff --git a/pos_product_stock/static/description/assets/icons/banner-bg.svg b/pos_product_stock/static/description/assets/icons/banner-bg.svg new file mode 100644 index 000000000..b1378103e --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/banner-bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/banner-call.svg b/pos_product_stock/static/description/assets/icons/banner-call.svg new file mode 100644 index 000000000..96c687e81 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/banner-call.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/pos_product_stock/static/description/assets/icons/banner-mail.svg b/pos_product_stock/static/description/assets/icons/banner-mail.svg new file mode 100644 index 000000000..cbf0d158d --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/banner-mail.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/pos_product_stock/static/description/assets/icons/banner-pattern.svg b/pos_product_stock/static/description/assets/icons/banner-pattern.svg new file mode 100644 index 000000000..9c1c7e101 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/banner-pattern.svg @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/banner-promo.svg b/pos_product_stock/static/description/assets/icons/banner-promo.svg new file mode 100644 index 000000000..d52791b11 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/banner-promo.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/brand-pair.svg b/pos_product_stock/static/description/assets/icons/brand-pair.svg new file mode 100644 index 000000000..d8db7fc1e --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/brand-pair.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/check.png b/pos_product_stock/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/check.png differ diff --git a/pos_product_stock/static/description/assets/icons/chevron.png b/pos_product_stock/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/chevron.png differ diff --git a/pos_product_stock/static/description/assets/icons/close-icon.svg b/pos_product_stock/static/description/assets/icons/close-icon.svg new file mode 100644 index 000000000..df8cce37a --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/close-icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/pos_product_stock/static/description/assets/icons/cogs.png b/pos_product_stock/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/cogs.png differ diff --git a/pos_product_stock/static/description/assets/icons/collabarate-icon.svg b/pos_product_stock/static/description/assets/icons/collabarate-icon.svg new file mode 100644 index 000000000..dd4e10518 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/collabarate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/pos_product_stock/static/description/assets/icons/consultation.png b/pos_product_stock/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/consultation.png differ diff --git a/pos_product_stock/static/description/assets/icons/cybro-logo.png b/pos_product_stock/static/description/assets/icons/cybro-logo.png new file mode 100644 index 000000000..ff4b78220 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/cybro-logo.png differ diff --git a/pos_product_stock/static/description/assets/icons/down.svg b/pos_product_stock/static/description/assets/icons/down.svg new file mode 100644 index 000000000..f21c36271 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pos_product_stock/static/description/assets/icons/ecom-black.png b/pos_product_stock/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/ecom-black.png differ diff --git a/pos_product_stock/static/description/assets/icons/education-black.png b/pos_product_stock/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/education-black.png differ diff --git a/pos_product_stock/static/description/assets/icons/faq.png b/pos_product_stock/static/description/assets/icons/faq.png new file mode 100644 index 000000000..4250b5b81 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/faq.png differ diff --git a/pos_product_stock/static/description/assets/icons/feature-icon.svg b/pos_product_stock/static/description/assets/icons/feature-icon.svg new file mode 100644 index 000000000..fa0ea6850 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/feature-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/feature.png b/pos_product_stock/static/description/assets/icons/feature.png new file mode 100644 index 000000000..ac7a785c0 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/feature.png differ diff --git a/pos_product_stock/static/description/assets/icons/gear.svg b/pos_product_stock/static/description/assets/icons/gear.svg new file mode 100644 index 000000000..0cc66b6ea --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/gear.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/hero.gif b/pos_product_stock/static/description/assets/icons/hero.gif new file mode 100644 index 000000000..4321a145f Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/hero.gif differ diff --git a/pos_product_stock/static/description/assets/icons/hire-odoo.svg b/pos_product_stock/static/description/assets/icons/hire-odoo.svg new file mode 100644 index 000000000..e1ac089b0 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/hire-odoo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/hotel-black.png b/pos_product_stock/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/hotel-black.png differ diff --git a/pos_product_stock/static/description/assets/icons/license.png b/pos_product_stock/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/license.png differ diff --git a/pos_product_stock/static/description/assets/icons/life-ring-icon.svg b/pos_product_stock/static/description/assets/icons/life-ring-icon.svg new file mode 100644 index 000000000..3ae6e1d89 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/life-ring-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/lifebuoy.png b/pos_product_stock/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/lifebuoy.png differ diff --git a/pos_product_stock/static/description/assets/icons/mail.svg b/pos_product_stock/static/description/assets/icons/mail.svg new file mode 100644 index 000000000..1eedde695 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/mail.svg @@ -0,0 +1,3 @@ + + + diff --git a/pos_product_stock/static/description/assets/icons/manufacturing-black.png b/pos_product_stock/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/manufacturing-black.png differ diff --git a/pos_product_stock/static/description/assets/icons/notes.png b/pos_product_stock/static/description/assets/icons/notes.png new file mode 100644 index 000000000..ee5e95404 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/notes.png differ diff --git a/pos_product_stock/static/description/assets/icons/notification icon.svg b/pos_product_stock/static/description/assets/icons/notification icon.svg new file mode 100644 index 000000000..053189973 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/notification icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/odoo-consultancy.svg b/pos_product_stock/static/description/assets/icons/odoo-consultancy.svg new file mode 100644 index 000000000..e05f65bde --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/odoo-consultancy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/pos_product_stock/static/description/assets/icons/odoo-licencing.svg b/pos_product_stock/static/description/assets/icons/odoo-licencing.svg new file mode 100644 index 000000000..2606c88b0 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/odoo-licencing.svg @@ -0,0 +1,3 @@ + + + diff --git a/pos_product_stock/static/description/assets/icons/odoo-logo.png b/pos_product_stock/static/description/assets/icons/odoo-logo.png new file mode 100644 index 000000000..0e4d0eb5a Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/odoo-logo.png differ diff --git a/pos_product_stock/static/description/assets/icons/patter.svg b/pos_product_stock/static/description/assets/icons/patter.svg new file mode 100644 index 000000000..25c9c0a8f --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/patter.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/pattern1.png b/pos_product_stock/static/description/assets/icons/pattern1.png new file mode 100644 index 000000000..09ab0fb2d Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/pattern1.png differ diff --git a/pos_product_stock/static/description/assets/icons/pos-black.png b/pos_product_stock/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/pos-black.png differ diff --git a/pos_product_stock/static/description/assets/icons/puzzle-piece-icon.svg b/pos_product_stock/static/description/assets/icons/puzzle-piece-icon.svg new file mode 100644 index 000000000..3e9ad9373 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/puzzle-piece-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/puzzle.png b/pos_product_stock/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/puzzle.png differ diff --git a/pos_product_stock/static/description/assets/icons/replace-icon.svg b/pos_product_stock/static/description/assets/icons/replace-icon.svg new file mode 100644 index 000000000..d0e3a7af1 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/replace-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/restaurant-black.png b/pos_product_stock/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/restaurant-black.png differ diff --git a/pos_product_stock/static/description/assets/icons/screenshot-main.png b/pos_product_stock/static/description/assets/icons/screenshot-main.png new file mode 100644 index 000000000..575f8e676 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/screenshot-main.png differ diff --git a/pos_product_stock/static/description/assets/icons/screenshot.png b/pos_product_stock/static/description/assets/icons/screenshot.png new file mode 100644 index 000000000..cef272529 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/screenshot.png differ diff --git a/pos_product_stock/static/description/assets/icons/service-black.png b/pos_product_stock/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/service-black.png differ diff --git a/pos_product_stock/static/description/assets/icons/skype-fill.svg b/pos_product_stock/static/description/assets/icons/skype-fill.svg new file mode 100644 index 000000000..c17423639 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/skype-fill.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/skype.png b/pos_product_stock/static/description/assets/icons/skype.png new file mode 100644 index 000000000..51b409fb3 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/skype.png differ diff --git a/pos_product_stock/static/description/assets/icons/skype.svg b/pos_product_stock/static/description/assets/icons/skype.svg new file mode 100644 index 000000000..df3dad39b --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/skype.svg @@ -0,0 +1,3 @@ + + + diff --git a/pos_product_stock/static/description/assets/icons/star-1.svg b/pos_product_stock/static/description/assets/icons/star-1.svg new file mode 100644 index 000000000..7e55ab162 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/star-1.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/star-2.svg b/pos_product_stock/static/description/assets/icons/star-2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/star-2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/support.png b/pos_product_stock/static/description/assets/icons/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/support.png differ diff --git a/pos_product_stock/static/description/assets/icons/test-1 - Copy.png b/pos_product_stock/static/description/assets/icons/test-1 - Copy.png new file mode 100644 index 000000000..f6a902663 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/test-1 - Copy.png differ diff --git a/pos_product_stock/static/description/assets/icons/test-1.png b/pos_product_stock/static/description/assets/icons/test-1.png new file mode 100644 index 000000000..0908add2b Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/test-1.png differ diff --git a/pos_product_stock/static/description/assets/icons/test-2.png b/pos_product_stock/static/description/assets/icons/test-2.png new file mode 100644 index 000000000..4671fe91e Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/test-2.png differ diff --git a/pos_product_stock/static/description/assets/icons/trading-black.png b/pos_product_stock/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/trading-black.png differ diff --git a/pos_product_stock/static/description/assets/icons/training.png b/pos_product_stock/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/training.png differ diff --git a/pos_product_stock/static/description/assets/icons/translate.svg b/pos_product_stock/static/description/assets/icons/translate.svg new file mode 100644 index 000000000..af9c8a1aa --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/update.png b/pos_product_stock/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/update.png differ diff --git a/pos_product_stock/static/description/assets/icons/user.png b/pos_product_stock/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/user.png differ diff --git a/pos_product_stock/static/description/assets/icons/video.png b/pos_product_stock/static/description/assets/icons/video.png new file mode 100644 index 000000000..576705b17 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/video.png differ diff --git a/pos_product_stock/static/description/assets/icons/whatsapp.png b/pos_product_stock/static/description/assets/icons/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/whatsapp.png differ diff --git a/pos_product_stock/static/description/assets/icons/wrench-icon.svg b/pos_product_stock/static/description/assets/icons/wrench-icon.svg new file mode 100644 index 000000000..174b5a465 --- /dev/null +++ b/pos_product_stock/static/description/assets/icons/wrench-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pos_product_stock/static/description/assets/icons/wrench.png b/pos_product_stock/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/pos_product_stock/static/description/assets/icons/wrench.png differ diff --git a/pos_product_stock/static/description/assets/modules/b1.png b/pos_product_stock/static/description/assets/modules/b1.png new file mode 100644 index 000000000..73845cfbf Binary files /dev/null and b/pos_product_stock/static/description/assets/modules/b1.png differ diff --git a/pos_product_stock/static/description/assets/modules/b2.png b/pos_product_stock/static/description/assets/modules/b2.png new file mode 100644 index 000000000..0cd7e58c2 Binary files /dev/null and b/pos_product_stock/static/description/assets/modules/b2.png differ diff --git a/pos_product_stock/static/description/assets/modules/b3.png b/pos_product_stock/static/description/assets/modules/b3.png new file mode 100644 index 000000000..12d8c74fb Binary files /dev/null and b/pos_product_stock/static/description/assets/modules/b3.png differ diff --git a/pos_product_stock/static/description/assets/modules/b4.png b/pos_product_stock/static/description/assets/modules/b4.png new file mode 100644 index 000000000..127f51e0b Binary files /dev/null and b/pos_product_stock/static/description/assets/modules/b4.png differ diff --git a/pos_product_stock/static/description/assets/modules/b5.png b/pos_product_stock/static/description/assets/modules/b5.png new file mode 100644 index 000000000..c46f05f78 Binary files /dev/null and b/pos_product_stock/static/description/assets/modules/b5.png differ diff --git a/pos_product_stock/static/description/assets/modules/b6.png b/pos_product_stock/static/description/assets/modules/b6.png new file mode 100644 index 000000000..a48b400df Binary files /dev/null and b/pos_product_stock/static/description/assets/modules/b6.png differ diff --git a/pos_product_stock/static/description/assets/screenshots/screenshot1.png b/pos_product_stock/static/description/assets/screenshots/screenshot1.png new file mode 100644 index 000000000..f623c1632 Binary files /dev/null and b/pos_product_stock/static/description/assets/screenshots/screenshot1.png differ diff --git a/pos_product_stock/static/description/assets/screenshots/screenshot2.png b/pos_product_stock/static/description/assets/screenshots/screenshot2.png new file mode 100644 index 000000000..dc6b7af77 Binary files /dev/null and b/pos_product_stock/static/description/assets/screenshots/screenshot2.png differ diff --git a/pos_product_stock/static/description/assets/screenshots/screenshot3.png b/pos_product_stock/static/description/assets/screenshots/screenshot3.png new file mode 100644 index 000000000..0e6ac71a9 Binary files /dev/null and b/pos_product_stock/static/description/assets/screenshots/screenshot3.png differ diff --git a/pos_product_stock/static/description/assets/screenshots/screenshot4.png b/pos_product_stock/static/description/assets/screenshots/screenshot4.png new file mode 100644 index 000000000..8cceb7afa Binary files /dev/null and b/pos_product_stock/static/description/assets/screenshots/screenshot4.png differ diff --git a/pos_product_stock/static/description/banner.jpg b/pos_product_stock/static/description/banner.jpg new file mode 100644 index 000000000..aa359bd1b Binary files /dev/null and b/pos_product_stock/static/description/banner.jpg differ diff --git a/pos_product_stock/static/description/icon.png b/pos_product_stock/static/description/icon.png new file mode 100644 index 000000000..1a53937bf Binary files /dev/null and b/pos_product_stock/static/description/icon.png differ diff --git a/pos_product_stock/static/description/index.html b/pos_product_stock/static/description/index.html new file mode 100644 index 000000000..79c2cda5b --- /dev/null +++ b/pos_product_stock/static/description/index.html @@ -0,0 +1,955 @@ + + + + + + POS Product Stock + + + + + + + + + + +
+
+ + + +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+
+

+ Shows Quantity of all Product in POS. +

+

POS Product Stock +

+
+
+ +
+ +
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+

Key + Highlights

+
+
+
+
+ +
+
+ Community & Enterprise Support. +
+

+

+
+
+
+
+
+ +
+
+ POS Product Stock. +
+

+

+
+
+
+
+
+ +
+
+ Deny Order in POS. +
+

Deny Order in POS by setting quantity in each product. +

+
+
+
+
+ +
+
+
+ POS Product Stock +

+ Are you ready to make your business more + organized? +
Improve now! +

+ +
+
+ +
+
+
+ + + +
+
+ +
+
+
+
+ acc_bg +
+ +
+
+
+
+

+ Display Stock in + + POS +

+
+
+

+ Go to Point Of Sale -> Configuration -> Settings -> + Display Stock. By enabling this feature you need to choose stock type as well as Location.

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Show + + Quantity +

+
+
+

+ Go to Point Of Sale -> Dashboard -> Shop -> NEW SESSION. + According to criteria you have chosen in settings Quantity will be displayed in pos session +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Deny + + Order +

+
+
+

+ Go to Point Of Sale ->Products ->Products -> Point of sale -> Deny POS Order. + User can set a limit so that order can be denied. +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Error + + Pop Up +

+
+
+

Go to Point Of Sale ->Dashboard -> Shop -> NEW SESSION. + if the value in quantity is less than or equal to Deny POS Order then the order will be denied + and shows Error popupWhile hovering over the product order line icon, you can see the product details. +

+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+

+ Shows quantity of product in POS.

+
+ +
+
+
+
+
+
+ +
+

+ Display product stock based on location.

+
+
+
+
+
+
+
+ +
+

+ Deny Order in POS by setting quantity in each product.

+
+
+
+
+
+
+
+ +
+

+ Can display On Hand quantity,Incoming quantity and Outgoing quantity.

+
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+

+ To view the stock quantity + for all products in Odoo 18 POS, + you need to enable the "Display stock" feature. +

+
+
+ +
+ +
+

+ You can enable this feature + by navigating to Point of Sale > Configuration > Settings. + Look for the "Display quantity" option and + check the box to activate it. + Save your settings after enabling this feature. +

+
+
+
+ +
+
+
+
+
+
+ +
+
+

+ Latest Release 18.0.1.0.0 +

+ + 03rd December, 2024 + +
+
+
+
+
+ Add +
+
+
+
    +
  • + Initial Commit +
  • +
+
+
+
+
+
+
+
+
+
+ + + +
+

+ Related Products +

+ +
+ +
+

+ Our Services

+ +
+ +
+
+ .... +
+
+ +
+ + +
+
+ + + + + + diff --git a/pos_product_stock/static/src/css/product_quantity.scss b/pos_product_stock/static/src/css/product_quantity.scss new file mode 100644 index 000000000..03d2a5e51 --- /dev/null +++ b/pos_product_stock/static/src/css/product_quantity.scss @@ -0,0 +1,12 @@ +.dummy{ +background-color : #F0F8FF ; +} +.ribbon { + padding: 9px; + position: relative; + top: 0; + background-color: #c3d8c3; + font-weight: bold; + width: 26%; + height: 39px; +} diff --git a/pos_product_stock/static/src/js/deny_order.js b/pos_product_stock/static/src/js/deny_order.js new file mode 100644 index 000000000..61d45adc3 --- /dev/null +++ b/pos_product_stock/static/src/js/deny_order.js @@ -0,0 +1,99 @@ +/** @odoo-module **/ +import { patch } from "@web/core/utils/patch"; +import { useService } from "@web/core/utils/hooks"; +import { AlertDialog } from "@web/core/confirmation_dialog/confirmation_dialog"; +import { ProductScreen } from "@point_of_sale/app/screens/product_screen/product_screen"; +import { _t } from "@web/core/l10n/translation"; + +patch(ProductScreen.prototype, { + setup(){ + super.setup(); + + }, + async addProductToOrder(event) { + const current_product_id = event.id; + const product_product = this.pos.product_product; + const stock_product = this.pos.stock_quant; + const main_product = product_product.find(product => product.id === current_product_id); + const product_tmpl_id = main_product._raw.product_tmpl_id; + const product_variants = product_product.filter(product => product._raw.product_tmpl_id === product_tmpl_id); + let total_qty_available = 0; + product_variants.forEach(variant => { + stock_product.forEach(stock => { + if (stock.product_id && stock.product_id.id === variant.id) { + total_qty_available += stock.available_quantity; + } + }); + }); + if(event.type === 'consu'){ + if(this.pos.res_setting['stock_from'] === 'all_warehouse'){ + let qty_available = 0; + product_variants.forEach((variant) => { + if (variant.qty_available) { + qty_available += variant.qty_available; + } + }); + if (this.pos.res_setting['stock_type'] === 'on_hand') { + if (qty_available <= event.deny) { + await this.dialog.add(AlertDialog, { + title: _t('Deny Order'), + body: _t('%s is Out Of Stock', event.name), + }); + } else { + super.addProductToOrder(event); + } + }else if (this.pos.res_setting['stock_type'] === 'outgoing_qty') { + if (event.outgoing_qty <= event.deny) { + await this.dialog.add(AlertDialog, { + title: _t('Deny Order'), + body: _t('%s is Out Of Stock', event.name), + }); + }else { + super.addProductToOrder(event); + } + } else if (this.pos.res_setting['stock_type'] === 'incoming_qty') { + if (event.incoming_qty <= event.deny) { + await this.dialog.add(AlertDialog, { + title: _t('Deny Order'), + body: _t('%s is Out Of Stock', event.name), + }); + }else { + super.addProductToOrder(event); + } + } + }else if (this.pos.res_setting['stock_from'] ==='current_warehouse') { + if (this.pos.res_setting['stock_type'] === 'on_hand') { + if (total_qty_available <= event.deny) { + await this.dialog.add(AlertDialog, { + title: _t('Deny Order'), + body: _t('%s is Out Of Stock', event.name), + }); + } else { + super.addProductToOrder(event); + } + }else if (this.pos.res_setting['stock_type'] === 'outgoing_qty') { + if (event.outgoing_qty <= event.deny) { + await this.dialog.add(AlertDialog, { + title: _t('Deny Order'), + body: _t('%s is Out Of Stock', event.name), + }); + } else { + super.addProductToOrder(event); + } + }else if (this.pos.res_setting['stock_type'] === 'incoming_qty') { + if (event.incoming_qty <= event.deny) { + await this.dialog.add(AlertDialog, { + title: _t('Deny Order'), + body: _t('%s is Out Of Stock', event.name), + }); + } else { + super.addProductToOrder(event); + } + } + } + }else { + super.addProductToOrder(event); + } + + }, +}); diff --git a/pos_product_stock/static/src/js/pos_location.js b/pos_product_stock/static/src/js/pos_location.js new file mode 100644 index 000000000..d3ce02380 --- /dev/null +++ b/pos_product_stock/static/src/js/pos_location.js @@ -0,0 +1,107 @@ +//** @odoo-module */ +import { ProductCard } from "@point_of_sale/app/generic_components/product_card/product_card"; +import { usePos } from "@point_of_sale/app/store/pos_hook"; +import { patch } from "@web/core/utils/patch"; +import { useService } from "@web/core/utils/hooks"; +import { useRef, useState } from "@odoo/owl"; + +patch(ProductCard.prototype, { + setup() { + super.setup(); + this.state = useState({ + qty_available: null, + incoming_qty: null, + outgoing_qty: null, + display_stock: false + }); + this.pos = usePos(); + this.orm = useService('orm'); + }, + async fetchProductDetails(productId) { + const product = await this.orm.call("product.product", "read", [[productId], ["name", "id", "incoming_qty","outgoing_qty","qty_available"]]); + return product[0]; + }, + async updateProductDetails() { + const productId = this.props.productId; + if (productId) { + this.productDetail = await this.fetchProductDetails(productId); + const product_product = this.pos.product_product; + const stock_product = this.pos.stock_quant; + const main_product = product_product.find(product => product.id === productId); + const product_tmpl_id = main_product._raw.product_tmpl_id; + const product_variants = product_product.filter(product => product._raw.product_tmpl_id === product_tmpl_id); + let total_qty_available = 0; + product_variants.forEach((variant) => { + if (variant.qty_available) { + total_qty_available += variant.qty_available; + } + }); + this.qty_available = total_qty_available; + } + }, + get value() { + if (this.pos.res_setting.display_stock == true) { + const current_product = this.props.productId; + const current_product_name = this.props.name; + const move_line = this.pos.move_line; + const stock_product = this.pos.stock_quant; + const product_product = this.pos.product_product; + let qty = 0; + let on_hand = 0; + let outgoing = 0; + let incoming = 0; + const main_product = product_product.find(product => product.id === current_product); + const product_tmpl_id = main_product._raw.product_tmpl_id; + const product_variants = product_product.filter(product => product._raw.product_tmpl_id === product_tmpl_id); + stock_product.forEach((product) => { + if (product && product.product_id) { + const product_id = product.product_id.id; + const is_variant = product_variants.some(variant => variant.id === product_id); + if (product_id === current_product || is_variant) { + qty += product.available_quantity; + on_hand += product.quantity; + } + } + }); + move_line.forEach((line) => { + if (line && line.product_id) { + if(line.product_id.id == current_product && this.pos.res_setting && this.pos.res_setting._raw.stock_location_id[1] == line._raw.location_dest_id[1]){ + incoming = incoming + line.product_id.incoming_qty; + }if(line.product_id.id == current_product && this.pos.res_setting && this.pos.res_setting._raw.stock_location_id && this.pos.res_setting._raw.stock_location_id[1] == line._raw.location_id[1]){ + outgoing = outgoing + line.product_id.outgoing_qty; + } + } + }); + + if (!this.props.available) { + this.props.available = qty + } + if (!this.props.on_hand) { + this.props.on_hand = on_hand; + } + if (!this.props.outgoing) { + this.props.outgoing = outgoing + } + if (!this.props.incoming) { + this.props.incoming_loc = incoming + } + + this.updateProductDetails().then(() => { + this.state.qty_available = this.qty_available + this.state.incoming_qty = this.productDetail.incoming_qty + this.state.outgoing_qty = this.productDetail.outgoing_qty + }); + this.state.display_stock = true; + return { + display_stock: this.pos.res_setting.display_stock + + }; + + } else { + return { + display_stock: false + }; + } + } +}); + diff --git a/pos_product_stock/static/src/js/pos_payment_screen.js b/pos_product_stock/static/src/js/pos_payment_screen.js new file mode 100644 index 000000000..7a1b0c4a4 --- /dev/null +++ b/pos_product_stock/static/src/js/pos_payment_screen.js @@ -0,0 +1,51 @@ +/** @odoo-module **/ +import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen"; +import { patch } from "@web/core/utils/patch"; + +patch(PaymentScreen.prototype, { + setup() { + super.setup(...arguments); + }, + async validateOrder(isForceValidate) { + var order = this.pos.get_order(); + var lines = order.get_orderlines(); + if (this.pos.res_setting['stock_from'] === 'all_warehouse') { + if (this.pos.res_setting['stock_type'] === 'on_hand') { + lines.forEach((line) => { + var order_quantity = line.qty; + var new_qty = line.product_id.qty_available - order_quantity; + line.product_id.qty_available = new_qty; + }); + }else if (this.pos.res_setting['stock_type'] === 'outgoing_qty') { + lines.forEach((line) => { + var order_quantity = line.qty; + + }); + } else if (this.pos.res_setting['stock_type'] === 'incoming_qty') { + lines.forEach((line) => { + var order_quantity = line.qty; + }); + } + } else if (this.pos.res_setting['stock_from'] === 'current_warehouse') { + if (this.pos.res_setting['stock_type'] === 'on_hand') { + lines.forEach((line) => { + var item_quantity = line.qty; + var on_hand_qty = line.product_id.qty_available; + var new_qty = on_hand_qty - item_quantity; + line.product_id.qty_available = new_qty; + }); + } else if (this.pos.res_setting['stock_type'] === 'outgoing_qty') { + lines.forEach((line) => { + var item_quantity = line.qty; + var out_going = line.product_id.outgoing; + }); + } else if (this.pos.res_setting['stock_type'] === 'incoming_qty') { + lines.forEach((line) => { + var item_quantity = line.qty; + var incoming = line.product_id.incoming; + }); + } + } + return super.validateOrder(...arguments); + } +}); diff --git a/pos_product_stock/static/src/js/pos_session.js b/pos_product_stock/static/src/js/pos_session.js new file mode 100644 index 000000000..08e97225b --- /dev/null +++ b/pos_product_stock/static/src/js/pos_session.js @@ -0,0 +1,13 @@ +/** @odoo-module */ +import { patch } from "@web/core/utils/patch"; +import { PosStore } from "@point_of_sale/app/store/pos_store"; + +patch(PosStore.prototype, { + async processServerData(data) { + super.processServerData(...arguments); + this.res_setting = this.data.models['res.config.settings'].getFirst(); + this.stock_quant = this.data.models['stock.quant'].getAll() + this.move_line = this.data.models['stock.move.line'].getAll(); + this.product_product = this.data.models['product.product'].getAll(); + } +}) \ No newline at end of file diff --git a/pos_product_stock/static/src/xml/product_item.xml b/pos_product_stock/static/src/xml/product_item.xml new file mode 100644 index 000000000..0a67c1901 --- /dev/null +++ b/pos_product_stock/static/src/xml/product_item.xml @@ -0,0 +1,43 @@ + + + + + + + +
+ +
+
+ +
+ +
+
+ +
+ +
+
+
+ + +
+ +
+
+ +
+ +
+
+ +
+ +
+
+
+
+
+
+
\ No newline at end of file diff --git a/pos_product_stock/views/product_template_views.xml b/pos_product_stock/views/product_template_views.xml new file mode 100644 index 000000000..e9eef77a8 --- /dev/null +++ b/pos_product_stock/views/product_template_views.xml @@ -0,0 +1,14 @@ + + + + + Product.template.view.form.inherit.pos.product.stock + product.template + + + + + + + + diff --git a/pos_product_stock/views/res_cofig_settings_views.xml b/pos_product_stock/views/res_cofig_settings_views.xml new file mode 100644 index 000000000..4c8ab8cdb --- /dev/null +++ b/pos_product_stock/views/res_cofig_settings_views.xml @@ -0,0 +1,41 @@ + + + + + res.config.settings.view.form.inherit.pos.product.stock + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+