diff --git a/chatter_attachments_manager/README.rst b/chatter_attachments_manager/README.rst new file mode 100644 index 000000000..4318efdb8 --- /dev/null +++ b/chatter_attachments_manager/README.rst @@ -0,0 +1,46 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Chatter Attachment Manager +========================== +This module helps to manage attachments in chatter and in discuss + +Configuration +============= +* No Additional configuration is needed. + +License +------- +Affero General Public License v3.0 (AGPL v3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: (V16) Anagha S, 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..9b3e52e0f --- /dev/null +++ b/chatter_attachments_manager/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Anagha S (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..1e6895366 --- /dev/null +++ b/chatter_attachments_manager/__manifest__.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Anagha S (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': '16.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', 'documents'], + '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/' + 'chatter_camera.js', + 'chatter_attachments_manager/static/src/attachment_control_panel/' + 'attachment_control_panel.js', + 'chatter_attachments_manager/static/src/attachment_card/' + 'attachment_card.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/chatter_topbar/' + 'chatter_topbar_templates.xml', + 'chatter_attachments_manager/static/src/attachment_control_panel/' + 'attachment_control_panel_templates.xml', + "chatter_attachments_manager/static/src/attachment_card/" + "attachment_card_templates.xml", + 'chatter_attachments_manager/static/src/attachment_image/' + 'attachment_image_templates.xml', + ], + }, + 'external_dependancy': ['pandas', 'qrcode', 'docx'], + 'images': [ + 'static/description/banner.jpg', + ], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False +} diff --git a/chatter_attachments_manager/controllers/__init__.py b/chatter_attachments_manager/controllers/__init__.py new file mode 100644 index 000000000..9c496abda --- /dev/null +++ b/chatter_attachments_manager/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Anagha S (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..e5725fce3 --- /dev/null +++ b/chatter_attachments_manager/controllers/chatter_attachment_manager.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Anagha S (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..598c98093 --- /dev/null +++ b/chatter_attachments_manager/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 16.10.2023 +#### Version 16.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..2771c9b24 --- /dev/null +++ b/chatter_attachments_manager/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Anagha S (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..b7a7da5e5 --- /dev/null +++ b/chatter_attachments_manager/models/ir_attachment.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Anagha S (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 io import BytesIO +import pandas as pd +from odoo import api, fields, models +try: + import qrcode + import base64 + import io + from docx import Document as DocxDocument +except ImportError: + io = None + qrcode = None + base64 = None + DocxDocument = None + + +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) + xlsx_data = base64.b64decode(attachment.datas) + if doc_type == 'xlsx': + content = pd.read_excel(BytesIO(xlsx_data), engine='openpyxl', + converters={'A': str}) + html_table = content.to_html(index=False) + return html_table + if doc_type == 'docx': + doc = DocxDocument(io.BytesIO(xlsx_data)) + paragraphs = [p.text for p in doc.paragraphs] + return paragraphs + 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 tha 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 and base64: + 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()) + 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..c33fe83a2 --- /dev/null +++ b/chatter_attachments_manager/models/ir_attachment_tag.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Anagha S (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.png b/chatter_attachments_manager/static/description/assets/modules/1.png new file mode 100644 index 000000000..9de1176ad Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/modules/1.png 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..42c89de23 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..8d99e8c68 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..c1f30354a 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.gif b/chatter_attachments_manager/static/description/assets/modules/5.gif new file mode 100644 index 000000000..8f40aab85 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/modules/5.gif 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..05c8b4a69 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/Screenshot10.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot10.png new file mode 100644 index 000000000..0cf61ccf0 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot10.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot12.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot12.png new file mode 100644 index 000000000..e942a6ae8 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot12.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot13.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot13.png new file mode 100644 index 000000000..cb47db0df Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot13.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot15.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot15.png new file mode 100644 index 000000000..1828574a5 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot15.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot16.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot16.png new file mode 100644 index 000000000..1ee265f0c Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot16.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot17.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot17.png new file mode 100644 index 000000000..23a7ab592 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot17.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot18.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot18.png new file mode 100644 index 000000000..78bd7d5ea Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot18.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot19.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot19.png new file mode 100644 index 000000000..2e17aab6b Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot19.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot2.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot2.png new file mode 100644 index 000000000..295f68a3c Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot2.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot20.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot20.png new file mode 100644 index 000000000..0c4fcd9c4 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot20.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot21.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot21.png new file mode 100644 index 000000000..625d1ed70 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot21.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot22.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot22.png new file mode 100644 index 000000000..3357e0e3e Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot22.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot23.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot23.png new file mode 100644 index 000000000..a46979884 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot23.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot24.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot24.png new file mode 100644 index 000000000..204da5189 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot24.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot3.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot3.png new file mode 100644 index 000000000..5bf85e8f2 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot3.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot4.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot4.png new file mode 100644 index 000000000..422e32372 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot4.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot5.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot5.png new file mode 100644 index 000000000..50616f8a4 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot5.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot6.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot6.png new file mode 100644 index 000000000..181378cdf Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot6.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot7.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot7.png new file mode 100644 index 000000000..30264c7a8 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot7.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot8.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot8.png new file mode 100644 index 000000000..7bc237058 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot8.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/Screenshot9.png b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot9.png new file mode 100644 index 000000000..194f227d1 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/Screenshot9.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/hero.gif b/chatter_attachments_manager/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..ce780b26b Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/hero.gif differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/screenshot1.png b/chatter_attachments_manager/static/description/assets/screenshots/screenshot1.png new file mode 100644 index 000000000..ea61e5893 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/screenshot1.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/screenshot11.png b/chatter_attachments_manager/static/description/assets/screenshots/screenshot11.png new file mode 100644 index 000000000..59e5eae1b Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/screenshot11.png differ diff --git a/chatter_attachments_manager/static/description/assets/screenshots/screenshot14.png b/chatter_attachments_manager/static/description/assets/screenshots/screenshot14.png new file mode 100644 index 000000000..06d025f34 Binary files /dev/null and b/chatter_attachments_manager/static/description/assets/screenshots/screenshot14.png 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..bcd9f6cd8 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..7f86c3f6d 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 100755 index 000000000..2bffaf236 --- /dev/null +++ b/chatter_attachments_manager/static/description/index.html @@ -0,0 +1,670 @@ +
+ +
+ +
+
+ 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 Document Module and filter the Attachments by Tags +
+
+
+ + + +
+
+ +
+

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

+ +

+ 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 'Edit record' to edit the record. +

+ +

+ Records can be edited by altering the file name and adding tags + etc. +

+ +

+ Click 'Save' to update the changes. +

+ +

Can see updated name.

+ +
+

+ 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 on 'Image Editor'

+ +

The selected picture will be shown in the TOAST UI Image Editor window.

+ +

Can edit the image by resizing, adding icons, also able to replace the image.

+ + +

Edited image will be saved on saving.

+ +
+ +
+

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

+ + +
+
+

+ Can view all Attachments from Document Module and filter The + Attachments by Tags +

+ + +

+ Can view, edit and create attachment tags from 'Attachment Tags' menu from Document module. +

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

+ 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..f64e8ab5a --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_card/attachment_card.js @@ -0,0 +1,104 @@ +/** @odoo-module */ +import { AttachmentCard } from '@mail/components/attachment_card/attachment_card'; +import { useService } from "@web/core/utils/hooks"; +import { patch } from '@web/core/utils/patch'; +import rpc from 'web.rpc'; +var core = require('web.core'); +var _t = core._t; +var QWeb = core.qweb; +const { useRef } = owl; + +patch(AttachmentCard.prototype, 'chatter_attachments_manager_attachment_card', { + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + /** + * @override + */ + setup() { + this.orm = useService("orm"); + this.preview = useRef('preview_modal') + this._super.apply(this, arguments); + }, + /** + * Offline Preview of file type 'docx', 'xlsx' and 'pdf' + */ + async onClickPreviewOffline(ev){ + ev.stopPropagation(); + ev.preventDefault(); + var self = this; + var type = $(ev.currentTarget).data("type") + 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.props.record.onClickImage() + } + }, + /** + Close preview window + **/ + stopPreviewButton(ev){ + this.preview.el.style.display= "none"; + this.preview.el.querySelector('.MyDocs').textContent = " "; + $('#MyTable').remove(); + this.preview.el.querySelector('#FileHead').textContent = " "; + }, + /** + * Records can be edited by altering the file name and adding tags. + */ + async onClickEditRecord(ev){ + ev.preventDefault(); + var attachment_id = parseInt(ev.target.id); + await this.env.services.action.doAction({ + 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', + context: { create: false }, + }, { + onClose: async () => { + await location.reload(); + }, + }); + }, + /** + * For generating Qr Code contain download link of attachment. + */ + _onClickQrCode(ev){ + var self = this; + rpc.query({ + model: 'ir.attachment', + method: 'generate_qr_code', + args: [parseInt(ev.target.id)], + }).then(function (data){ + 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, + }); + console.log(act,'act') + }); + }, +}); 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..63b994e5f --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_card/attachment_card_templates.xml @@ -0,0 +1,57 @@ + + + + + + + + + +
+ +
+ +
+
+
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..b6c2304ea --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_control_panel/attachment_control_panel.js @@ -0,0 +1,66 @@ +/** @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 } = owl; +const _t = core._t; + +patch(AttachmentBox.prototype, 'chatter_attachments_manager_attachment_box', { + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + setup() { + this._super.apply(this, arguments); + this.MyModal = useRef('myModal') + this.control_menu = useRef('control_menu_dropdown') + }, + /** + Open a dropdown on click upload icon + **/ + onClickUpload(ev){ + if (this.control_menu.el.style.display === "none") { + this.control_menu.el.style.display = "block"; + } + else { + this.control_menu.el.style.display = "none"; + } + }, + /** + Open camera to capture + **/ + onClickCamera(ev) { + 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); + }); + } +}); 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..ede7e95d1 --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_control_panel/attachment_control_panel_templates.xml @@ -0,0 +1,67 @@ + + + + + +
+
+ +
+
+ +
+ +
+
+
+
diff --git a/chatter_attachments_manager/static/src/attachment_control_panel/chatter_camera.js b/chatter_attachments_manager/static/src/attachment_control_panel/chatter_camera.js new file mode 100644 index 000000000..f1d66c31c --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_control_panel/chatter_camera.js @@ -0,0 +1,111 @@ +/** @odoo-module **/ +import { registerPatch } from '@mail/model/model_core'; + +registerPatch({ + name: 'AttachmentBoxView', + recordMethods: { + /** + Capture the image + **/ + ImageCapture: function(){ + 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.fileUploader.uploadFiles(fl) + }, + /** + Record the screen. + **/ + async onClickScreenRec(ev){ + 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.fileUploader.uploadFiles(fl) + }); + }) + mediaRecorder.start() + } catch(e){} + }, + /** + Download all attachments attached to the record. + **/ + onClickDownloadAll(ev) { + 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_image/attachment_image.js b/chatter_attachments_manager/static/src/attachment_image/attachment_image.js new file mode 100644 index 000000000..a9b62d3ef --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_image/attachment_image.js @@ -0,0 +1,92 @@ +/** @odoo-module **/ +import { registerPatch } from '@mail/model/model_core'; +import { isEventHandled, markEventHandled } from '@mail/utils/utils'; +import rpc from 'web.rpc'; + +registerPatch({ + name: 'AttachmentImage', + recordMethods: { + /** + on click image event + **/ + onClickImage(ev) { + if (isEventHandled(ev, 'AttachmentImage.onClickEditImgRecord')) { + return; + } + if (isEventHandled(ev, 'AttachmentImage.onClickImageEdit')) { + return; + } + this._super.apply(this, arguments); + }, + /** + Open window to edit image record + **/ + async onClickEditImgRecord(ev){ + ev.preventDefault(); + markEventHandled(ev, 'AttachmentImage.onClickEditImgRecord'); + var attachment_id = parseInt(ev.target.id); + await this.env.services.action.doAction({ + 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', + context: { create: false }, + }, { + onClose: async () => { + await location.reload(); + }, + }); + }, + /** + Open a window to edit image + **/ + async onClickImageEdit(ev){ + markEventHandled(ev, 'AttachmentImage.onClickImageEdit'); + var attachment_id = parseInt(ev.target.id) + var 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', this.CloseImageEditor) + $('.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(function (data){ + location.reload(); + }); + }); + }, + CloseImageEditor: function(){ + var edit = jQuery.noConflict(); + edit('#imageEditor').css("display","none"); + }, + } +}); 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..430df734f --- /dev/null +++ b/chatter_attachments_manager/static/src/attachment_image/attachment_image_templates.xml @@ -0,0 +1,57 @@ + + + + + +
+ + + +
+ +
+ + + + + + +
+ + diff --git a/chatter_attachments_manager/static/src/chatter_topbar/chatter_topbar_templates.xml b/chatter_attachments_manager/static/src/chatter_topbar/chatter_topbar_templates.xml new file mode 100644 index 000000000..b01523662 --- /dev/null +++ b/chatter_attachments_manager/static/src/chatter_topbar/chatter_topbar_templates.xml @@ -0,0 +1,21 @@ + + + + + + + + + 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..e991ad286 --- /dev/null +++ b/chatter_attachments_manager/static/src/css/chatter_attachment_manager.css @@ -0,0 +1,126 @@ +/* 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; + } + .context_menu_dropdown a{ + color: black; + text-decoration: none; + } + + .context_menu_dropdown a:hover { + background-color: #f1f1f1; + } + + .dropdown:hover .context_menu_dropdown{ + display: block; + } +/* 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..dd0b5c410 --- /dev/null +++ b/chatter_attachments_manager/views/ir_attachment_tag_views.xml @@ -0,0 +1,29 @@ + + + + + ir.attachment.tag.view.tree + ir.attachment.tag + + + + + + + + + + Tags + ir.attachment.tag + tree + +

+ Create Attachment Tags

+

Use Tags to manage and track your Attachments

+
+
+ + +
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..f9081f836 --- /dev/null +++ b/chatter_attachments_manager/views/ir_attachment_views.xml @@ -0,0 +1,48 @@ + + + + + ir.attachment.view.form.inherit.chatter.attachments.manager + + ir.attachment + + + + + + + + + + + + ir.attachment.view.search.inherit.chatter.attachments.manager + ir.attachment + + + + + + + + + + + + + Attachments + ir.attachment + kanban,tree,form + [('res_model','!=',('ir.ui.view', + 'ir.module.module',''))] + + + + + +