diff --git a/laundry_management_pos/README.rst b/laundry_management_pos/README.rst new file mode 100755 index 000000000..62efac07f --- /dev/null +++ b/laundry_management_pos/README.rst @@ -0,0 +1,49 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +POS Laundry Management +====================== +* From the POS we need to generate Laundry orders in the back end with out close the current window. +* Automatically create Laundry order form POS sale. +* We can assign which products make Laundry order Automatically. +* We can assign which Service type make Laundry order. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Affero General Public License v3.0 (AGPL v3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +Developer: (V16) Unnimaya C O, 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/laundry_management_pos/__init__.py b/laundry_management_pos/__init__.py new file mode 100755 index 000000000..daff00253 --- /dev/null +++ b/laundry_management_pos/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Unnimaya C O (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 +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from . import controllers +from . import models diff --git a/laundry_management_pos/__manifest__.py b/laundry_management_pos/__manifest__.py new file mode 100755 index 000000000..39b8c7a1c --- /dev/null +++ b/laundry_management_pos/__manifest__.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Unnimaya C O (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 +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': "POS Laundry Management", + 'version': '16.0.1.0.0', + 'category': 'Point of Sale', + 'summary': """Launch Automatic Laundry Orders After selling Through POS.""", + 'description': """It manages the Point of sale laundry process with assigning works to workers.We can create + Laundry orders with the help of POS.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['point_of_sale', 'laundry_management'], + 'data': [ + 'views/pos_config_views.xml', + 'views/laundry_order_views.xml', + 'views/pos_order_views.xml' + ], + 'assets': { + 'web.assets_backend': [ + 'laundry_management_pos/static/src/css/pos.css', + ], + 'point_of_sale.assets': [ + 'laundry_management_pos/static/src/xml/button/washing_type_button.xml', + 'laundry_management_pos/static/src/js/button/washing_type_button.js', + 'laundry_management_pos/static/src/js/screen/washing_type_popup.js', + 'laundry_management_pos/static/src/xml/screen/washing_type_popup.xml', + 'laundry_management_pos/static/src/js/models.js', + 'laundry_management_pos/static/src/js/order_line.js', + 'laundry_management_pos/static/src/js/pos_receipt.js', + 'laundry_management_pos/static/src/xml/pos_receipt.xml', + 'laundry_management_pos/static/src/js/product_img.js', + 'laundry_management_pos/static/src/xml/product_img.xml', + 'laundry_management_pos/static/src/js/screen/product_screen.js', + 'laundry_management_pos/static/src/css/pos.css', + 'laundry_management_pos/static/src/xml/button/product_create_button.xml', + 'laundry_management_pos/static/src/js/button/product_create_button.js', + 'laundry_management_pos/static/src/js/screen/product_create_popup.js', + 'laundry_management_pos/static/src/xml/screen/product_create_popup.xml' + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/laundry_management_pos/controllers/__init__.py b/laundry_management_pos/controllers/__init__.py new file mode 100755 index 000000000..3399f24fc --- /dev/null +++ b/laundry_management_pos/controllers/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Unnimaya C O (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 +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from . import laundry_management_pos diff --git a/laundry_management_pos/controllers/laundry_management_pos.py b/laundry_management_pos/controllers/laundry_management_pos.py new file mode 100755 index 000000000..ad9191e29 --- /dev/null +++ b/laundry_management_pos/controllers/laundry_management_pos.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Unnimaya C O (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 +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from odoo import http +from odoo.http import request + + +class PosProductCreation(http.Controller): + """Class PosProductCreation is used to create a product from the POS + Screen""" + @http.route('/create_product', type="json", auth="none") + def create_product(self, category, name, price, product_reference, + unit_measure, product_categories): + """Used for creating product from the point of sale view + that easily create a new product from the point of sale""" + categories = { + 'Consumable': 'consu', + 'Service': 'service', + 'Storable': 'product' + } + request.env['product.template'].sudo().create({ + 'name': name, + 'detailed_type': categories.get(category, ''), + 'default_code': product_reference, + 'list_price': float(price), + 'uom_id': int(unit_measure), + 'uom_po_id': int(unit_measure), + 'categ_id': int(product_categories), + 'available_in_pos': True, + }) diff --git a/laundry_management_pos/doc/RELEASE_NOTES.md b/laundry_management_pos/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..8f1d93a1d --- /dev/null +++ b/laundry_management_pos/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 04.05.2024 +#### Version 16.0.1.0.0 +#### ADD +- Initial commit for POS Laundry Management diff --git a/laundry_management_pos/models/__init__.py b/laundry_management_pos/models/__init__.py new file mode 100755 index 000000000..425804bec --- /dev/null +++ b/laundry_management_pos/models/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Unnimaya C O (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 +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from . import laundry_order +from . import pos_config +from . import pos_order + + diff --git a/laundry_management_pos/models/laundry_order.py b/laundry_management_pos/models/laundry_order.py new file mode 100755 index 000000000..741c59ef5 --- /dev/null +++ b/laundry_management_pos/models/laundry_order.py @@ -0,0 +1,226 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Unnimaya C O (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 +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +import json +from odoo import api, fields, models, _ + + +class LaundryOrder(models.Model): + """ This class is inherited for model laundry_order. + It contains fields and the functions for the model + + Methods: + _compute_amount_all(self): + Action perform to computing the total amounts of the LaundryOrder. + + _compute_tax_totals_json(self): + Action perform to computing the total tax amount using the order-lines tax and amount. + + _invoice_count(self): + Action perform to computing the invoice count based on the particular Laundry order. + + _work_count(self): + Action perform to computing the work count based on the particular Laundry order. + + action_view_laundry_works(self): + Action perform to works details of the LaundryOrder , the laundry work smart button views are displayed. + + action_view_invoice(self): + Action perform to Invoice details of the LaundryOrder when opening the smart button we can view the invoice details. + """ + _inherit = 'laundry.order' + + order_ref = fields.Char(string='Order Ref', + help='Reference field for order') + pos_reference = fields.Char(string='Receipt Number', + help='Reference field for POS') + is_invoiced = fields.Boolean(string='Is Invoiced', invisible=1, + help='Boolean field for checking and ' + 'adding the invoices') + pos_order = fields.Boolean(string='Is POS order', + help='Boolean field for pos order ' + 'identification') + pos_order_id = fields.Many2one('pos.order', string='POS order', + help='Relating the many2one field for pos.order') + tax_totals_json = fields.Char(compute='_compute_tax_totals_json', + help='For computing the tax ') + amount_untaxed = fields.Monetary(string='Untaxed Amount', + compute='_compute_amount_all', + help='For computing the untaxed amount') + amount_tax = fields.Monetary(string='Taxes', compute='_compute_amount_all', + help='Compute the tax amounts') + total_amount = fields.Monetary(string='Total', store=True, + compute='_compute_amount_all', + help='Compute the total amount') + + @api.depends('order_lines') + def _compute_amount_all(self): + """ + Compute the total amounts of the LaundryOrder. + """ + for order in self: + amount_untaxed = amount_tax = 0.0 + for line in order.order_lines: + amount_untaxed += line.amount + amount_tax += line.price_tax + order.update({ + 'amount_untaxed': amount_untaxed, + 'amount_tax': amount_tax, + 'total_amount': amount_untaxed + amount_tax, + }) + + @api.depends('order_lines.tax_ids', 'order_lines.amount', + 'total_amount') + def _compute_tax_totals_json(self): + """ computing the total tax amount using the order-lines + tax and amount""" + def compute_taxes(order_lines): + price = order_lines.amount + orders = order_lines.laundry_obj + return order_lines.tax_ids._origin.compute_all(price, + orders.currency_id, + product= + order_lines.product_id, + partner= + orders.partner_shipping_id) + + for order in self: + tax_lines_data = self.env['account.move']._prepare_tax_lines_data_for_totals_from_object( + order.order_lines, compute_taxes) + tax_totals = self.env['account.move']._get_tax_totals( + order.partner_id, tax_lines_data, order.order_lines.amount, + order.total_amount, order.currency_id) + order.tax_totals_json = json.dumps(tax_totals) + + def _invoice_count(self): + """Computing the invoice count based on the particular Laundry order + override the _invoice_count function""" + work = self.env['pos.order'].search( + [('name', '=', self.order_ref)]) + if not work: + wrk_ordr_ids = self.env['account.move'].search([('invoice_origin', '=', + self.sale_obj.name)]) + self.invoice_count = len(wrk_ordr_ids) + else: + work_orders = self.env['account.move'].search([('invoice_origin', + '=', work.name)]) + self.invoice_count = len(work_orders) + self.is_invoiced = True + + def _work_count(self): + """Computing the work count based on the particular Laundry order + override the _work_count function""" + work = self.env['pos.order'].search( + [('name', '=', self.order_ref)]) + if not work: + if self.id: + wrk_ordr_ids = self.env['washing.washing'].search([('laundry_obj.laundry_obj.id', '=', self.id)]) + self.work_count = len(wrk_ordr_ids) + else: + self.work_count = False + else: + self.work_count = len(work.lines) + + def action_view_laundry_works(self): + """ + works details of the LaundryOrder , the laundry work + smart button views are displayed here. + """ + result = super().action_view_laundry_works() + pos_orders = self.env['pos.order'].search( + [('name', '=', self.order_ref)]) + pos_order_ids = pos_orders.mapped('id') + view_id = self.env.ref('laundry_management.washing_form_view').id + if pos_orders and len(pos_orders.lines) <= 1: + return { + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'washing.washing', + 'view_id': view_id, + 'type': 'ir.actions.act_window', + 'name': _('Works'), + 'res_id': pos_order_ids and pos_order_ids[0] + } + + return result + + def action_view_invoice(self): + """ + Invoice details of the LaundryOrder when opening the smart button + we can view the invoice details. + """ + result = super(LaundryOrder, self).action_view_invoice() + work = self.env['pos.order'].search( + [('name', '=', self.order_ref)]) + invoice = self.env['account.move'].search( + [('invoice_origin', '=', work.name)]) + invoice_ids = invoice.mapped('id') + view_id = self.env.ref('account.view_move_form').id + if invoice and len(invoice_ids) <= 1: + return { + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'account.move', + 'view_id': view_id, + 'type': 'ir.actions.act_window', + 'name': _('Invoice'), + 'res_id': invoice_ids and invoice_ids[0] + } + return result + + +class LaundryOrderLine(models.Model): + """ This class is inherited for model laundry_order_line. + It contains fields and the functions for the model + + Methods: + _compute_price_tax(self): + Action perform to compute the subtotal amounts of the LaundryOrder line. + + """ + _inherit = 'laundry.order.line' + + # washing_type field is updated with the module Laundry Management + washing_type = fields.Many2one('washing.type', string='Washing Type', + required=False, + help='The many2one field for relating' + ' to the washing type') + tax_ids = fields.Many2many('account.tax', string='Taxes', + help='The many2one field for relating to ' + 'the account tax') + price_tax = fields.Float(compute='_compute_price_tax', string='Total Tax', + help='The compute field for calculating price ' + 'tax') + + @api.depends('qty', 'washing_type', 'extra_work', 'tax_ids') + def _compute_price_tax(self): + """ + Compute the amounts of the LaundryOrder line ie used to calculate subtotal amount with the quantity of product and the washing types. + """ + for line in self: + price = line.washing_type.amount + taxes = line.tax_ids.compute_all(price, + line.laundry_obj.currency_id, + line.qty, + product=line.product_id, + partner=line.laundry_obj.partner_shipping_id) + line.update({ + 'price_tax': taxes['total_included'] - taxes['total_excluded'], + }) diff --git a/laundry_management_pos/models/pos_config.py b/laundry_management_pos/models/pos_config.py new file mode 100755 index 000000000..25441f64c --- /dev/null +++ b/laundry_management_pos/models/pos_config.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Unnimaya C O (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 +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from odoo import fields, models + + +class PosConfig(models.Model): + """ This class is inherited for model pos_config. + It contains field for the model + """ + + _inherit = 'pos.config' + + orderline_washing_type = fields.Boolean(string='Washing Type', + help='Allow to add Washing type' + ' for customer on OrderLines') diff --git a/laundry_management_pos/models/pos_order.py b/laundry_management_pos/models/pos_order.py new file mode 100755 index 000000000..68d996d60 --- /dev/null +++ b/laundry_management_pos/models/pos_order.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Unnimaya C O (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 +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from datetime import datetime +from odoo import api, fields, models, _ +from odoo.tools import float_repr + + +class PosOrderLine(models.Model): + """ This class is inherited for model pos_order_line. + It contains field and the functions for the model + + Methods: + _export_for_ui(self, orderline): + Supering the export_for_ui function for generating the washing type in the order line for the model. + + _order_line_fields(self, line, session_id): + Action perform to adding order-line details in the pos orders. + """ + _inherit = 'pos.order.line' + + washing_type_id = fields.Many2one('washing.type', + String='Washing Type', + help='The many2one filed that related' + ' to the washing type') + + def _export_for_ui(self, orderline): + """super the exporting function in the pos order line""" + result = super()._export_for_ui(orderline) + result['washing_type_id'] = \ + orderline.washing_type.read(fields=['name'])[0] + return result + + def _order_line_fields(self, line, session_id): + """ + Adding order-line details in the pos orders + """ + result = super()._order_line_fields(line, session_id) + vals = result[2] + washing_type_id = line[2].get('washingType_id') + new_values = {'washing_type_id': int(washing_type_id)} + vals.update(new_values) + return result + + +class PosOrder(models.Model): + """ This class is inherited for model pos_order. + It contains fields and the functions for the model + Methods: + create_from_ui(self, orders, draft=False): + Supering the create_from_ui that create and update Orders + from the frontend PoS application line for the model. + + _prepare_invoice_lines(self): + Action perform to create Invoice for the corresponding POS order + + """ + _inherit = "pos.order" + + orderline_washing_type = fields.Boolean(string='Washing Type in orderline', + related='session_id.config_id.orderline_washing_type', + help='Related to the type in the pos session washing type id') + laundry_order = fields.Boolean('Laundry', + help='Field for calling the invoice' + ' functionality') + + @api.model + def create_from_ui(self, orders, draft=False): + """ Create and update Orders from the frontend PoS application. + """ + order = super(PosOrder, self).create_from_ui(orders=orders, + draft=draft) + if order: + order_id = order[0]['id'] + values = self.env['pos.order'].browse(order_id) + values.write({ + 'laundry_order': True, + }) + if values.laundry_order: + values.action_pos_order_invoice() + lines = [] + for rec in values.lines: + vals = (0, 0, { + 'product_id': rec.product_id.id, + 'description': rec.full_product_name, + 'qty': rec.qty, + 'state': 'done', + 'tax_ids': [(6, 0, rec.tax_ids.ids)], + 'washing_type': rec.washing_type_id.id, + 'amount': rec.price_subtotal_incl, + }) + lines.append(vals) + laundry_order = self.env['laundry.order'].sudo().create({ + 'order_ref': values.name, + 'pos_order_id': values.id, + 'pos_reference': values.pos_reference, + 'partner_id': values.partner_id.id, + 'partner_invoice_id': values.partner_id.id, + 'partner_shipping_id': values.partner_id.id, + 'laundry_person': values.user_id.id, + 'state': 'done', + 'order_lines': lines, + }) + for each in laundry_order: + for obj in each.order_lines: + self.env['washing.washing'].create( + {'name': obj.product_id.name + '-Washing', + 'user_id': obj.washing_type.assigned_person.id, + 'description': obj.description, + 'laundry_obj': obj.id, + 'state': 'done', + 'washing_date': datetime.now().strftime( + '%Y-%m-%d %H:%M:%S')}) + return order + + def _prepare_invoice_lines(self): + """ + Invoice for the corresponding POS order + """ + invoice_lines = [] + for line in self.lines: + invoice_lines.append((0, None, self._prepare_invoice_line(line))) + if line.order_id.pricelist_id.discount_policy == 'without_discount' \ + and line.price_unit != line.product_id.lst_price: + invoice_lines.append((0, None, { + 'name': _('Price discount from %s -> %s', + float_repr(line.product_id.lst_price, + self.currency_id.decimal_places), + float_repr(line.price_unit, + self.currency_id.decimal_places)), + 'display_type': 'line_note', + })) + if line.customer_note: + invoice_lines.append((0, None, { + 'name': line.customer_note, + 'display_type': 'line_note', + })) + if line.washing_type_id: + invoice_lines.append((0, None, { + 'name': line.washing_type_id.name, + 'display_type': 'line_note', + })) + return invoice_lines diff --git a/laundry_management_pos/static/description/assets/icons/check.png b/laundry_management_pos/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/check.png differ diff --git a/laundry_management_pos/static/description/assets/icons/chevron.png b/laundry_management_pos/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/chevron.png differ diff --git a/laundry_management_pos/static/description/assets/icons/cogs.png b/laundry_management_pos/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/cogs.png differ diff --git a/laundry_management_pos/static/description/assets/icons/consultation.png b/laundry_management_pos/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/consultation.png differ diff --git a/laundry_management_pos/static/description/assets/icons/ecom-black.png b/laundry_management_pos/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/ecom-black.png differ diff --git a/laundry_management_pos/static/description/assets/icons/education-black.png b/laundry_management_pos/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/education-black.png differ diff --git a/laundry_management_pos/static/description/assets/icons/hotel-black.png b/laundry_management_pos/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/hotel-black.png differ diff --git a/laundry_management_pos/static/description/assets/icons/license.png b/laundry_management_pos/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/license.png differ diff --git a/laundry_management_pos/static/description/assets/icons/lifebuoy.png b/laundry_management_pos/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/lifebuoy.png differ diff --git a/laundry_management_pos/static/description/assets/icons/manufacturing-black.png b/laundry_management_pos/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/manufacturing-black.png differ diff --git a/laundry_management_pos/static/description/assets/icons/pos-black.png b/laundry_management_pos/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/pos-black.png differ diff --git a/laundry_management_pos/static/description/assets/icons/puzzle.png b/laundry_management_pos/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/puzzle.png differ diff --git a/laundry_management_pos/static/description/assets/icons/restaurant-black.png b/laundry_management_pos/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/restaurant-black.png differ diff --git a/laundry_management_pos/static/description/assets/icons/service-black.png b/laundry_management_pos/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/service-black.png differ diff --git a/laundry_management_pos/static/description/assets/icons/trading-black.png b/laundry_management_pos/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/trading-black.png differ diff --git a/laundry_management_pos/static/description/assets/icons/training.png b/laundry_management_pos/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/training.png differ diff --git a/laundry_management_pos/static/description/assets/icons/update.png b/laundry_management_pos/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/update.png differ diff --git a/laundry_management_pos/static/description/assets/icons/user.png b/laundry_management_pos/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/user.png differ diff --git a/laundry_management_pos/static/description/assets/icons/wrench.png b/laundry_management_pos/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/laundry_management_pos/static/description/assets/icons/wrench.png differ diff --git a/laundry_management_pos/static/description/assets/misc/categories.png b/laundry_management_pos/static/description/assets/misc/categories.png new file mode 100755 index 000000000..bedf1e0b1 Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/categories.png differ diff --git a/laundry_management_pos/static/description/assets/misc/check-box.png b/laundry_management_pos/static/description/assets/misc/check-box.png new file mode 100755 index 000000000..42caf24b9 Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/check-box.png differ diff --git a/laundry_management_pos/static/description/assets/misc/compass.png b/laundry_management_pos/static/description/assets/misc/compass.png new file mode 100755 index 000000000..d5fed8faa Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/compass.png differ diff --git a/laundry_management_pos/static/description/assets/misc/corporate.png b/laundry_management_pos/static/description/assets/misc/corporate.png new file mode 100755 index 000000000..2eb13edbf Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/corporate.png differ diff --git a/laundry_management_pos/static/description/assets/misc/customer-support.png b/laundry_management_pos/static/description/assets/misc/customer-support.png new file mode 100755 index 000000000..79efc72ed Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/customer-support.png differ diff --git a/laundry_management_pos/static/description/assets/misc/cybrosys-logo.png b/laundry_management_pos/static/description/assets/misc/cybrosys-logo.png new file mode 100755 index 000000000..cc3cc0ccf Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/cybrosys-logo.png differ diff --git a/laundry_management_pos/static/description/assets/misc/features.png b/laundry_management_pos/static/description/assets/misc/features.png new file mode 100755 index 000000000..b41769f77 Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/features.png differ diff --git a/laundry_management_pos/static/description/assets/misc/logo.png b/laundry_management_pos/static/description/assets/misc/logo.png new file mode 100755 index 000000000..478462d3e Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/logo.png differ diff --git a/laundry_management_pos/static/description/assets/misc/pictures.png b/laundry_management_pos/static/description/assets/misc/pictures.png new file mode 100755 index 000000000..56d255fe9 Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/pictures.png differ diff --git a/laundry_management_pos/static/description/assets/misc/pie-chart.png b/laundry_management_pos/static/description/assets/misc/pie-chart.png new file mode 100755 index 000000000..426e05244 Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/pie-chart.png differ diff --git a/laundry_management_pos/static/description/assets/misc/right-arrow.png b/laundry_management_pos/static/description/assets/misc/right-arrow.png new file mode 100755 index 000000000..730984a06 Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/right-arrow.png differ diff --git a/laundry_management_pos/static/description/assets/misc/star.png b/laundry_management_pos/static/description/assets/misc/star.png new file mode 100755 index 000000000..2eb9ab29f Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/star.png differ diff --git a/laundry_management_pos/static/description/assets/misc/support.png b/laundry_management_pos/static/description/assets/misc/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/support.png differ diff --git a/laundry_management_pos/static/description/assets/misc/whatsapp.png b/laundry_management_pos/static/description/assets/misc/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/laundry_management_pos/static/description/assets/misc/whatsapp.png differ diff --git a/laundry_management_pos/static/description/assets/modules/l1.png b/laundry_management_pos/static/description/assets/modules/l1.png new file mode 100644 index 000000000..d1d3775d6 Binary files /dev/null and b/laundry_management_pos/static/description/assets/modules/l1.png differ diff --git a/laundry_management_pos/static/description/assets/modules/l2.png b/laundry_management_pos/static/description/assets/modules/l2.png new file mode 100644 index 000000000..2a27948da Binary files /dev/null and b/laundry_management_pos/static/description/assets/modules/l2.png differ diff --git a/laundry_management_pos/static/description/assets/modules/l3.png b/laundry_management_pos/static/description/assets/modules/l3.png new file mode 100644 index 000000000..dcbd0cb06 Binary files /dev/null and b/laundry_management_pos/static/description/assets/modules/l3.png differ diff --git a/laundry_management_pos/static/description/assets/modules/l4.png b/laundry_management_pos/static/description/assets/modules/l4.png new file mode 100644 index 000000000..17c14989e Binary files /dev/null and b/laundry_management_pos/static/description/assets/modules/l4.png differ diff --git a/laundry_management_pos/static/description/assets/modules/l5.png b/laundry_management_pos/static/description/assets/modules/l5.png new file mode 100755 index 000000000..a77027978 Binary files /dev/null and b/laundry_management_pos/static/description/assets/modules/l5.png differ diff --git a/laundry_management_pos/static/description/assets/modules/l6.png b/laundry_management_pos/static/description/assets/modules/l6.png new file mode 100644 index 000000000..66e5f3dd1 Binary files /dev/null and b/laundry_management_pos/static/description/assets/modules/l6.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/1.png b/laundry_management_pos/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..6add59e6a Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/1.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/10.png b/laundry_management_pos/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..9dfbe1f27 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/10.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/11.png b/laundry_management_pos/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..5799b3f22 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/11.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/12.png b/laundry_management_pos/static/description/assets/screenshots/12.png new file mode 100644 index 000000000..cc2bef6d9 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/12.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/13.png b/laundry_management_pos/static/description/assets/screenshots/13.png new file mode 100644 index 000000000..954f0da95 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/13.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/14.png b/laundry_management_pos/static/description/assets/screenshots/14.png new file mode 100644 index 000000000..c98fcf7b6 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/14.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/2.png b/laundry_management_pos/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..f70de0647 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/2.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/3.png b/laundry_management_pos/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..41dde98dd Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/3.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/4.png b/laundry_management_pos/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..fbe159906 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/4.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/5.png b/laundry_management_pos/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..f367857c2 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/5.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/6.png b/laundry_management_pos/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..f361fff06 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/6.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/7.png b/laundry_management_pos/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..d13568f29 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/7.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/8.png b/laundry_management_pos/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..6ddee8c11 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/8.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/9.png b/laundry_management_pos/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..925b9e819 Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/9.png differ diff --git a/laundry_management_pos/static/description/assets/screenshots/hero.gif b/laundry_management_pos/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..862bbc16d Binary files /dev/null and b/laundry_management_pos/static/description/assets/screenshots/hero.gif differ diff --git a/laundry_management_pos/static/description/banner.png b/laundry_management_pos/static/description/banner.png new file mode 100644 index 000000000..1d410859b Binary files /dev/null and b/laundry_management_pos/static/description/banner.png differ diff --git a/laundry_management_pos/static/description/icon.png b/laundry_management_pos/static/description/icon.png new file mode 100644 index 000000000..9041daaef Binary files /dev/null and b/laundry_management_pos/static/description/icon.png differ diff --git a/laundry_management_pos/static/description/index.html b/laundry_management_pos/static/description/index.html new file mode 100755 index 000000000..e9da1a163 --- /dev/null +++ b/laundry_management_pos/static/description/index.html @@ -0,0 +1,680 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ POS Laundry Management

+

+ A Module For Configuring the Point of Sale in Laundry + Management.

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

+ Explore This + Module

+
+ + + +
+
+ +
+

+ Overview +

+
+
+
+ In the POS Laundry Management App, It manages the Point of sale laundry + process with assigning works to workers.We can create Laundry orders + with the help of POS. Before installing this module, Install the Laundry + management module in the Odoo App Store. +
+
+ + +
+
+ +
+

+ Features +

+
+
+
+
+ + Display Laundry Service in the POS Screen. + +
+
+ + Display Washing Type in the Order lines and Order Receipts. + +
+
+ + Make Invoices Based on the Laundry Orders. + +
+
+ + Create Product from the POS Screen. + +
+
+
+ + +
+
+ +
+

+ Screenshots +

+
+
+
+

+ Enable Washing Type in the POS Settings.

+ +
+
+

+ Laundry Service button in POS Screen

+ +
+
+

+ Add Washing Type.

+

+ Click either Laundry Service button or the custom button in orderline to add the Washing Type. +

+ +
+
+

+ Washing Type added to the orderline.

+ +
+
+

+ Washing Type in Receipt

+ +
+
+

+ Washing Type in Invoice

+ +
+
+

+ Create Product button in POS Screen

+

+ Click Create Product button to add new products. +

+ +
+
+

+ Product Popup.

+

+ Add product details and click Create Product button. +

+ +
+
+

+ Added Product.

+ +
+
+

+ Laundry Order in Laundry Management module.

+

+ Navigate to Laundry Order under Laundry Management menu in Laundry Management module and open the order created from POS. +

+ +
+
+

+ Works in Laundry Order.

+ +
+
+

+ List view of Works.

+ +
+
+

+ Invoice in Laundry Order

+ +
+
+

+ Invoice form view.

+ +
+
+ + +
+
+ +
+

+ Related + 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

+
+
+
+
+ + +
+
+ +
+

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/laundry_management_pos/static/src/css/pos.css b/laundry_management_pos/static/src/css/pos.css new file mode 100755 index 000000000..9df293c34 --- /dev/null +++ b/laundry_management_pos/static/src/css/pos.css @@ -0,0 +1,109 @@ +.pos .numpad button { + color: #2F4F4F; + background: #D3D6D6; + border-color: #2F4F4F; +} + +.pos button.button.set-customer{ + padding-left: 0px; + padding-right: 0px; + color: black; + } +.pos .actionpad .button.set-customer.decentered{ + padding-left: 0px; + padding-right: 0px; + color: black; + } +.pos .button-control { + background: #A9A9A9; + color: black; + border: none; + border-radius: 0; + border-top: 1px solid; + border-left: 1px solid; + border-bottom: 1px solid; + border-right: 1px solid; + border-color: white; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + flex-grow: 1; + height: 60px; +} +.pos .order .orderline .pos_product_image{ + float:left; + margin:auto; +} +.pos .order { + padding-top: 0px !important; +} +.pos .order .orderline .product-name { + padding-top: 5px; +} +.pos .order .orderline .info-list { + margin-left: 15px; + padding-bottom: 10px; + font-weight: bold; + font-family: Verdana; +} +.pos .order .orderline .product-name{ + padding:0; + display:inline-block; + font-weight: bold; + font-family: Verdana; + width:80%; + overflow:hidden; + text-overflow: ellipsis; +} +.pos .actionpad .button.pay { + height: calc(var(--btn-height-size) * 3); + color: black; +} +.pos .order .orderline .price{ + padding:0; + font-weight: bold; + font-family: Verdana; + float:right; +} +.salesperson-scroll{ + height: 270px; + overflow: auto; +} + +.salesperson { + border-collapse: collapse; + width: 100%; +} + +.salesperson td{ + text-align: left; + border: 1px solid #ddd; + padding: 8px; +} + +.salesperson tr:nth-child(even){background-color: #f2f2f2;} + +.salesperson tr:hover {background-color: #ddd;} + +.orderline-salesperson{ + padding:5; + float:right; +} +.orderline-laundry{ + padding:5; + float:left; +} +.pos .products-widget .products-widget-control{ + display: none; +} +.pos button, .pos a.button { + display: inline-block; + cursor: pointer; + padding: 4px 10px; + font-size: 11px; + border: 1px solid #cacaca; + background: #A9A9A9; + border-radius: 3px; +} +.button-control:hover { + background: #efefef; +} diff --git a/laundry_management_pos/static/src/js/button/product_create_button.js b/laundry_management_pos/static/src/js/button/product_create_button.js new file mode 100644 index 000000000..d5382acb5 --- /dev/null +++ b/laundry_management_pos/static/src/js/button/product_create_button.js @@ -0,0 +1,81 @@ +odoo.define('laundry_management_pos.product_create_button', function(require) { + 'use strict'; + +const PosComponent = require('point_of_sale.PosComponent'); +const ProductScreen = require('point_of_sale.ProductScreen'); +const { useListener } = require("@web/core/utils/hooks"); +const Registries = require('point_of_sale.Registries'); +const ajax = require('web.ajax'); +const { Gui } = require('point_of_sale.Gui'); + +// Extending the PosComponent that used to create a button in the POS View +class ProductCreateButton extends PosComponent { + async setup() { + super.setup(); + await this.loadProductCategory(); + } + async loadProductCategory() { + // Method for loading product categories + const product_categories = await this.rpc({ + model: 'product.category', + method: 'search_read', + fields: ['name', 'complete_name'], + }); + this.env.pos.product_categories = product_categories; + } + async _onClickCreateProduct(e) { + //Method for opening the popup + var self = this; + const core = require('web.core'); + const _t = core._t; + const { confirmed, payload } = await Gui.showPopup("ProductCreatePopup", { + title: _t("POS Product Creation"), + confirmText: _t("Exit"), + }); + if (confirmed) { + var product_category = payload[0]; + var product_name = payload[1]; + var product_reference = payload[2]; + var product_price = payload[3]; + var unit_measure = payload[4]; + var product_categories = payload[5]; + var pos_categories = payload[6]; + if (!product_name){ + return this.showPopup('ErrorPopup', { + title: _('Product Name is Required'), + }); + } + if (!unit_measure){ + return this.showPopup('ErrorPopup', { + title: _('A Unit Of Measure is Required'), + }); + } + if (!product_categories){ + return this.showPopup('ErrorPopup', { + title: _('Product Category is Required'), + }); + } + ajax.jsonRpc('/create_product', 'call', { + 'category': product_category, + 'name': product_name, + 'price': product_price, + 'product_reference': product_reference, + 'unit_measure': unit_measure, + 'product_categories': product_categories, + 'pos_categories': pos_categories + }).then(function(response) {}); + } + } +} +// Create a new Button that used to Display the Product Information +ProductCreateButton.template = 'ProductCreateButton'; +ProductScreen.addControlButton({ + component: ProductCreateButton, + condition: function() { + return true; + }, + position: ['before', 'SetPricelistButton'], +}); +Registries.Component.add(ProductCreateButton); +return ProductCreateButton; +}); diff --git a/laundry_management_pos/static/src/js/button/washing_type_button.js b/laundry_management_pos/static/src/js/button/washing_type_button.js new file mode 100755 index 000000000..4b42b400b --- /dev/null +++ b/laundry_management_pos/static/src/js/button/washing_type_button.js @@ -0,0 +1,46 @@ +odoo.define('laundry_management_pos.Custom', function (require) { + 'use strict'; + const { Gui } = require('point_of_sale.Gui'); + const PosComponent = require('point_of_sale.PosComponent'); + const Registries = require('point_of_sale.Registries'); + const { useListener } = require("@web/core/utils/hooks"); + const models = require('point_of_sale.models'); + + // Extending the PosComponent that used to create a button in the POS View + class CustomDemoButtons extends PosComponent { + async setup() { + super.setup(); + await this.loadDataFromWashingTypeModel(); + } + async _onClickLaundry(e) { + //Method corresponds to Laundry service button click + const core = require('web.core'); + const _t = core._t; + Gui.showPopup("LaundryServiceTypePopup", { + title: _t("Laundry Service"), + confirmText: _t("Exit"), + service: this.env.pos.washing_type, + pos: this.env.pos, + }); + } + async loadDataFromWashingTypeModel() { + // Method for loading washing types + const washingTypeData = await this.rpc({ + model: 'washing.type', + method: 'search_read', + fields: ['name', 'assigned_person', 'amount'], + }); + this.env.pos.washing_type = washingTypeData; + } + } + CustomDemoButtons.template = 'CustomDemoButtons'; + const ProductScreen = Registries.Component.get('ProductScreen'); + ProductScreen.addControlButton({ + component: CustomDemoButtons, + condition: function () { + return this.env.pos.config.orderline_washing_type; + }, + }); + Registries.Component.add(CustomDemoButtons); + return CustomDemoButtons; +}); diff --git a/laundry_management_pos/static/src/js/models.js b/laundry_management_pos/static/src/js/models.js new file mode 100755 index 000000000..9a407ec3f --- /dev/null +++ b/laundry_management_pos/static/src/js/models.js @@ -0,0 +1,67 @@ +/** @odoo-module */ + +import { Orderline } from 'point_of_sale.models'; +import Registries from 'point_of_sale.Registries'; + +const PosSaleOrderline = (Orderline) => class PosSaleOrderline extends Orderline { + constructor() { + super(...arguments); + this.washingType = this.washingType || arguments[1].washingType; + this.washingType_id = this.washingType_id || 0.0; + this.washingType_price = this.washingType_id || 0.0; + } + + // Function to set the service type of the Washing + set_washingType(service) { + this.washingType = service.name; + this.washingType_id = service.id; + this.washingType_price = service.amount; + this.price = service.amount; + } + + // Function to get the service type of the Washing + get_washingType() { + return this.washingType; + } + + // Used to merge the services with Order-line + can_be_merged_with(orderline) { + if (orderline.get_washingType() !== this.get_washingType()) { + return false; + } else { + return super.can_be_merged_with(orderline); + } + } + + // Clone the service with order-lines + clone() { + var orderline = super.clone(); + orderline.washingType = this.washingType; + orderline.washingType_id = this.washingType_id; + orderline.washingType_price = this.washingType_price; + if(this.washingType_price){ + orderline.price = this.washingType_price; + } + return orderline; + } + //Add washing type and price to orderline + export_as_JSON() { + var json = super.export_as_JSON(); + json.washingType = this.washingType; + json.washingType_id = this.washingType_id; + json.washingType_price = this.washingType_price; + if (this.washingType_price){ + json.price=this.washingType_price; + } + return json; + } + //Set washing type and price to orderline + init_from_JSON(json) { + super.init_from_JSON(json); + this.washingType = json.washingType; + this.washingType_id = json.washingType_id; + this.washingType_price = json.washingType_price; + } +}; +Registries.Model.extend(Orderline, PosSaleOrderline); +export default PosSaleOrderline; diff --git a/laundry_management_pos/static/src/js/order_line.js b/laundry_management_pos/static/src/js/order_line.js new file mode 100755 index 000000000..3b758cb71 --- /dev/null +++ b/laundry_management_pos/static/src/js/order_line.js @@ -0,0 +1,22 @@ +/** @odoo-module */ + +import { Orderline } from 'point_of_sale.models'; +import Registries from 'point_of_sale.Registries'; + +const PosResOrderline = Orderline => class extends Orderline { + click() { + this.showPopup("LaundryServiceTypePopup", { + title: this.env._t("Laundry Service"), + service: this.env.pos.washing_type, + pos: this.env.pos, + orderline: this.props.line, + }); + } + remove_laundry() { + //Method for removing laundry + this.props.line.washingType = ''; + this.props.line.washingType_id = 0.0; + } +}; + // Extend Orderline with PosResOrderline + Registries.Component.extend('Orderline', PosResOrderline); diff --git a/laundry_management_pos/static/src/js/pos_receipt.js b/laundry_management_pos/static/src/js/pos_receipt.js new file mode 100755 index 000000000..641a8e0c1 --- /dev/null +++ b/laundry_management_pos/static/src/js/pos_receipt.js @@ -0,0 +1,18 @@ +odoo.define('laundry_management_pos.receipt', function(require){ + "use strict"; + + const { Orderline } = require('point_of_sale.models'); + const Registries = require('point_of_sale.Registries'); + var _super_orderline = Orderline.prototype; + // Extends the order-line used to add the Washing Details in the order receipts + const PosSaleOrderline = (Orderline) => class PosSaleOrderline extends Orderline { + // Used to add the Washing Details in the order receipt + export_for_printing(){ + var line = _super_orderline.export_for_printing.apply(this, arguments); + line.service_type = this.get_washingType(); + return line; + } +} + Registries.Model.extend(Orderline, PosSaleOrderline); + return PosSaleOrderline; +}); diff --git a/laundry_management_pos/static/src/js/product_img.js b/laundry_management_pos/static/src/js/product_img.js new file mode 100755 index 000000000..bf41e43cb --- /dev/null +++ b/laundry_management_pos/static/src/js/product_img.js @@ -0,0 +1,17 @@ +odoo.define('laundry_management_pos.pos_order_line', function(require) { +"use strict"; + + const { Orderline } = require('point_of_sale.models'); + const Registries = require('point_of_sale.Registries'); + + // Extend the order lines for getting the product images + const PosSaleOrderline = (Orderline) => class PosSaleOrderline extends Orderline { + // Product images uploading to the particular field + get_product_image(){ + const product = this.product; + return `/web/image?model=product.product&field=image_128&id=${product.id}&write_date=${product.write_date}&unique=1`; + } + }; +Registries.Model.extend(Orderline, PosSaleOrderline); +return PosSaleOrderline; +}); diff --git a/laundry_management_pos/static/src/js/screen/product_create_popup.js b/laundry_management_pos/static/src/js/screen/product_create_popup.js new file mode 100644 index 000000000..e10ce50b5 --- /dev/null +++ b/laundry_management_pos/static/src/js/screen/product_create_popup.js @@ -0,0 +1,50 @@ +/** @odoo-module */ + +import AbstractAwaitablePopup from 'point_of_sale.AbstractAwaitablePopup'; +import Registries from 'point_of_sale.Registries'; +import PosComponent from 'point_of_sale.PosComponent'; +import { useListener } from '@web/core/utils/hooks'; +const { useState, useRef } = owl; + +// Extending the AbstractAwaitablePopup that used to add a new popup +class ProductCreatePopup extends AbstractAwaitablePopup { + setup() { + super.setup(); + this.state = useState({ + typeValue: this.props.startingValue, + productValue: this.props.startingValue, + priceValue: this.props.priceValue, + productRef: this.props.startingValue + }); + } + getPayload() { + var selected_vals = []; + var category = this.state.typeValue; + var product = this.state.productValue; + var product_reference = this.state.productRef; + var price = this.state.priceValue; + var unit = this.state.unitValue; + var product_category = this.state.categoryValue; + selected_vals.push(category); + selected_vals.push(product); + selected_vals.push(product_reference); + selected_vals.push(price); + selected_vals.push(unit); + selected_vals.push(product_category); + return selected_vals + } +} +// Create Service popup +ProductCreatePopup.template = 'ProductCreatePopup'; +ProductCreatePopup.defaultProps = { + confirmText: 'Ok', + cancelText: 'Cancel', + array: [], + title: 'Create ?', + body: '', + startingValue: '', + priceValue: 1, + list: [], +}; +Registries.Component.add(ProductCreatePopup); +export default ProductCreatePopup; diff --git a/laundry_management_pos/static/src/js/screen/product_screen.js b/laundry_management_pos/static/src/js/screen/product_screen.js new file mode 100644 index 000000000..7809a4b6d --- /dev/null +++ b/laundry_management_pos/static/src/js/screen/product_screen.js @@ -0,0 +1,43 @@ +/** @odoo-module **/ + +import ProductScreen from 'point_of_sale.ProductScreen'; +import Registries from 'point_of_sale.Registries'; + +export const PoSSaleBeProductScreen = (ProductScreen) => + class extends ProductScreen { + async onClickPartner() { + // Override to check whether the laundry type already is added + const currentPartner = this.currentOrder.get_partner(); + if (currentPartner && this.currentOrder.getHasRefundLines()) { + this.showPopup('ErrorPopup', { + title: this.env._t("Can't change customer"), + body: _.str.sprintf( + this.env._t( + "This order already has refund lines for %s. We can't change the customer associated to it. Create a new order for the new customer." + ), + currentPartner.name + ), + }); + return; + } + const { confirmed, payload: newPartner } = await this.showTempScreen( + 'PartnerListScreen', + { partner: currentPartner } + ); + if (confirmed) { + this.currentOrder.set_partner(newPartner); + var washing=0 + for (let line of this.currentOrder.orderlines) { + if (line.get_washingType()) + { + washing=1 + } + } + if (washing==0) + { + this.currentOrder.updatePricelist(newPartner); + } + } + } + }; +Registries.Component.extend(ProductScreen, PoSSaleBeProductScreen); diff --git a/laundry_management_pos/static/src/js/screen/washing_type_popup.js b/laundry_management_pos/static/src/js/screen/washing_type_popup.js new file mode 100755 index 000000000..1c462a506 --- /dev/null +++ b/laundry_management_pos/static/src/js/screen/washing_type_popup.js @@ -0,0 +1,34 @@ +/** @odoo-module */ + +import AbstractAwaitablePopup from 'point_of_sale.AbstractAwaitablePopup'; +import Registries from 'point_of_sale.Registries'; +import PosComponent from 'point_of_sale.PosComponent'; +import { useListener } from '@web/core/utils/hooks'; + +// Extending the AbstractAwaitablePopup that used to add a new popup +class LaundryServiceTypePopup extends AbstractAwaitablePopup { + setup() { + super.setup(); + } + // Create a new Popup instance + laundryPopup(event) { + var order = this.props.pos.get_order(); + if (order.selected_orderline && !this.props.orderline) { + order.selected_orderline.set_washingType(this.env.pos.washing_type.find(obj => obj['id'] === parseInt(event.currentTarget.dataset['id']))); + } else if (order.selected_orderline && this.props.orderline) { + this.props.orderline.set_washingType(this.env.pos.washing_type.find(obj => obj['id'] === parseInt(event.currentTarget.dataset['id']))); + } + this.env.posbus.trigger('close-popup', { + popupId: this.props.id, + response: { confirmed: false, payload: null }, + }); + } +} +// Create Service popup +LaundryServiceTypePopup.template = 'LaundryServiceTypePopup'; +LaundryServiceTypePopup.defaultProps = { + confirmText: 'Ok', + cancelText: 'Cancel', +}; +Registries.Component.add(LaundryServiceTypePopup); +export default LaundryServiceTypePopup; diff --git a/laundry_management_pos/static/src/xml/button/product_create_button.xml b/laundry_management_pos/static/src/xml/button/product_create_button.xml new file mode 100755 index 000000000..6db9d09b8 --- /dev/null +++ b/laundry_management_pos/static/src/xml/button/product_create_button.xml @@ -0,0 +1,11 @@ + + + + +
+ + + Create Product +
+
+
diff --git a/laundry_management_pos/static/src/xml/button/washing_type_button.xml b/laundry_management_pos/static/src/xml/button/washing_type_button.xml new file mode 100755 index 000000000..83986e00e --- /dev/null +++ b/laundry_management_pos/static/src/xml/button/washing_type_button.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + +
+ + + Laundry Service +
+
+
diff --git a/laundry_management_pos/static/src/xml/pos_receipt.xml b/laundry_management_pos/static/src/xml/pos_receipt.xml new file mode 100755 index 000000000..54826531b --- /dev/null +++ b/laundry_management_pos/static/src/xml/pos_receipt.xml @@ -0,0 +1,57 @@ + + + + + +
+

+
+
+
+ + +
+ Assigned person: +
+ +
+
+
+
+ + + + + + + + +

Laundry Service

+
+
+ + + + +
+
--------------------------------
+
Laundry Person
+
+
+ +
+
+ +
+ +
+ +
+
+
+
+
+
+
diff --git a/laundry_management_pos/static/src/xml/product_img.xml b/laundry_management_pos/static/src/xml/product_img.xml new file mode 100755 index 000000000..b1d7c0d62 --- /dev/null +++ b/laundry_management_pos/static/src/xml/product_img.xml @@ -0,0 +1,11 @@ + + diff --git a/laundry_management_pos/static/src/xml/screen/product_create_popup.xml b/laundry_management_pos/static/src/xml/screen/product_create_popup.xml new file mode 100644 index 000000000..822dcbf02 --- /dev/null +++ b/laundry_management_pos/static/src/xml/screen/product_create_popup.xml @@ -0,0 +1,97 @@ + + + + + + + diff --git a/laundry_management_pos/static/src/xml/screen/washing_type_popup.xml b/laundry_management_pos/static/src/xml/screen/washing_type_popup.xml new file mode 100755 index 000000000..714380fbc --- /dev/null +++ b/laundry_management_pos/static/src/xml/screen/washing_type_popup.xml @@ -0,0 +1,41 @@ + + + + + + + diff --git a/laundry_management_pos/views/laundry_order_views.xml b/laundry_management_pos/views/laundry_order_views.xml new file mode 100755 index 000000000..130ea3453 --- /dev/null +++ b/laundry_management_pos/views/laundry_order_views.xml @@ -0,0 +1,31 @@ + + + + + laundry.order.view.form.inherit.laundry.management.pos + + laundry.order + + + + + + + + + + + + {'invisible': ['|', ('is_invoiced', '=', True), ('state', 'in', ('draft', 'order', 'process'))]} + + + + + + + diff --git a/laundry_management_pos/views/pos_config_views.xml b/laundry_management_pos/views/pos_config_views.xml new file mode 100755 index 000000000..33a35b9e8 --- /dev/null +++ b/laundry_management_pos/views/pos_config_views.xml @@ -0,0 +1,26 @@ + + + + + pos.config.view.form.inherit.laundry.management.pos + pos.config + + +
+
+
+ +
+
+
+
+
+
+
+
diff --git a/laundry_management_pos/views/pos_order_views.xml b/laundry_management_pos/views/pos_order_views.xml new file mode 100755 index 000000000..5997d374e --- /dev/null +++ b/laundry_management_pos/views/pos_order_views.xml @@ -0,0 +1,25 @@ + + + + + pos.order.view.form.inherit.laundry.management.pos + + pos.order + + + + + + + + + + + + +