diff --git a/drag_and_drop_image_widget/README.rst b/drag_and_drop_image_widget/README.rst new file mode 100644 index 000000000..194a2eec7 --- /dev/null +++ b/drag_and_drop_image_widget/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/licence-LGPL--3-green.svg + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Drag and Drop Widget +======================= +This is a widget for Drag and drop files into the attachment field. + +Configuration +=============== +Add the 'drag_and_drop' as the widget of an image field. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(http://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +Developer: Megha K @cybrosys, 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/drag_and_drop_image_widget/__init__.py b/drag_and_drop_image_widget/__init__.py new file mode 100644 index 000000000..cf5c36cdc --- /dev/null +++ b/drag_and_drop_image_widget/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys () +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models diff --git a/drag_and_drop_image_widget/__manifest__.py b/drag_and_drop_image_widget/__manifest__.py new file mode 100644 index 000000000..c773882a4 --- /dev/null +++ b/drag_and_drop_image_widget/__manifest__.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys () +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Drag and Drop Widget', + 'version': '16.0.1.0.0', + 'category': 'Extra Tools', + 'summary': 'This is a widget for Drag and drop images into the ' + 'image field', + 'description': "This module is used to drag and drop files into the " + "image field", + 'author': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['base', 'web'], + 'images': ['static/description/banner.jpg'], + 'assets': { + 'web.assets_backend': [ + 'drag_and_drop_image_widget/static/src/scss/drag_and_drop.scss', + 'drag_and_drop_image_widget/static/src/js/drag_and_drop.js', + 'drag_and_drop_image_widget/static/src/xml/drag_and_drop_templates.xml' + ] + }, + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/drag_and_drop_image_widget/doc/RELEASE_NOTES.md b/drag_and_drop_image_widget/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..4a4b6ed1d --- /dev/null +++ b/drag_and_drop_image_widget/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 31.10.2023 +#### Version 16.0.1.0.0 +#### ADD +- Initial commit for Drag and Drop Widget diff --git a/drag_and_drop_image_widget/models/__init__.py b/drag_and_drop_image_widget/models/__init__.py new file mode 100644 index 000000000..faef4393e --- /dev/null +++ b/drag_and_drop_image_widget/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys () +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import ir_attachment diff --git a/drag_and_drop_image_widget/models/ir_attachment.py b/drag_and_drop_image_widget/models/ir_attachment.py new file mode 100644 index 000000000..779f8e79a --- /dev/null +++ b/drag_and_drop_image_widget/models/ir_attachment.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys () +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import models + + +class Attachment(models.Model): + """Inheriting the ir attachment and saving the image into the fields""" + _inherit = 'ir.attachment' + + def action_save_drag_and_drop_image(self, data, url): + """Save the image into the fields""" + image = url.split(',') + self.env[data['resModel']].browse( + int(data['id'])).sudo().write({ + data['name']: image[1] + }) + return True diff --git a/drag_and_drop_image_widget/static/description/assets/icons/check.png b/drag_and_drop_image_widget/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/check.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/chevron.png b/drag_and_drop_image_widget/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/chevron.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/cogs.png b/drag_and_drop_image_widget/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/cogs.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/consultation.png b/drag_and_drop_image_widget/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/consultation.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/ecom-black.png b/drag_and_drop_image_widget/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/ecom-black.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/education-black.png b/drag_and_drop_image_widget/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/education-black.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/hotel-black.png b/drag_and_drop_image_widget/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/hotel-black.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/license.png b/drag_and_drop_image_widget/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/license.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/lifebuoy.png b/drag_and_drop_image_widget/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/lifebuoy.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/manufacturing-black.png b/drag_and_drop_image_widget/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/manufacturing-black.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/pos-black.png b/drag_and_drop_image_widget/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/pos-black.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/puzzle.png b/drag_and_drop_image_widget/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/puzzle.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/restaurant-black.png b/drag_and_drop_image_widget/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/restaurant-black.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/service-black.png b/drag_and_drop_image_widget/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/service-black.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/trading-black.png b/drag_and_drop_image_widget/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/trading-black.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/training.png b/drag_and_drop_image_widget/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/training.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/update.png b/drag_and_drop_image_widget/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/update.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/user.png b/drag_and_drop_image_widget/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/user.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/icons/wrench.png b/drag_and_drop_image_widget/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/icons/wrench.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/categories.png b/drag_and_drop_image_widget/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/categories.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/check-box.png b/drag_and_drop_image_widget/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/check-box.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/compass.png b/drag_and_drop_image_widget/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/compass.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/corporate.png b/drag_and_drop_image_widget/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/corporate.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/customer-support.png b/drag_and_drop_image_widget/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/customer-support.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/cybrosys-logo.png b/drag_and_drop_image_widget/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/cybrosys-logo.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/features.png b/drag_and_drop_image_widget/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/features.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/logo.png b/drag_and_drop_image_widget/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/logo.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/pictures.png b/drag_and_drop_image_widget/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/pictures.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/pie-chart.png b/drag_and_drop_image_widget/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/pie-chart.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/right-arrow.png b/drag_and_drop_image_widget/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/right-arrow.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/star.png b/drag_and_drop_image_widget/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/star.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/support.png b/drag_and_drop_image_widget/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/support.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/misc/whatsapp.png b/drag_and_drop_image_widget/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/misc/whatsapp.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/1.png b/drag_and_drop_image_widget/static/description/assets/modules/1.png new file mode 100644 index 000000000..3415917c2 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/1.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/2.png b/drag_and_drop_image_widget/static/description/assets/modules/2.png new file mode 100644 index 000000000..31ed46762 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/2.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/3.png b/drag_and_drop_image_widget/static/description/assets/modules/3.png new file mode 100644 index 000000000..25ed3e0b6 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/3.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/4.png b/drag_and_drop_image_widget/static/description/assets/modules/4.png new file mode 100644 index 000000000..359d3e4d6 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/4.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/5.gif b/drag_and_drop_image_widget/static/description/assets/modules/5.gif new file mode 100644 index 000000000..2a5f8e659 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/5.gif differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/5.png b/drag_and_drop_image_widget/static/description/assets/modules/5.png new file mode 100644 index 000000000..3add135c3 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/5.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/6.png b/drag_and_drop_image_widget/static/description/assets/modules/6.png new file mode 100644 index 000000000..be454ea44 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/6.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/l1.png b/drag_and_drop_image_widget/static/description/assets/modules/l1.png new file mode 100644 index 000000000..83e33258b Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/l1.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/l2.png b/drag_and_drop_image_widget/static/description/assets/modules/l2.png new file mode 100644 index 000000000..99298bf4b Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/l2.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/l3.png b/drag_and_drop_image_widget/static/description/assets/modules/l3.png new file mode 100644 index 000000000..e894393ef Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/l3.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/l4.png b/drag_and_drop_image_widget/static/description/assets/modules/l4.png new file mode 100644 index 000000000..f3c986fc1 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/l4.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/l5.png b/drag_and_drop_image_widget/static/description/assets/modules/l5.png new file mode 100644 index 000000000..b21837312 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/l5.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/modules/l6.png b/drag_and_drop_image_widget/static/description/assets/modules/l6.png new file mode 100644 index 000000000..51555e88c Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/modules/l6.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/screenshots/Screenshot-1.png b/drag_and_drop_image_widget/static/description/assets/screenshots/Screenshot-1.png new file mode 100644 index 000000000..1a3e56083 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/screenshots/Screenshot-1.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/screenshots/Screenshot-2.png b/drag_and_drop_image_widget/static/description/assets/screenshots/Screenshot-2.png new file mode 100644 index 000000000..00d43dc5b Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/screenshots/Screenshot-2.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/screenshots/Screenshot-3.png b/drag_and_drop_image_widget/static/description/assets/screenshots/Screenshot-3.png new file mode 100644 index 000000000..42a106704 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/screenshots/Screenshot-3.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/screenshots/hero.gif b/drag_and_drop_image_widget/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..fe42534e6 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/screenshots/hero.gif differ diff --git a/drag_and_drop_image_widget/static/description/assets/screenshots/screen/Screenshot-1.png b/drag_and_drop_image_widget/static/description/assets/screenshots/screen/Screenshot-1.png new file mode 100644 index 000000000..1a3e56083 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/screenshots/screen/Screenshot-1.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/screenshots/screen/Screenshot-2.png b/drag_and_drop_image_widget/static/description/assets/screenshots/screen/Screenshot-2.png new file mode 100644 index 000000000..00d43dc5b Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/screenshots/screen/Screenshot-2.png differ diff --git a/drag_and_drop_image_widget/static/description/assets/screenshots/screen/Screenshot-3.png b/drag_and_drop_image_widget/static/description/assets/screenshots/screen/Screenshot-3.png new file mode 100644 index 000000000..42a106704 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/assets/screenshots/screen/Screenshot-3.png differ diff --git a/drag_and_drop_image_widget/static/description/banner.jpg b/drag_and_drop_image_widget/static/description/banner.jpg new file mode 100644 index 000000000..4719467c7 Binary files /dev/null and b/drag_and_drop_image_widget/static/description/banner.jpg differ diff --git a/drag_and_drop_image_widget/static/description/icon.png b/drag_and_drop_image_widget/static/description/icon.png new file mode 100644 index 000000000..bd0fd9d9b Binary files /dev/null and b/drag_and_drop_image_widget/static/description/icon.png differ diff --git a/drag_and_drop_image_widget/static/description/index.html b/drag_and_drop_image_widget/static/description/index.html new file mode 100644 index 000000000..7d61e9126 --- /dev/null +++ b/drag_and_drop_image_widget/static/description/index.html @@ -0,0 +1,572 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+ +
+ Odoo sh +
+
+
+ +
+
+
+ +

+ Drag and Drop Widget

+

Drag and Drop Widget for Image Fields + +

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

Explore This + Module

+
+ + + + +
+
+ +
+

Overview +

+
+
+
+ This module is used to Drag and drop image to an image fields. + This is a widget used to drag and drop the images. +
+
+ + + +
+
+ +
+

Features +

+
+
+
+
+ + Enterprise and Community compatible. +
+
+ + Drag and drop Images +
+
+
+ + + +
+
+ +
+

Screenshots +

+
+
+
+ +
+

Configuration +

+

Add the 'drag_and_drop' as the widget of an image field

+
+ +
+

Click the Up Arrow button to start the drag and drop operation +

+ +
+
+

Drag and drop images to this area. +

+ +
+
+

Drag the image and click the Upload image button. +

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

+ 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

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/drag_and_drop_image_widget/static/src/js/drag_and_drop.js b/drag_and_drop_image_widget/static/src/js/drag_and_drop.js new file mode 100644 index 000000000..4e09d677f --- /dev/null +++ b/drag_and_drop_image_widget/static/src/js/drag_and_drop.js @@ -0,0 +1,171 @@ +/** @odoo-module **/ +import { isMobileOS } from "@web/core/browser/feature_detection"; +import { registry } from "@web/core/registry"; +import { FileUploader } from "@web/views/fields/file_handler"; +import { standardFieldProps } from "@web/views/fields/standard_field_props"; +import { _lt } from "@web/core/l10n/translation"; +import { useService } from "@web/core/utils/hooks"; +import { isBinarySize } from "@web/core/utils/binary"; +const placeholder = "/web/static/img/placeholder.png"; +const { DateTime } = luxon; +import { url } from "@web/core/utils/urls"; +import rpc from 'web.rpc'; +const { useRef } = owl; + +export const fileTypeMagicWordMap = { + "/": "jpg", + R: "gif", + i: "png", + P: "svg+xml", +}; + +export function imageCacheKey(value) { + if (value instanceof DateTime) { + return value.ts; + } + return ""; +} +var translation = require('web.translation'); +var _t = translation._t; +import { Component, useState, onWillUpdateProps } from "@odoo/owl"; + +export class DragAndDropBinaryField extends Component { + setup() { + /* setting for widget */ + this.notification = useService("notification"); + this.isMobile = isMobileOS(); + this.state = useState({ + isValid: true, + }); + this.inputFile = useRef('inputFile') + this.image_picker = useRef('image_picker') + this.rawCacheKey = this.props.record.data.__last_update; + onWillUpdateProps((nextProps) => { + const { record } = this.props; + const { record: nextRecord } = nextProps; + if (record.resId !== nextRecord.resId || nextRecord.mode === "readonly") { + this.rawCacheKey = nextRecord.data.__last_update; + } + }); + } + get sizeStyle() { + /* Styling the widget */ + let style = ""; + if (this.props.width) { + style += `max-width: ${this.props.width}px;`; + } + if (this.props.height) { + style += `max-height: ${this.props.height}px;`; + } + return style; + } + get hasTooltip() { + /* Method for getting the tooltip */ + return this.props.enableZoom && this.props.readonly && this.props.value; + } + getUrl(previewFieldName) { + /* Get image URL */ + if (this.state.isValid && this.props.value) { + if (isBinarySize(this.props.value)) { + if (!this.rawCacheKey) { + this.rawCacheKey = this.props.record.data.__last_update; + } + return url("/web/image", { + model: this.props.record.resModel, + id: this.props.record.resId, + field: previewFieldName, + unique: imageCacheKey(this.rawCacheKey), + }); + } else { + // Use magic-word technique for detecting image type + const magic = fileTypeMagicWordMap[this.props.value[0]] || "png"; + return `data:image/${magic};base64,${this.props.value}`; + } + } + return placeholder; + } + /* File Remove */ + onFileRemove() { + this.state.isValid = true; + this.props.update(false); + } + /* File Upload */ + onFileUploaded(info) { + this.state.isValid = true; + this.rawCacheKey = null; + this.props.update(info.data); + } + /* File Load */ + onLoadFailed() { + this.state.isValid = false; + this.notification.add(this.env._t("Could not display the selected image"), { + type: "danger", + }); + } + /* Upload Image to the field */ + onImageUpload(){ + let file =this.inputFile.el.defaultValue + if (file == "") + { + image_picker.classList.add('d-none'); + } + else{ + rpc.query({ + model: 'ir.attachment', + method: 'action_save_drag_and_drop_image', + args: [[], {'resModel': this.props.record.resModel, + 'id': this.props.record.data.id, 'name': this.props.name}, file], + }).then(function(results){ + location.reload(); + }) + + } + } + /* method for dragging */ + onFileDragImage(){ + var image_picker = this.image_picker.el; + image_picker.classList.remove('d-none'); + } +} + +DragAndDropBinaryField.components = { + FileUploader, +}; +DragAndDropBinaryField.props = { + ...standardFieldProps, + enableZoom: { type: Boolean, optional: true }, + zoomDelay: { type: Number, optional: true }, + previewImage: { type: String, optional: true }, + acceptedFileExtensions: { type: String, optional: true }, + width: { type: Number, optional: true }, + height: { type: Number, optional: true }, +}; +DragAndDropBinaryField.defaultProps = { + acceptedFileExtensions: "image/*", +}; + +DragAndDropBinaryField.displayName = _lt("Image"); +DragAndDropBinaryField.supportedTypes = ["binary"]; + +DragAndDropBinaryField.fieldDependencies = { + __last_update: { type: "datetime" }, +}; + +DragAndDropBinaryField.extractProps = ({ attrs }) => { + return { + enableZoom: attrs.options.zoom, + zoomDelay: attrs.options.zoom_delay, + previewImage: attrs.options.preview_image, + acceptedFileExtensions: attrs.options.accepted_file_extensions, + width: + attrs.options.size && Boolean(attrs.options.size[0]) + ? attrs.options.size[0] + : attrs.width, + height: + attrs.options.size && Boolean(attrs.options.size[1]) + ? attrs.options.size[1] + : attrs.height, + }; +}; +DragAndDropBinaryField.template = 'FieldDragAndDropBinary'; +registry.category("fields").add("drag_and_drop", DragAndDropBinaryField); diff --git a/drag_and_drop_image_widget/static/src/scss/drag_and_drop.scss b/drag_and_drop_image_widget/static/src/scss/drag_and_drop.scss new file mode 100644 index 000000000..25979c939 --- /dev/null +++ b/drag_and_drop_image_widget/static/src/scss/drag_and_drop.scss @@ -0,0 +1,192 @@ +@import url(https://fonts.googleapis.com/css?family=Open+Sans); + +@basecolor: #f80; +@dropperbg: hsl(0, 0%, 90%); + +*, +*:before, +*:after { + box-sizing: border-box; +} +body { + background: #eee; + font-family: "Open Sans", Helvetica, sans-serif; +} +.setting { + background: #fff; + margin: 0 auto 3px; + padding: 12px; + width: 300px; + h2 { + color: #999; + font-size: 14px; + font-weight: 400; + margin: 0 0 6px; + line-height: 24px; + } + a[data-action] { + cursor: pointer; + color: #555; + font-size: 14px; + line-height: 24px; + transition: color 0.2s; + i { + width: 1.25em; + text-align: center; + } + &:hover { + color: #f80; + } + &.disabled { + opacity: 0.35; + cursor: default; + &:hover { + color: #555; + } + } + } +} +.image_picker .settings_wrap { + overflow: hidden; + position: relative; + .drop_target, + .settings_actions { + float: left; + } + .drop_target { + margin-right: 18px; + } + .settings_actions { + margin-top: 12px; + } +} +.settings_actions.vertical { + a { + display: block; + } +} +.drop_target { + position: relative; + cursor: pointer; + background: hsl(0, 0%, 90%); + border-top: 1px solid darken(hsl(0, 0%, 90%), 10%); + border-radius: 4px; + width: 72px; + height: 72px; + padding: 4px 6px 6px; + transition: all 0.2s; + input[type="file"] { + visibility: hidden; + } + &:before { + content: "\f0ee"; + font-family: FontAwesome; + position: absolute; + display: block; + width: 60px; + line-height: 60px; + text-align: center; + font-size: 32px; + color: fadeout(#000, 70%); + transition: color 0.2s; + } + &:hover, + &.dropping { + background: #aca8a3; + border-top-color: darken(#0d0d0d, 10%); + } + &:hover:before, + &.dropping:before { + color: fadeout(#000, 40%); + } + .image_preview { + width: 100%; + height: 100%; + background: no-repeat center; + background-size: contain; + position: relative; + z-index: 2; + } +} +.image_details { + width: 192px; + padding: 4px; + background: hsl(0, 0%, 90%); + border-radius: 4px; + position: absolute; + top: 0; + left: 84px; + z-index: 5; + opacity: 0; + pointer-events: none; + transition: opacity 0.4s; + .dropped ~ & { + opacity: 1; + pointer-events: all; + } + &:before { + content: ""; + display: block; + width: 0; + height: 0; + border: 6px solid transparent; + border-right-color: hsl(0, 0%, 90%); + position: absolute; + left: -12px; + top: 10px; + } + .input_line { + display: block; + overflow: hidden; + margin-bottom: 4px; + &:last-of-type { + margin-bottom: 0; + } + span, + input { + float: left; + line-height: 24px; + } + span { + font-size: 12px; + color: #666; + width: 20%; + } + input[type="text"] { + width: 100%; + color: #444444; + appearance: none; + border: 1px solid hsl(0, 0%, 90%); + border-radius: 3px; + background: #fff; + height: 24px; + line-height: 18px; + padding: 3px 5px; + font-size: 14px; + transition: border 0.2s; + &:hover, + &:focus { + outline: 0; + border: 1px solid #f80; + } + &::-webkit-input-placeholder { + font-size: 14px; + color: #999; + } + } + } + a.confirm { + position: absolute; + right: -12px; + top: 50%; + margin-top: -12px; + display: block; + width: 21px; + height: 21px; + border-radius: 100%; + background: #eee; + line-height: 23px; + text-align: center; + font-size: 16px; + } +} diff --git a/drag_and_drop_image_widget/static/src/xml/drag_and_drop_templates.xml b/drag_and_drop_image_widget/static/src/xml/drag_and_drop_templates.xml new file mode 100644 index 000000000..7f839a9c8 --- /dev/null +++ b/drag_and_drop_image_widget/static/src/xml/drag_and_drop_templates.xml @@ -0,0 +1,112 @@ + + + + +
+
+ + + + + + + + + +
+ Binary file +
+
+
+
+ + + \ No newline at end of file