diff --git a/chatter_attachments_manager/README.rst b/chatter_attachments_manager/README.rst new file mode 100644 index 000000000..84947e35c --- /dev/null +++ b/chatter_attachments_manager/README.rst @@ -0,0 +1,47 @@ +.. image:: https://img.shields.io/badge/licence-OPL--1-red.svg + :target: https://www.odoo.com/documentation/16.0/legal/licenses.html#odoo-apps + :alt: License: OPL-1 + +Chatter Attachment Manager +========================== +This module helps to manage attachments in chatter and in discuss + +Configuration +============= +* No Additional configuration is needed. + +License +------- +Odoo Proprietary License v1.0 (OPL-1) +(https://www.odoo.com/documentation/16.0/legal/licenses.html#odoo-apps) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: (V16) Anagha S, Contact: odoo@cybrosys.com +* Developer: (V15) Nihala KP, 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/chatter_attachments_manager/__init__.py b/chatter_attachments_manager/__init__.py new file mode 100644 index 000000000..613d2e8e4 --- /dev/null +++ b/chatter_attachments_manager/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Nihala KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from . import controllers +from . import models diff --git a/chatter_attachments_manager/__manifest__.py b/chatter_attachments_manager/__manifest__.py new file mode 100644 index 000000000..a115658b7 --- /dev/null +++ b/chatter_attachments_manager/__manifest__.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Nihala KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +{ + 'name': 'Chatter Attachment Manager', + 'version': '15.0.1.0.0', + 'category': "Discuss, Document Management", + 'summary': """This module help to manage attachments""", + 'description': """This module helps to enhance the attachment management + capabilities within Odoo.Can easily edit,read, save, preview your documents + inside odoo. Module works in discuss, chat and chatter of any record""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['mail', 'base', 'web'], + 'data': [ + 'security/ir.model.access.csv', + 'views/ir_attachment_views.xml', + 'views/ir_attachment_tag_views.xml', + 'report/chatter_attachments_manager_report_templates.xml', + ], + "assets": { + 'web.assets_backend': [ + 'chatter_attachments_manager/static/src/attachment_control_panel/' + 'attachment_control_panel.js', + 'chatter_attachments_manager/static/src/attachment_image/' + 'attachment_image.js', + 'chatter_attachments_manager/static/src/css/' + 'chatter_attachment_manager.css', + 'chatter_attachments_manager/static/src/attachment_card/' + 'attachment_card.js', + ], + 'web.assets_qweb': [ + "chatter_attachments_manager/static/src/attachment_control_panel/" + "attachment_control_panel_templates.xml", + 'chatter_attachments_manager/static/src/attachment_image/' + 'attachment_image_templates.xml', + 'chatter_attachments_manager/static/src/attachment_card/' + 'attachment_card_templates.xml', + ], + }, + 'external_dependancy': ['pandas', 'qrcode', 'docx'], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'application': False, + 'auto_install': False +} diff --git a/chatter_attachments_manager/controllers/__init__.py b/chatter_attachments_manager/controllers/__init__.py new file mode 100644 index 000000000..e399869e9 --- /dev/null +++ b/chatter_attachments_manager/controllers/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Nihala KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from . import chatter_attachment_manager diff --git a/chatter_attachments_manager/controllers/chatter_attachment_manager.py b/chatter_attachments_manager/controllers/chatter_attachment_manager.py new file mode 100644 index 000000000..3a36414e1 --- /dev/null +++ b/chatter_attachments_manager/controllers/chatter_attachment_manager.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Nihala KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from datetime import datetime +try: + from BytesIO import BytesIO +except ImportError: + from io import BytesIO +import zipfile +from odoo import http +from odoo.http import request, content_disposition + + +class Binary(http.Controller): + """Attachment downloading binary class.""" + + @http.route('/web/binary/download_document', type='http', + auth='public') + def download_zip(self, **kwargs): + """This method used to download all chatter attachments inside a record + as a zip file.""" + model = kwargs.get('param1', 0) + tab_id = int(kwargs.get('param2', 0)) + attachment_ids = request.env['ir.attachment'].search( + [('res_model', '=', model), ('res_id', '=', tab_id)]) + file_dict = {} + for attachment_id in attachment_ids: + file_store = attachment_id.store_fname + if file_store: + file_name = attachment_id.name + file_path = attachment_id._full_path(file_store) + file_dict[f"{file_store}:{file_name}"] = { + 'path': file_path, 'name': file_name} + zip_filename = datetime.now() + zip_filename = f"{zip_filename}.zip" + bit_io = BytesIO() + with zipfile.ZipFile(bit_io, "w", + zipfile.ZIP_DEFLATED) as zip_file: + for file_info in file_dict.values(): + zip_file.write(file_info["path"], file_info["name"]) + zip_file.close() + return request.make_response(bit_io.getvalue(), headers=[ + ('Content-Type', 'application/x-zip-compressed'), + ('Content-Disposition', content_disposition(zip_filename))]) diff --git a/chatter_attachments_manager/doc/RELEASE_NOTES.md b/chatter_attachments_manager/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..fc8afc538 --- /dev/null +++ b/chatter_attachments_manager/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 17.07.2024 +#### Version 15.0.1.0.0 +#### ADD +- Initial commit for Chatter Attachment Manager diff --git a/chatter_attachments_manager/models/__init__.py b/chatter_attachments_manager/models/__init__.py new file mode 100644 index 000000000..11c9bc04a --- /dev/null +++ b/chatter_attachments_manager/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Nihala KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from . import ir_attachment +from . import ir_attachment_tag diff --git a/chatter_attachments_manager/models/ir_attachment.py b/chatter_attachments_manager/models/ir_attachment.py new file mode 100644 index 000000000..f175f9c57 --- /dev/null +++ b/chatter_attachments_manager/models/ir_attachment.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Nihala KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +import binascii +from io import BytesIO +import pandas as pd +from odoo import api, fields, models +import base64 +import qrcode +from docx import Document as DocxDocument + + +class IrAttachment(models.Model): + """Extended Attachment Model (Inherited from 'ir.attachment') + + This class represents an extension of the original 'ir.attachment' model in + Odoo. The 'ir.attachment' model is a built-in Odoo model that handles file + attachments to various records, such as documents, emails, or notes. + + In this custom model, we extend the functionality of 'ir.attachment' to add + new fields and custom methods to cater to specific requirements of our + application. + """ + _inherit = 'ir.attachment' + + tags_ids = fields.Many2many(comodel_name='ir.attachment.tag', + string='Tags', help="Tags for attachments") + + @api.model + def decode_content(self, attach_id, doc_type): + """Decode XLSX or DOC File Data. + This method takes a binary file data from an attachment and decodes + the content of the file for XLSX and DOC file formats. + :param int attach_id: id of attachment. + :param str doc_type: the type of the given attachment either 'xlsx' or 'doc' + :return: return the decoded data.""" + attachment = self.sudo().browse(attach_id) + if not attachment or not attachment.datas: + return "Attachment not found or has no data" + try: + if doc_type == 'xlsx': + data = binascii.a2b_base64(attachment.datas) + content = pd.read_excel(BytesIO(data), + engine='openpyxl', + converters={'A': str}) + html_table = content.to_html(index=False) + return html_table + elif doc_type == 'docx': + data = binascii.a2b_base64(attachment.datas) + if DocxDocument is None: + return "Docx processing library not available" + doc = DocxDocument(BytesIO(data)) + paragraphs = [p.text for p in doc.paragraphs] + return paragraphs + else: + raise ValueError("Unsupported file format") + html_table = content.to_html(index=False) + return html_table + except TypeError: + return ("

" + "No preview available

") + text = "Cant Preview" + return text + + @api.model + def save_edited_image(self, attach_id, image): + """The image is replaced by image from Toast image editor + :param int attach_id: id of attachment. + :param str image: new image data + :return file containing image + """ + file = self.sudo().browse(attach_id) + file.write({'datas': image.strip('data:image/png;base64')}) + return file + + @api.model + def generate_qr_code(self, attach_id): + """Generate qr code for attachment that allow anyone to download it.""" + base_url = self.env['ir.config_parameter'].sudo().get_param( + 'web.base.url') + data = {} + download_url = f"/mail/channel/1/attachment/{attach_id}?download=true" + if qrcode: + attach_qr = qrcode.QRCode( + version=3, + error_correction=qrcode.constants.ERROR_CORRECT_L, + box_size=4, border=4) + attach_qr.add_data(base_url + download_url) + attach_qr.make(fit=True) + img = attach_qr.make_image() + temp = BytesIO() + img.save(temp, format="PNG") + qr_image = base64.b64encode(temp.getvalue()).decode('utf-8') + data.update({'image': qr_image, 'company': self.env.company.name}) + return data diff --git a/chatter_attachments_manager/models/ir_attachment_tag.py b/chatter_attachments_manager/models/ir_attachment_tag.py new file mode 100644 index 000000000..db9a4b914 --- /dev/null +++ b/chatter_attachments_manager/models/ir_attachment_tag.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Nihala KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from random import randint +from odoo import fields, models + + +class AttachmentTag(models.Model): + """Attachment tag model.""" + _name = "ir.attachment.tag" + _description = "Attachment Tag" + + def _get_default_color(self): + """To get default color for tags.""" + return randint(1, 11) + + name = fields.Char(string='Tag Name', required=True, translate=True, + help='Name of tags.') + color = fields.Integer(string='Color', default=_get_default_color, + help="Tag color.") + _sql_constraints = [ + ('name_uniq', 'unique (name)', "Tag name already exists !"), ] diff --git a/chatter_attachments_manager/report/chatter_attachments_manager_report_templates.xml b/chatter_attachments_manager/report/chatter_attachments_manager_report_templates.xml new file mode 100644 index 000000000..f6616f3d2 --- /dev/null +++ b/chatter_attachments_manager/report/chatter_attachments_manager_report_templates.xml @@ -0,0 +1,27 @@ + + + + + Attachment QR Code + ir.attachment + qweb-pdf + chatter_attachments_manager.attachment_qr_report_template + chatter_attachments_manager.attachment_qr_report_template + + + + diff --git a/chatter_attachments_manager/security/ir.model.access.csv b/chatter_attachments_manager/security/ir.model.access.csv new file mode 100644 index 000000000..34105b255 --- /dev/null +++ b/chatter_attachments_manager/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_ir_attachment_tag_user,access.ir.attachment.tag.user,model_ir_attachment_tag,base.group_user,1,1,1,1 diff --git a/chatter_attachments_manager/static/description/assets/icons/check.png b/chatter_attachments_manager/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/check.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/chevron.png b/chatter_attachments_manager/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/chevron.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/cogs.png b/chatter_attachments_manager/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/cogs.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/consultation.png b/chatter_attachments_manager/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/consultation.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/ecom-black.png b/chatter_attachments_manager/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/ecom-black.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/education-black.png b/chatter_attachments_manager/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/education-black.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/hotel-black.png b/chatter_attachments_manager/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/hotel-black.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/license.png b/chatter_attachments_manager/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/license.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/lifebuoy.png b/chatter_attachments_manager/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/lifebuoy.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/manufacturing-black.png b/chatter_attachments_manager/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/manufacturing-black.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/pos-black.png b/chatter_attachments_manager/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/pos-black.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/puzzle.png b/chatter_attachments_manager/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/puzzle.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/restaurant-black.png b/chatter_attachments_manager/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/restaurant-black.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/service-black.png b/chatter_attachments_manager/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/service-black.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/trading-black.png b/chatter_attachments_manager/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/trading-black.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/training.png b/chatter_attachments_manager/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/training.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/update.png b/chatter_attachments_manager/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/update.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/user.png b/chatter_attachments_manager/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/user.png differ diff --git a/chatter_attachments_manager/static/description/assets/icons/wrench.png b/chatter_attachments_manager/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/icons/wrench.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/categories.png b/chatter_attachments_manager/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/categories.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/check-box.png b/chatter_attachments_manager/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/check-box.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/compass.png b/chatter_attachments_manager/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/compass.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/corporate.png b/chatter_attachments_manager/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/corporate.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/customer-support.png b/chatter_attachments_manager/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/customer-support.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/cybrosys-logo.png b/chatter_attachments_manager/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/cybrosys-logo.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/features.png b/chatter_attachments_manager/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/features.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/logo.png b/chatter_attachments_manager/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/logo.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/pictures.png b/chatter_attachments_manager/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/pictures.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/pie-chart.png b/chatter_attachments_manager/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/pie-chart.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/right-arrow.png b/chatter_attachments_manager/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/right-arrow.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/star.png b/chatter_attachments_manager/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/star.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/support.png b/chatter_attachments_manager/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/support.png differ diff --git a/chatter_attachments_manager/static/description/assets/misc/whatsapp.png b/chatter_attachments_manager/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/misc/whatsapp.png differ diff --git a/chatter_attachments_manager/static/description/assets/modules/1.jpg b/chatter_attachments_manager/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..158fefab6 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/modules/1.jpg differ diff --git a/chatter_attachments_manager/static/description/assets/modules/2.png b/chatter_attachments_manager/static/description/assets/modules/2.png new file mode 100644 index 000000000..6402182ba Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/modules/2.png differ diff --git a/chatter_attachments_manager/static/description/assets/modules/3.png b/chatter_attachments_manager/static/description/assets/modules/3.png new file mode 100644 index 000000000..33f803afd Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/modules/3.png differ diff --git a/chatter_attachments_manager/static/description/assets/modules/4.png b/chatter_attachments_manager/static/description/assets/modules/4.png new file mode 100644 index 000000000..cdcba33eb Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/modules/4.png differ diff --git a/chatter_attachments_manager/static/description/assets/modules/5.jpg b/chatter_attachments_manager/static/description/assets/modules/5.jpg new file mode 100755 index 000000000..7de3c541d Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/modules/5.jpg differ diff --git a/chatter_attachments_manager/static/description/assets/modules/6.png b/chatter_attachments_manager/static/description/assets/modules/6.png new file mode 100644 index 000000000..1272619b1 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/modules/6.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/1.png b/chatter_attachments_manager/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..ee9901f59 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/1.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/10.png b/chatter_attachments_manager/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..e2c38ab8f Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/10.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/11.png b/chatter_attachments_manager/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..e2bfd9e30 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/11.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/12.png b/chatter_attachments_manager/static/description/assets/screenshots/12.png new file mode 100644 index 000000000..6b4d79197 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/12.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/13.png b/chatter_attachments_manager/static/description/assets/screenshots/13.png new file mode 100644 index 000000000..b79275466 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/13.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/14.png b/chatter_attachments_manager/static/description/assets/screenshots/14.png new file mode 100644 index 000000000..e6e99205d Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/14.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/15.png b/chatter_attachments_manager/static/description/assets/screenshots/15.png new file mode 100644 index 000000000..962170d0a Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/15.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/16.png b/chatter_attachments_manager/static/description/assets/screenshots/16.png new file mode 100644 index 000000000..125f27820 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/16.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/17.png b/chatter_attachments_manager/static/description/assets/screenshots/17.png new file mode 100644 index 000000000..0223fee84 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/17.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/18.png b/chatter_attachments_manager/static/description/assets/screenshots/18.png new file mode 100644 index 000000000..d7cda6366 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/18.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/19.png b/chatter_attachments_manager/static/description/assets/screenshots/19.png new file mode 100644 index 000000000..4c308fa5a Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/19.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/2.png b/chatter_attachments_manager/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..b74c7a6c5 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/2.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/3.png b/chatter_attachments_manager/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..6167a1cd7 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/3.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/4.png b/chatter_attachments_manager/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..a2849306e Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/4.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/5.png b/chatter_attachments_manager/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..e5ad2abf4 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/5.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/6.png b/chatter_attachments_manager/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..cb5055e1a Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/6.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/7.png b/chatter_attachments_manager/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..6fc893461 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/7.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/8.png b/chatter_attachments_manager/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..ccb2ce8da Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/8.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/9.png b/chatter_attachments_manager/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..4503cc8b2 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/9.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/v15-hero.gif b/chatter_attachments_manager/static/description/assets/screenshots/v15-hero.gif new file mode 100644 index 000000000..d713b448e Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/v15-hero.gif differ diff --git a/chatter_attachments_manager/static/description/banner.jpg b/chatter_attachments_manager/static/description/banner.jpg new file mode 100644 index 000000000..55c830e32 Binary files /dev/null and b/chatter_attachments_manager/static/description/banner.jpg differ diff --git a/chatter_attachments_manager/static/description/icon.png b/chatter_attachments_manager/static/description/icon.png new file mode 100644 index 000000000..4ba0496ee Binary files /dev/null and b/chatter_attachments_manager/static/description/icon.png differ diff --git a/chatter_attachments_manager/static/description/index.html b/chatter_attachments_manager/static/description/index.html new file mode 100644 index 000000000..5092c6924 --- /dev/null +++ b/chatter_attachments_manager/static/description/index.html @@ -0,0 +1,647 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Chatter Attachment Manager

+

+ This module helps to manage Attachments in Chatter, Chat and in Discuss

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

Explore This Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
This Module helps to enhance the Attachment Management + capabilities within Odoo.Can easily Edit, Read, Preview your Documents + inside Odoo. Module works in Discuss, Chat and Chatter of any record +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + Support front camera and screen recorder.Upload image to Chatter from these. +
+
+ + Can edit the record by renaming, adding Tags etc. +
+
+ + + Offline preview is available for Xlsx, Docx, Pdf And Image files from chatter itself +
+
+ + + Image Professional Editor support.This app provides a professional image editor, + allowing you to edit and enhance images directly within your App. +
+
+ + + Tag for Attachments: Any attachment can have many tags. +
+
+ + + Download all Attachments attached to a record can be downloaded as a Zip file. +
+
+ + + QRcode support: QR can be sent to any employee who can download and open the file. +
+
+ + + Can View all attachments from the Attachment lists +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

Upload Attachments. +

+

+ You can upload from your device, front camera, screencast.You + are able to download all attachments and manage it. + Can upload multiple files at a time.
+ Attachments can be posted by clicking the '+' icon in the + chatter. +

+ +

+ You can upload file from your device by clicking on 'My device'. +

+ +

+ Can select files from device and posted on attachments. +

+ +

+ Can upload file from 'Front Cam'. +

+ +

+ It will open a window to take picture.Click on 'Capture' to capture the photo or cancel it. +

+ +

+ You can see the captured photo in chatter +

+ +

+ The "Record Screen" button allows you to upload recorded screens. +

+ +

+ On click on 'Share' button, the screen is recorded. +

+ + +

+ Screen Recorder can be stopped on clicking 'Stop sharing'. Recorder video will be saved there. +

+ +

+ All uploaded attachments can be viewed. +

+ +
+
+

Edit Attachments. +

+

+ Click on 'cog' icon, it will list some items.Click on 'Image Editor' to edit the image. +

+ +

+ A professional Image Editor is Provided to alter the image, such as + cropping, Resizing, applying a color filter etc.Can load another image and + replace existing one. + + Click 'Save' to update the changes. +

+ +

+ You can see the edited image in the chatter +

+ +
+ + +
+

+ Offline preview of xlsx, docx and pdf files. +

+

Click on 'Preview Offline' to preview the attachments.Offline preview for only 'docx', 'XLSX', 'webm', 'pdf' is available.

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

+ Related Products +

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

Our Services +

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

+ Our Industries +

+
+
+
+
+
+ +
Trading +
+

Easily procure and + sell your products

+
+
+
+
+ +
+ POS +
+

Easy configuration and convivial experience

+
+
+
+
+ +
Education +
+

A platform for educational management

+
+
+
+
+ +
Manufacturing
+

Plan, track and schedule your operations

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

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +
+ Service Management +
+

Keep track of services and invoice

+
+
+
+
+ +
Restaurant +
+

Run your bar or restaurant methodically

+
+
+
+
+ +
Hotel Management +
+

An all-inclusive hotel management application

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

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+91 86068 27707

+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/chatter_attachments_manager/static/src/attachment_card/attachment_card.js b/chatter_attachments_manager/static/src/attachment_card/attachment_card.js new file mode 100644 index 000000000..daac6d829 --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_card/attachment_card.js @@ -0,0 +1,128 @@ +/** @odoo-module */ +import { AttachmentCard } from '@mail/components/attachment_card/attachment_card'; +import { isEventHandled, markEventHandled } from '@mail/utils/utils'; +import { patch } from 'web.utils'; +var rpc = require('web.rpc'); +var core = require('web.core'); +var _t = core._t; +var QWeb = core.qweb; +const { useRef, useState, onMounted, onWillUnmount } = owl.hooks; +patch(AttachmentCard.prototype, 'chatter_attachments_manager/static/src/attachment_card/attachment_card.js', { + setup() { + this.preview = useRef('preview_modal') + this._super.apply(this, arguments); + this.control_menu = useRef('card_menu_dropdown'); + this._onClickGlobal = this._onClickGlobal.bind(this) + this.state = useState({ + isDropdownOpen: false, + }); + onMounted(() => { + document.addEventListener('click', this._onClickGlobal) + }) + onWillUnmount(() => { + document.removeEventListener('click', this._onClickGlobal) + }) + }, + _onClickGlobal(ev){ + //----To close the dropdown on outside click + if(this.state?.isDropdownOpen && !this.control_menu.el.contains(ev.target)){ + this.state.isDropdownOpen = false + } + }, + onClickCard(){ + //---show the dropdown + this.state.isDropdownOpen = !this.state.isDropdownOpen + }, + + async onClickPreviewOffline(ev){ + //----Offline Preview of file type 'docx', 'xlsx' and 'pdf' + ev.stopPropagation(); + ev.preventDefault(); + var self = this; + var type = $(ev.currentTarget).data("type") + var fileHeadElement = this.preview.el.querySelector('#FileHead'); + this.preview.el.querySelector('#FileHead').textContent = ev.target.name + if(type === 'xlsx' || type === 'docx'){ + this.preview.el.style.display = "block"; + var preview = rpc.query({ + model: 'ir.attachment', + method: 'decode_content', + args: [parseInt(ev.target.id),type], + }).then(function (data) { + if (type === 'xlsx'){ + $('.XlsxTable').append(data) + var frame = $(".dataframe").attr('id', 'MyTable'); + } + else if(type === 'docx'){ + for (let para = 0; para < data.length; para++) { + self.preview.el.querySelector('.MyDocs').append(data[para]) + }; + } + }); + } + else{ + this.attachmentCard.onClickImage() + } + }, + + stopPreviewButton(ev){ + //----Close preview window + this.preview.el.style.display= "none"; + this.preview.el.querySelector('.MyDocs').textContent = " "; + $('#MyTable').remove(); + this.preview.el.querySelector('#FileHead').textContent = " "; + }, + + async onClickEditRecord(ev) { + //----Records can be edited by altering the file name and adding tags. + ev.preventDefault(); + markEventHandled(ev, 'AttachmentCard.onClickEditRecord'); + var attachment_id = parseInt(ev.target.id); + const action = { + name: this.env._t("Attachment"), + type: 'ir.actions.act_window', + view_mode: 'form', + views: [[false, 'form']], + target: 'new', + res_id: attachment_id, + res_model: 'ir.attachment', + }; + return this.env.bus.trigger('do-action', { + action, + options: {}, + }); + }, + + _onClickQrCode(ev){ + //----For generating Qr Code contain download link of attachment. + var self = this; + rpc.query({ + model: 'ir.attachment', + method: 'generate_qr_code', + args: [parseInt(ev.target.id)], + }).then(function (data){ + const action = { + type: 'ir.actions.report', + report_type: 'qweb-pdf', + report_name: 'chatter_attachments_manager.attachment_qr_report_template', + report_file: 'chatter_attachments_manager.attachment_qr_report_template', + data: data, + }; + return self.env.bus.trigger('do-action', { + action, + options: { + on_close: async () => { + await location.reload(); + }, + }, + }); + var act = self.env.services.action.doAction({ + type: 'ir.actions.report', + report_type: 'qweb-pdf', + report_name: 'chatter_attachments_manager.attachment_qr_report_template', + report_file: 'chatter_attachments_manager.attachment_qr_report_template', + data: data, + }); + }); + }, +}); diff --git a/chatter_attachments_manager/static/src/attachment_card/attachment_card_templates.xml b/chatter_attachments_manager/static/src/attachment_card/attachment_card_templates.xml new file mode 100644 index 000000000..0b8fbf93f --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_card/attachment_card_templates.xml @@ -0,0 +1,56 @@ + + + + + + + + +
+ +
+
+
+
diff --git a/chatter_attachments_manager/static/src/attachment_control_panel/attachment_control_panel.js b/chatter_attachments_manager/static/src/attachment_control_panel/attachment_control_panel.js new file mode 100644 index 000000000..20b3e210a --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_control_panel/attachment_control_panel.js @@ -0,0 +1,197 @@ +/** @odoo-module **/ +import { AttachmentBox } from '@mail/components/attachment_box/attachment_box'; +import { patch } from 'web.utils'; +import Dialog from 'web.Dialog'; +import view_dialogs from 'web.view_dialogs'; +import core from 'web.core'; +import rpc from 'web.rpc'; +const { useRef,onWillUnmount,onMounted , useState} = owl.hooks; +const _t = core._t; + +patch(AttachmentBox.prototype, 'chatter_attachments_manager_attachment_box', { + setup() { + this._super.apply(this, arguments); + this.MyModal = useRef('myModal'); + this.control_menu = useRef('control_menu_dropdown'); + this._onClickGlobal = this._onClickGlobal.bind(this) + this.state = useState({ + isDropdownOpen: false, + }); + onMounted(() => { + document.addEventListener('click', this._onClickGlobal) + }) + onWillUnmount(() => { + document.removeEventListener('click', this._onClickGlobal) + }) + }, + + _onClickGlobal(ev){ + //----To close the dropdown on outside click + if(this.state?.isDropdownOpen && !this.control_menu.el.contains(ev.target)){ + this.state.isDropdownOpen = false + } + }, + + onClickUpload(){ + //----Open a dropdown on click upload icon + this.state.isDropdownOpen = !this.state.isDropdownOpen + }, + + onClickCamera(ev) { + //----Open camera to capture + if (this.control_menu.el.style.display === "none") { + this.control_menu.el.style.display = "block"; + } + else { + this.control_menu.el.style.display = "none"; + } + var self = this; + this.MyModal.el.style.display = "table"; + let All_mediaDevices = navigator?.mediaDevices + All_mediaDevices?.getUserMedia({ + audio: false, + video: true + }) + .then(function(vidStream) { + var video = document.getElementById('videoCam'); + if ("srcObject" in video) { + video.srcObject = vidStream; + } else { + video.src = window.URL.createObjectURL(vidStream); + } + video.onloadedmetadata = function(e) { + video.play(); + }; + var stopButton = document.getElementById('stop-camera-button'); + stopButton.addEventListener('click', function() { + vidStream.getTracks().forEach(function(track) { + track.stop(); + self.MyModal.el.style.display = "none"; + canvas.toDataURL(); + }); + location.reload(); + }); + }) + .catch(function(e) { + console.log(e.name + ": " + e.message); + }); + }, + + ImageCapture: function(){ + //----Capture the image + let canvas = document.querySelector("#canvas"); + let video = document.querySelector("#videoCam"); + canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height); + let image_data_url = canvas.toDataURL('image/jpeg'); + var fl = []; + var arr = image_data_url.split(','), + mime = arr[0].match(/:(.*?);/)[1], + bstr = atob(arr[1]), + n = bstr.length, + u8arr = new Uint8Array(n); + while (n--) { + u8arr[n] = bstr.charCodeAt(n); + } + var f = new File([u8arr], 'image.jpeg', { + type: mime + }); + fl.push(f); + this._fileUploaderRef.comp.uploadFiles(fl) + }, + + async onClickScreenRec(ev){ + //----Capturing Screen recording + if (this.control_menu.el.style.display === "none") { + this.control_menu.el.style.display = "block"; + } + else { + this.control_menu.el.style.display = "none"; + } + try { + let stream = await navigator.mediaDevices.getDisplayMedia({ + video: true + }) + const mime = MediaRecorder.isTypeSupported("video/webm; codecs=vp9") + ? "video/webm; codecs=vp9" + : "video/webm" + let mediaRecorder = new MediaRecorder(stream, { + mimeType: mime + }) + var self = this; + let chunks = [] + mediaRecorder.addEventListener('dataavailable', function(e) { + chunks.push(e.data) + }) + mediaRecorder.addEventListener('stop', function(){ + let blob = new Blob(chunks, { + type: chunks[0].type + }) + const blobToBase64 = blob => { + const reader = new FileReader(); + reader.readAsDataURL(blob); + return new Promise(resolve => { + reader.onloadend = () => { + resolve(reader.result); + }; + }); + }; + blobToBase64(blob).then(res => { + var fl = []; + var arr = res.split(','), + mime = arr[0].match(/:(.*?);/)[1], + bstr = atob(arr[1]), + n = bstr.length, + u8arr = new Uint8Array(n); + while (n--) { + u8arr[n] = bstr.charCodeAt(n); + } + var f = new File([u8arr], 'example.webm', { + type: mime + }); + fl.push(f); + self._fileUploaderRef.comp.uploadFiles(fl) + }); + }) + mediaRecorder.start() + } + catch(e){} + }, + + _onClickAddAttachment() { + //----On clicking add Attachments + if (this.control_menu.el.style.display === "none") { + this.control_menu.el.style.display = "block"; + } + else { + this.control_menu.el.style.display = "none"; + } + this._fileUploaderRef.comp.openBrowserFileUploader(); + }, + + onClickDownloadAll(ev) { + //----On clicking Download All button + var apiUrl = '/web/binary/download_document'; // URL of Odoo controller + var modelName = this.chatter.thread.model; + var tabId = this.chatter.thread.id; + fetch(apiUrl + '?param1=' + modelName + '¶m2=' + tabId, { + method: 'GET', + responseType: 'blob' + }) + .then(response => response.blob()) + .then(blob => { + var url = window.URL.createObjectURL(blob); + var a = $('', { + style: 'display: none', + href: url, + download: modelName + '.zip' + }); + $('body').append(a); + a[0].click(); + a.remove(); + window.URL.revokeObjectURL(url); + }) + .catch(error => { + console.error('Error downloading zip:', error); + }); + }, +}); diff --git a/chatter_attachments_manager/static/src/attachment_control_panel/attachment_control_panel_templates.xml b/chatter_attachments_manager/static/src/attachment_control_panel/attachment_control_panel_templates.xml new file mode 100644 index 000000000..0f9a1eeb0 --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_control_panel/attachment_control_panel_templates.xml @@ -0,0 +1,72 @@ + + + + + + + +
+ +
+ + + diff --git a/chatter_attachments_manager/static/src/attachment_image/attachment_image.js b/chatter_attachments_manager/static/src/attachment_image/attachment_image.js new file mode 100644 index 000000000..2d34375a5 --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_image/attachment_image.js @@ -0,0 +1,112 @@ +/** @odoo-module **/ +import { AttachmentImage } from '@mail/components/attachment_image/attachment_image'; +import { patch } from 'web.utils'; +import { isEventHandled, markEventHandled } from '@mail/utils/utils'; +import rpc from 'web.rpc'; +const { useRef,onWillUnmount,onMounted , useState} = owl.hooks; +const core = require('web.core'); +const _t = core._t; +var dialogs = require('web.view_dialogs'); + +patch(AttachmentImage.prototype, 'chatter_attachments_manager/static/src/attachment_image/attachment_image.js', { + setup() { + this._super.apply(...arguments); + this.image_menu = useRef('image_menu_dropdown'); + this._onClickGlobal = this._onClickGlobal.bind(this) + this.state = useState({ + isDropdownOpen: false, + }); + onMounted(() => { + document.addEventListener('click', this._onClickGlobal) + }) + onWillUnmount(() => { + document.removeEventListener('click', this._onClickGlobal) + }) + }, + + _onClickGlobal(ev){ + //------To close the dropdown on outside click + if(this.state?.isDropdownOpen && !this.image_menu.el.contains(ev.target)){ + this.state.isDropdownOpen = false + } + }, + + onClickImage(ev) { + //----Handle click event on the settings button.Show or hide the context menu dropdown. + ev.preventDefault(); + this.state.isDropdownOpen = !this.state.isDropdownOpen + }, + + onClickEditImgRecord(ev) { + //----Open window to edit image record + ev.preventDefault(); + markEventHandled(ev, 'AttachmentImage.onClickEditImgRecord'); + const attachment_id = parseInt(ev.target.id); + const action = { + type: 'ir.actions.act_window', + name: this.env._t("Edit Record"), + res_model: 'ir.attachment', + view_mode: 'form', + views: [[false, 'form']], + target: 'new', + res_id: attachment_id, + }; + return this.env.bus.trigger('do-action', { + action, + options: { + on_close: () => {}, + }, + }); + }, + + async onClickImageEdit(ev) { + //----Open a window to edit image + ev.preventDefault(); + markEventHandled(ev, 'AttachmentImage.onClickImageEdit'); + const attachment_id = parseInt(ev.target.id); + const imageEditor = new tui.ImageEditor('.tui-image-editor-container', { + includeUI: { + loadImage: { + path: `/web/image/ir.attachment/${attachment_id}/datas`, + name: 'SampleImage' + }, + imageSize: { + oldWidth: "0", + oldHeight: "0", + newWidth: "300", + newHeight: "90" + }, + initMenu: 'filter', + menuBarPosition: 'bottom' + }, + cssMaxWidth: 500, + cssMaxHeight: 590, + usageStatistics: false + }); + + $('#imageEditor').css("display", "block"); + $('.tui-image-editor-header-buttons .tui-image-editor-download-btn') + .replaceWith(``); + $('.tui-image-editor-header-buttons').append(` +
+ Close +
+ `); + $('.tui-image-editor-header-buttons .tui-image-editor-close-btn') + .on('click', () => { + $('#imageEditor').css("display", "none"); + }); + + $('.tui-image-editor-header-buttons .tui-image-editor-save-btn').on('click', () => { + const myImage = imageEditor.toDataURL(); + rpc.query({ + model: 'ir.attachment', + method: 'save_edited_image', + args: [attachment_id, myImage], + }).then(() => { + location.reload(); + }); + }); + }, +}); diff --git a/chatter_attachments_manager/static/src/attachment_image/attachment_image_templates.xml b/chatter_attachments_manager/static/src/attachment_image/attachment_image_templates.xml new file mode 100644 index 000000000..4a2d2e556 --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_image/attachment_image_templates.xml @@ -0,0 +1,63 @@ + + + + + +
+ +
+ +
+ + + + +
+ +
+ + + + + + +
+
+
diff --git a/chatter_attachments_manager/static/src/css/chatter_attachment_manager.css b/chatter_attachments_manager/static/src/css/chatter_attachment_manager.css new file mode 100644 index 000000000..390999539 --- /dev/null +++ b/chatter_attachments_manager/static/src/css/chatter_attachment_manager.css @@ -0,0 +1,121 @@ +/* Dropdown on attachment card for tools*/ +.dropdown { + position: relative; + } + .o_AttachmentCard_aside{ + overflow:visible !important; + } + .context_menu_dropdown { + display: none; + position: absolute; + background-color: white; + min-width: 120px; + box-sizing: border-box; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + z-index: 1; + right: 0; + padding-bottom: 6px; + padding-top: 6px; + color: black; + } + .context_menu_dropdown a{ + color: black; + text-decoration: none; + } + + +/* Image editor container */ +#tui-image-editor-container{ + width: 981px; + height: 500px; + top: 0px; + position: fixed; /* Stay in place */ + z-index: 10; /* Sit on top by 10px*/ + padding: 1px; /* location of box */ + left: 10px; + } +#xlsx_preview{ + display: none; /* Hidden by default */ + position: fixed; /* Stay in place */ + z-index: 1; /* Sit on top */ + padding-top: 100px; /* Location of the box */ + left: 0; + top: 0; + width: 100%; /* Full width */ + height: 100%; /* Full height */ + overflow: auto; /* Enable scroll if needed */ + background-color: rgb(0,0,0); /* Fallback color */ + background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ +} +#video_content{ + background-color: rgba(0, 0, 0, -5.3); +} +#MyTable{ + font-family: Arial, Helvetica, sans-serif; + border-collapse: collapse; + width: 100%; +} +#MyTable th{ + padding-top: 12px; + padding-bottom: 12px; + text-align: left; + background-color: #04AA6D; + color: white; + border: 1px solid #ddd; + padding: 8px; +} +#MyTable td{ + border: 1px solid #ddd; + padding: 8px; +} +.XlsxTable{ + overflow: overlay; +} +#MyPreview_content { + background-color: #fefefe; + overflow: hidden; + margin: auto; + padding: 20px; + border: 1px solid #888; + width: 80%; +} + +/* The Close Button */ +#stop-preview-button { + color: #aaaaaa; + text-align: end; + font-size: 28px; + font-weight: bold; +} + +#stop-preview-button :hover, +#stop-preview-button :focus { + color: #000; + text-decoration: none; + cursor: pointer; +} +.MyDocs{ + overflow: auto; + text-align: justify; + padding: 30px; +} + +.o_AttachmentCard_tags span{ + border: 2px solid yellow; + border-radius: 25px; + background:yellow; + +} +.o_AttachmentImage { + width: 250px; + height: 200px; +} +.control_menu_dropdown{ + position: absolute; + background-color: white; + min-width: 112px; + box-sizing: border-box; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + z-index: 1; + left: 40px; +} diff --git a/chatter_attachments_manager/views/ir_attachment_tag_views.xml b/chatter_attachments_manager/views/ir_attachment_tag_views.xml new file mode 100644 index 000000000..e8b14e8fa --- /dev/null +++ b/chatter_attachments_manager/views/ir_attachment_tag_views.xml @@ -0,0 +1,14 @@ + + + + + ir.attachment.tag.view.tree + ir.attachment.tag + + + + + + + + diff --git a/chatter_attachments_manager/views/ir_attachment_views.xml b/chatter_attachments_manager/views/ir_attachment_views.xml new file mode 100644 index 000000000..ed6209afb --- /dev/null +++ b/chatter_attachments_manager/views/ir_attachment_views.xml @@ -0,0 +1,36 @@ + + + + + + ir.attachment.view.form.inherit.chatter.attachments.manager + + ir.attachment + + + + + + + + + + + + + ir.attachment.view.search.inherit.chatter.attachments.manager + + ir.attachment + + + + + + + + + + +