From a0cc1c1fc004402ca74d99c487c141d6f7336669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Wed, 8 Feb 2023 17:24:35 +0100 Subject: [PATCH 01/11] [ADD] dms_attachment_link: New module TT41512 [UPD] Update dms_attachment_link.pot [UPD] README.rst --- dms_attachment_link/README.rst | 97 ++++ dms_attachment_link/__init__.py | 2 + dms_attachment_link/__manifest__.py | 15 + .../i18n/dms_attachment_link.pot | 91 ++++ dms_attachment_link/i18n/es.po | 95 ++++ dms_attachment_link/models/__init__.py | 1 + dms_attachment_link/models/ir_attachment.py | 18 + dms_attachment_link/readme/CONTRIBUTORS.rst | 4 + dms_attachment_link/readme/DESCRIPTION.rst | 1 + dms_attachment_link/readme/USAGE.rst | 9 + .../static/description/icon.png | Bin 0 -> 8191 bytes .../static/description/icon.svg | 200 ++++++++ .../static/description/index.html | 439 ++++++++++++++++++ .../static/src/js/dms_attachment_link.js | 24 + .../static/src/xml/chatter.xml | 12 + dms_attachment_link/tests/__init__.py | 1 + .../tests/test_dms_attachment_link.py | 28 ++ dms_attachment_link/views/assets.xml | 15 + dms_attachment_link/wizard/__init__.py | 1 + .../wizard/wizard_ir_attachment_dms_file.py | 23 + .../wizard_ir_attachment_dms_file_view.xml | 30 ++ 21 files changed, 1106 insertions(+) create mode 100644 dms_attachment_link/README.rst create mode 100644 dms_attachment_link/__init__.py create mode 100644 dms_attachment_link/__manifest__.py create mode 100644 dms_attachment_link/i18n/dms_attachment_link.pot create mode 100644 dms_attachment_link/i18n/es.po create mode 100644 dms_attachment_link/models/__init__.py create mode 100644 dms_attachment_link/models/ir_attachment.py create mode 100644 dms_attachment_link/readme/CONTRIBUTORS.rst create mode 100644 dms_attachment_link/readme/DESCRIPTION.rst create mode 100644 dms_attachment_link/readme/USAGE.rst create mode 100644 dms_attachment_link/static/description/icon.png create mode 100644 dms_attachment_link/static/description/icon.svg create mode 100644 dms_attachment_link/static/description/index.html create mode 100644 dms_attachment_link/static/src/js/dms_attachment_link.js create mode 100644 dms_attachment_link/static/src/xml/chatter.xml create mode 100644 dms_attachment_link/tests/__init__.py create mode 100644 dms_attachment_link/tests/test_dms_attachment_link.py create mode 100644 dms_attachment_link/views/assets.xml create mode 100644 dms_attachment_link/wizard/__init__.py create mode 100644 dms_attachment_link/wizard/wizard_ir_attachment_dms_file.py create mode 100644 dms_attachment_link/wizard/wizard_ir_attachment_dms_file_view.xml diff --git a/dms_attachment_link/README.rst b/dms_attachment_link/README.rst new file mode 100644 index 000000000..5f261ce36 --- /dev/null +++ b/dms_attachment_link/README.rst @@ -0,0 +1,97 @@ +=================== +Dms Attachment Link +=================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fdms-lightgray.png?logo=github + :target: https://github.com/OCA/dms/tree/13.0/dms_attachment_link + :alt: OCA/dms +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/dms-13-0/dms-13-0-dms_attachment_link + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/292/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds a wizard to be able to link an DMS file as an attachment of a document. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +#. Open the form view of a document (Example: the contact "Azure Interior"). +#. Go to the chatter and click on the clip icon. +#. Click **Add DMS File** link. +#. A popup wizard will appear. +#. Search for the desired DMS file (Example: Sydney.jpg) and click on the "Add" button. +#. A new attachment will be created for the document without duplicating + the content. + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_ + + * Pedro M. Baeza + * Víctor Martínez + +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. + +.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px + :target: https://github.com/victoralmau + :alt: victoralmau + +Current `maintainer `__: + +|maintainer-victoralmau| + +This module is part of the `OCA/dms `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/dms_attachment_link/__init__.py b/dms_attachment_link/__init__.py new file mode 100644 index 000000000..9b4296142 --- /dev/null +++ b/dms_attachment_link/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizard diff --git a/dms_attachment_link/__manifest__.py b/dms_attachment_link/__manifest__.py new file mode 100644 index 000000000..a890ac954 --- /dev/null +++ b/dms_attachment_link/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2023 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Dms Attachment Link", + "version": "13.0.1.0.0", + "category": "Document Management", + "website": "https://github.com/OCA/dms", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["dms"], + "data": ["views/assets.xml", "wizard/wizard_ir_attachment_dms_file_view.xml"], + "qweb": ["static/src/xml/chatter.xml"], + "installable": True, + "maintainers": ["victoralmau"], +} diff --git a/dms_attachment_link/i18n/dms_attachment_link.pot b/dms_attachment_link/i18n/dms_attachment_link.pot new file mode 100644 index 000000000..5ccc3317c --- /dev/null +++ b/dms_attachment_link/i18n/dms_attachment_link.pot @@ -0,0 +1,91 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * dms_attachment_link +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.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: dms_attachment_link +#: model_terms:ir.ui.view,arch_db:dms_attachment_link.view_wizard_ir_attachment_dms_file_form +msgid "Add" +msgstr "" + +#. module: dms_attachment_link +#. openerp-web +#: code:addons/dms_attachment_link/static/src/xml/chatter.xml:0 +#, python-format +msgid "Add DMS File" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model,name:dms_attachment_link.model_ir_attachment +msgid "Attachment" +msgstr "" + +#. module: dms_attachment_link +#: model_terms:ir.ui.view,arch_db:dms_attachment_link.view_wizard_ir_attachment_dms_file_form +msgid "Cancel" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.actions.act_window,name:dms_attachment_link.action_wizard_ir_attachment_dms_file +msgid "Create Attachment from DMS File" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__create_uid +msgid "Created by" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__create_date +msgid "Created on" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__dms_file_id +msgid "DMS File" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__display_name +msgid "Display Name" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_ir_attachment__dms_file_id +msgid "Dms File" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__id +msgid "ID" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file____last_update +msgid "Last Modified on" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__write_date +msgid "Last Updated on" +msgstr "" + +#. module: dms_attachment_link +#: model:ir.model,name:dms_attachment_link.model_wizard_ir_attachment_dms_file +msgid "Wizard Ir Attachment DMS File" +msgstr "" diff --git a/dms_attachment_link/i18n/es.po b/dms_attachment_link/i18n/es.po new file mode 100644 index 000000000..0cb20f4f8 --- /dev/null +++ b/dms_attachment_link/i18n/es.po @@ -0,0 +1,95 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * dms_attachment_link +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-02-09 16:49+0000\n" +"PO-Revision-Date: 2023-02-09 17:50+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"X-Generator: Poedit 3.0.1\n" + +#. module: dms_attachment_link +#: model_terms:ir.ui.view,arch_db:dms_attachment_link.view_wizard_ir_attachment_dms_file_form +msgid "Add" +msgstr "Añadir" + +#. module: dms_attachment_link +#. openerp-web +#: code:addons/dms_attachment_link/static/src/xml/chatter.xml:0 +#, python-format +msgid "Add DMS File" +msgstr "Añadir archivo DMS" + +#. module: dms_attachment_link +#: model:ir.model,name:dms_attachment_link.model_ir_attachment +msgid "Attachment" +msgstr "Adjunto" + +#. module: dms_attachment_link +#: model_terms:ir.ui.view,arch_db:dms_attachment_link.view_wizard_ir_attachment_dms_file_form +msgid "Cancel" +msgstr "Cancelar" + +#. module: dms_attachment_link +#: model:ir.actions.act_window,name:dms_attachment_link.action_wizard_ir_attachment_dms_file +msgid "Create Attachment from DMS File" +msgstr "Crear adjunto desde archivo DMS" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__dms_file_id +msgid "DMS File" +msgstr "Archivo DMS" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__display_name +msgid "Display Name" +msgstr "Nombre a mostrar" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_ir_attachment__dms_file_id +msgid "Dms File" +msgstr "Archivo Dms" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__id +msgid "ID" +msgstr "ID" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file____last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: dms_attachment_link +#: model:ir.model.fields,field_description:dms_attachment_link.field_wizard_ir_attachment_dms_file__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: dms_attachment_link +#: model:ir.model,name:dms_attachment_link.model_wizard_ir_attachment_dms_file +msgid "Wizard Ir Attachment DMS File" +msgstr "" diff --git a/dms_attachment_link/models/__init__.py b/dms_attachment_link/models/__init__.py new file mode 100644 index 000000000..aaf38a167 --- /dev/null +++ b/dms_attachment_link/models/__init__.py @@ -0,0 +1 @@ +from . import ir_attachment diff --git a/dms_attachment_link/models/ir_attachment.py b/dms_attachment_link/models/ir_attachment.py new file mode 100644 index 000000000..fd373474e --- /dev/null +++ b/dms_attachment_link/models/ir_attachment.py @@ -0,0 +1,18 @@ +# Copyright 2023 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class IrAttachment(models.Model): + _inherit = "ir.attachment" + + dms_file_id = fields.Many2one(comodel_name="dms.file") + + @api.depends("dms_file_id.content") + def _compute_datas(self): + """Get the contents of the attachment directly from the DMS fiel.""" + _self = self.filtered("dms_file_id") + super(IrAttachment, (self - _self))._compute_datas() + for item in _self: + item.datas = item.dms_file_id.content diff --git a/dms_attachment_link/readme/CONTRIBUTORS.rst b/dms_attachment_link/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..4c9d0f2a9 --- /dev/null +++ b/dms_attachment_link/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_ + + * Pedro M. Baeza + * Víctor Martínez diff --git a/dms_attachment_link/readme/DESCRIPTION.rst b/dms_attachment_link/readme/DESCRIPTION.rst new file mode 100644 index 000000000..d6172b1a6 --- /dev/null +++ b/dms_attachment_link/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module adds a wizard to be able to link an DMS file as an attachment of a document. diff --git a/dms_attachment_link/readme/USAGE.rst b/dms_attachment_link/readme/USAGE.rst new file mode 100644 index 000000000..4b6103b41 --- /dev/null +++ b/dms_attachment_link/readme/USAGE.rst @@ -0,0 +1,9 @@ +To use this module, you need to: + +#. Open the form view of a document (Example: the contact "Azure Interior"). +#. Go to the chatter and click on the clip icon. +#. Click **Add DMS File** link. +#. A popup wizard will appear. +#. Search for the desired DMS file (Example: Sydney.jpg) and click on the "Add" button. +#. A new attachment will be created for the document without duplicating + the content. diff --git a/dms_attachment_link/static/description/icon.png b/dms_attachment_link/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..667d38d369f109dcdda868948acd32bfb7b4e52f GIT binary patch literal 8191 zcmcgx^;Z<$(*{Hd0Rd5#&IOio=|z{$U3%#Sq`N^tT9HoaZWaXuq)R~QbO|Zxkd@C8 z!qWNj{U_cZX6BrG?zulaGxJQ`7;Q}za#DIyJUl#dn5rV;-p2n=h#%eSn(uPb_lCqn z)z}*kk67`4f=gFKf}4hl|`BVI&*T?qcQ_6&Oc&wW7w-UGc@`*3IdW#PK$@7ZK0 zvvA_$9@UuH0P9Y%GA<(_!^jFltgx@WoYYUzOmF|J$YDEY3nV&Pij z)1s1qV98~$UP=+}8>^Z|7T*JT)^ORk%$k6WMkHi&^Rs4DgXi_DgWF!2>$LOVD$+;g z85pTKB+_Xo;^D6;YF>>=L>S_iURymY9wX6uJ4EiChNS{@kzhCZ#AHnZeuirmdtXf@h2pHGwE;9Ka9XY%D|Etvp3^>7HGEMxny^5jlRd zif!yVZ3jrWYDySGK@@}1!Le$Js~7k?Y`TY`G6wMg&g=l1bd04Z`v99 zOGOPhIhcL^#QC0|!TU{yB(mb=EMl|Ca+faOHnB9FH{SF!P(8uhvWM5;Gvv=>hG0uE z<>&OIiGZXE<%Gw|8d>yM`TqwM<_FT+R;03)SXIX)z9JTP?@Ie5Sp4Y0Pv|9&+SO?> zE=Zwf-D?2Ip$-=5&6PPMdFi(j;~{SF)y(JaChvTMR`OIOG<>92 zkX!Ib=ZSnv>tD~TQI+N|;S%BliRRZzTnBAYD?dK;z37gIrzCWJd8YjVzmw(q-SPRM z+Vk*lWyvd}RMptpPd+y%48e4@B$5D+|B_W8r}m-BU9IOigEwl!Lr9qUzyy+`Bs#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4o%%VdWI)z^d`PLt!{1WUB&-feSji%edE?6w}bJ^+0mZFLEWFrL=K;uq+{eO zE(K{wU8Z#XJu?JQ@B|fP?JIBN&5a+$VDV9Dhg1<##wb;g*PK9^8fxsvcInbc?{hD6 zRk3B{*96}f1X;ruY(IkefKQB>S3l!wri_kUkK8g>dIDK$+QRS7)ABnPBb@C3OcSsK zFZ^YR)Hb!B2WMEzR(hoXgRG{IVN$Npvhx4Ek=8t{61Bd=s6Qprs6D_h3Wall!cl@5Fx zzjo$wY_JQLzslS8FS|3ayJ-4Y!CH1v6n-(#*)gGRmoQ3e(DX;PT&%95YKK4*5VEeT zC3A!K1>xQuh^@Y}1OtM8&9y(16B>6okrP|_`qj0$4MFx^FZ$M~^w3bHS!i={|5)|?vwxk literal 0 HcmV?d00001 diff --git a/dms_attachment_link/static/description/icon.svg b/dms_attachment_link/static/description/icon.svg new file mode 100644 index 000000000..43344af51 --- /dev/null +++ b/dms_attachment_link/static/description/icon.svg @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dms_attachment_link/static/description/index.html b/dms_attachment_link/static/description/index.html new file mode 100644 index 000000000..18b27371e --- /dev/null +++ b/dms_attachment_link/static/description/index.html @@ -0,0 +1,439 @@ + + + + + + +Dms Attachment Link + + + + + + diff --git a/dms_attachment_link/static/src/js/dms_attachment_link.js b/dms_attachment_link/static/src/js/dms_attachment_link.js new file mode 100644 index 000000000..48a4466ba --- /dev/null +++ b/dms_attachment_link/static/src/js/dms_attachment_link.js @@ -0,0 +1,24 @@ +odoo.define("dms_attachment_link", function (require) { + "use strict"; + + var AttachmentBox = require("mail.AttachmentBox"); + + AttachmentBox.include({ + events: _.extend(AttachmentBox.prototype.events, { + "click span.o_add_dms_file_button": "_onAddDmsFile", + }), + _onAddDmsFile: function () { + this.do_action("dms_attachment_link.action_wizard_ir_attachment_dms_file", { + additional_context: { + active_id: this.currentResID, + active_ids: [this.currentResID], + active_model: this.currentResModel, + }, + on_close: this._onAddedUrl.bind(this), + }); + }, + _onAddedUrl: function () { + this.trigger_up("reload_attachment_box"); + }, + }); +}); diff --git a/dms_attachment_link/static/src/xml/chatter.xml b/dms_attachment_link/static/src/xml/chatter.xml new file mode 100644 index 000000000..e9efa831e --- /dev/null +++ b/dms_attachment_link/static/src/xml/chatter.xml @@ -0,0 +1,12 @@ + + + + + + Add DMS File + + + diff --git a/dms_attachment_link/tests/__init__.py b/dms_attachment_link/tests/__init__.py new file mode 100644 index 000000000..b113345c9 --- /dev/null +++ b/dms_attachment_link/tests/__init__.py @@ -0,0 +1 @@ +from . import test_dms_attachment_link diff --git a/dms_attachment_link/tests/test_dms_attachment_link.py b/dms_attachment_link/tests/test_dms_attachment_link.py new file mode 100644 index 000000000..e01148c77 --- /dev/null +++ b/dms_attachment_link/tests/test_dms_attachment_link.py @@ -0,0 +1,28 @@ +# Copyright 2023 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import common + + +class TestDmsAttachmentLink(common.TransactionCase): + def setUp(self): + super().setUp() + self.partner = self.env["res.partner"].create({"name": "Test partner"}) + self.dms_file = self.env.ref("dms.file_01_demo") + ctx = { + "active_model": self.partner._name, + "active_id": self.partner.id, + } + self.wizard_model = self.env["wizard.ir.attachment.dms.file"].with_context(ctx) + + def test_add_url_attachment(self): + wizard = self.wizard_model.create({"dms_file_id": self.dms_file.id}) + wizard.action_link() + domain = [ + ("dms_file_id", "=", self.dms_file.id), + ("res_model", "=", self.partner._name), + ("res_id", "=", self.partner.id), + ] + attachment = self.env["ir.attachment"].search(domain) + self.assertEqual(attachment.name, self.dms_file.name) + self.assertEqual(attachment.datas, self.dms_file.content) diff --git a/dms_attachment_link/views/assets.xml b/dms_attachment_link/views/assets.xml new file mode 100644 index 000000000..0791b32e9 --- /dev/null +++ b/dms_attachment_link/views/assets.xml @@ -0,0 +1,15 @@ + + +