diff --git a/attachment_zipped_download/README.rst b/attachment_zipped_download/README.rst deleted file mode 100644 index e737525f..00000000 --- a/attachment_zipped_download/README.rst +++ /dev/null @@ -1,168 +0,0 @@ -========================== -Attachment Zipped Download -========================== - -.. - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! This file is generated by oca-gen-addon-readme !! - !! changes will be overwritten. !! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:4163544eb16787f39f46edcd97305586594a6f708c1e489908d344467c82483e - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png - :target: https://odoo-community.org/page/development-status - :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 -.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github - :target: https://github.com/OCA/knowledge/tree/16.0/attachment_zipped_download - :alt: OCA/knowledge -.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/knowledge-16-0/knowledge-16-0-attachment_zipped_download - :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=16.0 - :alt: Try me on Runboat - -|badge1| |badge2| |badge3| |badge4| |badge5| - -This module allows downloading multiple attachments as a zip file. - -This also provide a helper class `IrAttachmentActionDownloadMixin` -to be used by developer to add action method on models. - -**Table of contents** - -.. contents:: - :local: - -Usage -===== - -#. Go to *Settings > Technical > Database Structure > Attachments* and select some files. -#. Go to *Actions > Download* and a zip file containing the selected files will be downloaded. - -## For developer - -You can reuse the `IrAttachmentActionDownloadMixin` on your -favorite models:: - - from odoo import models - - - class StockPicking(models.Model): - _name = "stock.picking" - _inherit = ["stock.picking", "ir.attachment.action_download"] - - -Then you can add an action button on list view line or on the action button -(when multiple lines are selected) to download all files:: - - - - - - stock.picking.tree download attachments - stock.picking - - - - - - - - - - attachmentCard.attachment.mimetype != 'application/link' - - - - - - - attachmentCard.attachment.mimetype != 'application/link' - - - - - - - - diff --git a/document_url/tests/__init__.py b/document_url/tests/__init__.py deleted file mode 100644 index eecce6c0..00000000 --- a/document_url/tests/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from . import test_document_url diff --git a/document_url/tests/test_document_url.py b/document_url/tests/test_document_url.py deleted file mode 100644 index 56511345..00000000 --- a/document_url/tests/test_document_url.py +++ /dev/null @@ -1,39 +0,0 @@ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -import base64 - -from odoo.tests import common - - -class TestDocumentUrl(common.TransactionCase): - def setUp(self): - super().setUp() - wizard_add_url = self.env["ir.attachment.add_url"] - - self.wizard_add_url = wizard_add_url.with_context( - active_model="res.users", - active_id=self.env.ref("base.user_demo").id, - active_ids=[self.env.ref("base.user_demo").id], - ).create({"name": "Demo User (Website)", "url": "http://www.odoodemouser.com"}) - - def test_add_url_attachment(self): - self.wizard_add_url.action_add_url() - domain = [ - ("type", "=", "url"), - ("name", "=", "Demo User (Website)"), - ("url", "=", "http://www.odoodemouser.com"), - ("res_model", "=", "res.users"), - ("res_id", "=", self.env.ref("base.user_demo").id), - ] - attachment_added_count = self.env["ir.attachment"].search_count(domain) - self.assertEqual(attachment_added_count, 1) - attachment = self.env["ir.attachment"].search(domain) - self.assertEqual(attachment.mimetype, "application/link") - - def test_dont_broke_default_compute_mimetype(self): - blob1 = b"blob1" - blob1_b64 = base64.b64encode(blob1) - attachment = self.env["ir.attachment"].create( - {"name": "a2", "datas": blob1_b64, "mimetype": "image/png"} - ) - self.assertEqual(attachment.mimetype, "image/png") diff --git a/document_url/view/document_url_view.xml b/document_url/view/document_url_view.xml deleted file mode 100644 index 5c0b208a..00000000 --- a/document_url/view/document_url_view.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - Add URL - ir.attachment.add_url - ir.actions.act_window - new - form - - - - ir.attachment.add_url.form - ir.attachment.add_url - -
- - - - -
-
-
-
-
-
-
diff --git a/document_url/wizard/__init__.py b/document_url/wizard/__init__.py deleted file mode 100644 index 56b033b9..00000000 --- a/document_url/wizard/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) -# Copyright 2014 Tecnativa - Pedro M. Baeza -# Copyright 2016 ACSONE SA/NV () -from . import document_url diff --git a/document_url/wizard/document_url.py b/document_url/wizard/document_url.py deleted file mode 100644 index befd90af..00000000 --- a/document_url/wizard/document_url.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2014 Tecnativa - Pedro M. Baeza -# Copyright 2020 Tecnativa - Manuel Calero -# Copyright 2016 ACSONE SA/NV () -from urllib import parse - -from odoo import fields, models - - -class AddUrlWizard(models.TransientModel): - _name = "ir.attachment.add_url" - _description = "Wizard to add URL attachment" - - name = fields.Char(required=True) - url = fields.Char("URL", required=True) - - def action_add_url(self): - """Adds the URL with the given name as an ir.attachment record.""" - if not self.env.context.get("active_model"): - return - attachment_obj = self.env["ir.attachment"] - for form in self: - url = parse.urlparse(form.url) - if not url.scheme: - url = parse.urlparse("{}{}".format("http://", form.url)) - for active_id in self.env.context.get("active_ids", []): - attachment = { - "name": form.name, - "type": "url", - "url": url.geturl(), - "res_id": active_id, - "res_model": self.env.context["active_model"], - } - attachment_obj.create(attachment) - return {"type": "ir.actions.act_window_close"} diff --git a/document_url_google_drive/README.rst b/document_url_google_drive/README.rst deleted file mode 100644 index 1cb70e59..00000000 --- a/document_url_google_drive/README.rst +++ /dev/null @@ -1,144 +0,0 @@ -=========================== -Google Drive URL Attachment -=========================== - -.. - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! This file is generated by oca-gen-addon-readme !! - !! changes will be overwritten. !! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:87f75612d4443c8f053ffbfd02ff5f4d6a31cbb16218dfd0561f7589ae010da9 - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png - :target: https://odoo-community.org/page/development-status - :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 -.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github - :target: https://github.com/OCA/knowledge/tree/16.0/document_url_google_drive - :alt: OCA/knowledge -.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/knowledge-16-0/knowledge-16-0-document_url_google_drive - :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=16.0 - :alt: Try me on Runboat - -|badge1| |badge2| |badge3| |badge4| |badge5| - -This module extends the functionality of the document_url module and -allows you to attach a link to a file from your Google Drive - -**Table of contents** - -.. contents:: - :local: - -Configuration -============= - -To configure this module, you need to: - -- Go to Settings -> General Settings and scroll down to the - Integrations section. - -- Enable "Google API", save. Setup instructions - https://developers.google.com/drive/picker/guides/overview - - - "Google Client ID" - enter the client ID from the Google API - console: - https://developers.google.com/identity/oauth2/web/guides/get-google-api-clientid - - "Google API key" - enter the API key from the Google API console. - - "Google App ID" - enter the ID of the Google application. The - default value is ``odoo``. - -You will be asked to authenticate when you add a link for the first -time. - -|Configuration| - -**To modify your personal login credentials later** - -- Open your user profile and set up personal access credentials on the - "Google API" tab. - - - field "Google Scope" - enter the scope for the Google API. The - default value is - ``https://www.googleapis.com/auth/drive.readonly``. - - field "Google Access Token" - your token will be displayed here. - It is necessary to edit it. - - field "Google Mime Types" - enter the file formats to be filtered - when selecting. Example: - ``application/pdf, image/jpeg, image/png``. By default, all files - are selected - - To log out from the current Google Account by clicking the "logout" - icon right to the "Add GDrive link". - -.. |Configuration| image:: https://raw.githubusercontent.com/OCA/knowledge/16.0/document_url_google_drive/static/img/google_api_settings.png - -Usage -===== - -To use this module, you need to: - -1. Open the form view of an object (Example: Customer Invoice - INV/2019/0007). -2. Go to the chatter and click on the attached icon. -3. Click **Add GDrive link**. -4. Fill the wizard fields and click on Add button. -5. In the open window, select the files you need and press the select - button. -6. You will see a new **URL attachment** in the set of attachments - related to the object. -7. In order to log in under another google user, click on the logout - icon located after **Add GDrive link** - -|Google Drive Link| - -.. |Google Drive Link| image:: https://raw.githubusercontent.com/OCA/knowledge/16.0/document_url_google_drive/static/img/gdrive_link.png - -Bug Tracker -=========== - -Bugs are tracked on `GitHub Issues `_. -In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. - -Do not contact contributors directly about support or help with technical issues. - -Credits -======= - -Authors -------- - -* Cetmix - -Contributors ------------- - -Cetmix - -- Ivan Sokolov -- Mykola Demchuk - -Maintainers ------------ - -This module is maintained by the OCA. - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -OCA, or the Odoo Community Association, is a nonprofit organization whose -mission is to support the collaborative development of Odoo features and -promote its widespread use. - -This module is part of the `OCA/knowledge `_ project on GitHub. - -You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/document_url_google_drive/__init__.py b/document_url_google_drive/__init__.py deleted file mode 100644 index 68fa3356..00000000 --- a/document_url_google_drive/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (C) 2023 Cetmix OÜ -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from . import models, wizard diff --git a/document_url_google_drive/__manifest__.py b/document_url_google_drive/__manifest__.py deleted file mode 100644 index 4b1a2d03..00000000 --- a/document_url_google_drive/__manifest__.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (C) 2023 Cetmix OÜ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -{ - "name": "Google Drive URL Attachment", - "summary": "Attach Google Drive link to Odoo document using Google Drive Picker", - "version": "16.0.1.0.1", - "category": "Tools", - "website": "https://github.com/OCA/knowledge", - "author": "Cetmix, Odoo Community Association (OCA)", - "license": "AGPL-3", - "installable": True, - "images": ["static/description/banner.png"], - "depends": [ - "document_url", - "google_account", - ], - "data": [ - "views/res_users_view.xml", - "views/res_config_settings_view.xml", - ], - "assets": { - "web.assets_backend": [ - "document_url_google_drive/static/src/js/attachment_google_picker.esm.js", - "document_url_google_drive/static/src/xml/google_picker_url.xml", - "document_url_google_drive/static/src/xml/attachment_google_picker.xml", - ], - }, -} diff --git a/document_url_google_drive/i18n/document_url_google_drive.pot b/document_url_google_drive/i18n/document_url_google_drive.pot deleted file mode 100644 index 914aa996..00000000 --- a/document_url_google_drive/i18n/document_url_google_drive.pot +++ /dev/null @@ -1,103 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * document_url_google_drive -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" -"Report-Msgid-Bugs-To: \n" -"Last-Translator: \n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: document_url_google_drive -#. odoo-javascript -#: code:addons/document_url_google_drive/static/src/xml/attachment_google_picker.xml:0 -#, python-format -msgid "Add GDrive link" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model,name:document_url_google_drive.model_res_config_settings -msgid "Config Settings" -msgstr "" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_users_google_picker_view_form -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_users_google_picker_view_form_simple_modif -msgid "Google API" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__google_picker_api_key -msgid "Google API Key" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__is_active_google_api -msgid "Google APIs" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_access_token -msgid "Google Access Token" -msgstr "" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Google Api Key" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__google_picker_app_id -msgid "Google App ID" -msgstr "" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Google App Id" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__google_picker_client_id -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Google Client ID" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_expires_date -msgid "Google Expires Date" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_mime_types -msgid "Google Mime Types" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_active -msgid "Google Picker Active" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_scope -msgid "Google Scope" -msgstr "" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Use google integration." -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model,name:document_url_google_drive.model_res_users -msgid "User" -msgstr "" - -#. module: document_url_google_drive -#: model:ir.model,name:document_url_google_drive.model_ir_attachment_add_url -msgid "Wizard to add URL attachment" -msgstr "" diff --git a/document_url_google_drive/i18n/it.po b/document_url_google_drive/i18n/it.po deleted file mode 100644 index a61aa645..00000000 --- a/document_url_google_drive/i18n/it.po +++ /dev/null @@ -1,106 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * document_url_google_drive -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" -"Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2024-02-08 09:36+0000\n" -"Last-Translator: mymage \n" -"Language-Team: none\n" -"Language: it\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.17\n" - -#. module: document_url_google_drive -#. odoo-javascript -#: code:addons/document_url_google_drive/static/src/xml/attachment_google_picker.xml:0 -#, python-format -msgid "Add GDrive link" -msgstr "Aggiungi link GDrive" - -#. module: document_url_google_drive -#: model:ir.model,name:document_url_google_drive.model_res_config_settings -msgid "Config Settings" -msgstr "Impostazioni configurazione" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_users_google_picker_view_form -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_users_google_picker_view_form_simple_modif -msgid "Google API" -msgstr "API Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__google_picker_api_key -msgid "Google API Key" -msgstr "Chiave API Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__is_active_google_api -msgid "Google APIs" -msgstr "API Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_access_token -msgid "Google Access Token" -msgstr "Token accesso Google" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Google Api Key" -msgstr "Chiave API Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__google_picker_app_id -msgid "Google App ID" -msgstr "ID app Google" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Google App Id" -msgstr "ID app Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__google_picker_client_id -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Google Client ID" -msgstr "ID client Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_expires_date -msgid "Google Expires Date" -msgstr "Data scadenza Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_mime_types -msgid "Google Mime Types" -msgstr "Tipi MIME Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_active -msgid "Google Picker Active" -msgstr "Picker Google attivo" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_scope -msgid "Google Scope" -msgstr "Ambito Google" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Use google integration." -msgstr "Usa integrazione Google." - -#. module: document_url_google_drive -#: model:ir.model,name:document_url_google_drive.model_res_users -msgid "User" -msgstr "Utente" - -#. module: document_url_google_drive -#: model:ir.model,name:document_url_google_drive.model_ir_attachment_add_url -msgid "Wizard to add URL attachment" -msgstr "Procedura guidata per aggiungere l'URL di un allegato" diff --git a/document_url_google_drive/i18n/pt.po b/document_url_google_drive/i18n/pt.po deleted file mode 100644 index c4753bdb..00000000 --- a/document_url_google_drive/i18n/pt.po +++ /dev/null @@ -1,106 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * document_url_google_drive -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" -"Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2024-02-28 21:33+0000\n" -"Last-Translator: Peter Romão \n" -"Language-Team: none\n" -"Language: pt\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.17\n" - -#. module: document_url_google_drive -#. odoo-javascript -#: code:addons/document_url_google_drive/static/src/xml/attachment_google_picker.xml:0 -#, python-format -msgid "Add GDrive link" -msgstr "Adicionar ligação GDrive" - -#. module: document_url_google_drive -#: model:ir.model,name:document_url_google_drive.model_res_config_settings -msgid "Config Settings" -msgstr "Ajustes de Configuração" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_users_google_picker_view_form -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_users_google_picker_view_form_simple_modif -msgid "Google API" -msgstr "API Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__google_picker_api_key -msgid "Google API Key" -msgstr "Chave API do Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__is_active_google_api -msgid "Google APIs" -msgstr "APIs Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_access_token -msgid "Google Access Token" -msgstr "Token de Acesso Google" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Google Api Key" -msgstr "Chave API do Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__google_picker_app_id -msgid "Google App ID" -msgstr "ID Google App" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Google App Id" -msgstr "Id Google App" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_config_settings__google_picker_client_id -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Google Client ID" -msgstr "ID Cliente Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_expires_date -msgid "Google Expires Date" -msgstr "Data de Expiração do Google" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_mime_types -msgid "Google Mime Types" -msgstr "Tipos de Google Mime" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_active -msgid "Google Picker Active" -msgstr "Selector do Google Ativo" - -#. module: document_url_google_drive -#: model:ir.model.fields,field_description:document_url_google_drive.field_res_users__google_picker_scope -msgid "Google Scope" -msgstr "Âmbito Google" - -#. module: document_url_google_drive -#: model_terms:ir.ui.view,arch_db:document_url_google_drive.res_config_settings_view_form -msgid "Use google integration." -msgstr "Usar a integração do google." - -#. module: document_url_google_drive -#: model:ir.model,name:document_url_google_drive.model_res_users -msgid "User" -msgstr "Utilizador" - -#. module: document_url_google_drive -#: model:ir.model,name:document_url_google_drive.model_ir_attachment_add_url -msgid "Wizard to add URL attachment" -msgstr "Assistente para adicionar anexo de URL" diff --git a/document_url_google_drive/models/__init__.py b/document_url_google_drive/models/__init__.py deleted file mode 100644 index e85fc905..00000000 --- a/document_url_google_drive/models/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (C) 2023 Cetmix OÜ -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from . import res_users, res_config_settings diff --git a/document_url_google_drive/models/res_config_settings.py b/document_url_google_drive/models/res_config_settings.py deleted file mode 100644 index fbc7eda7..00000000 --- a/document_url_google_drive/models/res_config_settings.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2023 Cetmix OÜ -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from odoo import fields, models - - -class ResConfigSettings(models.TransientModel): - _inherit = "res.config.settings" - - is_active_google_api = fields.Boolean( - string="Google APIs", - config_parameter="is_active_google_api", - ) - google_picker_client_id = fields.Char( - string="Google Client ID", - config_parameter="google_picker_client_id", - ) - google_picker_api_key = fields.Char( - string="Google API Key", - config_parameter="google_picker_api_key", - ) - google_picker_app_id = fields.Char( - string="Google App ID", - config_parameter="google_picker_app_id", - default="odoo", - ) diff --git a/document_url_google_drive/models/res_users.py b/document_url_google_drive/models/res_users.py deleted file mode 100644 index 88a33489..00000000 --- a/document_url_google_drive/models/res_users.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2023 Cetmix OÜ -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from odoo import fields, models - - -class ResUsers(models.Model): - _inherit = "res.users" - - google_picker_scope = fields.Char( - string="Google Scope", - default="https://www.googleapis.com/auth/drive.readonly", - ) - google_picker_access_token = fields.Char(string="Google Access Token") - google_picker_expires_date = fields.Integer(string="Google Expires Date") - google_picker_mime_types = fields.Char(string="Google Mime Types") - google_picker_active = fields.Boolean( - compute="_compute_google_picker_active", - ) - - def get_google_picker_params(self): - """ - Get Google Picker params - :return: dict - """ - self.ensure_one() - config = self.env["ir.config_parameter"].sudo() - google_service = self.env["google.service"] - - if not self.google_picker_active: - return {} - return { - "client_id": google_service._get_client_id("picker"), - "api_key": config.get_param("google_picker_api_key"), - "app_id": config.get_param("google_picker_app_id"), - "scope": self.google_picker_scope, - "access_token": self.google_picker_access_token, - "expires_date": self.google_picker_expires_date, - "mime_types": self.google_picker_mime_types, - } - - def save_google_picker_access_token(self, access_token, expires_date): - """ - Save Google Picker access token - :param access_token: str - :return: None - """ - self.ensure_one() - self.google_picker_access_token = access_token - self.google_picker_expires_date = expires_date - - def _compute_google_picker_active(self): - """ - Compute Google Picker Active - :return: None - """ - conf = self.env["ir.config_parameter"].sudo() - self.google_picker_active = conf.get_param("is_active_google_api") diff --git a/document_url_google_drive/readme/CONFIGURE.md b/document_url_google_drive/readme/CONFIGURE.md deleted file mode 100644 index 2562fe7f..00000000 --- a/document_url_google_drive/readme/CONFIGURE.md +++ /dev/null @@ -1,31 +0,0 @@ -To configure this module, you need to: - -- Go to Settings -> General Settings and scroll down to the Integrations section. - -- Enable "Google API", save. Setup instructions https://developers.google.com/drive/picker/guides/overview - - - "Google Client ID" - enter the client ID from the Google API console: https://developers.google.com/identity/oauth2/web/guides/get-google-api-clientid - - "Google API key" - enter the API key from the Google API console. - - "Google App ID" - enter the ID of the Google application. The default value is - `odoo`. - -You will be asked to authenticate when you add a link for the first time. - -![Configuration](../static/img/google_api_settings.png) - -**To modify your personal login credentials later** - -- Open your user profile and set up personal access credentials on the "Google - API" tab. - - - field "Google Scope" - enter the scope for the Google API. The default value is - `https://www.googleapis.com/auth/drive.readonly`. - - field "Google Access Token" - your token will be displayed here. It is necessary to - edit it. - - field "Google Mime Types" - enter the file formats to be filtered when selecting. - Example: `application/pdf, image/jpeg, image/png`. By default, all files are - selected - - To log out from the current Google Account by clicking the "logout" icon right to the "Add GDrive link". - - diff --git a/document_url_google_drive/readme/CONTRIBUTORS.md b/document_url_google_drive/readme/CONTRIBUTORS.md deleted file mode 100644 index 7977655e..00000000 --- a/document_url_google_drive/readme/CONTRIBUTORS.md +++ /dev/null @@ -1,3 +0,0 @@ - Cetmix - * Ivan Sokolov - * Mykola Demchuk diff --git a/document_url_google_drive/readme/DESCRIPTION.md b/document_url_google_drive/readme/DESCRIPTION.md deleted file mode 100644 index 750f6b24..00000000 --- a/document_url_google_drive/readme/DESCRIPTION.md +++ /dev/null @@ -1,2 +0,0 @@ -This module extends the functionality of the document_url module and allows you to -attach a link to a file from your Google Drive diff --git a/document_url_google_drive/readme/USAGE.md b/document_url_google_drive/readme/USAGE.md deleted file mode 100644 index 8692ac9e..00000000 --- a/document_url_google_drive/readme/USAGE.md +++ /dev/null @@ -1,11 +0,0 @@ -To use this module, you need to: - -1. Open the form view of an object (Example: Customer Invoice INV/2019/0007). -1. Go to the chatter and click on the attached icon. -1. Click **Add GDrive link**. -1. Fill the wizard fields and click on Add button. -1. In the open window, select the files you need and press the select button. -1. You will see a new **URL attachment** in the set of attachments related to the object. -1. In order to log in under another google user, click on the logout icon located after **Add GDrive link** - -![Google Drive Link](../static/img/gdrive_link.png) diff --git a/document_url_google_drive/readme/newsfragments/.gitkeep b/document_url_google_drive/readme/newsfragments/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/document_url_google_drive/static/description/banner.png b/document_url_google_drive/static/description/banner.png deleted file mode 100644 index 6339699d..00000000 Binary files a/document_url_google_drive/static/description/banner.png and /dev/null differ diff --git a/document_url_google_drive/static/description/icon.png b/document_url_google_drive/static/description/icon.png deleted file mode 100644 index 3a0328b5..00000000 Binary files a/document_url_google_drive/static/description/icon.png and /dev/null differ diff --git a/document_url_google_drive/static/description/icon.svg b/document_url_google_drive/static/description/icon.svg deleted file mode 100644 index a7a26d09..00000000 --- a/document_url_google_drive/static/description/icon.svg +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/document_url_google_drive/static/description/index.html b/document_url_google_drive/static/description/index.html deleted file mode 100644 index d7909fa8..00000000 --- a/document_url_google_drive/static/description/index.html +++ /dev/null @@ -1,483 +0,0 @@ - - - - - -Google Drive URL Attachment - - - -
-

Google Drive URL Attachment

- - -

Beta License: AGPL-3 OCA/knowledge Translate me on Weblate Try me on Runboat

-

This module extends the functionality of the document_url module and -allows you to attach a link to a file from your Google Drive

-

Table of contents

- -
-

Configuration

-

To configure this module, you need to:

- -

You will be asked to authenticate when you add a link for the first -time.

-

Configuration

-

To modify your personal login credentials later

-
    -
  • Open your user profile and set up personal access credentials on the -“Google API” tab.

    -
      -
    • field “Google Scope” - enter the scope for the Google API. The -default value is -https://www.googleapis.com/auth/drive.readonly.
    • -
    • field “Google Access Token” - your token will be displayed here. -It is necessary to edit it.
    • -
    • field “Google Mime Types” - enter the file formats to be filtered -when selecting. Example: -application/pdf, image/jpeg, image/png. By default, all files -are selected
    • -
    -

    To log out from the current Google Account by clicking the “logout” -icon right to the “Add GDrive link”.

    -
  • -
-
-
-

Usage

-

To use this module, you need to:

-
    -
  1. Open the form view of an object (Example: Customer Invoice -INV/2019/0007).
  2. -
  3. Go to the chatter and click on the attached icon.
  4. -
  5. Click Add GDrive link.
  6. -
  7. Fill the wizard fields and click on Add button.
  8. -
  9. In the open window, select the files you need and press the select -button.
  10. -
  11. You will see a new URL attachment in the set of attachments -related to the object.
  12. -
  13. In order to log in under another google user, click on the logout -icon located after Add GDrive link
  14. -
-

Google Drive Link

-
-
-

Bug Tracker

-

Bugs are tracked on GitHub Issues. -In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

-

Do not contact contributors directly about support or help with technical issues.

-
-
-

Credits

-
-

Authors

-
    -
  • Cetmix
  • -
-
-
-

Contributors

-

Cetmix <cetmix.com>

-
    -
  • Ivan Sokolov
  • -
  • Mykola Demchuk
  • -
-
-
-

Maintainers

-

This module is maintained by the OCA.

-Odoo Community Association -

OCA, or the Odoo Community Association, is a nonprofit organization whose -mission is to support the collaborative development of Odoo features and -promote its widespread use.

-

This module is part of the OCA/knowledge project on GitHub.

-

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

-
-
-
- - diff --git a/document_url_google_drive/static/img/gdrive_link.png b/document_url_google_drive/static/img/gdrive_link.png deleted file mode 100644 index 5f628690..00000000 Binary files a/document_url_google_drive/static/img/gdrive_link.png and /dev/null differ diff --git a/document_url_google_drive/static/img/google_api_settings.png b/document_url_google_drive/static/img/google_api_settings.png deleted file mode 100644 index 17c930d2..00000000 Binary files a/document_url_google_drive/static/img/google_api_settings.png and /dev/null differ diff --git a/document_url_google_drive/static/src/img/logo-google-drive.png b/document_url_google_drive/static/src/img/logo-google-drive.png deleted file mode 100644 index 13ccc257..00000000 Binary files a/document_url_google_drive/static/src/img/logo-google-drive.png and /dev/null differ diff --git a/document_url_google_drive/static/src/js/attachment_google_picker.esm.js b/document_url_google_drive/static/src/js/attachment_google_picker.esm.js deleted file mode 100644 index d3f69dc3..00000000 --- a/document_url_google_drive/static/src/js/attachment_google_picker.esm.js +++ /dev/null @@ -1,195 +0,0 @@ -/** @odoo-module **/ - -import {loadJS} from "@web/core/assets"; -import {registerMessagingComponent} from "@mail/utils/messaging_component"; -import {useComponentToModel} from "@mail/component_hooks/use_component_to_model"; -import {useService} from "@web/core/utils/hooks"; - -const {Component, onWillStart, useState} = owl; - -export class AttachmentGooglePicker extends Component { - /** - * @override - */ - setup() { - super.setup(); - useComponentToModel({fieldName: "component"}); - this.orm = useService("orm"); - this.user = useService("user"); - this.action = useService("action"); - this.state = useState({ - pickerInited: false, - gisInited: false, - api_key: "", - scopes: "", - client_id: "", - app_id: "", - accessToken: null, - expiresDate: 0, - }); - this.tokenClient = null; - - onWillStart(async () => { - await this.getUserAuthParams(); - if (!this.checkActive()) { - return; - } - await loadJS("https://apis.google.com/js/api.js", { - attrs: {async: true, defer: true}, - }); - await this.gapiLoaded(); - await loadJS("https://accounts.google.com/gsi/client", { - attrs: {async: true, defer: true}, - }); - await this.gisLoaded(); - }); - } - - // -------------------------------------------------------------------------- - // Public - // -------------------------------------------------------------------------- - - async _onAddGooglePickerUrl() { - if ( - this.state.accessToken && - this.state.expiresDate > Math.floor(Date.now() / 1000) - ) { - await this.createPicker(); - } else { - await this.handleAuthClick(); - } - } - - checkActive() { - return ( - Boolean(this.state.api_key) && - Boolean(this.state.scopes) && - Boolean(this.state.client_id) && - Boolean(this.state.app_id) - ); - } - - async _onSignOut() { - this.state.accessToken = null; - await this.saveUserAuthAccessToken(); - } - // -------------------------------------------------------------------------- - // Private - // -------------------------------------------------------------------------- - - async getUserAuthParams() { - const res = await this.orm.call("res.users", "get_google_picker_params", [ - this.user.userId, - ]); - if (!res) { - return; - } - this.state.client_id = res.client_id; - this.state.api_key = res.api_key; - this.state.app_id = res.app_id; - this.state.scopes = res.scope; - this.state.accessToken = res.access_token; - this.state.expiresDate = res.expires_date; - this.state.mime_types = res.mime_types; - } - - async saveUserAuthAccessToken() { - await this.orm.call("res.users", "save_google_picker_access_token", [ - this.user.userId, - this.state.accessToken, - this.state.expiresDate, - ]); - } - - async gapiLoaded() { - window.gapi.load("client:picker", this.initializePicker.bind(this)); - } - - async initializePicker() { - await window.gapi.client.load( - "https://www.googleapis.com/discovery/v1/apis/drive/v3/rest" - ); - this.state.pickerInited = true; - } - - handleAuthClick() { - this.tokenClient.callback = async (response) => { - if (response.error !== undefined) { - throw response; - } - this.state.accessToken = response.access_token; - this.state.expiresDate = - Math.floor(Date.now() / 1000) + response.expires_in; - await this.createPicker(); - await this.saveUserAuthAccessToken(); - }; - - if (this.state.accessToken === null) { - // Prompt the user to select a Google Account and ask for consent to share their data - // when establishing a new session. - this.tokenClient.requestAccessToken({ - prompt: "consent", - access_type: "offline", - }); - } else { - // Skip display of account chooser and consent dialog for an existing session. - this.tokenClient.requestAccessToken({prompt: "", access_type: "offline"}); - } - } - - async gisLoaded() { - this.tokenClient = window.google.accounts.oauth2.initTokenClient({ - client_id: this.state.client_id, - scope: this.state.scopes, - callback: "", - }); - this.state.gisInited = true; - } - - createPicker() { - const view = new window.google.picker.View(window.google.picker.ViewId.DOCS); - if (this.state.mime_types) { - view.setMimeTypes(this.state.mime_types); - } - const picker = new window.google.picker.PickerBuilder() - .enableFeature(window.google.picker.Feature.NAV_HIDDEN) - .enableFeature(window.google.picker.Feature.MULTISELECT_ENABLED) - .setDeveloperKey(this.state.api_key) - .setAppId(this.state.app_id) - .setOAuthToken(this.state.accessToken) - .addView(view) - .addView(new window.google.picker.DocsUploadView()) - .setCallback(this.pickerCallback.bind(this)) - .build(); - picker.setVisible(true); - } - - async pickerCallback(data) { - if (data.action === window.google.picker.Action.PICKED) { - for (const document of data.docs) { - await this.createAttachment(document); - } - await this._onAddedUrl(); - } - } - - async createAttachment(document) { - await this.orm.call("ir.attachment.add_url", "add_attachment_google_drive", [ - document.url, - document.name, - this.props.record.chatter.thread.model, - [this.props.record.chatter.thread.id], - ]); - } - - async _onAddedUrl() { - this.props.record.chatter.refresh(); - } -} - -Object.assign(AttachmentGooglePicker, { - props: {record: Object}, - template: "document_url_google_drive.GooglePickerUrl", -}); - -registerMessagingComponent(AttachmentGooglePicker); diff --git a/document_url_google_drive/static/src/xml/attachment_google_picker.xml b/document_url_google_drive/static/src/xml/attachment_google_picker.xml deleted file mode 100644 index aa3eee5d..00000000 --- a/document_url_google_drive/static/src/xml/attachment_google_picker.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - -