diff --git a/pos_multi_variant/README.rst b/pos_multi_variant/README.rst new file mode 100644 index 000000000..f10767ef4 --- /dev/null +++ b/pos_multi_variant/README.rst @@ -0,0 +1,41 @@ +POS Product Multi variant +========================= +* Configure products having variants + +Installation +============ +- www.odoo.com/documentation/12.0/setup/install.html +- Install our custom addon + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(http://www.gnu.org/licenses/agpl.html) + +Company +------- +* 'Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: + Sreejith sasidharan + Athira P S + +Contacts +-------- +* Mail Contact : odoo@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 +========== +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/pos_multi_variant/__init__.py b/pos_multi_variant/__init__.py new file mode 100644 index 000000000..05922f764 --- /dev/null +++ b/pos_multi_variant/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Sreejith sasidharan() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models diff --git a/pos_multi_variant/__manifest__.py b/pos_multi_variant/__manifest__.py new file mode 100644 index 000000000..c5a25b313 --- /dev/null +++ b/pos_multi_variant/__manifest__.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Sreejith sasidharan() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': "POS Product Multi variant", + 'version': '15.0.1.0.1', + 'summary': """Product with multi-variants""", + 'description': """Configure products having variants in POS""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'category': 'Point of Sale', + 'depends': ['base', + 'point_of_sale', + ], + 'data': ['views/pos_variants.xml', + 'security/ir.model.access.csv', + ], + + 'assets': { + 'point_of_sale.assets': [ + 'pos_multi_variant/static/src/css/label.css', + 'pos_multi_variant/static/src/js/models.js', + 'pos_multi_variant/static/src/js/ProductPopup.js', + 'pos_multi_variant/static/src/js/ProductScreen.js' + ], + 'web.assets_qweb': [ + 'pos_multi_variant/static/src/xml/label.xml', + 'pos_multi_variant/static/src/xml/popup.xml' + ], + }, + + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + + + + 'auto_install': False, +} diff --git a/pos_multi_variant/doc/RELEASE_NOTES.md b/pos_multi_variant/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..f9f551f05 --- /dev/null +++ b/pos_multi_variant/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 30.09.2022 +#### Version 15.0.1.0.0 +##### ADD +- Initial commit for pos_multi_variant + diff --git a/pos_multi_variant/models/__init__.py b/pos_multi_variant/models/__init__.py new file mode 100644 index 000000000..e1fe8a83c --- /dev/null +++ b/pos_multi_variant/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Sreejith sasidharan() +# +# 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_variants diff --git a/pos_multi_variant/models/pos_variants.py b/pos_multi_variant/models/pos_variants.py new file mode 100644 index 000000000..50aa1c897 --- /dev/null +++ b/pos_multi_variant/models/pos_variants.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Sreejith sasidharan() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, models, fields + + +class PosVarients(models.Model): + + _inherit = ['product.template'] + + pos_variants = fields.Boolean('pos variants', default=False) + variant_line_ids = fields.One2many('variants.tree', 'variants_id', string="Configure Variants") + + +class VariantsSelection(models.Model): + + _name = 'variants.tree' + + variants_id = fields.Many2one('product.template') + attribute = fields.Many2one('product.attribute', string='Attribute', ondelete='restrict', required=True, index=True) + value = fields.Many2many('product.attribute.value', string='Values') + extra_price = fields.Char(string="Price Extra") + pos_active = fields.Boolean(string="Active") + + diff --git a/pos_multi_variant/security/ir.model.access.csv b/pos_multi_variant/security/ir.model.access.csv new file mode 100644 index 000000000..29b68ed81 --- /dev/null +++ b/pos_multi_variant/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_variants_tree, access.variants.tree,model_variants_tree,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/pos_multi_variant/static/description/assets/icons/check.png b/pos_multi_variant/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/check.png differ diff --git a/pos_multi_variant/static/description/assets/icons/chevron.png b/pos_multi_variant/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/chevron.png differ diff --git a/pos_multi_variant/static/description/assets/icons/cogs.png b/pos_multi_variant/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/cogs.png differ diff --git a/pos_multi_variant/static/description/assets/icons/consultation.png b/pos_multi_variant/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/consultation.png differ diff --git a/pos_multi_variant/static/description/assets/icons/ecom-black.png b/pos_multi_variant/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/ecom-black.png differ diff --git a/pos_multi_variant/static/description/assets/icons/education-black.png b/pos_multi_variant/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/education-black.png differ diff --git a/pos_multi_variant/static/description/assets/icons/hotel-black.png b/pos_multi_variant/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/hotel-black.png differ diff --git a/pos_multi_variant/static/description/assets/icons/license.png b/pos_multi_variant/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/license.png differ diff --git a/pos_multi_variant/static/description/assets/icons/lifebuoy.png b/pos_multi_variant/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/lifebuoy.png differ diff --git a/pos_multi_variant/static/description/assets/icons/logo.png b/pos_multi_variant/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/logo.png differ diff --git a/pos_multi_variant/static/description/assets/icons/manufacturing-black.png b/pos_multi_variant/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/manufacturing-black.png differ diff --git a/pos_multi_variant/static/description/assets/icons/pos-black.png b/pos_multi_variant/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/pos-black.png differ diff --git a/pos_multi_variant/static/description/assets/icons/puzzle.png b/pos_multi_variant/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/puzzle.png differ diff --git a/pos_multi_variant/static/description/assets/icons/restaurant-black.png b/pos_multi_variant/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/restaurant-black.png differ diff --git a/pos_multi_variant/static/description/assets/icons/service-black.png b/pos_multi_variant/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/service-black.png differ diff --git a/pos_multi_variant/static/description/assets/icons/trading-black.png b/pos_multi_variant/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/trading-black.png differ diff --git a/pos_multi_variant/static/description/assets/icons/training.png b/pos_multi_variant/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/training.png differ diff --git a/pos_multi_variant/static/description/assets/icons/update.png b/pos_multi_variant/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/update.png differ diff --git a/pos_multi_variant/static/description/assets/icons/user.png b/pos_multi_variant/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/user.png differ diff --git a/pos_multi_variant/static/description/assets/icons/wrench.png b/pos_multi_variant/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/pos_multi_variant/static/description/assets/icons/wrench.png differ diff --git a/pos_multi_variant/static/description/banner.png b/pos_multi_variant/static/description/banner.png new file mode 100644 index 000000000..e5a258f80 Binary files /dev/null and b/pos_multi_variant/static/description/banner.png differ diff --git a/pos_multi_variant/static/description/icon.png b/pos_multi_variant/static/description/icon.png new file mode 100644 index 000000000..63f664e29 Binary files /dev/null and b/pos_multi_variant/static/description/icon.png differ diff --git a/pos_multi_variant/static/description/icon.png~ b/pos_multi_variant/static/description/icon.png~ new file mode 100644 index 000000000..5c1d3b967 Binary files /dev/null and b/pos_multi_variant/static/description/icon.png~ differ diff --git a/pos_multi_variant/static/description/images/checked.png b/pos_multi_variant/static/description/images/checked.png new file mode 100644 index 000000000..e6c63d582 Binary files /dev/null and b/pos_multi_variant/static/description/images/checked.png differ diff --git a/pos_multi_variant/static/description/images/hero.gif b/pos_multi_variant/static/description/images/hero.gif new file mode 100644 index 000000000..00819588c Binary files /dev/null and b/pos_multi_variant/static/description/images/hero.gif differ diff --git a/pos_multi_variant/static/description/images/logo.png b/pos_multi_variant/static/description/images/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/pos_multi_variant/static/description/images/logo.png differ diff --git a/pos_multi_variant/static/description/images/modules/1.png b/pos_multi_variant/static/description/images/modules/1.png new file mode 100644 index 000000000..b50130c7d Binary files /dev/null and b/pos_multi_variant/static/description/images/modules/1.png differ diff --git a/pos_multi_variant/static/description/images/modules/2.png b/pos_multi_variant/static/description/images/modules/2.png new file mode 100644 index 000000000..3ad04ecfd Binary files /dev/null and b/pos_multi_variant/static/description/images/modules/2.png differ diff --git a/pos_multi_variant/static/description/images/modules/3.png b/pos_multi_variant/static/description/images/modules/3.png new file mode 100644 index 000000000..30ad58232 Binary files /dev/null and b/pos_multi_variant/static/description/images/modules/3.png differ diff --git a/pos_multi_variant/static/description/images/modules/4.png b/pos_multi_variant/static/description/images/modules/4.png new file mode 100644 index 000000000..492980ad0 Binary files /dev/null and b/pos_multi_variant/static/description/images/modules/4.png differ diff --git a/pos_multi_variant/static/description/images/modules/5.png b/pos_multi_variant/static/description/images/modules/5.png new file mode 100644 index 000000000..1ae7cfe3b Binary files /dev/null and b/pos_multi_variant/static/description/images/modules/5.png differ diff --git a/pos_multi_variant/static/description/images/modules/6.png b/pos_multi_variant/static/description/images/modules/6.png new file mode 100644 index 000000000..499b1a72f Binary files /dev/null and b/pos_multi_variant/static/description/images/modules/6.png differ diff --git a/pos_multi_variant/static/description/images/s1.png b/pos_multi_variant/static/description/images/s1.png new file mode 100644 index 000000000..1f343b57c Binary files /dev/null and b/pos_multi_variant/static/description/images/s1.png differ diff --git a/pos_multi_variant/static/description/images/s2.png b/pos_multi_variant/static/description/images/s2.png new file mode 100644 index 000000000..e78c183b5 Binary files /dev/null and b/pos_multi_variant/static/description/images/s2.png differ diff --git a/pos_multi_variant/static/description/images/s3.png b/pos_multi_variant/static/description/images/s3.png new file mode 100644 index 000000000..98489aa2c Binary files /dev/null and b/pos_multi_variant/static/description/images/s3.png differ diff --git a/pos_multi_variant/static/description/images/s4.png b/pos_multi_variant/static/description/images/s4.png new file mode 100644 index 000000000..641d8ceb5 Binary files /dev/null and b/pos_multi_variant/static/description/images/s4.png differ diff --git a/pos_multi_variant/static/description/images/s5.png b/pos_multi_variant/static/description/images/s5.png new file mode 100644 index 000000000..62d384b99 Binary files /dev/null and b/pos_multi_variant/static/description/images/s5.png differ diff --git a/pos_multi_variant/static/description/images/s6.png b/pos_multi_variant/static/description/images/s6.png new file mode 100644 index 000000000..a21ea0d18 Binary files /dev/null and b/pos_multi_variant/static/description/images/s6.png differ diff --git a/pos_multi_variant/static/description/images/s7.png b/pos_multi_variant/static/description/images/s7.png new file mode 100644 index 000000000..d088be560 Binary files /dev/null and b/pos_multi_variant/static/description/images/s7.png differ diff --git a/pos_multi_variant/static/description/index.html b/pos_multi_variant/static/description/index.html new file mode 100644 index 000000000..7c68e6457 --- /dev/null +++ b/pos_multi_variant/static/description/index.html @@ -0,0 +1,705 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+ +
+
+
+
+ +
+
+ +
+
+

POS Product Multi Variant

+

+ Configure Multi-Variant Products For POS +

+ +
+
+ + + +
+
+

Overview

+
+

+ POS Multi-variant module is an advanced way for managing product variants from the point of sale application. + The module helps the user to configure product variants straight from POS. User can set extra price, also activate/inactivate the option for variants. + As multi-variant products are displayed with a label, it comes easy for the user to sort which is multi-variant and which is not. + User can confirm the variant type to POS orders. +

+
+
+ + + + +
+
+

Key Features

+
+
+ + +
+ +
+ +

+ Multi-variant option in product configuration. +

+
+ +
+ +

+ Option for activating/inactivating variant types in POS. +

+
+ +
+ +

+ Easy selection of variant type from wizard. +

+
+ +
+ +

+ Option for adding extra price for the variant. +

+
+ +
+ +

+ Notification for multi-variant products in POS. + +

+
+ +
+ +

+ Displays variant details in order receipt and order. + +

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

Screenshots

+
+ + +
+
+

+ 01

+
+
+

+ Products -> Enable POS +

+

+ After installation, go to Products -> Enable POS variants option. +

+ +
+
+ + + + + +
+
+

+ 02

+
+
+

+ Configure variants + +

+

+ Here you have an option to configure different variants. + +

+ +
+
+ + + + +
+
+

+ 03

+
+
+

+ See multi-variant products +

+

+ Open the POS session, you can see the product with multi-variants. + +

+ +
+
+ + + + +
+
+

+ 04

+
+
+

+ Variant selection window pop-up +

+

+ Variant selection window pop-ups, upon selecting a product having multi-variants. +

+ +
+
+ + + + + +
+
+

+ 05

+
+
+

+ Choose desired variants +

+

+ Choose required variants of the product. +

+ +
+
+ + + + + +
+
+

+ 06

+
+
+

+ Confirmed variants get listed in the POS order list. +

+

+ On confirming the variants, it gets listed in the order list of POS session. + +

+ +
+
+ + + + + +
+
+

+ 07

+
+
+

+ Variant details in the order receipt +

+

+ The order receipt will be shown as below, + +

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

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/pos_multi_variant/static/src/css/label.css b/pos_multi_variant/static/src/css/label.css new file mode 100644 index 000000000..980a9452b --- /dev/null +++ b/pos_multi_variant/static/src/css/label.css @@ -0,0 +1,67 @@ +.pos .product .variant { + position: absolute; + top: 50px; + left: 2px; + right: 2px; + vertical-align: top; + color: white; + line-height: 13px; + background: #0070F7; + padding: 2px 5px; + border-radius: 2px; +} + +.variants{ + position: absolute; + bottom: -11px; + left: 2px; + right: 2px; + vertical-align: top; + color: white; + line-height: 13px; + background: #1b9c99; + padding: 2px 5px; + border-radius: 2px; +} +.extra-price{ +position: absolute; + top: 2px; + right: 2px; + vertical-align: top; + color: white; + line-height: 13px; + background: #ff6a6a; + padding: 2px 5px; + border-radius: 2px; +} +.tag{ +background-color:#d7d7d7; +font-style: italic; +} +.variant-selected{ + position: absolute; + bottom: 23px; + left: 2px; + right: 2px; + vertical-align: top; + color: white; + line-height: 13px; + font-size: 15px; + background: #0831b3; + padding: 2px 5px; + border-radius: 2px; +} +.custom-pos-label{ + width: 100%; + position: absolute; + top: 45%; + left: 0; + background: blue; + height: 20px; + display: block; + line-height: 100%; + display: flex; + justify-content: center; + align-items: center; + color: white; +} \ No newline at end of file diff --git a/pos_multi_variant/static/src/js/ProductPopup.js b/pos_multi_variant/static/src/js/ProductPopup.js new file mode 100644 index 000000000..5edeb6406 --- /dev/null +++ b/pos_multi_variant/static/src/js/ProductPopup.js @@ -0,0 +1,78 @@ +odoo.define('pos_multi_variant.ProductsPopup', function(require) { + 'use strict'; + + const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); + const Registries = require('point_of_sale.Registries'); + const PosComponent = require('point_of_sale.PosComponent'); + const { configureGui } = require('point_of_sale.Gui'); + const { + useListener + } = require('web.custom_hooks'); + const ProductItem = require('point_of_sale.ProductItem'); + var models = require('point_of_sale.models'); + + + + class ProductsPopup extends ProductItem { + constructor() { + super(...arguments); + useListener('click-product', this._clickProduct); + } + + select_variant(e){ + var order = this.env.pos.get('selectedOrder') + var self = e.currentTarget + var action = $(self).find('.action').text(); + var categories = [] + var category = $(self).find('.action').data('category'); + $('.product-img').find('.variant-selected').each(function () + { if($(this).data('category') == category) + { $(this).text("").removeClass('variant-selected'); + $(self).find('.action').text("Selected").addClass('variant-selected'); + } + }); + $(self).find('.action').text("Selected").addClass('variant-selected'); + var add = $(self).find('.extra-price').text().substr(1).slice(0, -2); + var type = $(self).find('.variants').text(); + $(self).find('.variant-selected').attr('data-price', add); + $(self).find('.variant-selected').attr('data-type', type); + } + click_confirm(e) + { var price = 0.00 + var order = this.env.pos.get_order() + var selected_orderline = order.get_selected_orderline() + var variant = order.selected_orderline.product_variants + $('.product-img').find('.variant-selected').each(function () + { + var add = this.previousSibling.innerHTML; + add = add.slice(3) + price += parseFloat(add) + if (order.selected_orderline.product.pos_variants){ + variant.push({ + 'extra_price': add, + 'type': $(this).data('type'), + }) + }; + }) + selected_orderline.price_manually_set = true; + selected_orderline.price += price + selected_orderline.trigger('change', selected_orderline); + this.trigger('close-popup') + } + imageUrl() { + return `/web/image?model=product.product&field=image_1920&id=${this.props.product_tmpl_id}&unique=1`; + } + + + async _clickProduct(event) { + } + } + + //products popup template + ProductsPopup.template = 'ProductsPopUp'; + ProductsPopup.defaultProps = {}; + + + Registries.Component.add(ProductsPopup); + return ProductsPopup; +}); diff --git a/pos_multi_variant/static/src/js/ProductScreen.js b/pos_multi_variant/static/src/js/ProductScreen.js new file mode 100644 index 000000000..5d8ad1ab4 --- /dev/null +++ b/pos_multi_variant/static/src/js/ProductScreen.js @@ -0,0 +1,90 @@ +odoo.define('pos_multi_variant.ProductScreen', function(require) { + 'use strict'; + + var ProductScreen = require('point_of_sale.ProductScreen'); + const Registries = require('point_of_sale.Registries'); + const NumberBuffer = require('point_of_sale.NumberBuffer'); + var models = require('point_of_sale.models'); + var rpc = require('web.rpc'); + + models.load_models([ + { model: 'variants.tree', + fields: ["pos_active", "value", "attribute", "variants_id", "extra_price"], + loaded: function(self, variants_tree) + { self.variant_tree = variants_tree; + _.each(variants_tree, function(item) + { self.item = item; + }); + } + },{ model: 'product.attribute.value', + fields: ["id", "name"], + loaded: function(self,values) + { self.values = values; + } + }]); + + var super_models = models.PosModel.prototype.models; + models.load_fields('product.product', 'pos_variants'); + models.load_fields('product.product', 'variant_line_ids'); + + const ProductScreenExtend = (ProductScreen) => + class extends ProductScreen { + constructor() { + super(...arguments); + } + + async _clickProduct(event) { + if (!this.currentOrder) { + this.env.pos.add_new_order(); + } + const product = event.detail; + var variant_product = '' + await rpc.query({ + model: 'variants.tree', + method: 'search_read', + fields: ['extra_price','attribute','value', 'variants_id'], + args: [[['variants_id','=',event.detail.product_tmpl_id]]] + }).then(function (data) { + variant_product = data + + }); + var li=[] + for(var i=0; i + + + + + Multi-variant + + + + + + + + + + : $ + +
+
+
+
+
+ + + + +
+ : + + + + +
+
+ +
diff --git a/pos_multi_variant/static/src/xml/popup.xml b/pos_multi_variant/static/src/xml/popup.xml new file mode 100644 index 000000000..ab9f17535 --- /dev/null +++ b/pos_multi_variant/static/src/xml/popup.xml @@ -0,0 +1,46 @@ + + + + + + + diff --git a/pos_multi_variant/views/pos_variants.xml b/pos_multi_variant/views/pos_variants.xml new file mode 100644 index 000000000..007c81f07 --- /dev/null +++ b/pos_multi_variant/views/pos_variants.xml @@ -0,0 +1,30 @@ + + + + + pos.variants + product.template + + + +
+ +
+
+ + + + + + + + + + + + +
+
+
+
\ No newline at end of file