-
-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW] New module: attachment_attach_non_editable
In odoo, by default, you can't add attachments to a record if the form view is set as not editable (``edit='false'`` in the form tag) This module adds a new form view attribute, ``attach=``, which lets you enable attachment uploads even in non-editable forms.
- Loading branch information
Showing
6 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
=============================== | ||
Force enable attachments upload | ||
=============================== | ||
|
||
In odoo, by default, you can't add attachments to a record if the form view | ||
is set as not editable (``edit='false'`` in the form tag) | ||
|
||
This module adds a new form view attribute, ``attach=``, which lets you | ||
enable attachment uploads even in non-editable forms. | ||
|
||
Usage | ||
===== | ||
|
||
Add the ``attach=true`` attribute to the form view tag which of uneditable views | ||
(normal editable views already allow attaching a document and there is no need | ||
for this attribute). | ||
|
||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/ | ||
knowledge/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 `here <https://github.com/OCA/ | ||
knowledge/issues/new?body=module:%20 | ||
attachment_force_attach%0Aversion:%20 | ||
10.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Leonardo Donelli @ MONK Software (leonardo.donelli@monksoftware.it) | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
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. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2016 MONK Software | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Force enable attachments", | ||
"version": "10.0.1.0.0", | ||
"author": "MONK Software, Odoo Community Association (OCA)", | ||
"category": "Knowledge", | ||
"license": "AGPL-3", | ||
"website": "https://odoo-community.org/", | ||
"depends": ["document"], | ||
"data": [ | ||
'templates/web.xml', | ||
], | ||
"qweb": [ | ||
'static/src/xml/sidebar.xml', | ||
], | ||
"installable": True, | ||
"auto_install": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
odoo.define('attachment_attach_non_editable.sidebar', function(require) { | ||
"use strict"; | ||
|
||
var core = require('web.core'); | ||
var Sidebar = require('web.Sidebar'); | ||
|
||
|
||
Sidebar.include({ | ||
|
||
init: function(parent, options) { | ||
this._super.apply(this, arguments); | ||
if (parent.is_action_enabled('attach')) { | ||
this.options.attachable = true; | ||
} | ||
} | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<templates id="template" xml:space="preserve"> | ||
|
||
<t t-extend="Sidebar"> | ||
<t t-jquery=".o_sidebar_add_attachment"> | ||
this.attr('t-if', "section.name == 'files' and (widget.options.editable or widget.options.attachable)"); | ||
</t> | ||
</t> | ||
|
||
</templates> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<template id="assets_backend" name="document_type backend assets" inherit_id="web.assets_backend"> | ||
<xpath expr="." position="inside"> | ||
<script type="text/javascript" src="/attachment_attach_non_editable/static/src/js/sidebar.js"></script> | ||
</xpath> | ||
</template> | ||
|
||
</odoo> |