Browse Source

Merge 3f9728ee95 into ad79aa45cf

pull/657/merge
Benjamin Willig (ACSONE) 5 years ago
committed by GitHub
parent
commit
76cf18aeb7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      setup/web_form_sidebar_hide_attachment/odoo/__init__.py
  2. 1
      setup/web_form_sidebar_hide_attachment/odoo/addons/__init__.py
  3. 1
      setup/web_form_sidebar_hide_attachment/odoo/addons/web_form_sidebar_hide_attachment
  4. 6
      setup/web_form_sidebar_hide_attachment/setup.py
  5. 72
      web_form_sidebar_hide_attachment/README.rst
  6. 0
      web_form_sidebar_hide_attachment/__init__.py
  7. 21
      web_form_sidebar_hide_attachment/__manifest__.py
  8. BIN
      web_form_sidebar_hide_attachment/static/description/icon.png
  9. 37
      web_form_sidebar_hide_attachment/static/src/js/sidebar.js
  10. 13
      web_form_sidebar_hide_attachment/views/assets.xml

1
setup/web_form_sidebar_hide_attachment/odoo/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/web_form_sidebar_hide_attachment/odoo/addons/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/web_form_sidebar_hide_attachment/odoo/addons/web_form_sidebar_hide_attachment

@ -0,0 +1 @@
../../../../web_form_sidebar_hide_attachment

6
setup/web_form_sidebar_hide_attachment/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

72
web_form_sidebar_hide_attachment/README.rst

@ -0,0 +1,72 @@
.. 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
================================
Web Form Sidebar Hide Attachment
================================
This module allows to hide attachment sidebar on specific form views.
Installation
============
This module depends on document.
Usage
=====
To use this module, you need to add an attribute on form views:
.. code-block:: xml
<form string="Partners" attachment_sidebar="false">
or
.. code-block:: xml
<form string="Partners" attachment_sidebar="0">
Known issues / Roadmap
======================
* Allow to define a parameter/property on a model to disable the attachment sidebar of all form views which belongs to the model.
* Allow to use a condition depending on the current record values.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/{project_repo}/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.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Benjamin Willig <benjamin.willig@acsone.eu>
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 https://odoo-community.org.

0
web_form_sidebar_hide_attachment/__init__.py

21
web_form_sidebar_hide_attachment/__manifest__.py

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Web Form Sidebar Hide Attachment',
'summary': """
Allow to hide the attachment sidebar available in the form view""",
'version': '10.0.1.0.0',
'license': 'AGPL-3',
'author': 'ACSONE SA/NV, Odoo Community Association (OCA)',
'website': 'https://www.acsone.eu',
'depends': [
'document',
],
'data': [
'views/assets.xml',
],
'demo': [
],
}

BIN
web_form_sidebar_hide_attachment/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

37
web_form_sidebar_hide_attachment/static/src/js/sidebar.js

@ -0,0 +1,37 @@
odoo.define('web_form_sidebar_hide_attachment.Sidebar', function (require) {
"use strict";
var Sidebar = require('web.Sidebar');
Sidebar.include({
init: function() {
var self = this;
self._super.apply(self, arguments);
if (!self.get_use_attachment_sidebar()) {
self.remove_attachment_sidebar();
}
},
get_use_attachment_sidebar: function() {
var self = this;
var view = self.getParent();
var fields_view = view.fields_view;
var use_sidebar = true;
if(fields_view && fields_view.type === 'form') {
use_sidebar = view.is_action_enabled('attachment_sidebar');
}
return use_sidebar;
},
remove_attachment_sidebar: function() {
var self = this;
var sections = self.sections;
self.sections = _.without(sections, _.findWhere(sections, {
name: 'files',
}));
}
});
});

13
web_form_sidebar_hide_attachment/views/assets.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="assets_backend" name="web_form_sidebar_hide_attachment assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_form_sidebar_hide_attachment/static/src/js/sidebar.js"/>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save