Browse Source
[ADD] base_import_csv_restrict:
[ADD] base_import_csv_restrict:
Added module for making csv import optional based on users groups.pull/743/head
Alejandro Santana
9 years ago
committed by
Stefan Rijnhart
18 changed files with 579 additions and 0 deletions
-
65base_import_csv_optional/README.rst
-
5base_import_csv_optional/__init__.py
-
47base_import_csv_optional/__openerp__.py
-
21base_import_csv_optional/i18n/base_import_csv_optional.pot
-
21base_import_csv_optional/i18n/ca.po
-
21base_import_csv_optional/i18n/es.po
-
21base_import_csv_optional/i18n/fr.po
-
21base_import_csv_optional/i18n/gl.po
-
21base_import_csv_optional/i18n/it.po
-
21base_import_csv_optional/i18n/pt.po
-
21base_import_csv_optional/i18n/sk.po
-
5base_import_csv_optional/models/__init__.py
-
36base_import_csv_optional/models/models.py
-
13base_import_csv_optional/security/base_import_csv_optional_security.xml
-
BINbase_import_csv_optional/static/description/icon.png
-
168base_import_csv_optional/static/description/icon.svg
-
59base_import_csv_optional/static/src/js/import.js
-
13base_import_csv_optional/views/base_import.xml
@ -0,0 +1,65 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:alt: License: AGPL-3 |
|||
|
|||
Group-based permissions for importing CSV files |
|||
=============================================== |
|||
|
|||
This module makes importing data from CSV files optional for each user, |
|||
allowing it only for those users belonging to a specific group. |
|||
Any other user not belonging to such group will not have the "Import" button |
|||
available anywhere. The action will even be blocked internally (to prevent |
|||
XMLRPC access, for example). |
|||
|
|||
|
|||
Usage |
|||
===== |
|||
|
|||
To allow a user to import data from CSV files, just follow this steps: |
|||
|
|||
* Go to *Settings/Users/Users* menu. |
|||
* Enter the user you want to allow. |
|||
* Within the "Access Rights" tab and "Technical Settings" group, check the |
|||
option "Allow importing CSV files". |
|||
|
|||
|
|||
For further information, please visit: |
|||
|
|||
- https://www.odoo.com/forum/help-1 |
|||
|
|||
|
|||
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 smashing it by providing a detailed and welcomed feedback |
|||
`here <https://github.com/OCA/server-tools/issues/new?body=module:%20super_calendar%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
|||
|
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Alejandro Santana <alejandrosantana@anubia.es> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: http://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: http://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. |
|||
|
|||
Icon |
|||
---- |
|||
|
|||
Iconic fonts used in module icon are Font Awesome: http://fontawesome.io/ |
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License and authorship info in: |
|||
# __openerp__.py file at the root folder of this module. |
|||
|
|||
from . import models |
@ -0,0 +1,47 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Odoo, Open Source Management Solution |
|||
# |
|||
# Copyright (c) All rights reserved: |
|||
# (c) 2015 Anubía, soluciones en la nube,SL (http://www.anubia.es) |
|||
# Alejandro Santana <alejandrosantana@anubia.es> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see http://www.gnu.org/licenses |
|||
# |
|||
############################################################################## |
|||
{ |
|||
'name': 'Optional CSV import', |
|||
'version': '1.0', |
|||
'category': 'Server tools', |
|||
'summary': 'Group-based permissions for importing CSV files', |
|||
'license': 'AGPL-3', |
|||
'author': 'Odoo Community Association (OCA), ' |
|||
'Alejandro Santana <alejandrosantana@anubia.es>', |
|||
'maintainer': 'Odoo Community Association (OCA)', |
|||
'website': 'http://odoo-community.org', |
|||
'depends': [ |
|||
'base_import' |
|||
], |
|||
'data': [ |
|||
'security/base_import_csv_optional_security.xml', |
|||
'views/base_import.xml', |
|||
], |
|||
'js': [ |
|||
'static/src/js/import.js', |
|||
], |
|||
'installable': True, |
|||
'application': False, |
|||
'auto_install': False, |
|||
} |
@ -0,0 +1,21 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_import_csv_optional |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-08-06 18:37+0000\n" |
|||
"PO-Revision-Date: 2015-08-06 18:37+0000\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: base_import_csv_optional |
|||
#: model:res.groups,name:base_import_csv_optional.group_import_csv |
|||
msgid "Import CSV files" |
|||
msgstr "" |
@ -0,0 +1,21 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_import_csv_optional |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-08-06 18:37+0000\n" |
|||
"PO-Revision-Date: 2015-08-06 18:37+0000\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: base_import_csv_optional |
|||
#: model:res.groups,name:base_import_csv_optional.group_import_csv |
|||
msgid "Import CSV files" |
|||
msgstr "Importar arxius CSV" |
@ -0,0 +1,21 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_import_csv_optional |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-08-06 18:37+0000\n" |
|||
"PO-Revision-Date: 2015-08-06 18:37+0000\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: base_import_csv_optional |
|||
#: model:res.groups,name:base_import_csv_optional.group_import_csv |
|||
msgid "Import CSV files" |
|||
msgstr "Importar archivos CSV" |
@ -0,0 +1,21 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_import_csv_optional |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-08-06 18:37+0000\n" |
|||
"PO-Revision-Date: 2015-08-06 18:37+0000\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: base_import_csv_optional |
|||
#: model:res.groups,name:base_import_csv_optional.group_import_csv |
|||
msgid "Import CSV files" |
|||
msgstr "Importation de fichiers CSV" |
@ -0,0 +1,21 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_import_csv_optional |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-08-06 18:37+0000\n" |
|||
"PO-Revision-Date: 2015-08-06 18:37+0000\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: base_import_csv_optional |
|||
#: model:res.groups,name:base_import_csv_optional.group_import_csv |
|||
msgid "Import CSV files" |
|||
msgstr "Importar arquivos CSV" |
@ -0,0 +1,21 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_import_csv_optional |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-08-06 18:37+0000\n" |
|||
"PO-Revision-Date: 2015-08-06 18:37+0000\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: base_import_csv_optional |
|||
#: model:res.groups,name:base_import_csv_optional.group_import_csv |
|||
msgid "Import CSV files" |
|||
msgstr "Importazione di file CSV" |
@ -0,0 +1,21 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_import_csv_optional |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-08-06 18:37+0000\n" |
|||
"PO-Revision-Date: 2015-08-06 18:37+0000\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: base_import_csv_optional |
|||
#: model:res.groups,name:base_import_csv_optional.group_import_csv |
|||
msgid "Import CSV files" |
|||
msgstr "Importar arquivos CSV" |
@ -0,0 +1,21 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_import_csv_optional |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-08-06 18:37+0000\n" |
|||
"PO-Revision-Date: 2015-08-06 18:37+0000\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: base_import_csv_optional |
|||
#: model:res.groups,name:base_import_csv_optional.group_import_csv |
|||
msgid "Import CSV files" |
|||
msgstr "Importovať súbory CSV" |
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License and authorship info in: |
|||
# __openerp__.py file at the root folder of this module. |
|||
|
|||
from . import models |
@ -0,0 +1,36 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License and authorship info in: |
|||
# __openerp__.py file at the root folder of this module. |
|||
|
|||
from openerp import api |
|||
from openerp.models import BaseModel |
|||
import logging |
|||
|
|||
_logger = logging.getLogger(__name__) |
|||
base_load = BaseModel.load |
|||
|
|||
|
|||
@api.model |
|||
def load_import_optional(self, fields=None, data=None): |
|||
'''Overriding this method we only allow its execution |
|||
if current user belongs to the group allowed for CSV data import. |
|||
An exception is raised otherwise, and also log the import attempt. |
|||
''' |
|||
res = {} |
|||
current_user = self.env['res.users'].browse(self.env.uid) |
|||
allowed_group = 'base_import_csv_optional.group_import_csv' |
|||
if current_user and current_user.has_group(allowed_group): |
|||
res = base_load(self, fields=fields, data=data) |
|||
else: |
|||
msg = ('User (ID: %s) is not allowed to import data ' |
|||
'in model %s.') % (self.env.uid, self._name) |
|||
_logger.error(msg) |
|||
messages = [] |
|||
info = {} |
|||
messages.append(dict(info, type='error', message=msg, moreinfo=None)) |
|||
res = {'ids': None, 'messages': messages} |
|||
return res |
|||
|
|||
# Monkey patch function |
|||
# Because BaseModel _name = None |
|||
BaseModel.load = load_import_optional |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data noupdate="0"> |
|||
|
|||
<!-- GROUPS --> |
|||
<record id="group_import_csv" model="res.groups"> |
|||
<field name="name">Import CSV files</field> |
|||
<field name="category_id" ref="base.module_category_hidden"/> |
|||
<field name="users" eval="[(4, ref('base.user_root'))]"/> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
After Width: 128 | Height: 128 | Size: 2.7 KiB |
@ -0,0 +1,168 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|||
<!-- Created with Inkscape (http://www.inkscape.org/) --> |
|||
|
|||
<svg |
|||
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|||
xmlns:cc="http://creativecommons.org/ns#" |
|||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|||
xmlns:svg="http://www.w3.org/2000/svg" |
|||
xmlns="http://www.w3.org/2000/svg" |
|||
xmlns:xlink="http://www.w3.org/1999/xlink" |
|||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
|||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
|||
id="svg2" |
|||
version="1.1" |
|||
inkscape:version="0.48.4 r9939" |
|||
width="128" |
|||
height="128" |
|||
sodipodi:docname="icon.svg" |
|||
inkscape:export-filename="icon.png" |
|||
inkscape:export-xdpi="90" |
|||
inkscape:export-ydpi="90"> |
|||
<metadata |
|||
id="metadata8"> |
|||
<rdf:RDF> |
|||
<cc:Work |
|||
rdf:about=""> |
|||
<dc:format>image/svg+xml</dc:format> |
|||
<dc:type |
|||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
|||
<dc:title /> |
|||
</cc:Work> |
|||
</rdf:RDF> |
|||
</metadata> |
|||
<defs |
|||
id="defs6"> |
|||
<linearGradient |
|||
id="linearGradient3779"> |
|||
<stop |
|||
style="stop-color:#ff6600;stop-opacity:1;" |
|||
offset="0" |
|||
id="stop3781" /> |
|||
<stop |
|||
style="stop-color:#ffcc00;stop-opacity:1;" |
|||
offset="1" |
|||
id="stop3783" /> |
|||
</linearGradient> |
|||
<linearGradient |
|||
id="linearGradient3798"> |
|||
<stop |
|||
style="stop-color:#99cc00;stop-opacity:1;" |
|||
offset="0" |
|||
id="stop3800" /> |
|||
<stop |
|||
style="stop-color:#669900;stop-opacity:1;" |
|||
offset="1" |
|||
id="stop3802" /> |
|||
</linearGradient> |
|||
<linearGradient |
|||
inkscape:collect="always" |
|||
xlink:href="#linearGradient3798" |
|||
id="linearGradient3804" |
|||
x1="64" |
|||
y1="124" |
|||
x2="64" |
|||
y2="4" |
|||
gradientUnits="userSpaceOnUse" |
|||
gradientTransform="translate(-140,0)" /> |
|||
<linearGradient |
|||
inkscape:collect="always" |
|||
xlink:href="#linearGradient3798" |
|||
id="linearGradient4053" |
|||
gradientUnits="userSpaceOnUse" |
|||
x1="64" |
|||
y1="124" |
|||
x2="64" |
|||
y2="4" /> |
|||
<linearGradient |
|||
inkscape:collect="always" |
|||
xlink:href="#linearGradient3779" |
|||
id="linearGradient3874" |
|||
x1="64" |
|||
y1="136" |
|||
x2="64" |
|||
y2="8" |
|||
gradientUnits="userSpaceOnUse" /> |
|||
</defs> |
|||
<sodipodi:namedview |
|||
pagecolor="#ffffff" |
|||
bordercolor="#666666" |
|||
borderopacity="1" |
|||
objecttolerance="10" |
|||
gridtolerance="10" |
|||
guidetolerance="10" |
|||
inkscape:pageopacity="0" |
|||
inkscape:pageshadow="2" |
|||
inkscape:window-width="1920" |
|||
inkscape:window-height="1025" |
|||
id="namedview4" |
|||
showgrid="false" |
|||
inkscape:zoom="1.4142136" |
|||
inkscape:cx="24.182947" |
|||
inkscape:cy="79.115464" |
|||
inkscape:window-x="-2" |
|||
inkscape:window-y="-3" |
|||
inkscape:window-maximized="1" |
|||
inkscape:current-layer="svg2" |
|||
inkscape:snap-bbox="false" |
|||
inkscape:bbox-paths="true" |
|||
inkscape:bbox-nodes="true" |
|||
inkscape:snap-bbox-edge-midpoints="true" |
|||
inkscape:snap-bbox-midpoints="true" |
|||
inkscape:object-paths="true" |
|||
inkscape:snap-midpoints="true" |
|||
inkscape:snap-object-midpoints="true" |
|||
inkscape:snap-center="true" |
|||
inkscape:snap-page="false" |
|||
inkscape:snap-smooth-nodes="true" |
|||
inkscape:object-nodes="true" |
|||
inkscape:snap-intersection-paths="true" |
|||
inkscape:snap-grids="false" |
|||
showguides="true" |
|||
inkscape:guide-bbox="true" |
|||
borderlayer="true" |
|||
inkscape:snap-nodes="false" |
|||
inkscape:snap-global="true"> |
|||
<inkscape:grid |
|||
type="xygrid" |
|||
id="grid2984" |
|||
empspacing="4" |
|||
visible="true" |
|||
enabled="true" |
|||
snapvisiblegridlinesonly="true" |
|||
dotted="false" /> |
|||
</sodipodi:namedview> |
|||
<rect |
|||
style="fill:#ff7f2a;fill-opacity:1;stroke:none" |
|||
id="rect3858" |
|||
width="128" |
|||
height="128" |
|||
x="-128" |
|||
y="0" |
|||
transform="matrix(0,-1,1,0,0,0)" /> |
|||
<text |
|||
xml:space="preserve" |
|||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" |
|||
x="-184.20132" |
|||
y="6.0240803" |
|||
id="text2995" |
|||
sodipodi:linespacing="125%"><tspan |
|||
sodipodi:role="line" |
|||
id="tspan2997" |
|||
x="-184.20132" |
|||
y="6.0240803" /></text> |
|||
<path |
|||
style="fill:#c87137;fill-opacity:1;stroke:none" |
|||
d="M 48.46875 39.1875 L 0 87.65625 L 0 128 L 76.78125 128 L 102.90625 101.875 L 99.53125 98.5 L 101.9375 96.0625 L 92.71875 86.8125 L 90.28125 89.25 L 80.09375 79.0625 L 80.0625 79.125 L 78.96875 78.03125 L 68.09375 88.90625 L 69.1875 89.96875 L 64.75 94.40625 L 59.90625 89.53125 L 72.34375 77.09375 L 67.6875 72.4375 L 87.71875 52.40625 L 78.5 43.15625 L 65.46875 56.1875 L 48.46875 39.1875 z " |
|||
id="rect3087" /> |
|||
<path |
|||
id="path3027" |
|||
d="m 85.85809,93.664544 q 0,-1.26855 -0.92703,-2.195567 -0.92701,-0.927017 -2.19556,-0.927017 -1.26855,0 -2.19557,0.927017 -0.92702,0.927017 -0.92702,2.195567 0,1.268548 0.92702,2.195566 0.92702,0.927017 2.19557,0.927017 1.26855,0 2.19556,-0.927017 0.92703,-0.927018 0.92703,-2.195566 z m 12.49033,0 q 0,-1.26855 -0.92702,-2.195567 -0.92702,-0.927017 -2.19556,-0.927017 -1.26856,0 -2.19557,0.927017 -0.92702,0.927017 -0.92702,2.195567 0,1.268548 0.92702,2.195566 0.92701,0.927017 2.19557,0.927017 1.26854,0 2.19556,-0.927017 0.92702,-0.927018 0.92702,-2.195566 z M 104.59359,82.7355 v 15.612919 q 0,1.951621 -1.36614,3.317751 -1.36613,1.36613 -3.31774,1.36613 H 28.09028 q -1.95161,0 -3.31774,-1.36613 -1.36613,-1.36613 -1.36613,-3.317751 V 82.7355 q 0,-1.951615 1.36613,-3.317745 1.36613,-1.36613 3.31774,-1.36613 h 20.83349 q 1.0246,2.73226 3.43972,4.488715 2.41512,1.756452 5.39134,1.756452 h 12.49033 q 2.97621,0 5.39134,-1.756452 2.41512,-1.756455 3.43972,-4.488715 h 20.83349 q 1.95161,0 3.31774,1.36613 1.36614,1.36613 1.36614,3.317745 z M 88.73671,51.119343 q -0.82943,1.951614 -2.87862,1.951614 H 73.36775 v 21.858085 q 0,1.26855 -0.92702,2.195567 -0.92702,0.927017 -2.19557,0.927017 H 57.75483 q -1.26855,0 -2.19557,-0.927017 -0.92701,-0.927017 -0.92701,-2.195567 V 53.070957 H 42.14191 q -2.04919,0 -2.87863,-1.951614 -0.82944,-1.902825 0.68306,-3.366536 L 61.80443,25.894722 Q 62.68265,24.967705 64,24.967705 q 1.31733,0 2.19556,0.927017 l 21.85809,21.858085 q 1.5125,1.463711 0.68306,3.366536 z" |
|||
inkscape:connector-curvature="0" |
|||
style="fill:#ffffff" /> |
|||
<path |
|||
id="path3016" |
|||
d="m 66.979191,59.343527 v 4.895685 q 0,0.326379 -0.244778,0.571165 -0.244797,0.244783 -0.571181,0.244783 h -4.895668 q -0.326383,0 -0.571181,-0.244783 -0.244777,-0.244786 -0.244777,-0.571165 v -4.895685 q 0,-0.32638 0.244777,-0.571163 0.244798,-0.244785 0.571181,-0.244785 h 4.895668 q 0.326384,0 0.571181,0.244785 0.244778,0.244783 0.244778,0.571163 z M 73.42517,47.104314 q 0,1.101528 -0.316172,2.060266 -0.316173,0.958739 -0.713951,1.560501 -0.397778,0.601761 -1.121941,1.213721 -0.724141,0.611962 -1.172913,0.887343 -0.448772,0.275383 -1.244329,0.724154 -0.836339,0.469171 -1.397309,1.325916 -0.56097,0.856745 -0.56097,1.366711 0,0.346777 -0.244778,0.662957 -0.244777,0.316181 -0.57116,0.316181 h -4.895689 q -0.305982,0 -0.520167,-0.377377 -0.214185,-0.377375 -0.214185,-0.76495 v -0.917942 q 0,-1.69309 1.325914,-3.192395 1.325915,-1.499303 2.917008,-2.213257 1.203525,-0.550764 1.713502,-1.142326 0.509956,-0.591562 0.509956,-1.5503 0,-0.856745 -0.948537,-1.509503 -0.948538,-0.652759 -2.192846,-0.652759 -1.325915,0 -2.203057,0.591562 -0.713971,0.509966 -2.182676,2.345849 -0.265178,0.326379 -0.632345,0.326379 -0.244797,0 -0.509976,-0.163189 L 54.903171,45.45202 q -0.265199,-0.203986 -0.316193,-0.509968 -0.05099,-0.30598 0.112198,-0.571163 3.263793,-5.426052 9.464994,-5.426052 1.631896,0 3.284194,0.632361 1.652298,0.632359 2.978212,1.69309 1.325915,1.060732 2.162254,2.600834 0.83634,1.540099 0.83634,3.233192 z" |
|||
inkscape:connector-curvature="0" |
|||
style="fill:#c87137" /> |
|||
</svg> |
@ -0,0 +1,59 @@ |
|||
// License, author and contributors information in:
|
|||
// __openerp__.py file at the root folder of this module.
|
|||
|
|||
openerp.base_import_csv_optional = function (instance) { |
|||
var QWeb = instance.web.qweb; |
|||
var _t = instance.web._t; |
|||
var _lt = instance.web._lt; |
|||
|
|||
instance.web.ListView.prototype.defaults.import_enabled = false; |
|||
base_import_csv_optional = instance.web.ListView.include({ |
|||
load_list: function () { |
|||
var self = this; |
|||
var Users = new openerp.web.Model('res.users'); |
|||
|
|||
self._super.apply(self, arguments); |
|||
|
|||
Users.call('has_group', ['base_import_csv_optional.group_import_csv']) |
|||
.then(function (result) { |
|||
var import_enabled = result; |
|||
self.options.import_enabled = import_enabled; |
|||
|
|||
if (import_enabled) { |
|||
if (self.$buttons) { |
|||
self.$buttons.remove(); |
|||
} |
|||
self.$buttons = $(QWeb.render("ListView.buttons", {'widget': self})); |
|||
if (self.options.$buttons) { |
|||
self.$buttons.appendTo(self.options.$buttons); |
|||
} else { |
|||
self.$el.find('.oe_list_buttons').replaceWith(self.$buttons); |
|||
} |
|||
self.$buttons.find('.oe_list_add') |
|||
.click(self.proxy('do_add_record')) |
|||
.prop('disabled', self.grouped); |
|||
|
|||
self.$buttons.on('click', '.oe_list_button_import', function () { |
|||
self.do_action({ |
|||
type: 'ir.actions.client', |
|||
tag: 'import', |
|||
params: { |
|||
model: self.dataset.model, |
|||
// self.dataset.get_context() could be a compound?
|
|||
// not sure. action's context should be evaluated
|
|||
// so safer bet. Odd that timezone & al in it
|
|||
// though
|
|||
context: self.getParent().action.context |
|||
} |
|||
}, { |
|||
on_reverse_breadcrumb: function () { |
|||
self.reload(); |
|||
} |
|||
}); |
|||
return false; |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}; |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<template id="assets_backend" name="base_import_csv_optional assets" inherit_id="base_import.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<script type="text/javascript" src="/base_import_csv_optional/static/src/js/import.js"></script> |
|||
</xpath> |
|||
</template> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue