Browse Source

Oct 13 [ADD] : Initial Commit 'pos_multi_variant'

pull/216/head
AjmalCybro 3 years ago
parent
commit
c707bbd1b0
  1. 41
      pos_multi_variant/README.rst
  2. 22
      pos_multi_variant/__init__.py
  3. 44
      pos_multi_variant/__manifest__.py
  4. 6
      pos_multi_variant/doc/RELEASE_NOTES.md
  5. 22
      pos_multi_variant/models/__init__.py
  6. 43
      pos_multi_variant/models/pos_variants.py
  7. 2
      pos_multi_variant/security/ir.model.access.csv
  8. BIN
      pos_multi_variant/static/description/assets/icons/check.png
  9. BIN
      pos_multi_variant/static/description/assets/icons/chevron.png
  10. BIN
      pos_multi_variant/static/description/assets/icons/cogs.png
  11. BIN
      pos_multi_variant/static/description/assets/icons/consultation.png
  12. BIN
      pos_multi_variant/static/description/assets/icons/ecom-black.png
  13. BIN
      pos_multi_variant/static/description/assets/icons/education-black.png
  14. BIN
      pos_multi_variant/static/description/assets/icons/hotel-black.png
  15. BIN
      pos_multi_variant/static/description/assets/icons/license.png
  16. BIN
      pos_multi_variant/static/description/assets/icons/lifebuoy.png
  17. BIN
      pos_multi_variant/static/description/assets/icons/logo.png
  18. BIN
      pos_multi_variant/static/description/assets/icons/manufacturing-black.png
  19. BIN
      pos_multi_variant/static/description/assets/icons/pos-black.png
  20. BIN
      pos_multi_variant/static/description/assets/icons/puzzle.png
  21. BIN
      pos_multi_variant/static/description/assets/icons/restaurant-black.png
  22. BIN
      pos_multi_variant/static/description/assets/icons/service-black.png
  23. BIN
      pos_multi_variant/static/description/assets/icons/trading-black.png
  24. BIN
      pos_multi_variant/static/description/assets/icons/training.png
  25. BIN
      pos_multi_variant/static/description/assets/icons/update.png
  26. BIN
      pos_multi_variant/static/description/assets/icons/user.png
  27. BIN
      pos_multi_variant/static/description/assets/icons/wrench.png
  28. BIN
      pos_multi_variant/static/description/assets/modules/1.png
  29. BIN
      pos_multi_variant/static/description/assets/modules/2.png
  30. BIN
      pos_multi_variant/static/description/assets/modules/3.png
  31. BIN
      pos_multi_variant/static/description/assets/modules/4.png
  32. BIN
      pos_multi_variant/static/description/assets/modules/5.png
  33. BIN
      pos_multi_variant/static/description/assets/modules/6.png
  34. BIN
      pos_multi_variant/static/description/banner.png
  35. BIN
      pos_multi_variant/static/description/icon.png
  36. BIN
      pos_multi_variant/static/description/icon.png~
  37. BIN
      pos_multi_variant/static/description/images/1.png
  38. BIN
      pos_multi_variant/static/description/images/2.png
  39. BIN
      pos_multi_variant/static/description/images/3.png
  40. BIN
      pos_multi_variant/static/description/images/4.png
  41. BIN
      pos_multi_variant/static/description/images/5.png
  42. BIN
      pos_multi_variant/static/description/images/6.png
  43. BIN
      pos_multi_variant/static/description/images/7.png
  44. BIN
      pos_multi_variant/static/description/images/checked.png
  45. BIN
      pos_multi_variant/static/description/images/hero.gif
  46. BIN
      pos_multi_variant/static/description/images/logo.png
  47. 710
      pos_multi_variant/static/description/index.html
  48. 67
      pos_multi_variant/static/src/css/label.css
  49. 75
      pos_multi_variant/static/src/js/ProductPopup.js
  50. 88
      pos_multi_variant/static/src/js/ProductScreen.js
  51. 32
      pos_multi_variant/static/src/js/models.js
  52. 38
      pos_multi_variant/static/src/xml/label.xml
  53. 45
      pos_multi_variant/static/src/xml/popup.xml
  54. 30
      pos_multi_variant/views/pos_variants.xml
  55. 12
      pos_multi_variant/views/pos_wizard.xml

41
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 <https://cybrosys.com/>`__
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: `<static/description/index.html>`__

22
pos_multi_variant/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sreejith sasidharan(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import models

44
pos_multi_variant/__manifest__.py

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sreejith sasidharan(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
{
'name': "POS Product Multi variant",
'version': '14.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',
'views/pos_wizard.xml'],
'images': ['static/description/banner.png'],
'license': 'AGPL-3',
'installable': True,
'qweb': ['static/src/xml/label.xml',
'static/src/xml/popup.xml'],
'auto_install': False,
}

6
pos_multi_variant/doc/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module <pos_multi_variant>
#### 30.09.2022
#### Version 14.0.1.0.0
##### ADD
- Initial commit for pos_multi_variant

22
pos_multi_variant/models/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sreejith sasidharan(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import pos_variants

43
pos_multi_variant/models/pos_variants.py

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sreejith sasidharan(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
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")

2
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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_variants_tree access.variants.tree model_variants_tree base.group_user 1 1 1 1

BIN
pos_multi_variant/static/description/assets/icons/check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
pos_multi_variant/static/description/assets/icons/chevron.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

BIN
pos_multi_variant/static/description/assets/icons/cogs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
pos_multi_variant/static/description/assets/icons/consultation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
pos_multi_variant/static/description/assets/icons/ecom-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
pos_multi_variant/static/description/assets/icons/education-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
pos_multi_variant/static/description/assets/icons/hotel-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

BIN
pos_multi_variant/static/description/assets/icons/license.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
pos_multi_variant/static/description/assets/icons/lifebuoy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
pos_multi_variant/static/description/assets/icons/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
pos_multi_variant/static/description/assets/icons/manufacturing-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

BIN
pos_multi_variant/static/description/assets/icons/pos-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

BIN
pos_multi_variant/static/description/assets/icons/puzzle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

BIN
pos_multi_variant/static/description/assets/icons/restaurant-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

BIN
pos_multi_variant/static/description/assets/icons/service-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

BIN
pos_multi_variant/static/description/assets/icons/trading-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
pos_multi_variant/static/description/assets/icons/training.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

BIN
pos_multi_variant/static/description/assets/icons/update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
pos_multi_variant/static/description/assets/icons/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

BIN
pos_multi_variant/static/description/assets/icons/wrench.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
pos_multi_variant/static/description/assets/modules/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
pos_multi_variant/static/description/assets/modules/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
pos_multi_variant/static/description/assets/modules/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
pos_multi_variant/static/description/assets/modules/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
pos_multi_variant/static/description/assets/modules/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
pos_multi_variant/static/description/assets/modules/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
pos_multi_variant/static/description/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
pos_multi_variant/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
pos_multi_variant/static/description/icon.png~

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
pos_multi_variant/static/description/images/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

BIN
pos_multi_variant/static/description/images/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

BIN
pos_multi_variant/static/description/images/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 KiB

BIN
pos_multi_variant/static/description/images/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

BIN
pos_multi_variant/static/description/images/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

BIN
pos_multi_variant/static/description/images/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 KiB

BIN
pos_multi_variant/static/description/images/7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
pos_multi_variant/static/description/images/checked.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
pos_multi_variant/static/description/images/hero.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

BIN
pos_multi_variant/static/description/images/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

710
pos_multi_variant/static/description/index.html

@ -0,0 +1,710 @@
<div class="container" style="padding: 1rem !important; margin-bottom: 1.5rem !important;">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12 d-flex justify-content-between"
style="border-bottom: 1px solid #d5d5d5;">
<div class="my-3">
<img src="./images/logo.png" style="width: auto !important; height: 40px !important;">
</div>
<div class="my-3 d-flex align-items-center">
<div
style="background-color: #7C7BAD !important; color: #fff !important; font-weight: 600 !important; padding: 5px 15px 8px !important; margin: 0 5px !important;">
<i class="fa fa-check mr-1"></i>Community
</div>
<div
style="background-color: #875A7B !important; color: #fff !important; font-weight: 600 !important; padding: 5px 15px 8px !important; margin: 0 5px !important;">
<i class="fa fa-check mr-1"></i>Enterprise
</div>
</div>
</div>
</div>
</div>
<div style="padding: 3.5rem 1.5rem !important; background-color: #ffffff !important;">
<div class="container">
<!-- HERO -->
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center"
style="text-align: center; padding: 1rem !important;">
<h1 class="text-center" style="color: #212121 !important; font-size: 3.5rem !important;"><span
style="font-weight: 700 !important;">POS Product Multi Variant</span></h1>
<p class="text-center"
style="color: #212529 !important; font-size: 1.5rem !important; letter-spacing: 1px !important;">
Configure Multi-Variant Products For POS
</p>
<img src="./images/hero.gif" class="img-responsive">
</div>
</div>
<!-- END OF HERO -->
<!-- OVERVIEW -->
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center"
style="text-align: center; padding: 2.5rem 1rem !important;">
<h2 style="color: #212529 !important;">Overview</h2>
<hr
style="border: 3px solid #AC1015 !important; background-color: #AC1015 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
<p class="text-center" style="color: #212529 !important; font-size: 1.5rem !important;">
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.
</p>
</div>
</div>
<!-- END OF OVERVIEW -->
<!-- KEY FEATURES -->
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center" style="padding: 2.5rem 1rem !important;">
<h2 class="text-center" style="color: #212529 !important;">Key Features</h2>
<hr
style="border: 3px solid #AC1015 !important; background-color: #AC1015 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
<div class="row">
<div class="col-lg-12">
<div class="d-flex deep-2"
style="height: 60px !important; padding: 1rem 1.5rem !important; border-radius: 0 !important; margin: 1.5rem 0">
<img src="./images/checked.png" style="height: 24px !important; width: 24px !important;"
class="mt-1 mr-2" height="24px" width="24px">
<p style="color: #212529 !important; font-size: 1.3rem !important;">
Multi-variant option in product configuration.
</p>
</div>
<div class="d-flex deep-2"
style="height: 60px !important; padding: 1rem 1.5rem !important; border-radius: 0 !important; margin: 1.5rem 0">
<img src="./images/checked.png" style="height: 24px !important; width: 24px !important;"
class="mt-1 mr-2" height="24px" width="24px">
<p style="color: #212529 !important; font-size: 1.3rem !important;">
Option for activating/inactivating variant types in POS.
</p>
</div>
<div class="d-flex deep-2"
style="height: 60px !important; padding: 1rem 1.5rem !important; border-radius: 0 !important; margin: 1.5rem 0">
<img src="./images/checked.png" style="height: 24px !important; width: 24px !important;"
class="mt-1 mr-2" height="24px" width="24px">
<p style="color: #212529 !important; font-size: 1.3rem !important;">
Easy selection of variant type from wizard.
</p>
</div>
<div class="d-flex deep-2"
style="height: 60px !important; padding: 1rem 1.5rem !important; border-radius: 0 !important; margin: 1.5rem 0">
<img src="./images/checked.png" style="height: 24px !important; width: 24px !important;"
class="mt-1 mr-2" height="24px" width="24px">
<p style="color: #212529 !important; font-size: 1.3rem !important;">
Option for adding extra price for the variant.
</p>
</div>
<div class="d-flex deep-2"
style="height: 60px !important; padding: 1rem 1.5rem !important; border-radius: 0 !important; margin: 1.5rem 0">
<img src="./images/checked.png" style="height: 24px !important; width: 24px !important;"
class="mt-1 mr-2" height="24px" width="24px">
<p style="color: #212529 !important; font-size: 1.3rem !important;">
Notification for multi-variant products in POS.
</p>
</div>
<div class="d-flex deep-2"
style="height: 60px !important; padding: 1rem 1.5rem !important; border-radius: 0 !important; margin: 1.5rem 0">
<img src="./images/checked.png" style="height: 24px !important; width: 24px !important;"
class="mt-1 mr-2" height="24px" width="24px">
<p style="color: #212529 !important; font-size: 1.3rem !important;">
Displays variant details in order receipt and order.
</p>
</div>
</div>
</div>
</div>
</div>
<!-- END OF KEY FEATURES -->
<!-- SCREENSHOTS -->
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center" style="padding: 2.5rem 1rem !important;">
<h2 style="text-align: center; color: #212529 !important;">Screenshots</h2>
<hr
style="border: 3px solid #AC1015 !important; background-color: #AC1015 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
<!-- img -->
<div class="d-flex m-0" style="border-bottom: 1px solid #e5e5e5 !important;">
<div class="mr-3">
<h3
style="font-size: 2rem !important; font-weight: 800 !important; color: #ffffff !important; background-color: #AC1015 !important; padding: 1rem !important; width: 70px !important; height: 75px !important;">
01</h3>
</div>
<div>
<h3 style="font-size: 1.7rem !important; font-weight: 600 !important;">
Products > Enable POS
</h3>
<p
style="color: #212529 !important; font-size: 1.3rem !important; font-weight: 300 !important;">
After installation, go to Products > Enable POS variants option.
</p>
</div>
</div>
<img src="./images/1.png" class="img-responsive border"
style="margin-top: -15px !important; margin-top: 1rem !important; margin-bottom: 4rem !important;">
<!-- endo of img -->
<!-- img-->
<div class="d-flex m-0" style="border-bottom: 1px solid #e5e5e5 !important;">
<div class="mr-3">
<h3
style="font-size: 2rem !important; font-weight: 800 !important; color: #ffffff !important; background-color: #AC1015 !important; padding: 1rem !important; width: 70px !important; height: 75px !important;">
02</h3>
</div>
<div>
<h3 style="font-size: 1.7rem !important; font-weight: 600 !important;">
Configure variants
</h3>
<p
style="color: #212529 !important; font-size: 1.3rem !important; font-weight: 300 !important;">
Here you have an option to configure different variants.
</p>
</div>
</div>
<img src="./images/2.png" class="img-responsive border"
style="margin-top: -15px !important; margin-top: 1rem !important; margin-bottom: 4rem !important;">
<!-- endo of img-->
<!-- img-->
<div class="d-flex m-0" style="border-bottom: 1px solid #e5e5e5 !important;">
<div class="mr-3">
<h3
style="font-size: 2rem !important; font-weight: 800 !important; color: #ffffff !important; background-color: #AC1015 !important; padding: 1rem !important; width: 70px !important; height: 75px !important;">
03</h3>
</div>
<div>
<h3 style="font-size: 1.7rem !important; font-weight: 600 !important;">
See multi-variant products
</h3>
<p
style="color: #212529 !important; font-size: 1.3rem !important; font-weight: 300 !important;">
Open the POS session, you can see the product with multi-variants.
</p>
</div>
</div>
<img src="./images/3.png" class="img-responsive border"
style="margin-top: -15px !important; margin-top: 1rem !important; margin-bottom: 4rem !important;">
<!-- endo of img-->
<!-- img-->
<div class="d-flex m-0" style="border-bottom: 1px solid #e5e5e5 !important;">
<div class="mr-3">
<h3
style="font-size: 2rem !important; font-weight: 800 !important; color: #ffffff !important; background-color: #AC1015 !important; padding: 1rem !important; width: 70px !important; height: 75px !important;">
04</h3>
</div>
<div>
<h3 style="font-size: 1.7rem !important; font-weight: 600 !important;">
Variant selection window pop-up
</h3>
<p
style="color: #212529 !important; font-size: 1.3rem !important; font-weight: 300 !important;">
Variant selection window pop-ups, upon selecting a product having multi-variants.
</p>
</div>
</div>
<img src="./images/4.png" class="img-responsive border"
style="margin-top: -15px !important; margin-top: 1rem !important; margin-bottom: 4rem !important;">
<!-- endo of img-->
<!-- img-->
<div class="d-flex m-0" style="border-bottom: 1px solid #e5e5e5 !important;">
<div class="mr-3">
<h3
style="font-size: 2rem !important; font-weight: 800 !important; color: #ffffff !important; background-color: #AC1015 !important; padding: 1rem !important; width: 70px !important; height: 75px !important;">
05</h3>
</div>
<div>
<h3 style="font-size: 1.7rem !important; font-weight: 600 !important;">
Choose desired variants
</h3>
<p
style="color: #212529 !important; font-size: 1.3rem !important; font-weight: 300 !important;">
Choose required variants of the product.
</p>
</div>
</div>
<img src="./images/5.png" class="img-responsive border"
style="margin-top: -15px !important; margin-top: 1rem !important; margin-bottom: 4rem !important;">
<!-- endo of img-->
<!-- img-->
<div class="d-flex m-0" style="border-bottom: 1px solid #e5e5e5 !important;">
<div class="mr-3">
<h3
style="font-size: 2rem !important; font-weight: 800 !important; color: #ffffff !important; background-color: #AC1015 !important; padding: 1rem !important; width: 70px !important; height: 75px !important;">
06</h3>
</div>
<div>
<h3 style="font-size: 1.7rem !important; font-weight: 600 !important;">
Confirmed variants get listed in the POS order list.
</h3>
<p
style="color: #212529 !important; font-size: 1.3rem !important; font-weight: 300 !important;">
On confirming the variants, it gets listed in the order list of POS session.
</p>
</div>
</div>
<img src="./images/6.png" class="img-responsive border"
style="margin-top: -15px !important; margin-top: 1rem !important; margin-bottom: 4rem !important;">
<!-- endo of img-->
<!-- <img>-->
<div class="d-flex m-0" style="border-bottom: 1px solid #e5e5e5 !important;">
<div class="mr-3">
<h3
style="font-size: 2rem !important; font-weight: 800 !important; color: #ffffff !important; background-color: #AC1015 !important; padding: 1rem !important; width: 70px !important; height: 75px !important;">
07</h3>
</div>
<div>
<h3 style="font-size: 1.7rem !important; font-weight: 600 !important;">
Variant details in the order receipt
</h3>
<p
style="color: #212529 !important; font-size: 1.3rem !important; font-weight: 300 !important;">
The order receipt will be shown as below,
</p>
</div>
</div>
<img src="./images/7.png" class="img-responsive border"
style="margin-top: -15px !important; margin-top: 1rem !important; margin-bottom: 4rem !important;">
<!-- <end of img>-->
</div>
</div>
<!-- END OF SCREENSHOTS -->
<!-- VIDEO -->
<!-- <div class="row">-->
<!-- <div class="col-lg-12 d-flex flex-column justify-content-center" style="padding: 2.5rem 1rem !important;">-->
<!-- <h2 style="text-align: center; color: #212529 !important;">Video</h2>-->
<!-- <hr-->
<!-- style="border: 3px solid #AC1015 !important; background-color: #AC1015 !important; width: 80px !important; margin-bottom: 2rem !important;" />-->
<!-- <div class="s_panel_video mx-auto" data-video-id="7PFB7FpMFyM?rel=0">-->
<!-- <img class="img-fluid s_tooltip_tabs_tooltip_image s_figure_link pb0"-->
<!-- src="/images/task_timer_youtube.png" alt="Cybrosys Cover Video" style="max-width:100%">-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- END OF VIDEO -->
<!-- SUGGESTED PRODUCTS -->
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center"
style="text-align: center; padding: 2.5rem 1rem !important;">
<h2 style="color: #212529 !important;">Suggested Products</h2>
<hr
style="border: 3px solid #AC1015 !important; background-color: #AC1015 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
<div id="demo1" class="row carousel slide" data-ride="carousel">
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active" style="min-height:0px">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/pos_order_types/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/1.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/pos_product_addons/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/2.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/dashboard_pos/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/3.png">
</div>
</a>
</div>
</div>
<div class="carousel-item" style="min-height:0px">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/product_return_pos/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/4.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/point_of_sale_logo" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/5.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/invoice_format_editor/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/6.png">
</div>
</a>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo1" data-slide="prev"
style="left:-25px;width: 35px;color: #000;"> <span class="carousel-control-prev-icon"><i
class="fa fa-chevron-left" style="font-size:24px"></i></span> </a> <a
class="carousel-control-next" href="#demo1" data-slide="next"
style="right:-25px;width: 35px;color: #000;">
<span class="carousel-control-next-icon"><i class="fa fa-chevron-right"
style="font-size:24px"></i></span>
</a>
</div>
</div>
</div>
<!-- END OF SUGGESTED PRODUCTS -->
<!-- OUR SERVICES -->
<section class="container" style="margin-top: 6rem !important;">
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center">
<h2 style="color: #212529 !important;">Our Services</h2>
<hr
style="border: 3px solid #AC1015 !important; background-color: #AC1015 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #1dd1a1 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/cogs.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">Odoo
Customization</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/wrench.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/lifebuoy.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">Odoo
Support</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/user.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">Hire
Odoo
Developer</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/puzzle.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">Odoo
Integration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/update.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">Odoo
Migration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/consultation.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">Odoo
Consultancy</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/training.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/license.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">Odoo
Licensing Consultancy</h6>
</div>
</div>
</section>
<!-- END OF END OF OUR SERVICES -->
<!-- OUR INDUSTRIES -->
<section class="container" style="margin-top: 6rem !important;">
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center">
<h2 style="color: #212529 !important;">Our Industries</h2>
<hr
style="border: 3px solid #AC1015 !important; background-color: #AC1015 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/trading-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Trading
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easily procure
and
sell your products</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/pos-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
POS
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easy
configuration
and convivial experience</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/education-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Education
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
A platform for
educational management</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/manufacturing-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Manufacturing
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Plan, track and
schedule your operations</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/ecom-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
E-commerce &amp; Website
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Mobile
friendly,
awe-inspiring product pages</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/service-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Service Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Keep track of
services and invoice</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/restaurant-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Restaurant
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Run your bar or
restaurant methodically</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/hotel-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Hotel Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
An
all-inclusive
hotel management application</p>
</div>
</div>
</div>
</section>
<!-- END OF END OF OUR INDUSTRIES -->
<!-- FOOTER -->
<!-- Footer Section -->
<section class="container" style="margin: 5rem auto 2rem;">
<div class="row" style="max-width:1540px;">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center">
<h2 style="color: #212529 !important;">Need Help?</h2>
<hr
style="border: 3px solid #AC1015 !important; background-color: #AC1015 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
</div>
</div>
<!-- Contact Cards -->
<div class="row d-flex justify-content-center align-items-center"
style="max-width:1540px; margin: 0 auto 2rem auto;">
<div class="col-lg-12" style="padding: 0rem 3rem 2rem; border-radius: 10px; margin-right: 3rem; ">
<div class="row mt-4">
<div class="col-lg-6">
<a href="mailto:odoo@cybrosys.com" target="_blank" class="btn btn-block mb-2 deep_hover"
style="text-decoration: none; background-color: #4d4d4d; color: #FFF; border-radius: 4px;"><i
class="fa fa-envelope mr-2"></i>odoo@cybrosys.com</a>
</div>
<div class="col-lg-6">
<a href="https://api.whatsapp.com/send?phone=918606827707" target="_blank"
class="btn btn-block mb-2 deep_hover"
style="text-decoration: none; background-color: #25D366; color: #FFF; border-radius: 4px;"><i
class="fa fa-whatsapp mr-2"></i>WhatsApp</a>
</div>
</div>
</div>
</div>
<!-- End of Contact Cards -->
</section>
<!-- Footer -->
<section class="oe_container" style="padding: 2rem 3rem 1rem;">
<div class="row" style="max-width:1540px; margin: 0 auto; margin-right: 3rem; ">
<!-- Logo -->
<div class="col-lg-12 d-flex justify-content-center align-items-center" style="margin-top: 3rem;">
<img src="https://www.cybrosys.com/images/logo.png" width="200px" height="auto"/>
</div>
<!-- End of Logo -->
<div class="col-lg-12">
<hr
style="margin-top: 3rem;background: linear-gradient(90deg, rgba(2,0,36,0) 0%, rgba(229,229,229,1) 33%, rgba(229,229,229,1) 58%, rgba(0,212,255,0) 100%); height: 2px; border-style: none;">
<!-- End of Footer Section -->
</div>
</div>
</section>
<!-- END OF FOOTER -->
</div>
</div>

67
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;
}

75
pos_multi_variant/static/src/js/ProductPopup.js

@ -0,0 +1,75 @@
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;
});

88
pos_multi_variant/static/src/js/ProductScreen.js

@ -0,0 +1,88 @@
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<variant_product.length; ++i) {
variant_product[i].value.forEach(function (field) {
li.push(field)
});
}
var variant_details = ''
await rpc.query({
model: 'product.attribute.value',
method: 'search_read',
fields: ['name'],
domain: [['id', 'in', li]],
}).then(function (result) {
variant_details = result
});
const options = await this._getAddProductOptions(product);
// Do not add product if options is undefined.
if (!options) return;
// Add the product after having the extra information.
this.currentOrder.add_product(product, options);
NumberBuffer.reset();
if(product.pos_variants)
this.showPopup('ProductsPopup',{
title: product.display_name,
products: variant_product,
product_tmpl_id: event.detail.id,
variant_details: variant_details,
});
}
};
Registries.Component.extend(ProductScreen, ProductScreenExtend);
return ProductScreen;
});

32
pos_multi_variant/static/src/js/models.js

@ -0,0 +1,32 @@
odoo.define('pos_multi_variant.model', 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');
var _super_orderline = models.Orderline.prototype;
models.Orderline = models.Orderline.extend
({ initialize: function(attr, options)
{ _super_orderline.initialize.call(this,attr,options);
this.product_variants = this.product_variants || [];
},
init_from_JSON: function(json)
{ _super_orderline.init_from_JSON.apply(this,arguments);
this.product_variants = json.product_variants || [];
},
export_as_JSON: function ()
{ var json = _super_orderline.export_as_JSON.apply(this, arguments);
json.product_variants = this.product_variants || [];
return json;
},
export_for_printing: function() {
var line = _super_orderline.export_for_printing.apply(this,arguments);
line.product_variants = this.product_variants;
return line;
},
});
});

38
pos_multi_variant/static/src/xml/label.xml

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-inherit="point_of_sale.ProductItem" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('product-img')]" position="inside">
<t t-if="props.product.pos_variants">
<span class="custom-pos-label">Multi-variant</span>
<link rel="stylesheet" type="text/scss" href="pos_multi_variant/static/src/css/label.css"/>
</t>
</xpath>
</t>
<t t-inherit="point_of_sale.Orderline" t-inherit-mode="extension" owl="1">
<xpath expr="//ul[hasclass('info-list')]" position="inside">
<t>
<t t-foreach="props.line.product_variants" t-as="variant" t-key="variant_index">
<t t-esc="variant.type"/>: $
<t t-esc="variant.extra_price"/>
<br/>
</t>
</t>
</xpath>
</t>
<t t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">
<xpath expr="//WrappedProductNameLines" position="after">
<t t-foreach="line.product_variants" t-as="variant">
<br/>
<t t-esc="variant['type']"/>:
<span class="pos-receipt-right-align">
<t t-esc="variant['extra_price']"/>
</span>
</t>
</xpath>
</t>
</templates>

45
pos_multi_variant/static/src/xml/popup.xml

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="ProductsPopUp" owl="1">
<div role="dialog" class="modal-dialog">
<div class="popup popup-selection">
<header class="title"><t t-esc="props.title || 'Product'" /></header>
<div class="selection scrollable-y touch-scrollable">
<div id="notify"></div>
</div>
<t t-foreach="props.products" t-as="product">
<div>
<h2><t t-esc="product['attribute'][1]"/></h2>
</div>
<t t-set="attribute" t-value="product['attribute'][1]"/>
<t t-foreach="props.variant_details" t-as="variant">
<t t-foreach="product['value']" t-as="val">
<t t-if="variant['id'] == val">
<article class='product' t-on-click="select_variant()">
<div class='product-img'>
<img t-att-src="imageUrl()"/>
<span class='extra-price'> +$ <t t-esc="product['extra_price']"/></span>
<h2 class='action' data-price='' data-type='' t-att-data-category='attribute'></h2>
<span class='variants'><t t-esc="variant['name']"/></span>
</div>
</article>
</t>
</t>
</t>
</t>
<footer class="footer">
<div class="button confirm" t-on-click="click_confirm()">
Confirm
</div>
<div class="button cancel" t-on-click="trigger('close-popup')">
Cancel
</div>
</footer>
</div>
</div>
</t>
</templates>

30
pos_multi_variant/views/pos_variants.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="pos_variants" model="ir.ui.view">
<field name="name">pos.variants</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='options']" position="inside">
<div>
<field name="pos_variants"/>
<label for="pos_variants"/>
</div>
</xpath>
<xpath expr="//page[@name='general_information']" position="after">
<page string="Pos Variants" name="pos variants" attrs="{'invisible': [('pos_variants','=',False)]}">
<field name="variant_line_ids" >
<tree string="Pos Variants" editable="bottom">
<field name="attribute"/>
<field name="value" widget="many2many_tags" options="{'no_create_edit': True}" domain="[('attribute_id', '=', attribute)]" context="{'default_attribute_id': attribute}"/>
<field name="extra_price"/>
<field name="pos_active"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
</data>
</odoo>

12
pos_multi_variant/views/pos_wizard.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="pos_wizard_popup" inherit_id="point_of_sale.assets">
<!-- adding scripts and css-->
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_multi_variant/static/src/js/models.js"></script>
<script type="text/javascript" src="/pos_multi_variant/static/src/js/ProductPopup.js"></script>
<script type="text/javascript" src="/pos_multi_variant/static/src/js/ProductScreen.js"></script>
<link rel="stylesheet" type="text/scss" href="/pos_multi_variant/static/src/css/label.css"/>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save