mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 16:52:05 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,104 @@
|
|||
.. image:: https://odoo-community.org/readme-banner-image
|
||||
:target: https://odoo-community.org/get-involved?utm_source=readme
|
||||
:alt: Odoo Community Association
|
||||
|
||||
==================
|
||||
Attachment Logging
|
||||
==================
|
||||
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:3d655774b23a7ef9fac54c63f7baeb7473eb31267eadf2f02c29292d7f1fe8b0
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |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/license-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%2Fserver--tools-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/server-tools/tree/16.0/attachment_logging
|
||||
:alt: OCA/server-tools
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-attachment_logging
|
||||
: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/server-tools&target_branch=16.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module shows attachment information in chatter. Following data is displayed:
|
||||
|
||||
- User, who has created the attachment
|
||||
- Attachment creation date
|
||||
|
||||
It also allows to log attachment related actions in the record chatter.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
To enable note logging of attachment operations in record chatter:
|
||||
|
||||
- Go to "Settings > General Settings" and scroll to the "Discuss" section.
|
||||
- Activate the "Attachment Logging" checkbox.
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/OCA/server-tools/16.0/attachment_logging/static/src/img/settings.png
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Create date and user are displayed next to attachments in chatter.
|
||||
When attachment is added or removed a note is logged in chatter if the corresponding option is enabled in the General Settings.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/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 <https://github.com/OCA/server-tools/issues/new?body=module:%20attachment_logging%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Cetmix
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
- Cetmix <cetmix.com>
|
||||
|
||||
- Ivan Sokolov
|
||||
- Maksim Shurupov
|
||||
|
||||
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/server-tools <https://github.com/OCA/server-tools/tree/16.0/attachment_logging>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
from . import controllers
|
||||
from . import models
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "Attachment Logging",
|
||||
"version": "16.0.1.0.0",
|
||||
"author": "Cetmix, Odoo Community Association (OCA)",
|
||||
"summary": "Show attachment information in chatter",
|
||||
"website": "https://github.com/OCA/server-tools",
|
||||
"license": "AGPL-3",
|
||||
"category": "Hidden/Tools",
|
||||
"depends": ["mail"],
|
||||
"data": [
|
||||
"data/mail_message_subtype_data.xml",
|
||||
"views/res_config_settings_views.xml",
|
||||
],
|
||||
"assets": {
|
||||
"web.assets_backend": [
|
||||
"attachment_logging/static/src/models/*",
|
||||
"attachment_logging/static/src/components/*/*",
|
||||
]
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
from . import main
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
from odoo.http import request
|
||||
|
||||
from odoo.addons.mail.controllers.discuss import DiscussController
|
||||
|
||||
|
||||
class AttachmentController(DiscussController):
|
||||
def mail_attachment_upload(
|
||||
self, ufile, thread_id, thread_model, is_pending=False, **kwargs
|
||||
):
|
||||
response = super().mail_attachment_upload(
|
||||
ufile, thread_id, thread_model, is_pending=is_pending, **kwargs
|
||||
)
|
||||
attachment_id = response.json.get("id")
|
||||
if not attachment_id:
|
||||
return response
|
||||
# Update attachment data
|
||||
attachmentData = {**response.json}
|
||||
attachment = request.env["ir.attachment"].sudo().browse(attachment_id).exists()
|
||||
if attachment:
|
||||
attachmentData.update(**attachment.get_additional_data())
|
||||
return request.make_json_response(attachmentData)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo noupdate="1">
|
||||
|
||||
<record id="mt_attachment" model="mail.message.subtype">
|
||||
<field name="name">Attachments</field>
|
||||
<field name="default" eval="False" />
|
||||
<field name="internal" eval="True" />
|
||||
<field name="sequence" eval="150" />
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * attachment_logging
|
||||
#
|
||||
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: attachment_logging
|
||||
#. odoo-python
|
||||
#: code:addons/attachment_logging/models/ir_attachment.py:0
|
||||
#, python-format
|
||||
msgid "<b>%(username)s</b> %(action)s a file: <i>%(filename)s</i>"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model_terms:ir.ui.view,arch_db:attachment_logging.res_config_settings_form_view
|
||||
msgid "<span class=\"o_form_label\">Attachment Logging</span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model,name:attachment_logging.model_ir_attachment
|
||||
msgid "Attachment"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:mail.message.subtype,name:attachment_logging.mt_attachment
|
||||
msgid "Attachments"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__changeset_change_ids
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__changeset_change_ids
|
||||
msgid "Changeset Changes"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__changeset_ids
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__changeset_ids
|
||||
msgid "Changesets"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model,name:attachment_logging.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__count_changesets
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__count_changesets
|
||||
msgid "Count Changesets"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__count_pending_changeset_changes
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__count_pending_changeset_changes
|
||||
msgid "Count Pending Changeset Changes"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__count_pending_changesets
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__count_pending_changesets
|
||||
msgid "Count Pending Changesets"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model_terms:ir.ui.view,arch_db:attachment_logging.res_config_settings_form_view
|
||||
msgid "Log a note in record chatter when an attachment is added or removed."
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__use_attachment_log
|
||||
msgid "Log attachment operations in chatter"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__smart_search
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__smart_search
|
||||
msgid "Smart Search"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_ir_attachment__count_pending_changeset_changes
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__count_pending_changeset_changes
|
||||
msgid "The number of pending changes of this record"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_ir_attachment__count_pending_changesets
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__count_pending_changesets
|
||||
msgid "The number of pending changesets of this record"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_ir_attachment__count_changesets
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__count_changesets
|
||||
msgid "The overall number of changesets of this record"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__use_attachment_log
|
||||
msgid "Use Attachment Log"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__user_can_see_changeset
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__user_can_see_changeset
|
||||
msgid "User Can See Changeset"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#. odoo-python
|
||||
#: code:addons/attachment_logging/models/ir_attachment.py:0
|
||||
#, python-format
|
||||
msgid "attached"
|
||||
msgstr ""
|
||||
|
||||
#. module: attachment_logging
|
||||
#. odoo-python
|
||||
#: code:addons/attachment_logging/models/ir_attachment.py:0
|
||||
#, python-format
|
||||
msgid "unlinked"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * attachment_logging
|
||||
#
|
||||
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: attachment_logging
|
||||
#. odoo-python
|
||||
#: code:addons/attachment_logging/models/ir_attachment.py:0
|
||||
#, python-format
|
||||
msgid "<b>%(username)s</b> %(action)s a file: <i>%(filename)s</i>"
|
||||
msgstr "<b>%(username)s</b> %(action)s datoteku: <i>%(filename)s</i>"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model_terms:ir.ui.view,arch_db:attachment_logging.res_config_settings_form_view
|
||||
msgid "<span class=\"o_form_label\">Attachment Logging</span>"
|
||||
msgstr "<span class=\"o_form_label\">Evidencija priloga</span>"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model,name:attachment_logging.model_ir_attachment
|
||||
msgid "Attachment"
|
||||
msgstr "Prilog"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:mail.message.subtype,name:attachment_logging.mt_attachment
|
||||
msgid "Attachments"
|
||||
msgstr "Prilozi"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__changeset_change_ids
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__changeset_change_ids
|
||||
msgid "Changeset Changes"
|
||||
msgstr "Promene skupa izmena"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__changeset_ids
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__changeset_ids
|
||||
msgid "Changesets"
|
||||
msgstr "Skupovi izmena"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model,name:attachment_logging.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr "Postavke"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__count_changesets
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__count_changesets
|
||||
msgid "Count Changesets"
|
||||
msgstr "Broj skupova izmena"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__count_pending_changeset_changes
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__count_pending_changeset_changes
|
||||
msgid "Count Pending Changeset Changes"
|
||||
msgstr "Broj promena skupa izmena na čekanju"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__count_pending_changesets
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__count_pending_changesets
|
||||
msgid "Count Pending Changesets"
|
||||
msgstr "Broj skupova izmena na čekanju"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model_terms:ir.ui.view,arch_db:attachment_logging.res_config_settings_form_view
|
||||
msgid "Log a note in record chatter when an attachment is added or removed."
|
||||
msgstr "Evidentiraj belešku u razgovoru zapisa kada se prilog doda ili ukloni."
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__use_attachment_log
|
||||
msgid "Log attachment operations in chatter"
|
||||
msgstr "Evidentiraj operacije sa prilozima u razgovoru"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__smart_search
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__smart_search
|
||||
msgid "Smart Search"
|
||||
msgstr "Pametna pretraga"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_ir_attachment__count_pending_changeset_changes
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__count_pending_changeset_changes
|
||||
msgid "The number of pending changes of this record"
|
||||
msgstr "Broj promena na čekanju ovog zapisa"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_ir_attachment__count_pending_changesets
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__count_pending_changesets
|
||||
msgid "The number of pending changesets of this record"
|
||||
msgstr "Broj skupova izmena na čekanju ovog zapisa"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_ir_attachment__count_changesets
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__count_changesets
|
||||
msgid "The overall number of changesets of this record"
|
||||
msgstr "Ukupan broj skupova izmena ovog zapisa"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__use_attachment_log
|
||||
msgid "Use Attachment Log"
|
||||
msgstr "Koristi evidenciju priloga"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__user_can_see_changeset
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__user_can_see_changeset
|
||||
msgid "User Can See Changeset"
|
||||
msgstr "Korisnik može videti skup izmena"
|
||||
|
||||
#. module: attachment_logging
|
||||
#. odoo-python
|
||||
#: code:addons/attachment_logging/models/ir_attachment.py:0
|
||||
#, python-format
|
||||
msgid "attached"
|
||||
msgstr "priložen"
|
||||
|
||||
#. module: attachment_logging
|
||||
#. odoo-python
|
||||
#: code:addons/attachment_logging/models/ir_attachment.py:0
|
||||
#, python-format
|
||||
msgid "unlinked"
|
||||
msgstr "uklonjen"
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * attachment_logging
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"PO-Revision-Date: 2025-06-30 10:25+0000\n"
|
||||
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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 5.10.4\n"
|
||||
|
||||
#. module: attachment_logging
|
||||
#. odoo-python
|
||||
#: code:addons/attachment_logging/models/ir_attachment.py:0
|
||||
#, python-format
|
||||
msgid "<b>%(username)s</b> %(action)s a file: <i>%(filename)s</i>"
|
||||
msgstr "<b>%(username)s</b> %(action)s un file: <i>%(filename)s</i>"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model_terms:ir.ui.view,arch_db:attachment_logging.res_config_settings_form_view
|
||||
msgid "<span class=\"o_form_label\">Attachment Logging</span>"
|
||||
msgstr "<span class=\"o_form_label\">Tracciamento allegato</span>"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model,name:attachment_logging.model_ir_attachment
|
||||
msgid "Attachment"
|
||||
msgstr "Allegato"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:mail.message.subtype,name:attachment_logging.mt_attachment
|
||||
msgid "Attachments"
|
||||
msgstr "Allegati"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__changeset_change_ids
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__changeset_change_ids
|
||||
msgid "Changeset Changes"
|
||||
msgstr "Modifiche dell'insieme di modifiche"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__changeset_ids
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__changeset_ids
|
||||
msgid "Changesets"
|
||||
msgstr "Insieme di modifiche"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model,name:attachment_logging.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr "Impostazioni configurazione"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__count_changesets
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__count_changesets
|
||||
msgid "Count Changesets"
|
||||
msgstr "Conta insiemi di modifiche"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__count_pending_changeset_changes
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__count_pending_changeset_changes
|
||||
msgid "Count Pending Changeset Changes"
|
||||
msgstr "Conteggio modifiche dell'insieme di modifiche in attesa"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__count_pending_changesets
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__count_pending_changesets
|
||||
msgid "Count Pending Changesets"
|
||||
msgstr "Conteggio insieme di modifiche in attesa"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model_terms:ir.ui.view,arch_db:attachment_logging.res_config_settings_form_view
|
||||
msgid "Log a note in record chatter when an attachment is added or removed."
|
||||
msgstr ""
|
||||
"Registra una nota nel record della conversazione quando un allegato è "
|
||||
"aggiunto o rimosso."
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__use_attachment_log
|
||||
msgid "Log attachment operations in chatter"
|
||||
msgstr "Registra le operazioni allegato nella conversazione"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__smart_search
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__smart_search
|
||||
msgid "Smart Search"
|
||||
msgstr "Ricerca intelligente"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_ir_attachment__count_pending_changeset_changes
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__count_pending_changeset_changes
|
||||
msgid "The number of pending changes of this record"
|
||||
msgstr "Numero di modifiche di questo record in attesa"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_ir_attachment__count_pending_changesets
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__count_pending_changesets
|
||||
msgid "The number of pending changesets of this record"
|
||||
msgstr "Numero di insiemi di modifiche in attesa di questo record"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,help:attachment_logging.field_ir_attachment__count_changesets
|
||||
#: model:ir.model.fields,help:attachment_logging.field_res_config_settings__count_changesets
|
||||
msgid "The overall number of changesets of this record"
|
||||
msgstr "Numero totale di insiemi di modifiche di questo record"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__use_attachment_log
|
||||
msgid "Use Attachment Log"
|
||||
msgstr "Usa tracciamento allegato"
|
||||
|
||||
#. module: attachment_logging
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_ir_attachment__user_can_see_changeset
|
||||
#: model:ir.model.fields,field_description:attachment_logging.field_res_config_settings__user_can_see_changeset
|
||||
msgid "User Can See Changeset"
|
||||
msgstr "L'utente può vedere l'insieme delle modifiche"
|
||||
|
||||
#. module: attachment_logging
|
||||
#. odoo-python
|
||||
#: code:addons/attachment_logging/models/ir_attachment.py:0
|
||||
#, python-format
|
||||
msgid "attached"
|
||||
msgstr "allegato"
|
||||
|
||||
#. module: attachment_logging
|
||||
#. odoo-python
|
||||
#: code:addons/attachment_logging/models/ir_attachment.py:0
|
||||
#, python-format
|
||||
msgid "unlinked"
|
||||
msgstr "scollegato"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
from . import ir_attachment
|
||||
from . import res_config_settings
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
from odoo import _, api, models
|
||||
from odoo.tools.misc import format_datetime
|
||||
|
||||
|
||||
class IrAttachment(models.Model):
|
||||
_inherit = "ir.attachment"
|
||||
|
||||
def _send_attachment_notification(self, is_create=False, is_unlink=False):
|
||||
"""
|
||||
Send attachment notification
|
||||
|
||||
:param is_create: send notification for create method
|
||||
:param is_unlink: send notification for unlink method
|
||||
"""
|
||||
if is_create:
|
||||
action = _("attached")
|
||||
elif is_unlink:
|
||||
action = _("unlinked")
|
||||
else:
|
||||
return
|
||||
record = self.env[self.res_model].sudo().browse(self.res_id)
|
||||
message_text = _(
|
||||
"<b>%(username)s</b> %(action)s a file: <i>%(filename)s</i>",
|
||||
username=self.create_uid.name,
|
||||
filename=self.name,
|
||||
action=action,
|
||||
)
|
||||
message = record.message_post(
|
||||
body=message_text,
|
||||
author_id=self.env.ref("base.user_root").partner_id.id,
|
||||
subtype_xmlid="attachment_logging.mt_attachment",
|
||||
)
|
||||
self.env["bus.bus"]._sendone(
|
||||
self.env.user.partner_id.id,
|
||||
"mail.message/insert",
|
||||
{
|
||||
"id": message.id,
|
||||
"body": message.body,
|
||||
},
|
||||
)
|
||||
|
||||
@api.model
|
||||
def _is_use_attachment_log(self):
|
||||
"""Check use attachment log"""
|
||||
return (
|
||||
self.env["ir.config_parameter"]
|
||||
.sudo()
|
||||
.get_param("attachment_logging.use_attachment_log", False)
|
||||
)
|
||||
|
||||
def _post_add_create(self):
|
||||
result = super()._post_add_create()
|
||||
if not self._is_use_attachment_log():
|
||||
return result
|
||||
# Send notification after creation attachments
|
||||
for attachment in self:
|
||||
if self.pool and issubclass(
|
||||
self.pool[attachment.res_model], self.pool["mail.thread"]
|
||||
):
|
||||
attachment._send_attachment_notification(is_create=True)
|
||||
return result
|
||||
|
||||
def _delete_and_notify(self):
|
||||
if not self._is_use_attachment_log():
|
||||
return super()._delete_and_notify()
|
||||
# Send notification before unlink attachments
|
||||
for attachment in self:
|
||||
if self.pool and issubclass(
|
||||
self.pool[attachment.res_model], self.pool["mail.thread"]
|
||||
):
|
||||
attachment._send_attachment_notification(is_unlink=True)
|
||||
return super()._delete_and_notify()
|
||||
|
||||
def _attachment_format(self, legacy=False):
|
||||
res_list = super()._attachment_format(legacy=legacy)
|
||||
for res in res_list:
|
||||
attachment = self.browse(res.get("id"))
|
||||
res.update(**attachment.get_additional_data())
|
||||
return res_list
|
||||
|
||||
def get_additional_data(self):
|
||||
"""Get additional data for attachment"""
|
||||
self.ensure_one()
|
||||
return {
|
||||
"create_date": format_datetime(self.env, self.create_date),
|
||||
"create_user": self.create_uid.name,
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = "res.config.settings"
|
||||
|
||||
use_attachment_log = fields.Boolean(
|
||||
config_parameter="attachment_logging.use_attachment_log",
|
||||
help="Log attachment operations in chatter",
|
||||
)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
To enable note logging of attachment operations in record chatter:
|
||||
|
||||
- Go to "Settings > General Settings" and scroll to the "Discuss" section.
|
||||
- Activate the "Attachment Logging" checkbox.
|
||||
|
||||
.. image:: ../static/src/img/settings.png
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
- Cetmix <cetmix.com>
|
||||
|
||||
- Ivan Sokolov
|
||||
- Maksim Shurupov
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
This module shows attachment information in chatter. Following data is displayed:
|
||||
|
||||
- User, who has created the attachment
|
||||
- Attachment creation date
|
||||
|
||||
It also allows to log attachment related actions in the record chatter.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Create date and user are displayed next to attachments in chatter.
|
||||
When attachment is added or removed a note is logged in chatter if the corresponding option is enabled in the General Settings.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
|
|
@ -0,0 +1,454 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
|
||||
<title>README.rst</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
Despite the name, some widely supported CSS2 features are used.
|
||||
|
||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
.subscript {
|
||||
vertical-align: sub;
|
||||
font-size: smaller }
|
||||
|
||||
.superscript {
|
||||
vertical-align: super;
|
||||
font-size: smaller }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title, .code .error {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||
clear: left ;
|
||||
float: left ;
|
||||
margin-right: 1em }
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||
clear: right ;
|
||||
float: right ;
|
||||
margin-left: 1em }
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left }
|
||||
|
||||
.align-center {
|
||||
clear: both ;
|
||||
text-align: center }
|
||||
|
||||
.align-right {
|
||||
text-align: right }
|
||||
|
||||
/* reset inner alignment in figures */
|
||||
div.align-right {
|
||||
text-align: inherit }
|
||||
|
||||
/* div.align-center * { */
|
||||
/* text-align: left } */
|
||||
|
||||
.align-top {
|
||||
vertical-align: top }
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle }
|
||||
|
||||
.align-bottom {
|
||||
vertical-align: bottom }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font: inherit }
|
||||
|
||||
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: gray; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic, pre.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
/* "booktabs" style (no vertical lines) */
|
||||
table.docutils.booktabs {
|
||||
border: 0px;
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.docutils.booktabs * {
|
||||
border: 0px;
|
||||
}
|
||||
table.docutils.booktabs th {
|
||||
border-bottom: thin solid;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document">
|
||||
|
||||
|
||||
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
|
||||
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
|
||||
</a>
|
||||
<div class="section" id="attachment-logging">
|
||||
<h1>Attachment Logging</h1>
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:3d655774b23a7ef9fac54c63f7baeb7473eb31267eadf2f02c29292d7f1fe8b0
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/16.0/attachment_logging"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-attachment_logging"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module shows attachment information in chatter. Following data is displayed:</p>
|
||||
<ul class="simple">
|
||||
<li>User, who has created the attachment</li>
|
||||
<li>Attachment creation date</li>
|
||||
</ul>
|
||||
<p>It also allows to log attachment related actions in the record chatter.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
|
||||
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="configuration">
|
||||
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
|
||||
<p>To enable note logging of attachment operations in record chatter:</p>
|
||||
<ul class="simple">
|
||||
<li>Go to “Settings > General Settings” and scroll to the “Discuss” section.</li>
|
||||
<li>Activate the “Attachment Logging” checkbox.</li>
|
||||
</ul>
|
||||
<img alt="https://raw.githubusercontent.com/OCA/server-tools/16.0/attachment_logging/static/src/img/settings.png" src="https://raw.githubusercontent.com/OCA/server-tools/16.0/attachment_logging/static/src/img/settings.png" />
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
|
||||
<p>Create date and user are displayed next to attachments in chatter.
|
||||
When attachment is added or removed a note is logged in chatter if the corresponding option is enabled in the General Settings.</p>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20attachment_logging%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
|
||||
<div class="section" id="authors">
|
||||
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
|
||||
<ul class="simple">
|
||||
<li>Cetmix</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
|
||||
<ul class="simple">
|
||||
<li>Cetmix <cetmix.com><ul>
|
||||
<li>Ivan Sokolov</li>
|
||||
<li>Maksim Shurupov</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org">
|
||||
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
||||
</a>
|
||||
<p>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.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/16.0/attachment_logging">OCA/server-tools</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-inherit="mail.AttachmentCard" t-inherit-mode="extension">
|
||||
<xpath expr="//div[hasclass('o_AttachmentCard_details')]" position="inside">
|
||||
<div class="o_AttachmentCard_createDate text-truncate">
|
||||
<t t-esc="attachmentCard.attachment.create_user" /><br />
|
||||
<t t-esc="attachmentCard.attachment.create_date" />
|
||||
</div>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-inherit="mail.AttachmentImage" t-inherit-mode="extension">
|
||||
<div t-ref="root" position="inside">
|
||||
<t t-esc="attachmentImage.attachment.create_user" /><br />
|
||||
<t t-esc="attachmentImage.attachment.create_date" />
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 116 KiB |
|
|
@ -0,0 +1,24 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import {attr} from "@mail/model/model_field";
|
||||
import {registerPatch} from "@mail/model/model_core";
|
||||
|
||||
registerPatch({
|
||||
name: "Attachment",
|
||||
modelMethods: {
|
||||
convertData(data) {
|
||||
const data2 = this._super(data);
|
||||
if ("create_date" in data) {
|
||||
data2.create_date = data.create_date;
|
||||
}
|
||||
if ("create_user" in data) {
|
||||
data2.create_user = data.create_user;
|
||||
}
|
||||
return data2;
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
create_date: attr(),
|
||||
create_user: attr(),
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1 @@
|
|||
from . import test_ir_attachments
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
import json
|
||||
import tempfile
|
||||
|
||||
from odoo.http import Request
|
||||
from odoo.tools.misc import format_datetime
|
||||
|
||||
from odoo.addons.base.tests.common import HttpCaseWithUserDemo
|
||||
|
||||
|
||||
class TestIrAttachments(HttpCaseWithUserDemo):
|
||||
def _make_rpc(self, route, params, headers=None):
|
||||
data = json.dumps(
|
||||
{
|
||||
"id": 0,
|
||||
"jsonrpc": "2.0",
|
||||
"method": "call",
|
||||
"params": params,
|
||||
}
|
||||
).encode()
|
||||
headers = headers or {}
|
||||
headers["Content-Type"] = "application/json"
|
||||
return self.url_open(route, data, headers=headers)
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.partner = self.env["res.partner"].create({"name": "Test Partner #1"})
|
||||
self.mt_attachment = self.env.ref("attachment_logging.mt_attachment")
|
||||
|
||||
def _attach_temp_file(self):
|
||||
"""Attach temp file to partner record"""
|
||||
with tempfile.NamedTemporaryFile(mode="rb") as f:
|
||||
response = self.url_open(
|
||||
url=f"{self.base_url()}/mail/attachment/upload",
|
||||
data={
|
||||
"thread_id": self.partner.id,
|
||||
"thread_model": "res.partner",
|
||||
"csrf_token": Request.csrf_token(self),
|
||||
},
|
||||
files={"ufile": f},
|
||||
)
|
||||
return response
|
||||
|
||||
def _delete_attachment(self, attachment_id):
|
||||
"""Delete attachment from partner record"""
|
||||
response = self._make_rpc(
|
||||
f"{self.base_url()}/mail/attachment/delete",
|
||||
{
|
||||
"attachment_id": attachment_id,
|
||||
},
|
||||
)
|
||||
return response
|
||||
|
||||
def test_upload_file_without_config(self):
|
||||
"""Test flow where upload temp file to record (default behavior)"""
|
||||
self.authenticate("demo", "demo")
|
||||
message_count = len(self.partner.message_ids)
|
||||
response = self._attach_temp_file()
|
||||
data = response.json()
|
||||
self.assertEqual(
|
||||
response.status_code, 200, "Response status code must be equal to 200 (OK)"
|
||||
)
|
||||
attachments = self.env["ir.attachment"].search(
|
||||
[
|
||||
("res_id", "=", self.partner.id),
|
||||
("res_model", "=", "res.partner"),
|
||||
]
|
||||
)
|
||||
self.assertEqual(len(attachments), 1, "Count attachment must be equal to 1")
|
||||
self.assertEqual(
|
||||
data.get("id"), attachments.id, "Attachment ID must be the same"
|
||||
)
|
||||
self.assertEqual(
|
||||
data.get("create_user"),
|
||||
attachments.create_uid.name,
|
||||
"Attachment create user name must be the same",
|
||||
)
|
||||
self.assertEqual(
|
||||
data.get("create_date"),
|
||||
format_datetime(self.env, attachments.create_date),
|
||||
"Attachment create date must be the same",
|
||||
)
|
||||
self.assertEqual(
|
||||
len(self.partner.message_ids),
|
||||
message_count,
|
||||
"Message count must be the same",
|
||||
)
|
||||
|
||||
def test_upload_file_with_config(self):
|
||||
"""Test flow where upload temp file to record with log message"""
|
||||
self.authenticate("demo", "demo")
|
||||
message_count = len(self.partner.message_ids)
|
||||
self.env["ir.config_parameter"].sudo().set_param(
|
||||
"attachment_logging.use_attachment_log", True
|
||||
)
|
||||
response = self._attach_temp_file()
|
||||
data = response.json()
|
||||
self.assertEqual(
|
||||
response.status_code, 200, "Response status code must be equal to 200 (OK)"
|
||||
)
|
||||
attachments = self.env["ir.attachment"].search(
|
||||
[
|
||||
("res_id", "=", self.partner.id),
|
||||
("res_model", "=", "res.partner"),
|
||||
]
|
||||
)
|
||||
self.assertEqual(len(attachments), 1, "Count attachment must be equal to 1")
|
||||
self.assertEqual(
|
||||
data.get("id"), attachments.id, "Attachment ID must be the same"
|
||||
)
|
||||
attachment_addition_data = attachments.get_additional_data()
|
||||
self.assertEqual(
|
||||
data.get("create_user"),
|
||||
attachment_addition_data.get("create_user"),
|
||||
"Attachment authors must be the same",
|
||||
)
|
||||
self.assertEqual(
|
||||
data.get("create_date"),
|
||||
attachment_addition_data.get("create_date"),
|
||||
"Dates must be the same",
|
||||
)
|
||||
self.assertNotEqual(
|
||||
len(self.partner.message_ids),
|
||||
message_count,
|
||||
"Message count must not be the same",
|
||||
)
|
||||
last_message = self.partner.message_ids[0]
|
||||
self.assertEqual(
|
||||
last_message.subtype_id,
|
||||
self.mt_attachment,
|
||||
"Message subtypes must be the same",
|
||||
)
|
||||
self.assertEqual(
|
||||
last_message.author_id,
|
||||
self.env.ref("base.user_root").partner_id,
|
||||
"Message author must be OdooBot",
|
||||
)
|
||||
self.assertIn(
|
||||
"attached", last_message.body, "Message body must be contain 'attached'"
|
||||
)
|
||||
|
||||
def test_delete_attachment_without_config(self):
|
||||
"""Test flow where delete attachment from record (default behavior)"""
|
||||
self.authenticate("demo", "demo")
|
||||
message_count = len(self.partner.message_ids)
|
||||
response = self._attach_temp_file()
|
||||
data = response.json()
|
||||
attachments = self.env["ir.attachment"].search(
|
||||
[
|
||||
("res_id", "=", self.partner.id),
|
||||
("res_model", "=", "res.partner"),
|
||||
]
|
||||
)
|
||||
self.assertEqual(len(attachments), 1, "Count attachment must be equal to 1")
|
||||
self.assertEqual(
|
||||
response.status_code, 200, "Response status code must be equal to 200 (OK)"
|
||||
)
|
||||
self._delete_attachment(attachment_id=data["id"])
|
||||
attachments = self.env["ir.attachment"].search(
|
||||
[
|
||||
("res_id", "=", self.partner.id),
|
||||
("res_model", "=", "res.partner"),
|
||||
]
|
||||
)
|
||||
self.assertFalse(attachments, "Attachments must be empty")
|
||||
self.assertEqual(
|
||||
len(self.partner.message_ids),
|
||||
message_count,
|
||||
"Message count must be the same",
|
||||
)
|
||||
|
||||
def test_delete_attachment_with_config(self):
|
||||
"""Test flow where delete attachment from record with log message"""
|
||||
self.authenticate("demo", "demo")
|
||||
message_count = len(self.partner.message_ids)
|
||||
self.env["ir.config_parameter"].sudo().set_param(
|
||||
"attachment_logging.use_attachment_log", True
|
||||
)
|
||||
response = self._attach_temp_file()
|
||||
data = response.json()
|
||||
self.assertEqual(
|
||||
response.status_code, 200, "Response status code must be equal to 200 (OK)"
|
||||
)
|
||||
self._delete_attachment(attachment_id=data["id"])
|
||||
attachments = self.env["ir.attachment"].search(
|
||||
[
|
||||
("res_id", "=", self.partner.id),
|
||||
("res_model", "=", "res.partner"),
|
||||
]
|
||||
)
|
||||
self.assertFalse(attachments, "Attachments must be empty")
|
||||
self.assertNotEqual(
|
||||
len(self.partner.message_ids),
|
||||
message_count,
|
||||
"Message count must not be the same",
|
||||
)
|
||||
last_message = self.partner.message_ids[0]
|
||||
self.assertEqual(
|
||||
last_message.subtype_id,
|
||||
self.mt_attachment,
|
||||
"Message subtypes must be the same",
|
||||
)
|
||||
self.assertEqual(
|
||||
last_message.author_id,
|
||||
self.env.ref("base.user_root").partner_id,
|
||||
"Message author must be OdooBot",
|
||||
)
|
||||
self.assertIn(
|
||||
"unlinked", last_message.body, "Message body must be contain 'unlinked'"
|
||||
)
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="res_config_settings_form_view" model="ir.ui.view">
|
||||
<field
|
||||
name="name"
|
||||
>res.config.settings.form.view.inherited.attachment_logging</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="mail.res_config_settings_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<div id="emails" position="inside">
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="use_attachment_log" />
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<span class="o_form_label">Attachment Logging</span>
|
||||
<div class="text-muted col-md-12">
|
||||
Log a note in record chatter when an attachment is added or removed.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue