diff --git a/enhanced_document_management/README.rst b/enhanced_document_management/README.rst new file mode 100755 index 000000000..7e637174e --- /dev/null +++ b/enhanced_document_management/README.rst @@ -0,0 +1,44 @@ +.. image:: https://img.shields.io/badge/license-OPL--1-red.svg + :target: https://www.odoo.com/documentation/16.0/legal/licenses.html#odoo-apps + :alt: License: OPL-1 + +Document Management +=================== +The Document Management module provide a quick access to create, share and delete. +The module requires beautiful Soup python library + +License +------- +Odoo Proprietary License v1.0 (OPL-1) +(https://www.odoo.com/documentation/user/16.0/legal/licenses/licenses.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: V16 Mohamed Savad, Gokul PI, Megha AP, Javid, Nisiya +* 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/enhanced_document_management/__init__.py b/enhanced_document_management/__init__.py new file mode 100755 index 000000000..74fc46cb3 --- /dev/null +++ b/enhanced_document_management/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from . import controllers +from . import models +from . import wizard diff --git a/enhanced_document_management/__manifest__.py b/enhanced_document_management/__manifest__.py new file mode 100755 index 000000000..4a97e646b --- /dev/null +++ b/enhanced_document_management/__manifest__.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Document Management', + 'version': '15.0.1.0.0', + 'category': 'Document Management', + 'summary': 'The Document Management module to access document tools', + 'description': 'The Document Management module provides a quick access to ' + 'create, share and delete.', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://cybrosys.com', + 'depends': ['base', 'mail', 'website'], + 'data': [ + 'security/enhanced_document_management_groups.xml', + 'security/enhanced_document_management_security.xml', + 'security/ir.model.access.csv', + 'data/document_data.xml', + 'data/ir_cron_data.xml', + 'views/document_workspace_views.xml', + 'views/document_file_views.xml', + 'views/res_config_settings_views.xml', + 'views/document_portal_templates.xml', + 'views/outgoing_request_document_views.xml', + 'views/incoming_request_document_views.xml', + 'views/portal_document_breadcrumb_templates.xml', + 'views/document_trash_views.xml', + 'views/document_request_templates.xml', + 'wizard/document_share_templates.xml', + 'wizard/document_share_views.xml', + 'wizard/document_url_views.xml', + 'wizard/document_tool_views.xml', + 'views/enhanced_document_management_menus.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'enhanced_document_management/static/src/css/kanban.css', + 'enhanced_document_management/static/src/xml/KanbanController.xml', + 'enhanced_document_management/static/src/js/search_panel_extention_model.js', + 'enhanced_document_management/static/src/js/kanbancontroller.js', + 'enhanced_document_management/static/src/js/search_document.js', + 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.6/dist/jquery.fancybox.min.css', + 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.6/dist/jquery.fancybox.min.js' + ], + 'web.assets_frontend': [ + 'enhanced_document_management/static/src/xml/KanbanController.xml', + 'enhanced_document_management/static/src/js/portal.js', + 'enhanced_document_management/static/src/js/portal_document_request.js', + ], + 'web.assets_qweb': [ + 'enhanced_document_management/static/src/xml/KanbanController.xml', + ], + }, + 'external_dependencies': { + 'python': ['bs4'] + }, + 'images': ['/static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/enhanced_document_management/controllers/__init__.py b/enhanced_document_management/controllers/__init__.py new file mode 100755 index 000000000..547d44d75 --- /dev/null +++ b/enhanced_document_management/controllers/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from . import document_file +from . import document_portal +from . import document_share +from . import website_document diff --git a/enhanced_document_management/controllers/document_file.py b/enhanced_document_management/controllers/document_file.py new file mode 100755 index 000000000..963a60ae5 --- /dev/null +++ b/enhanced_document_management/controllers/document_file.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from odoo import http +from odoo.http import request + + +class DocumentPortalView(http.Controller): + """Controller class for accessing documents from portal.""" + + @http.route('/my/documents', type="http", auth="user", website=True) + def document_in_portal(self): + """ + Http controller to all user document from portal + :return Http response with all Documents data + """ + document_ids = request.env['document.file'].search([ + ('user_id.id', '=', request.uid) + ]) + extensions = set(item.extension for item in document_ids) + groups = [[rec for rec in document_ids if rec.extension == item + ] for item in extensions] + return request.render( + "enhanced_document_management.portal_my_documents", { + 'extensions': extensions, + 'base_url': request.httprequest.host_url[:-1], + 'document_ids': groups, + 'page_name': 'document', + }) + + @http.route('/my/document_request', type="http", auth="user", + website=True) + def document_request_in_portal(self): + """ + Http controller to access user requests for document from portal + :return Http response with all Documents data + """ + request_ids = request.env['request.document'].search([ + ('user_id.id', '=', request.uid), + ('state', '=', 'requested') + ]) + context = [{ + 'id': item.id, + 'needed_doc': item.needed_doc, + 'workspace_id': [item.workspace_id.id, item.workspace_id.name], + 'requested_by': [item.requested_by.id, item.requested_by.name], + 'user_id': [item.user_id.id, item.user_id.name], + 'date': item.create_date.date() + } for item in request_ids] + return request.render( + "enhanced_document_management.portal_my_document_request", + { + 'requests': context, + 'page_name': 'document_requests', + }) + + @http.route('/my/documents/', type="http", + auth="user", website=True) + def document_view(self, doc): + """ + Http controller to access document from portal + :param doc: primary key of a record + :return Http response with the selected Documents data + """ + context = { + 'page_name': 'document', + 'document': True, + 'name': doc.name, + 'id': doc.id, + 'owner': doc.user_id, + 'attachment_id': doc.attachment_id.id, + 'brochure_url': doc.brochure_url, + 'workspace_id': doc.workspace_id.name, + 'date': doc.date, + 'url': f"""{request.httprequest.host_url[:-1]}/web/content/ + {doc.attachment_id.id}/{doc.name} + """.replace('\n', '').replace(" ", ""), + 'partner_id': doc.partner_id.name, + 'extension': doc.extension, + 'preview': doc.preview, + 'content_url': doc.content_url, + } + return request.render("enhanced_document_management.portal_my_document_view", + context) diff --git a/enhanced_document_management/controllers/document_portal.py b/enhanced_document_management/controllers/document_portal.py new file mode 100755 index 000000000..340591389 --- /dev/null +++ b/enhanced_document_management/controllers/document_portal.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from odoo.addons.portal.controllers.portal import CustomerPortal +from odoo.http import request + + +class WebsiteCustomerPortal(CustomerPortal): + """ Functon : Prepare portal values, datas are searched from document.file + :return document count, request count + """ + + def _prepare_home_portal_values(self, counters): + """Functon : Prepare portal values, + datas are searched from document.file""" + values = super( + WebsiteCustomerPortal, self)._prepare_home_portal_values(counters) + if 'document_count' in counters: + values['document_count'] = request.env[ + 'document.file'].sudo().search_count([ + ('user_id.id', '=', request.uid) + ]) + values['request_count'] = request.env[ + 'request.document'].sudo().search_count([ + ('user_id.id', '=', request.uid), + ('state', '=', 'requested') + ]) + return values diff --git a/enhanced_document_management/controllers/document_share.py b/enhanced_document_management/controllers/document_share.py new file mode 100755 index 000000000..2c82ac6cb --- /dev/null +++ b/enhanced_document_management/controllers/document_share.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from odoo import http +from odoo.http import request + + +class DocumentFile(http.Controller): + """Http Controller to create sharable view for selected documents """ + + @http.route('/web/content/share/', type='http', auth='public', + website='True') + def document_share(self, **kwargs): + """Function that returns a list of documents + that grouped by unique link""" + folder_ids = request.env['document.share'].sudo().search([ + ('unique', '=', kwargs.get('unique')) + ], limit=1) + context = ({ + 'doc_id': document.id, + 'doc_name': document.name, + 'doc_extension': document.extension, + 'doc_owner': document.user_id, + 'doc_date': document.date, + 'doc_url': document.content_url, + } for document in folder_ids.document_ids) + return http.request.render( + 'enhanced_document_management.document_share_preview', + {'context': context} + ) + + @http.route("/web/attachments/download", type="http") + def download_zip(self): + """ Http Controller to download selected file as a ZIP """ + return http.send_file( + filepath_or_fp='./attachments.zip', + mimetype="application/zip", + as_attachment=True, + filename="attachments.zip", + ) diff --git a/enhanced_document_management/controllers/website_document.py b/enhanced_document_management/controllers/website_document.py new file mode 100755 index 000000000..43b9c567e --- /dev/null +++ b/enhanced_document_management/controllers/website_document.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +import base64 +from odoo import fields +from odoo import http +from odoo.http import request + + +class WebsiteDocumentsUpload(http.Controller): + """Controller for accept document upload form submission""" + + @http.route('/website/documents', type="http", auth="user", + website=True, csrf=False) + def website_docs(self, **post): + """ + Function : website form submit controller, + it creates a record in document.file + :param post: form-data + :return: redirect + """ + val_list = { + 'name': post['file'].filename, + 'attachment': base64.b64encode(post['file'].read()), + 'workspace_id': int(post['workspace']), + 'date': fields.Date.today(), + 'user_id': request.uid, + 'description': post['reason'], + 'security': 'private', + 'extension': post['file'].filename.split(".")[ + len(post['file'].filename.split(".")) - 1] + } + if post['security'] == 'Private': + val_list['security'] = 'private' + else: + val_list['security'] = 'managers_and_owner' + file_id = request.env['document.file'].create(val_list) + file_id.action_upload_document() + return request.redirect("/my/documents") + + @http.route('/website/documents_request', type="http", auth="user", + website=True, csrf=False) + def website_docs_request(self, **post): + """ + Function : website form submit controller for requested documents, + it creates a record in document.file + :param post: form-data + :return: redirect to /my/document_request + """ + request_id = request.env['request.document'].browse( + int(post['rec_id'])) + file_id = request.env['document.file'].sudo().create({ + 'name': post['file'].filename, + 'attachment': base64.b64encode(post['file'].read()), + 'workspace_id': int(post['workspace']), + 'date': fields.Date.today(), + 'user_id': request.uid, + 'description': post['reason'], + 'security': 'specific_users', + 'user_ids': [post['requested_by']], + 'extension': post['file'].filename.split(".")[ + len(post['file'].filename.split(".")) - 1] + }) + file_id.action_upload_document() + request_id.state = 'accepted' + return request.redirect("/my/document_request") + + @http.route('/website/documents_request_reject', type="http", + auth="user", website=True, csrf=False) + def document_request_reject(self, **post): + """ + Function accept document reject and update document.request + :param post: form-data + :return: redirect to /my/document_request + """ + request_id = request.env['request.document'].browse( + int(post['req_id'])) + request_id.state = 'rejected' + request_id.reject_reason = post['reason'] + return request.redirect("/my/document_request") diff --git a/enhanced_document_management/data/document_data.xml b/enhanced_document_management/data/document_data.xml new file mode 100755 index 000000000..58f110421 --- /dev/null +++ b/enhanced_document_management/data/document_data.xml @@ -0,0 +1,9 @@ + + + + + My Workspace + My Workspace + The workspace here is the default + + diff --git a/enhanced_document_management/data/ir_cron_data.xml b/enhanced_document_management/data/ir_cron_data.xml new file mode 100644 index 000000000..cd20120be --- /dev/null +++ b/enhanced_document_management/data/ir_cron_data.xml @@ -0,0 +1,25 @@ + + + + + Document Delete + + code + model.delete_doc() + + 1 + days + -1 + + + + Auto Document Delete + + code + model.auto_delete_doc() + + 1 + days + -1 + + diff --git a/enhanced_document_management/doc/RELEASE_NOTES.md b/enhanced_document_management/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..e7ed4154e --- /dev/null +++ b/enhanced_document_management/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 13.05.2024 +#### Version 15.0.1.0.0 +#### ADD + +- Initial commit for Document Management diff --git a/enhanced_document_management/models/__init__.py b/enhanced_document_management/models/__init__.py new file mode 100755 index 000000000..50253855e --- /dev/null +++ b/enhanced_document_management/models/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from . import document_file +from . import document_trash +from . import document_workspace +from . import request_document +from . import res_config_settings diff --git a/enhanced_document_management/models/document_file.py b/enhanced_document_management/models/document_file.py new file mode 100755 index 000000000..0d7174ed2 --- /dev/null +++ b/enhanced_document_management/models/document_file.py @@ -0,0 +1,259 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from zipfile import ZipFile +from odoo import api, fields, models +from odoo.http import request + + +class Document(models.Model): + """ Model used to store documents, perform document related functions """ + _name = 'document.file' + _inherit = ['mail.thread', 'mail.activity.mixin'] + _description = 'Documents Community' + + name = fields.Char(string="Name", help="Document name") + attachment = fields.Binary(string='File', help="Document data") + date = fields.Datetime(string='Date', help="Document create date") + workspace_id = fields.Many2one( + 'document.workspace', string='Workspace', + required=True, help="workspace name") + user_id = fields.Many2one( + 'res.users', string='Owner', + default=lambda self: self.env.user, + help="""Owner name, if the document belongs to a specific partner""") + brochure_url = fields.Char(string="URL", help="Document sharable URL") + extension = fields.Char( + string='Extension', + help="""Document extension, helps to determine the file type""") + priority = fields.Selection( + [('0', 'None'), ('1', 'Favorite')], + string="Priority", help="Favorite button") + activity_ids = fields.One2many( + 'mail.activity', string='Activities', + help="Created activity for this attachment") + attachment_id = fields.Many2one( + 'ir.attachment', string="Data", + help="Used to access datas without search function") + content_url = fields.Char( + string='Content Url', help="It store the URL for url type documents") + content_type = fields.Selection( + [('file', 'File'), ('url', 'Url')], string="Content Type", + help="Document content type") + preview = fields.Char( + string='Preview', help="Used to show a preview for URL file type") + active = fields.Boolean( + string='Active', default=True, help="It specify archived file") + deleted_date = fields.Date( + string="Deleted Date", help="File deleted date") + mimetype = fields.Char( + string='Mime Type', help="Document mimetype") + description = fields.Text(string='Description', help="Short description") + security = fields.Selection( + selection=[ + ('private', 'Private'), + ('managers_and_owner', 'Managers & Owner'), + ('specific_users', 'Specific Users') + ], default='managers_and_owner', string="Security", + help="""Privet : only the uploaded user can view + Managers & Owner : Document shared with Managers """) + user_ids = fields.Many2many( + 'res.users', help="Can access the documents", string="User Access") + partner_id = fields.Many2one( + 'res.partner', help="Document related partner name", + string="Related Partner") + auto_delete = fields.Boolean( + string='Auto Delete', default=False, + help="Document delete status") + days = fields.Integer(string='Days', help="auto delete in days") + trash = fields.Boolean(string='Trash', help="To specify deleted items") + delete_date = fields.Date( + string='Date Delete', readonly=True, + help="Used to calculate file remove date from trash") + file_url = fields.Char( + string='File URL', + help="""it store url while adding an url document""") + size = fields.Char( + string='Size', compute='_compute_size', + help="it store size of the document") + company_id = fields.Many2one( + related='workspace_id.company_id', string='Company', + help="Company Name") + + @api.depends('attachment_id') + def _compute_size(self): + """Function is used to fetch the file size of an attachment""" + for rec in self: + rec.size = str(rec.attachment_id.file_size/1000) + ' Kb' + + @api.onchange('days') + def _onchange_days(self): + """Function is used to add delete date for a record , + it automatically deleted at the specified date""" + self.delete_date = fields.Date.add(fields.Date.today(), days=self.days) + + def auto_delete_doc(self): + """Function to delete document automatically using schedule action""" + self.search([ + ('auto_delete', '=', True), + ('delete_date', '<=', fields.Date.today())]).unlink() + + def action_upload_document(self): + """Function it works while uploading a file, and it adds some basic + information about the file""" + # important to maintain extension and name as different + attachment_id = self.env['ir.attachment'].sudo().create({ + 'name': self.name, + 'datas': self.attachment, + 'res_model': 'document.file', + 'res_id': self.id, + 'public': True, + }) + self.sudo().write({ + 'name': self.name, + 'date': fields.Date.today(), + 'user_id': self.env.uid, + 'extension': self.name.split(".")[len(self.name.split(".")) - 1], + 'content_url': + f"/web/content/{attachment_id.id}/{self.name}", + 'mimetype': attachment_id.mimetype, + 'attachment_id': attachment_id.id, + 'brochure_url': attachment_id.local_url + }) + return { + 'type': 'ir.actions.client', + 'tag': 'reload' + } + + @api.model + def archive_function(self, document_selected): + """ Function to download document as a ZIP """ + zip_obj = ZipFile('attachments.zip', 'w') + for doc in self.browse(document_selected): + zip_obj.write(doc.attachment_id._full_path( + doc.attachment_id.store_fname), + doc.attachment_id.name) + zip_obj.close() + url = f"{request.httprequest.host_url[:-1]}/web/attachments/download" + return { + 'type': 'ir.actions.act_url', + 'url': url, + 'target': 'self', + } + + @api.model + def document_file_delete(self, doc_ids): + """Function works while deleting a document, + it creates a record in document.trash""" + for docs in self.browse(doc_ids): + self.env['document.trash'].create({ + 'name': docs.name, + 'attachment': docs.attachment, + 'document_create_date': docs.date, + 'workspace_id': docs.workspace_id.id, + 'user_id': docs.user_id.id, + 'brochure_url': docs.brochure_url, + 'extension': docs.extension, + 'priority': docs.priority, + 'attachment_id': docs.attachment_id.id, + 'content_url': docs.content_url, + 'content_type': docs.content_type, + 'preview': docs.preview, + 'active': docs.active, + 'deleted_date': fields.Date.today(), + 'mimetype': docs.mimetype, + 'description': docs.description, + 'security': docs.security, + 'user_ids': docs.user_ids.ids, + 'partner_id': docs.partner_id.id, + 'days': docs.days, + 'file_url': docs.file_url, + }) + docs.unlink() + + @api.model + def document_file_archive(self, documents_selected): + """Function to archive document, it deleted automatically + based on delete date""" + for docs in self.browse(documents_selected): + if docs.active: + docs.active = False + elif docs.delete_date: + docs.delete_date = False + docs.active = True + else: + docs.active = True + + @api.model + def on_mail_document(self, doc_ids): + """Function used to send document as an email attachment""" + return { + 'type': 'ir.actions.act_window', + 'name': 'mail', + 'res_model': 'mail.compose.message', + 'view_mode': 'form', + 'target': 'new', + 'views': [[False, 'form']], + 'context': { + 'default_attachment_ids': self.browse( + doc_ids).mapped('attachment_id').ids, + } + } + + @api.model + def action_btn_create_task(self, doc): + """Function used to create a task based on document """ + module_id = self.env['ir.module.module'].search( + [('name', '=', 'project')]) + if module_id.state == 'installed': + for rec in self.browse(doc): + task_id = self.env['project.task'].create({ + 'name': rec['name'] + }) + rec.attachment_id.res_model = 'project.task' + rec.attachment_id.res_id = task_id + return True + return False + + @api.model + def action_btn_create_lead(self, doc): + """Function to create a CRM lead based on a document """ + module_id = self.env['ir.module.module'].search([('name', '=', 'crm')]) + if module_id.state == 'installed': + for rec in self.browse(doc): + lead_id = self.env['crm.lead'].create({ + 'name': rec['name'] + }) + rec.attachment_id.res_model = 'crm.lead' + rec.attachment_id.res_id = lead_id + return True + return False + + @api.model + def delete_doc(self): + """Function to delete document from trash """ + limit = self.env['ir.config_parameter'].sudo().get_param( + 'document_management.trash') + for rec in self.env['document.trash'].search( + ['deleted_date', '!=', False]): + delta = fields.Date.today() - rec.deleted_date + if delta.days == limit: + rec.unlink() diff --git a/enhanced_document_management/models/document_trash.py b/enhanced_document_management/models/document_trash.py new file mode 100755 index 000000000..543b218bc --- /dev/null +++ b/enhanced_document_management/models/document_trash.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from odoo import fields, models + + +class DocumentTrash(models.Model): + """Module to store deleted documents for a specific time, + then it automatically""" + + _name = "document.trash" + _description = "Document Trash" + + name = fields.Char(string="Name", help="Document name") + attachment = fields.Binary(string="File", readonly=True, help="Document data") + document_create_date = fields.Datetime(string="Date", help="Document create date") + workspace_id = fields.Many2one( + "document.workspace", string="Workspace", required=True, help="workspace name" + ) + user_id = fields.Many2one( + "res.users", + string="Owner", + default=lambda self: self.env.user, + help="""owner name, if the document belongs to a specific user""", + ) + brochure_url = fields.Char(string="URL", store=True, help="Document sharable URL") + extension = fields.Char(string="Extension", help="helps to determine the file type") + priority = fields.Selection( + selection=[("0", "None"), ("1", "Favorite")], + string="Priority", + help="Favorite button", + ) + attachment_id = fields.Many2one( + "ir.attachment", + string="Attachment", + help="Used to access datas without search function", + ) + content_url = fields.Char( + string="Content Url", help="It store the URL for url type documents" + ) + content_type = fields.Selection( + [("file", "File"), ("url", "Url")], + help="Document content type", + string="Content type", + ) + preview = fields.Char( + string="Preview", help="Used to show a preview for URL file type" + ) + active = fields.Boolean( + string="Active", default=True, help="It specify archived file" + ) + days = fields.Integer(string="Days", help="auto delete in days") + deleted_date = fields.Date(string="Deleted Date", help="File deleted date") + mimetype = fields.Char(string="Mime Type", help="Document mimetype") + description = fields.Text(string="Description", help="Short description") + security = fields.Selection( + string="Security", + selection=[ + ("private", "Private"), + ("managers_and_owner", "Managers & Owner"), + ("specific_users", "Specific Users"), + ], + default="managers_and_owner", + help="""Privet : only the uploaded user can view + Managers & Owner : Document shared with Managers """, + ) + user_ids = fields.Many2many( + "res.users", help="Can access the documents", string="User Access" + ) + partner_id = fields.Many2one( + "res.partner", help="Document related partner name", string="Related Partner" + ) + auto_delete = fields.Boolean( + string="Auto Delete", default=False, help="Document delete status" + ) + delete_date = fields.Date( + string="Date Delete", + readonly=True, + help="Used to calculate file remove date from trash", + ) + file_url = fields.Char( + string="File URL", help="""it store url while adding an url document""" + ) + size = fields.Char(string="Size", help="it store size of the document") + company_id = fields.Many2one( + related='workspace_id.company_id', string='Company', + help="Company Name") + + def delete_doc(self): + """Function to delete all the documents after the trash date""" + trash_limit = ( + self.env["ir.config_parameter"] + .sudo() + .get_param("document_management.trash") + ) + if trash_limit: + for rec in self.search([]): + if fields.Date.today() == fields.Date.add( + rec.deleted_date, days=int(trash_limit) + ): + rec.unlink() diff --git a/enhanced_document_management/models/document_workspace.py b/enhanced_document_management/models/document_workspace.py new file mode 100755 index 000000000..63cd2dd89 --- /dev/null +++ b/enhanced_document_management/models/document_workspace.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from odoo import api, fields, models, _ +from odoo.exceptions import ValidationError + + +class DocumentWorkspace(models.Model): + """ Module to store document workspace """ + _name = 'document.workspace' + _description = 'Document Workspace' + + name = fields.Char( + string='Name', required=True, help="Name of the WorkSpace.") + display_name = fields.Char( + string='Workspace', help="Name of the workSpace.", + compute='_compute_display_name') + parent_id = fields.Many2one( + 'document.workspace', string='Parent Workspace', + help="Current workSpace will be under this workSpace") + company_id = fields.Many2one( + 'res.company', string='Company', + help="WorkSpace belongs to this company", + default=lambda self: self.env.company) + description = fields.Text( + string='Description', help="Description about the workSpace") + document_count = fields.Integer( + compute='_compute_document_count', string='Document count', + help="Number of documents uploaded under this workSpace") + + def action_view_document(self): + """Function to open document kanban view """ + return { + 'type': 'ir.actions.act_window', + 'res_model': 'document.file', + 'name': self.name, + 'view_mode': 'kanban,form', + 'view_type': 'form', + 'target': 'current', + 'domain': [('workspace_id', '=', self.id)] + } + + @api.depends('name') + def _compute_display_name(self): + """Function compute display name to view in searchpanel """ + for rec in self: + rec.display_name = rec.name + + def _compute_document_count(self): + """Compute function to calculate document count under a workspace """ + for record in self: + record.document_count = self.env['document.file'].search_count( + [('workspace_id', '=', self.id)]) + + @api.constrains('parent_id') + def _onchange_parent_id(self): + """Onchange function to restrict setting + current workspace as parent workspace""" + if self.parent_id.id == self.id: + raise ValidationError( + _("Cannot set current workspace as parent workspace !")) + return { + 'domain': { + 'parent_id': [('id', '!=', self.id)] + } + } + + @api.model + def work_spaces(self): + """Function to send workspace data to friend-end """ + workspace_ids = self.env['document.workspace'].search([]) + workspace_list = [{'id': i.id, 'name': i.name} for i in workspace_ids] + return workspace_list diff --git a/enhanced_document_management/models/request_document.py b/enhanced_document_management/models/request_document.py new file mode 100755 index 000000000..d52fa5d04 --- /dev/null +++ b/enhanced_document_management/models/request_document.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from odoo import api, fields, models, _ + + +class RequestDocumentUser(models.Model): + """Module to store document requests """ + _name = 'request.document' + _description = 'Request document from user' + _rec_name = 'needed_doc' + + user_id = fields.Many2one('res.users', string='User') + requested_by = fields.Many2one( + 'res.users', help="User who created request", + default=lambda self: self.env.user) + needed_doc = fields.Text(string='Document Needed', required=True, + help="Document needed by requestor") + workspace_id = fields.Many2one( + 'document.workspace', string='Work space', required=True) + reject_reason = fields.Text(string='Reason', help="Reason for rejection") + state = fields.Selection(selection=[ + ('requested', 'Requested'), + ('accepted', 'Accepted'), + ('rejected', 'Rejected')], default='requested') + company_id = fields.Many2one( + related='workspace_id.company_id', string='Company', + help="Company Name") + + def action_send_document_request(self): + """Function to send document request through email """ + user_id = self.env['res.users'].browse(self.env.uid) + mail_content = f'Hello
{user_id.name} Requested Document
' \ + f'{self.needed_doc}' + + main_content = { + 'subject': _('Document Request'), + 'body_html': mail_content, + 'email_to': self.user_id.partner_id.email, + } + self.env['mail.mail'].sudo().create(main_content).send() + + @api.model + def get_request(self): + """Function to fetch all request for login user """ + request_ids = self.env['request.document'].search( + [('user_id', '=', self.env.uid)]) + context = [{ + 'request_id': rec.id, + 'user_id': rec.user_id.name, + 'manager_id': rec.manager_id.name, + 'needed_doc': rec.needed_doc, + 'workspace': rec.workspace.name, + 'workspace_id': rec.workspace.id, + } for rec in request_ids] + return context diff --git a/enhanced_document_management/models/res_config_settings.py b/enhanced_document_management/models/res_config_settings.py new file mode 100755 index 000000000..8b9fb9070 --- /dev/null +++ b/enhanced_document_management/models/res_config_settings.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Paid App Development Team (odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary LicenseLicense v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + """ Inherited res.config.settings to add trash limit field""" + _inherit = 'res.config.settings' + + trash = fields.Integer( + 'Trash Limit', default=30, + help="set the time limit for the deleted files", + config_parameter='document_management.trash') diff --git a/enhanced_document_management/security/enhanced_document_management_groups.xml b/enhanced_document_management/security/enhanced_document_management_groups.xml new file mode 100755 index 000000000..fdfbf0c55 --- /dev/null +++ b/enhanced_document_management/security/enhanced_document_management_groups.xml @@ -0,0 +1,24 @@ + + + + + Document Management + Access for Document Management + 50 + + + + User + + + + + Manager + + + + + + + + diff --git a/enhanced_document_management/security/enhanced_document_management_security.xml b/enhanced_document_management/security/enhanced_document_management_security.xml new file mode 100755 index 000000000..06e1d9a42 --- /dev/null +++ b/enhanced_document_management/security/enhanced_document_management_security.xml @@ -0,0 +1,113 @@ + + + + + Document Manager + + ['|', '|', ('security', '=', 'specific_users'), + ('security', '=', 'managers_and_owner'), '&', + ('security', '=', 'private'), + ('user_id', '=', user.id)] + + + + + + + + + + View Own Document + + ['|', '|', '|', '|', ('user_ids', 'in', user.id), '&', + ('security', '=', 'specific_users'), + ('user_ids', '=', False), '&', + ('security', '=', 'private'), + ('user_id', '=', user.id), '&', + ('security', '=', 'managers_and_owner'), + ('user_id', '=', user.id), '&', + ('user_ids', 'not in', user.id), + ('user_id', '=', user.id)] + + + + + + + + + + View Own Request + + + ['|',('requested_by', '=', user.id), + ('user_id', '=', user.id)] + + + + + + + + + + + View All Request + + [(1, '=', 1)] + + + + + + + + + + + Documents multy-company + + ['|',('company_id', '=',False),('company_id', 'in', company_ids)] + + + + + + + + + + Document workspace multy-company + + ['|',('company_id', '=',False),('company_id', 'in', company_ids)] + + + + + + + + + + Document trash multy-company + + ['|',('company_id', '=',False),('company_id', 'in', company_ids)] + + + + + + + + + + Document requests multy-company + + ['|',('company_id', '=',False),('company_id', 'in', company_ids)] + + + + + + + diff --git a/enhanced_document_management/security/ir.model.access.csv b/enhanced_document_management/security/ir.model.access.csv new file mode 100755 index 000000000..8dee9a57b --- /dev/null +++ b/enhanced_document_management/security/ir.model.access.csv @@ -0,0 +1,18 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_document_file,access.document.file,model_document_file,document_management_group_manager,1,1,1,1 +access_document_file_portal,access.document.file.portal,model_document_file,base.group_portal,1,1,1,0 +access_document_trash,access.document.trash,model_document_trash,document_management_group_manager,1,1,1,1 +access_document_file_user,access.document.file.user,model_document_file,document_management_group_user,1,1,1,0 +access_document_trash_user,access.document.trash.user,model_document_trash,document_management_group_user,1,1,1,0 +access_document_workspace,access.document.workspace,model_document_workspace,document_management_group_manager,1,1,1,1 +access_document_workspace_user,access.document.workspace.user,model_document_workspace,document_management_group_user,1,0,0,0 +access_document_workspace_manager,access.document.workspace.manager,model_document_workspace,document_management_group_manager,1,1,1,0 +access_document_workspace_portal,access.document.workspace.portal,model_document_workspace,base.group_portal,1,1,0,0 +access_document_share_manager,access.document.share.manager,model_document_share,document_management_group_manager,1,1,1,1 +access_document_share_user,access.document.share.user,model_document_share,document_management_group_user,1,1,1,1 +access_document_url_manager,access.document.url.manager,model_document_url,document_management_group_manager,1,1,1,1 +access_document_url_user,access.document.url.user,model_document_url,document_management_group_user,1,1,1,1 +access_document_tool,access.document.tool,model_document_tool,document_management_group_manager,1,1,1,1 +access_request_document_manager,access.request.document.manager,model_request_document,document_management_group_manager,1,1,1,1 +access_request_document_user,access.request.document.user,model_request_document,document_management_group_user,1,1,1,1 +access_request_document_portal,access.request.document.portal,model_request_document,base.group_portal,1,1,0,0 diff --git a/enhanced_document_management/static/description/assets/icons/check.png b/enhanced_document_management/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/check.png differ diff --git a/enhanced_document_management/static/description/assets/icons/chevron.png b/enhanced_document_management/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/chevron.png differ diff --git a/enhanced_document_management/static/description/assets/icons/cogs.png b/enhanced_document_management/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/cogs.png differ diff --git a/enhanced_document_management/static/description/assets/icons/consultation.png b/enhanced_document_management/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/consultation.png differ diff --git a/enhanced_document_management/static/description/assets/icons/ecom-black.png b/enhanced_document_management/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/ecom-black.png differ diff --git a/enhanced_document_management/static/description/assets/icons/education-black.png b/enhanced_document_management/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/education-black.png differ diff --git a/enhanced_document_management/static/description/assets/icons/hotel-black.png b/enhanced_document_management/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/hotel-black.png differ diff --git a/enhanced_document_management/static/description/assets/icons/img.png b/enhanced_document_management/static/description/assets/icons/img.png new file mode 100644 index 000000000..d4e849075 Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/img.png differ diff --git a/enhanced_document_management/static/description/assets/icons/license.png b/enhanced_document_management/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/license.png differ diff --git a/enhanced_document_management/static/description/assets/icons/lifebuoy.png b/enhanced_document_management/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/lifebuoy.png differ diff --git a/enhanced_document_management/static/description/assets/icons/logo (1).png b/enhanced_document_management/static/description/assets/icons/logo (1).png new file mode 100755 index 000000000..478462d3e Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/logo (1).png differ diff --git a/enhanced_document_management/static/description/assets/icons/manufacturing-black.png b/enhanced_document_management/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/manufacturing-black.png differ diff --git a/enhanced_document_management/static/description/assets/icons/pos-black.png b/enhanced_document_management/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/pos-black.png differ diff --git a/enhanced_document_management/static/description/assets/icons/puzzle.png b/enhanced_document_management/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/puzzle.png differ diff --git a/enhanced_document_management/static/description/assets/icons/restaurant-black.png b/enhanced_document_management/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/restaurant-black.png differ diff --git a/enhanced_document_management/static/description/assets/icons/service-black.png b/enhanced_document_management/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/service-black.png differ diff --git a/enhanced_document_management/static/description/assets/icons/trading-black.png b/enhanced_document_management/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/trading-black.png differ diff --git a/enhanced_document_management/static/description/assets/icons/training.png b/enhanced_document_management/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/training.png differ diff --git a/enhanced_document_management/static/description/assets/icons/update.png b/enhanced_document_management/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/update.png differ diff --git a/enhanced_document_management/static/description/assets/icons/user.png b/enhanced_document_management/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/user.png differ diff --git a/enhanced_document_management/static/description/assets/icons/wrench.png b/enhanced_document_management/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/enhanced_document_management/static/description/assets/icons/wrench.png differ diff --git a/enhanced_document_management/static/description/assets/misc/categories.png b/enhanced_document_management/static/description/assets/misc/categories.png new file mode 100755 index 000000000..bedf1e0b1 Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/categories.png differ diff --git a/enhanced_document_management/static/description/assets/misc/check-box.png b/enhanced_document_management/static/description/assets/misc/check-box.png new file mode 100755 index 000000000..42caf24b9 Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/check-box.png differ diff --git a/enhanced_document_management/static/description/assets/misc/compass.png b/enhanced_document_management/static/description/assets/misc/compass.png new file mode 100755 index 000000000..d5fed8faa Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/compass.png differ diff --git a/enhanced_document_management/static/description/assets/misc/corporate.png b/enhanced_document_management/static/description/assets/misc/corporate.png new file mode 100755 index 000000000..2eb13edbf Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/corporate.png differ diff --git a/enhanced_document_management/static/description/assets/misc/customer-support.png b/enhanced_document_management/static/description/assets/misc/customer-support.png new file mode 100755 index 000000000..79efc72ed Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/customer-support.png differ diff --git a/enhanced_document_management/static/description/assets/misc/cybrosys-logo.png b/enhanced_document_management/static/description/assets/misc/cybrosys-logo.png new file mode 100755 index 000000000..cc3cc0ccf Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/cybrosys-logo.png differ diff --git a/enhanced_document_management/static/description/assets/misc/features.png b/enhanced_document_management/static/description/assets/misc/features.png new file mode 100755 index 000000000..b41769f77 Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/features.png differ diff --git a/enhanced_document_management/static/description/assets/misc/logo.png b/enhanced_document_management/static/description/assets/misc/logo.png new file mode 100755 index 000000000..478462d3e Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/logo.png differ diff --git a/enhanced_document_management/static/description/assets/misc/pictures.png b/enhanced_document_management/static/description/assets/misc/pictures.png new file mode 100755 index 000000000..56d255fe9 Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/pictures.png differ diff --git a/enhanced_document_management/static/description/assets/misc/pie-chart.png b/enhanced_document_management/static/description/assets/misc/pie-chart.png new file mode 100755 index 000000000..426e05244 Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/pie-chart.png differ diff --git a/enhanced_document_management/static/description/assets/misc/right-arrow.png b/enhanced_document_management/static/description/assets/misc/right-arrow.png new file mode 100755 index 000000000..730984a06 Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/right-arrow.png differ diff --git a/enhanced_document_management/static/description/assets/misc/star.png b/enhanced_document_management/static/description/assets/misc/star.png new file mode 100755 index 000000000..2eb9ab29f Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/star.png differ diff --git a/enhanced_document_management/static/description/assets/misc/support.png b/enhanced_document_management/static/description/assets/misc/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/support.png differ diff --git a/enhanced_document_management/static/description/assets/misc/whatsapp.png b/enhanced_document_management/static/description/assets/misc/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/enhanced_document_management/static/description/assets/misc/whatsapp.png differ diff --git a/enhanced_document_management/static/description/assets/modules/1.png b/enhanced_document_management/static/description/assets/modules/1.png new file mode 100755 index 000000000..3415917c2 Binary files /dev/null and b/enhanced_document_management/static/description/assets/modules/1.png differ diff --git a/enhanced_document_management/static/description/assets/modules/2.png b/enhanced_document_management/static/description/assets/modules/2.png new file mode 100755 index 000000000..31ed46762 Binary files /dev/null and b/enhanced_document_management/static/description/assets/modules/2.png differ diff --git a/enhanced_document_management/static/description/assets/modules/3.png b/enhanced_document_management/static/description/assets/modules/3.png new file mode 100755 index 000000000..25ed3e0b6 Binary files /dev/null and b/enhanced_document_management/static/description/assets/modules/3.png differ diff --git a/enhanced_document_management/static/description/assets/modules/4.png b/enhanced_document_management/static/description/assets/modules/4.png new file mode 100755 index 000000000..359d3e4d6 Binary files /dev/null and b/enhanced_document_management/static/description/assets/modules/4.png differ diff --git a/enhanced_document_management/static/description/assets/modules/5.png b/enhanced_document_management/static/description/assets/modules/5.png new file mode 100755 index 000000000..3add135c3 Binary files /dev/null and b/enhanced_document_management/static/description/assets/modules/5.png differ diff --git a/enhanced_document_management/static/description/assets/modules/6.png b/enhanced_document_management/static/description/assets/modules/6.png new file mode 100755 index 000000000..be454ea44 Binary files /dev/null and b/enhanced_document_management/static/description/assets/modules/6.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/1.png b/enhanced_document_management/static/description/assets/screenshots/1.png new file mode 100755 index 000000000..c8f6a9ef3 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/1.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/10.png b/enhanced_document_management/static/description/assets/screenshots/10.png new file mode 100755 index 000000000..d82109a02 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/10.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/11.png b/enhanced_document_management/static/description/assets/screenshots/11.png new file mode 100755 index 000000000..9746011c5 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/11.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/12.png b/enhanced_document_management/static/description/assets/screenshots/12.png new file mode 100755 index 000000000..b91124fbc Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/12.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/13.png b/enhanced_document_management/static/description/assets/screenshots/13.png new file mode 100755 index 000000000..4e4e5ea7b Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/13.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/2.png b/enhanced_document_management/static/description/assets/screenshots/2.png new file mode 100755 index 000000000..68cc19c33 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/2.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/3.png b/enhanced_document_management/static/description/assets/screenshots/3.png new file mode 100755 index 000000000..360f1ff77 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/3.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/4.png b/enhanced_document_management/static/description/assets/screenshots/4.png new file mode 100755 index 000000000..7ac4101d8 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/4.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/5.png b/enhanced_document_management/static/description/assets/screenshots/5.png new file mode 100755 index 000000000..5d1650266 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/5.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/6.png b/enhanced_document_management/static/description/assets/screenshots/6.png new file mode 100755 index 000000000..58d04d0c5 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/6.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/7.png b/enhanced_document_management/static/description/assets/screenshots/7.png new file mode 100755 index 000000000..a71504482 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/7.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/8.png b/enhanced_document_management/static/description/assets/screenshots/8.png new file mode 100755 index 000000000..ab3cd91ac Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/8.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/9.png b/enhanced_document_management/static/description/assets/screenshots/9.png new file mode 100755 index 000000000..73ea89445 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/9.png differ diff --git a/enhanced_document_management/static/description/assets/screenshots/hero.gif b/enhanced_document_management/static/description/assets/screenshots/hero.gif new file mode 100755 index 000000000..0ac2251e9 Binary files /dev/null and b/enhanced_document_management/static/description/assets/screenshots/hero.gif differ diff --git a/enhanced_document_management/static/description/banner.jpg b/enhanced_document_management/static/description/banner.jpg new file mode 100644 index 000000000..65b7e349a Binary files /dev/null and b/enhanced_document_management/static/description/banner.jpg differ diff --git a/enhanced_document_management/static/description/icon.png b/enhanced_document_management/static/description/icon.png new file mode 100755 index 000000000..24d3b3cc9 Binary files /dev/null and b/enhanced_document_management/static/description/icon.png differ diff --git a/enhanced_document_management/static/description/index.html b/enhanced_document_management/static/description/index.html new file mode 100755 index 000000000..a591d0753 --- /dev/null +++ b/enhanced_document_management/static/description/index.html @@ -0,0 +1,789 @@ +
+ +
+ +
+
+ Community +
+
+
+ +
+ +

+ Document Management

+

+ The Document Management module provide quick access to + create, share and delete.

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

+ Explore This + Module

+
+ + +
+
+ +
+

+ Overview +

+
+
+
+ The Document Management module (Version 16) offers a comprehensive range of features, + including document upload and storage, lead and task creation, document preview, + copy/move functionality, auto deletion, document privacy controls, email sharing, + and zip downloads. These features facilitate seamless document handling and collaboration, empowering organizations to + enhance productivity and streamline workflows. +
+ +
+ +
+ +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Multiple file can convert zip

+
+
+ +
+
+ +
+
+

+ Trash feature available

+
+
+ +
+
+ +
+
+

+ Easily to share documents to other users

+
+
+
+
+ +
+
+

+ Able to create different workspace

+
+
+
+
+ +
+
+

+ Document Portal View

+
+
+
+
+ +
+
+

+ Portal document upload access

+
+
+
+
+ +
+
+

+ Upload URL as document

+
+
+
+
+ +
+
+

+ Data Privacy

+
+
+ + +
+ +
+
+

+ Screenshots +

+
+ +
+

+ Document user interface

+ + +
+ +
+

+ Workspace

+

+ User can categories files using workspace +

+ + +
+ +
+

+ Favorite option

+

+ User can make favorite their document. +

+ + +
+ +
+

+ Upload, Add url, Create Request

+

+ User can upload their document into document management + module and able to add file using url. +

+ + +
+
+

+ Upload interface

+

+ User can upload their document into document management + module, give access to specific users, able to choose workspace and auto delete option +

+ + +
+
+

+ Add url window

+

+ User can add file using url. +

+ + +
+
+

+ Create Request

+

+ User can request file to other users . +

+ + +
+
+

+ Various filters

+

+ User can easily filter files using file type and favorite +

+ + +
+
+

+ Workspace

+

+ User can create unlimited workspace +

+ + +
+
+

+ Trash feature

+

+ User can easily retrieve files after delete trash facility available +

+ + +
+
+

+ Request feature

+

+ User can request document to other users +

+ + +
+ + +
+ + +
+

+ 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

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

Need Help?

+
+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
diff --git a/enhanced_document_management/static/images/csv.png b/enhanced_document_management/static/images/csv.png new file mode 100755 index 000000000..4c54cdd91 Binary files /dev/null and b/enhanced_document_management/static/images/csv.png differ diff --git a/enhanced_document_management/static/images/doc.png b/enhanced_document_management/static/images/doc.png new file mode 100755 index 000000000..dd94ad754 Binary files /dev/null and b/enhanced_document_management/static/images/doc.png differ diff --git a/enhanced_document_management/static/images/file.png b/enhanced_document_management/static/images/file.png new file mode 100755 index 000000000..19dc9cec0 Binary files /dev/null and b/enhanced_document_management/static/images/file.png differ diff --git a/enhanced_document_management/static/images/img.gif b/enhanced_document_management/static/images/img.gif new file mode 100755 index 000000000..e3f144ca3 Binary files /dev/null and b/enhanced_document_management/static/images/img.gif differ diff --git a/enhanced_document_management/static/images/pdf.png b/enhanced_document_management/static/images/pdf.png new file mode 100755 index 000000000..3d22ff10f Binary files /dev/null and b/enhanced_document_management/static/images/pdf.png differ diff --git a/enhanced_document_management/static/images/ppt.gif b/enhanced_document_management/static/images/ppt.gif new file mode 100755 index 000000000..3b0afc34b Binary files /dev/null and b/enhanced_document_management/static/images/ppt.gif differ diff --git a/enhanced_document_management/static/images/share.png b/enhanced_document_management/static/images/share.png new file mode 100755 index 000000000..56a09cbb7 Binary files /dev/null and b/enhanced_document_management/static/images/share.png differ diff --git a/enhanced_document_management/static/images/text.png b/enhanced_document_management/static/images/text.png new file mode 100755 index 000000000..2a540b53d Binary files /dev/null and b/enhanced_document_management/static/images/text.png differ diff --git a/enhanced_document_management/static/images/url.gif b/enhanced_document_management/static/images/url.gif new file mode 100755 index 000000000..385327bd6 Binary files /dev/null and b/enhanced_document_management/static/images/url.gif differ diff --git a/enhanced_document_management/static/images/xls.png b/enhanced_document_management/static/images/xls.png new file mode 100755 index 000000000..c14f97861 Binary files /dev/null and b/enhanced_document_management/static/images/xls.png differ diff --git a/enhanced_document_management/static/src/css/kanban.css b/enhanced_document_management/static/src/css/kanban.css new file mode 100755 index 000000000..40b3be5e5 --- /dev/null +++ b/enhanced_document_management/static/src/css/kanban.css @@ -0,0 +1,105 @@ +.o_legacy_kanban_view.o_kanban_ungrouped +.o_document_kanban { + flex-direction: column; + min-height: 230px; + width: 166px; + border-radius: 10px; +} + +.o_kanban_attachment { + padding: 0; + height: 140px; + align-items: center; +} + +.o_kanban_record_title { + margin-bottom: 4px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + width: 100%; +} + +.fa { + display: inline-block; + font: normal normal normal 14px/1 FontAwesome; + font-size: 15px; + text-rendering: auto; +} + +.check_box { + margin-left: 90%; +} + +.o_activity_btn span.fa { + color: inherit; + font-size: large; + margin-right: 1px; + margin-left: 10px; +} + +.new_container { + margin-top: 21px; + padding: 12px; + padding-top: 2px; + padding-left: 15px; + z-index: 9; + position: absolute; + margin-left: 94%; + align-items: center; + background-color: white; + width: fit-content; +} + +.new_container button { + padding-left: 0; + width: 10%; + font-size: 200%; +} + +.new_container button:hover { + background-color: LightGray; +} + + +/* Styles */ +.o_document_kanban tbody, +.o_document_kanban table, +.o_document_kanban tr { + width: 100%; + display: flex; + justify-content: space-between; +} + +.o_document_kanban { + flex-wrap: wrap !important; +} + +.o_document_kanban .form-check-input { + position: relative !important; + margin-top: unset !important; + margin-left: unset !important; + left: -25px; +} + +.o_document_kanban .o_kanban_record_bottom { + width: 100% !important; +} + +.o_document_kanban .oe_kanban_global_area { + justify-content: center; + align-items: center; + width: 100%; +} + +.o_document_kanban .o_kanban_record_bottom .oe_kanban_bottom_right { + position: absolute; + right: 5px; +} + +.o_kanban_record_title { + width: 95%; + display: block; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/enhanced_document_management/static/src/js/kanbancontroller.js b/enhanced_document_management/static/src/js/kanbancontroller.js new file mode 100755 index 000000000..db8289af0 --- /dev/null +++ b/enhanced_document_management/static/src/js/kanbancontroller.js @@ -0,0 +1,311 @@ +odoo.define('enhanced_document_management.uploadButton', function(require) { + "use strict"; + var core = require('web.core'); + var Dialog = require('web.Dialog'); + var _t = core._t; + var KanbanController = require('web.KanbanController'); + var KanbanView = require('web.KanbanView'); + var viewRegistry = require('web.view_registry'); + var DocumentSearchPanel = require('document.search_panel'); + var rpc = require('web.rpc'); + const session = require('web.session'); + + /** + * Extending KanbanController to add custom functions + */ + var KanbanButtonController = KanbanController.extend({ + buttons_template: 'button_in_kanban.button', + events: _.extend({}, KanbanController.prototype.events, { + 'click .on_upload_doc': '_onUpload', + 'click .on_delete_button': '_onDelete', + 'click .on_share_button': '_onShare', + 'click .on_add_url': '_onAddUrl', + 'click .docs_check_box': '_onSelectDocs', + 'click .on_download_archive': '_onDownloadArchive', + 'click .on_archive_document': '_onArchiveDocument', + 'click .on_mail_document': '_onMailDocument', + 'click .on_copy_document': '_onCopyDocument', + 'click .on_create_task': '_onCreateTask', + 'click .on_create_lead': '_onCreateLead', + 'click .on_add_request': '_onRequestDoc', + }), + documents_selected: [], + _onMailDocument:function(ev){ + /** + * Method to open email composer + */ + var self = this; + rpc.query({ + model: 'document.file', + method: 'on_mail_document', + args: [this.documents_selected], + }).then(function (result){ + self.documents_selected = [] + self.do_action(result); + }); + }, + _onCopyDocument:function(ev){ + /** + * Method to open copy/cut wizard + */ + session.user_has_group('enhanced_document_management.document_management_group_manager').then( + (has_group) => { + if (has_group){ + this.do_action({ + 'type': 'ir.actions.act_window', + 'name': 'copy', + 'res_model': 'document.tool', + 'view_mode': 'form', + 'target': 'new', + 'views': [[false, 'form']], + 'context': { + 'default_doc_ids': this.documents_selected + } + }); + }else{ + this.do_action({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': "You don't have permission to perform this action", + 'type': 'danger', + 'sticky': false, + } + }) + } + }) + }, + _onRequestDoc:function(ev){ + /** + * Method to open document request wizard + */ + this.do_action({ + 'type': 'ir.actions.act_window', + 'name': 'Add Document Request', + 'res_model': 'request.document', + 'view_mode': 'form', + 'target': 'new', + 'views': [[false, "form"]], + 'context': { + 'default_workspace_id': this.searchModel.get('selectedWorkspaceId'), + 'form_view_ref': "enhanced_document_management.incoming_quick_request_document_view_form", + } + }); + }, + _onArchiveDocument: function(ev){ + /** + * Method to archive selected document + */ + if (this.documents_selected.length != 0){ + var self = this; + rpc.query({ + model: 'document.file', + method: 'document_file_archive', + args: [this.documents_selected], + }).then(function (result){ + self.documents_selected = [] + location.reload(); + }); + }else{ + Dialog.alert(this, "Please select least one document"); + } + }, + _onSelectDocs: function(ev){ + /** + * Method to add selected document in a lisk + */ + var self = this; + var toast = self.$el.find('.toast') + var record_id =parseInt(ev.target.dataset.id); + if (ev.target.checked){ + toast.addClass('show'); + this.documents_selected.push(record_id); + } + else{ + let index = this.documents_selected.indexOf(record_id); + this.documents_selected.splice(index, 1) + if ( this.documents_selected.length == 0){ + toast.removeClass('show'); + } + } + }, + _onDownloadArchive: function(ev){ + /** + * Method to download selected file as a Zip + */ + var self = this; + if (this.documents_selected.length > 0) { + rpc.query({ + model: 'document.file', + method: 'archive_function', + args: [this.documents_selected] + }).then(function(res){ + self.do_action(res) + }) + } + }, + _onAddUrl: function(){ + /** + * Method to open add URL wizard + */ + return this.do_action({ + 'type': 'ir.actions.act_window', + 'name': _('Add Url'), + 'res_model': 'document.url', + 'view_mode': 'form', + 'target': 'new', + 'views': [[false, "form"]], + 'context': { + 'default_workspace_id': this.searchModel.get('selectedWorkspaceId'), + } + }); + }, + _onCreateTask: function(){ + /** + * Method to create task based on selected document + */ + var self = this; + rpc.query({ + model: 'document.file', + method: 'action_btn_create_task', + args: [this.documents_selected] + }).then(function (result){ + if (result) { + self.documents_selected = [] + location.reload(); + } + else { + self.do_action({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': "Install Project Module to use this function", + 'type': 'info', + 'sticky': false, + } + }) + } + }); + }, + _onCreateLead: function(){ + /** + * Method to create lead based on selected document + */ + var self = this; + rpc.query({ + model: 'document.file', + method: 'action_btn_create_lead', + args: [this.documents_selected] + }).then(function (result){ + if (result) { + self.documents_selected = [] + location.reload(); + }else { + self.do_action({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': "Install CRM Module to use this function", + 'type': 'info', + 'sticky': false, + } + }) + } + }); + }, + _onDelete: function(ev){ + /** + * Method to delete selected records + */ + session.user_has_group('enhanced_document_management.document_management_group_manager').then( + (has_group) => { + if (has_group){ + var self = this; + var record_id = parseInt(ev.target.dataset.id) + rpc.query({ + model: 'document.file', + method: 'document_file_delete', + args: [this.documents_selected], + }).then(function (result){ + self.documents_selected = [] + location.reload(); + }); + }else{ + this.do_action({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': "You don't have permission to perform this action", + 'type': 'danger', + 'sticky': false, + } + }) + } + }) + }, + _onShare: function(ev){ + /** + * Method to create sharable url based on selected document + */ + var self = this; + rpc.query({ + model: 'document.share', + method: 'create_url', + args: [this.documents_selected], + }).then(function (result){ + self.do_action(result) + }); + }, + _onUpload: function(){ + /** + * Method to open file upload wizard + */ + this.do_action({ + name: "Upload Documents", + type: 'ir.actions.act_window', + res_model: 'document.file', + view_mode: 'form', + views: [[false, 'form']], + target: 'new', + context: { + default_workspace_id: this.searchModel.get('selectedWorkspaceId'), + default_content_type: 'file', + }, + }) + }, + updateButtons() { + /** + * Method to restrict button click + */ + const selectedWorkspaceId = this.searchModel.get('selectedWorkspaceId'); + this.$buttons.find('.on_upload_doc').prop('disabled', !selectedWorkspaceId); + this.$buttons.find('.on_add_url').prop('disabled', !selectedWorkspaceId); + this.$buttons.find('.on_add_request').prop('disabled', !selectedWorkspaceId); + }, + + }); + var DocumentKanbanView = KanbanView.extend({ + config: _.extend({}, KanbanView.prototype.config, { + Controller: KanbanButtonController, + SearchPanel: DocumentSearchPanel, + }), + }); + viewRegistry.add('document_kanban_view', DocumentKanbanView); + Dialog.link = function (owner, message, options) { + var buttons = [{ + text: _t("Ok"), + close: true, + click: options && options.confirm_callback, + }]; + return new Dialog(owner, _.extend({ + size: 'medium', + buttons: buttons, + $content: $('
', { + role: 'alert', + text: message, + }), + title: _t("Here's your Link !"), + onForceClose: options && (options.onForceClose || options.confirm_callback), + }, options)).open({shouldFocusButtons:true}); + }; +}); diff --git a/enhanced_document_management/static/src/js/portal.js b/enhanced_document_management/static/src/js/portal.js new file mode 100755 index 000000000..66cd999a4 --- /dev/null +++ b/enhanced_document_management/static/src/js/portal.js @@ -0,0 +1,44 @@ +odoo.define("document.my_portal", function (require) { + "use strict"; + + var publicWidget = require('web.public.widget'); + publicWidget.registry.DocumentPortal = publicWidget.Widget.extend({ + selector: 'div[id="document_portal"]', + events: { + 'click .fa-share': '_onShare', + 'click .re-upload': '_onRequestAccept', + 'click .re-reject': '_onRequestReject', + }, + _onShare: function(ev){ + /** + * Method to copy sharable link + */ + var record_url = ev.target.dataset.url + var $temp = $(""); + $("body").append($temp); + $temp.val(record_url).select(); + document.execCommand("copy"); + $temp.remove(); + this.$el.find('.toast').addClass('show'); + this.$el.find('.toast-body').text(record_url) + }, + _onRequestAccept: function(ev){ + /** + * Function to open file upload modal + */ + this.$el.find('#req_upload_form').modal('show'); + this.$el.find('#workspace').val(ev.target.dataset.workspace) + this.$el.find('#requested_by').val(ev.target.dataset.requested_by) + this.$el.find('#workspace_id').val(ev.target.dataset.workspace_id) + this.$el.find('#rec_id').val(ev.target.dataset.id) + }, + _onRequestReject: function(ev){ + /** + * Function to reject file upload request + */ + this.$el.find('#req_id').val(ev.target.dataset.id) + this.$el.find('#req_reject_form').modal('show'); + } + + }) +}) diff --git a/enhanced_document_management/static/src/js/portal_document_request.js b/enhanced_document_management/static/src/js/portal_document_request.js new file mode 100755 index 000000000..54331ce30 --- /dev/null +++ b/enhanced_document_management/static/src/js/portal_document_request.js @@ -0,0 +1,32 @@ +odoo.define('website_documents', function (require) { + "use strict"; + var publicWidget = require('web.public.widget'); + var rpc = require('web.rpc'); + + publicWidget.registry.documentUploadButton = publicWidget.Widget.extend({ + selector: 'div[id="document_upload_button"]', + events: { + 'click #web_docs_upload': '_onUploadButtonClick', + }, + _onUploadButtonClick: function(){ + /** + * Method to open the document upload modal + * $('#docs_upload_form').modal('show'); this method will open the modal + * the modal located in another template, so that we used JQUERY to open modal + */ + var self = this; + this.$el.find('#docs_upload_form').modal('show'); + rpc.query({ + model : 'document.workspace', + method : 'work_spaces', + args : [] + }).then(function(result){ + result.forEach(element =>{ + self.$el.find('#workspace').append(` + ` + ) + }) + }) + } + }) +}) diff --git a/enhanced_document_management/static/src/js/search_document.js b/enhanced_document_management/static/src/js/search_document.js new file mode 100755 index 000000000..807d61c8d --- /dev/null +++ b/enhanced_document_management/static/src/js/search_document.js @@ -0,0 +1,11 @@ +odoo.define("document.search_panel", function (require) { + "use strict"; + const searchPanel = require("web.searchPanel"); + + /** + * Extended searchPanel to add custom + */ + class DocumentSearchPanel extends searchPanel {} + DocumentSearchPanel.modelExtension = 'CustomDocumentsSearchPanel'; + return DocumentSearchPanel; +}); diff --git a/enhanced_document_management/static/src/js/search_panel_extention_model.js b/enhanced_document_management/static/src/js/search_panel_extention_model.js new file mode 100755 index 000000000..a9419f263 --- /dev/null +++ b/enhanced_document_management/static/src/js/search_panel_extention_model.js @@ -0,0 +1,39 @@ +odoo.define("document.search_panel_extension", function (require) { + "use strict"; + + const ActionModel = require("web.ActionModel"); + const SearchPanelModelExtension = require("web.searchPanelModelExtension"); + + const isFolderCategory = (s) => s.fieldName === "workspace_id"; + + /** + * SearchPanelModelExtension inherited to updated custom searchPanel + */ + class CustomDocumentSearchPanelModelExtension extends SearchPanelModelExtension { + constructor() { + super(...arguments); + } + get(property) { + /** + * Get function that return selected workspace id + */ + switch (property) { + + case "selectedWorkspaceId": return this.getSections(isFolderCategory)[0]['activeValueId']; + + } + return super.get(...arguments); + } + + getFolders() { + /** + * Get function to return sub-folders (workspace) + */ + const { values } = this.getSections(isFolderCategory)[0]; + return [...values.values()]; + } + + } + ActionModel.registry.add("CustomDocumentsSearchPanel", CustomDocumentSearchPanelModelExtension, 30); + return CustomDocumentSearchPanelModelExtension; +}); diff --git a/enhanced_document_management/static/src/xml/KanbanController.xml b/enhanced_document_management/static/src/xml/KanbanController.xml new file mode 100755 index 000000000..7b019d49d --- /dev/null +++ b/enhanced_document_management/static/src/xml/KanbanController.xml @@ -0,0 +1,95 @@ + + + + + + + + +
+
+
+
+
+
diff --git a/enhanced_document_management/views/document_file_views.xml b/enhanced_document_management/views/document_file_views.xml new file mode 100755 index 000000000..27f6aeca4 --- /dev/null +++ b/enhanced_document_management/views/document_file_views.xml @@ -0,0 +1,241 @@ + + + + + Documents + document.file + kanban,form,activity + +

+ Save your documents... +

+
+
+ + + document.file.view.kanban + document.file + + + + + + + + + + + + + + +
+ + + + + +
+ + +
+ +
+
+
+
+
+ + + xlsx file + + + + pdf file + + + + + txt file + + + + pptx file + + + + url file + + + + docx file + + + + jpg file + + + + + jpeg file + + + + + png file + + + + csv file + + + other file + +
+
+
+
+
+
+ + +
+
+ +
+
+
+
+
+ +
+
+ + +
+
+
+
+
+
+
+
+ + + document.file.view.search + document.file + + + + + + + + + + + + + + + + + + + + + + + + + + + document.file.view.form + document.file + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
diff --git a/enhanced_document_management/views/document_portal_templates.xml b/enhanced_document_management/views/document_portal_templates.xml new file mode 100755 index 000000000..aefb426a3 --- /dev/null +++ b/enhanced_document_management/views/document_portal_templates.xml @@ -0,0 +1,103 @@ + + + + + + + diff --git a/enhanced_document_management/views/document_request_templates.xml b/enhanced_document_management/views/document_request_templates.xml new file mode 100755 index 000000000..8e723b043 --- /dev/null +++ b/enhanced_document_management/views/document_request_templates.xml @@ -0,0 +1,157 @@ + + + + + +