diff --git a/salesperson_pos_order_line/README.rst b/salesperson_pos_order_line/README.rst new file mode 100644 index 000000000..b83675153 --- /dev/null +++ b/salesperson_pos_order_line/README.rst @@ -0,0 +1,45 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Salesperson on POS Order Line +============================= +This module is used to set salespersons on pos order line + +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 : (V14) Mruthul Raj, 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 https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ diff --git a/salesperson_pos_order_line/__init__.py b/salesperson_pos_order_line/__init__.py new file mode 100644 index 000000000..0b67299ef --- /dev/null +++ b/salesperson_pos_order_line/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Mruthul Raj(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 models diff --git a/salesperson_pos_order_line/__manifest__.py b/salesperson_pos_order_line/__manifest__.py new file mode 100644 index 000000000..13fe5bca2 --- /dev/null +++ b/salesperson_pos_order_line/__manifest__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Mruthul Raj(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 . +# +################################################################################ +{ + 'name': 'Salesperson on POS Order Line', + 'version': '14.0.1.0.0', + 'category': 'Point of Sale', + 'summary': 'Set salespersons on POS order lines', + 'description': 'This module allows you to assign salespersons to order' + 'lines in the Point of Sale (POS)', + 'author': 'Cybrosys Techno solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base', 'point_of_sale'], + 'data': [ + 'views/pos_order_views.xml', + 'views/assets.xml', + ], + 'qweb': [ + 'static/src/xml/pos_screen_templates.xml', + 'static/src/xml/pos_popup_templates.xml', + 'static/src/xml/receipt_templates.xml', + 'static/src/xml/orderline_templates.xml', + ], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/salesperson_pos_order_line/doc/RELEASE_NOTES.md b/salesperson_pos_order_line/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..f1b85dba9 --- /dev/null +++ b/salesperson_pos_order_line/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 17.08.2023 +#### Version 14.0.1.0.0 +#### ADD +- Initial commit for Salesperson on POS Order Line diff --git a/salesperson_pos_order_line/models/__init__.py b/salesperson_pos_order_line/models/__init__.py new file mode 100644 index 000000000..188e03f23 --- /dev/null +++ b/salesperson_pos_order_line/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Mruthul Raj(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_order +from . import pos_session diff --git a/salesperson_pos_order_line/models/pos_order.py b/salesperson_pos_order_line/models/pos_order.py new file mode 100644 index 000000000..87939c53b --- /dev/null +++ b/salesperson_pos_order_line/models/pos_order.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Mruthul Raj(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 PosOrderLine(models.Model): + """ + This class inherits the pos.order.line model to add a custom field 'sales_persons'. + """ + _inherit = 'pos.order.line' + + sales_persons = fields.Char(string='Salesperson', + help="Name of the salesperson associated with " + "this POS order line.") diff --git a/salesperson_pos_order_line/models/pos_session.py b/salesperson_pos_order_line/models/pos_session.py new file mode 100644 index 000000000..aeab40a5c --- /dev/null +++ b/salesperson_pos_order_line/models/pos_session.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Mruthul Raj(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 models + + +class PosSession(models.Model): + """ + This class inherits the pos.session model and adds custom functionality + related to POS UI models and res.users. + """ + _inherit = 'pos.session' + + def _pos_ui_models_to_load(self): + """ + Returns a list of models to load for the POS UI with 'res.users' added + to the list. + :return: List of models to load for the POS UI. + """ + result = super()._pos_ui_models_to_load() + result.append('res.users') + return result + + def _loader_params_res_users(self): + """ + Returns the loader parameters for the 'res.users' model. + :return: Dictionary containing the loader parameters. + """ + return { + 'search_params': { + 'fields': ['name'], + }, + } + + def _get_pos_ui_res_users(self, params): + """ + Returns a list of dictionaries containing the names of all users in the 'res.users' model. + :param params: Parameters for fetching res.users data. + :return: List of dictionaries with user names. + """ + return self.env['res.users'].search_read(**params['search_params']) diff --git a/salesperson_pos_order_line/static/description/assets/icons/check.png b/salesperson_pos_order_line/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/check.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/cogs.png b/salesperson_pos_order_line/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/cogs.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/consultation.png b/salesperson_pos_order_line/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/consultation.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/ecom-black.png b/salesperson_pos_order_line/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/ecom-black.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/education-black.png b/salesperson_pos_order_line/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/education-black.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/hotel-black.png b/salesperson_pos_order_line/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/hotel-black.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/license.png b/salesperson_pos_order_line/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/license.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/lifebuoy.png b/salesperson_pos_order_line/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/lifebuoy.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/logo.png b/salesperson_pos_order_line/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/logo.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/manufacturing-black.png b/salesperson_pos_order_line/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/manufacturing-black.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/pos-black.png b/salesperson_pos_order_line/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/pos-black.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/puzzle.png b/salesperson_pos_order_line/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/puzzle.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/restaurant-black.png b/salesperson_pos_order_line/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/restaurant-black.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/service-black.png b/salesperson_pos_order_line/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/service-black.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/trading-black.png b/salesperson_pos_order_line/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/trading-black.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/training.png b/salesperson_pos_order_line/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/training.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/update.png b/salesperson_pos_order_line/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/update.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/user.png b/salesperson_pos_order_line/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/user.png differ diff --git a/salesperson_pos_order_line/static/description/assets/icons/wrench.png b/salesperson_pos_order_line/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/icons/wrench.png differ diff --git a/salesperson_pos_order_line/static/description/assets/modules/1.png b/salesperson_pos_order_line/static/description/assets/modules/1.png new file mode 100644 index 000000000..2aa92f3a9 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/modules/1.png differ diff --git a/salesperson_pos_order_line/static/description/assets/modules/2.png b/salesperson_pos_order_line/static/description/assets/modules/2.png new file mode 100644 index 000000000..6f28da108 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/modules/2.png differ diff --git a/salesperson_pos_order_line/static/description/assets/modules/3.png b/salesperson_pos_order_line/static/description/assets/modules/3.png new file mode 100644 index 000000000..db07ea03d Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/modules/3.png differ diff --git a/salesperson_pos_order_line/static/description/assets/modules/4.png b/salesperson_pos_order_line/static/description/assets/modules/4.png new file mode 100644 index 000000000..3afc14722 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/modules/4.png differ diff --git a/salesperson_pos_order_line/static/description/assets/modules/5.png b/salesperson_pos_order_line/static/description/assets/modules/5.png new file mode 100644 index 000000000..cea66b05f Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/modules/5.png differ diff --git a/salesperson_pos_order_line/static/description/assets/modules/6.png b/salesperson_pos_order_line/static/description/assets/modules/6.png new file mode 100644 index 000000000..ab44c997a Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/modules/6.png differ diff --git a/salesperson_pos_order_line/static/description/assets/screenshots/hero.gif b/salesperson_pos_order_line/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..9583f49e2 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/screenshots/hero.gif differ diff --git a/salesperson_pos_order_line/static/description/assets/screenshots/pos22.png b/salesperson_pos_order_line/static/description/assets/screenshots/pos22.png new file mode 100644 index 000000000..be3c85925 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/screenshots/pos22.png differ diff --git a/salesperson_pos_order_line/static/description/assets/screenshots/pos23.png b/salesperson_pos_order_line/static/description/assets/screenshots/pos23.png new file mode 100644 index 000000000..35fdb810b Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/screenshots/pos23.png differ diff --git a/salesperson_pos_order_line/static/description/assets/screenshots/pos25.png b/salesperson_pos_order_line/static/description/assets/screenshots/pos25.png new file mode 100644 index 000000000..fcfe728f9 Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/screenshots/pos25.png differ diff --git a/salesperson_pos_order_line/static/description/assets/screenshots/pos26.png b/salesperson_pos_order_line/static/description/assets/screenshots/pos26.png new file mode 100644 index 000000000..57b5bfbca Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/screenshots/pos26.png differ diff --git a/salesperson_pos_order_line/static/description/assets/screenshots/receipt.png b/salesperson_pos_order_line/static/description/assets/screenshots/receipt.png new file mode 100644 index 000000000..bb32d819a Binary files /dev/null and b/salesperson_pos_order_line/static/description/assets/screenshots/receipt.png differ diff --git a/salesperson_pos_order_line/static/description/banner.png b/salesperson_pos_order_line/static/description/banner.png new file mode 100644 index 000000000..4a45ac5b2 Binary files /dev/null and b/salesperson_pos_order_line/static/description/banner.png differ diff --git a/salesperson_pos_order_line/static/description/icon.png b/salesperson_pos_order_line/static/description/icon.png new file mode 100644 index 000000000..8df8f49f3 Binary files /dev/null and b/salesperson_pos_order_line/static/description/icon.png differ diff --git a/salesperson_pos_order_line/static/description/index.html b/salesperson_pos_order_line/static/description/index.html new file mode 100644 index 000000000..a062ac9a4 --- /dev/null +++ b/salesperson_pos_order_line/static/description/index.html @@ -0,0 +1,644 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+ +
+
+
+
+ +
+
+
+

+ Salesperson on POS Order Line +

+

+ Now You Can Add Salesperson In POS Order Line

+ +
+
+ + + + +
+
+

+ Overview +

+
+ +
+

+ This module is used to add Salesperson on Pos Order Line.

+ +
+
+ + +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Compatible with Community and Enterprise version of + Odoo.

+ +
+
+ +
+
+ +
+
+

+ + Set Salespersons on POS Order Line.

+ +
+
+ + +
+ +
+
+

+ Screenshots +

+
+ +
+

+ You can see a new button in POS. +

+ + +
+
+

+ Select the Salesperson from the list. +

+ + +
+
+

+ You can also set multiple Salespersons. + +

+ + +
+
+

+ Here we can see the assigned Salesperson. +

+ +
+
+

+ Also, the assigned Salesperson will be in receipt. +

+ +
+
+ +
+
+

Suggested Products

+
+ +
+
+ + + +
+
+
+

Our Services

+
+
+ +
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+ +
+
+ +
+
+
+

Need Help?

+
+
+
+ + +
+ +
+ +
+ +
+ WhatsApp +
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
\ No newline at end of file diff --git a/salesperson_pos_order_line/static/src/js/pos_orderline.js b/salesperson_pos_order_line/static/src/js/pos_orderline.js new file mode 100644 index 000000000..7a4a67383 --- /dev/null +++ b/salesperson_pos_order_line/static/src/js/pos_orderline.js @@ -0,0 +1,50 @@ +odoo.define('salesperson_pos_order_line.Orderline', function(require) { + 'use strict'; + var models = require('point_of_sale.models'); + var _super_orderline = models.Orderline.prototype; + // Define the Orderline model and extend its functionality + models.Orderline = models.Orderline.extend({ + /** + * Initialize the Orderline model. + * + * @param {Object} attr - The Orderline attributes. + * @param {Object} options - The Orderline options. + */ + initialize: function(attr, options) { + _super_orderline.initialize.call(this, attr, options); + if(options.json) { + this.salesperson = this.salesperson; + } + }, + /** + * Initialize the Orderline model from a JSON object. + * + * @param {Object} json - The JSON object to initialize the model from. + */ + init_from_JSON: function(json) { + _super_orderline.init_from_JSON.apply(this, arguments); + this.salesperson = json.salesperson; + }, + + /** + * Export the Orderline model as a JSON object. + * + * @returns {Object} The Orderline model as a JSON object. + */ + export_as_JSON: function() { + var json = _super_orderline.export_as_JSON.apply(this, arguments); + json.sales_persons = this.salesperson; + return json; + }, + + /** + * Set the salesperson for the Orderline. + * + * @param {Array} sp - The salesperson to set for the Orderline. + */ + set_salesperson: function(sp) { + this.salesperson = sp[0]; + this.trigger('change', this); + } + }); +}); diff --git a/salesperson_pos_order_line/static/src/js/pos_popup.js b/salesperson_pos_order_line/static/src/js/pos_popup.js new file mode 100644 index 000000000..92b533a1b --- /dev/null +++ b/salesperson_pos_order_line/static/src/js/pos_popup.js @@ -0,0 +1,57 @@ +odoo.define('salesperson_pos_order_line.Order', function(require) { + 'use strict'; + // Import dependencies + const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); + const Registries = require('point_of_sale.Registries'); + const { useRef } = owl.hooks; + var core = require('web.core'); + const { + Gui + } = require('point_of_sale.Gui'); + var _t = core._t; + + // Define the CustomDemoPopup class as a subclass of AbstractAwaitablePopup + class CustomDemoPopup extends AbstractAwaitablePopup { + + constructor() { + super(...arguments); + this.salePersonRef = useRef('salePersonRef'); + } + + /** + * Confirm the selected salesperson for the orderline. + * If no orderline is selected, show an error popup. + */ + confirm() { + if (this.env.pos.get_order().get_selected_orderline()) { + var order = this.env.pos.get_order().get_selected_orderline(); + var product_id = order.product.id; + var product = this.env.pos.db.get_product_by_id(product_id); + let option = this.salePersonRef.el.selectedOptions[0] + order.set_salesperson([(option.value)]); + this.trigger('close-popup'); + } else { + Gui.showPopup("ErrorPopup", { + 'title': _t("Error"), + 'body': _.str.sprintf(_t('You should add product first')), + }); + return false; + } + } + /** + * Close the popup without making any changes. + */ + click_cancel(){ + this.trigger('close-popup'); + } + } + + // Define the template for the CustomDemoPopup + CustomDemoPopup.template = "CustomDemoPopup"; + + // Register the CustomDemoPopup component with the point of sale Registries + Registries.Component.add(CustomDemoPopup); + + // Export the CustomDemoPopup class for use in other modules + return CustomDemoPopup +}); diff --git a/salesperson_pos_order_line/static/src/js/pos_screen.js b/salesperson_pos_order_line/static/src/js/pos_screen.js new file mode 100644 index 000000000..e53852963 --- /dev/null +++ b/salesperson_pos_order_line/static/src/js/pos_screen.js @@ -0,0 +1,49 @@ +odoo.define('salesperson_pos_order_line.line', function(require) { + 'use strict'; + const PosComponent = require('point_of_sale.PosComponent'); + const ProductScreen = require('point_of_sale.ProductScreen'); + const { useListener } = require('web.custom_hooks'); + const Registries = require('point_of_sale.Registries'); + /** + * SetProductListButton is a custom POS component that displays a list of products sorted by name. + * Clicking the button displays a popup window that shows a list of sales persons. + * The sales persons are passed to the popup window as a prop. + */ + class SetProductListButton extends PosComponent { + constructor() { + super(...arguments); + useListener("click", this.onClick); + } + /** + * Gets a list of products sorted by name. + * + * @returns {Array} An array of product objects. + */ + get productsList() { + let list = []; + list = this.env.pos.db.get_product_by_category( + this.env.pos.selectedCategoryId + ); + return list.sort(function (a, b) { + return a.display_name.localeCompare(b.display_name); + }); + } + + // /** + // * Handles the click event when the button is clicked. + // * Displays a popup window that shows a list of sales persons. + // */ + async onClick() { + let list = this.productsList; + this.showPopup("CustomDemoPopup",{'sales_persons':this.env.pos.users}); + } + } + SetProductListButton.template = "CustomDemoButtons"; + ProductScreen.addControlButton({ + component: SetProductListButton, + condition: function () { + return true; + }, + }); + Registries.Component.add(SetProductListButton); +}); diff --git a/salesperson_pos_order_line/static/src/xml/orderline_templates.xml b/salesperson_pos_order_line/static/src/xml/orderline_templates.xml new file mode 100644 index 000000000..02f63c171 --- /dev/null +++ b/salesperson_pos_order_line/static/src/xml/orderline_templates.xml @@ -0,0 +1,15 @@ + + + + + +
+ + Salesperson: +
+
+
+
+
diff --git a/salesperson_pos_order_line/static/src/xml/pos_popup_templates.xml b/salesperson_pos_order_line/static/src/xml/pos_popup_templates.xml new file mode 100644 index 000000000..e75aecab9 --- /dev/null +++ b/salesperson_pos_order_line/static/src/xml/pos_popup_templates.xml @@ -0,0 +1,44 @@ + + + + + + + diff --git a/salesperson_pos_order_line/static/src/xml/pos_screen_templates.xml b/salesperson_pos_order_line/static/src/xml/pos_screen_templates.xml new file mode 100644 index 000000000..0dae684bf --- /dev/null +++ b/salesperson_pos_order_line/static/src/xml/pos_screen_templates.xml @@ -0,0 +1,11 @@ + + + + +
+ + Salesperson +
+
+
diff --git a/salesperson_pos_order_line/static/src/xml/receipt_templates.xml b/salesperson_pos_order_line/static/src/xml/receipt_templates.xml new file mode 100644 index 000000000..d4fd94674 --- /dev/null +++ b/salesperson_pos_order_line/static/src/xml/receipt_templates.xml @@ -0,0 +1,17 @@ + + + + + + +
+ Salesperson: + +
+
+
+
+
diff --git a/salesperson_pos_order_line/views/assets.xml b/salesperson_pos_order_line/views/assets.xml new file mode 100644 index 000000000..701df4c57 --- /dev/null +++ b/salesperson_pos_order_line/views/assets.xml @@ -0,0 +1,15 @@ + + + +