menu auf v10 geändert. 2 neue STandardmodule

develop
Andreas Brückl 2017-08-28 08:17:02 +02:00
parent 770e228936
commit e3988fe010
24 changed files with 601 additions and 11 deletions

View File

@ -32,22 +32,21 @@ class ir_ui_menu(models.Model):
_inherit = 'ir.ui.menu'
@tools.ormcache(skiparg=2)
def get_disabled_menu_ids(self, cr, uid, context=None):
data_obj = self.pool.get('ir.model.data')
def get_disabled_menu_ids(self):
menu_ids = []
for menu in DISABLED_MENUS:
module, xml_id = menu.split('.')
menu = data_obj.get_object(cr, uid, module, xml_id)
menu = self.env.ref(menu)
if menu:
menu_ids.append(menu.id)
return menu_ids
def _filter_visible_menus(self, cr, uid, ids, context=None):
if uid != 1:
disabled_ids = self.get_disabled_menu_ids(cr, uid)
ids = [id for id in ids if id not in disabled_ids]
@api.multi
def _filter_visible_menus(self):
if self.env.uid != 1:
disabled_ids = self.get_disabled_menu_ids()
ids = [id for id in self.ids if id not in disabled_ids]
self = self.browse(ids)
ids = super(ir_ui_menu, self)._filter_visible_menus(cr, uid, ids, context)
ids = super(ir_ui_menu, self)._filter_visible_menus()
return ids

View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# datenpol gmbh
# Copyright (C) 2013-TODAY datenpol gmbh (<http://www.datenpol.at/>)
#
# 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/>.
#
##############################################################################
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# datenpol gmbh
# Copyright (C) 2013-TODAY datenpol gmbh (<http://www.datenpol.at/>)
#
# 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': 'Max. Width for Form View',
'category': 'Custom',
'version': '1.0',
'description': """
""",
'author': 'datenpol GmbH',
'website': 'http://www.datenpol.at',
'depends': [],
'data': [
'views/max_width.xml',
],
'installable': True,
'sequence': 150,
'auto_install': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,13 @@
.o_followers .o_invite {
float: none !important;
display: block;
padding-left: 0px;
}
.o_form_sheet {
max-width: 95% !important;
}
.o_form_view .o_group.o_inner_group > tbody > tr > td.o_td_label {
min-width: 200px !important;
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- vim:fdn=3:
-->
<openerp>
<data>
<template id="assets_backend" name="mail assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/dp_max_width/static/src/css/max_width.css"/>
</xpath>
</template>
</data>
</openerp>

View File

@ -0,0 +1,73 @@
.. 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 Environment Ribbon
======================
Mark a Test Environment with a red ribbon on the top left corner in every page
.. image:: /web_environment_ribbon/static/description/screenshot.png
:alt: Screenshot
Installation
============
No special setup
Configuration
=============
* You can change the ribbon's name ("TEST") by editing the default system
parameter "ribbon.name" (in the menu Settings > Parameters > System
Parameters) To hide the ribbon, set this parameter to "False" or delete it.
* You can customize the ribbon color and background color through system
parameters: "ribbon.color", "ribbon.background.color". Fill with valid CSS
colors or just set to "False" to use default values.
* You can add the database name in the ribbon by adding "{db_name}" in the
system parameter "ribbon.name".
Usage
=====
To use this module, you need only to install it. After installation, a red
ribbon will be visible on top left corner of every Odoo backend page
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/162/10.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/web/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
=======
Contributors
------------
* Francesco Apruzzese <cescoap@gmail.com>
* Javi Melendez <javimelex@gmail.com>
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Thomas Binsfeld <thomas.binsfeld@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.

View File

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com>
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com>
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "Web Environment Ribbon",
'version': '10.0.1.0.0',
'category': 'Web',
'author': 'Francesco OpenCode Apruzzese, '
'Tecnativa, '
'Odoo Community Association (OCA)',
'website': 'https://it.linkedin.com/in/francescoapruzzese',
'license': 'AGPL-3',
"depends": [
'web',
],
"data": [
'view/base_view.xml',
'data/ribbon_data.xml',
],
"update_xml": [],
"demo_xml": [],
"auto_install": False,
'installable': True
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">
<!-- Add ribbon name default configuration parameter -->
<record id="default_ribbon_name" model="ir.config_parameter">
<field name="key">ribbon.name</field>
<field name="value"><![CDATA[TEST<br/>({db_name})]]></field>
</record>
<!-- Add ribbon color configuration parameter -->
<record id="set_ribbon_color" model="ir.config_parameter">
<field name="key">ribbon.color</field>
<field name="value">#f0f0f0</field>
</record>
<!-- Add ribbon background color configuration parameter -->
<record id="set_ribbon_background_color" model="ir.config_parameter">
<field name="key">ribbon.background.color</field>
<field name="value">rgba(255,0,0,.6)</field>
</record>
</odoo>

View File

@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_environment_ribbon
#
# Translators:
# Niki Waibel <niki.waibel@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-13 16:06+0000\n"
"PO-Revision-Date: 2017-07-13 16:06+0000\n"
"Last-Translator: Niki Waibel <niki.waibel@gmail.com>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_display_name
msgid "Display Name"
msgstr "Anzeigename"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_id
msgid "ID"
msgstr "ID"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend___last_update
msgid "Last Modified on"
msgstr ""
#. module: web_environment_ribbon
#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend
msgid "Web Environment Ribbon Backend"
msgstr ""

View File

@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_environment_ribbon
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Quentin THEURET <odoo@kerpeo.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-26 02:44+0000\n"
"PO-Revision-Date: 2017-07-26 02:44+0000\n"
"Last-Translator: Quentin THEURET <odoo@kerpeo.com>, 2017\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_id
msgid "ID"
msgstr "ID"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend___last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: web_environment_ribbon
#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend
msgid "Web Environment Ribbon Backend"
msgstr "Backend du bandeau de l'environnement Web"

View File

@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_environment_ribbon
#
# Translators:
# Bole <bole@dajmi5.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-13 16:06+0000\n"
"PO-Revision-Date: 2017-07-13 16:06+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>, 2017\n"
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: hr\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_display_name
msgid "Display Name"
msgstr "Naziv za prikaz"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_id
msgid "ID"
msgstr "ID"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend___last_update
msgid "Last Modified on"
msgstr "Zadnje modificirano"
#. module: web_environment_ribbon
#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend
msgid "Web Environment Ribbon Backend"
msgstr ""

View File

@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_environment_ribbon
#
# Translators:
# Peter Hageman <hageman.p@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-13 16:06+0000\n"
"PO-Revision-Date: 2017-07-13 16:06+0000\n"
"Last-Translator: Peter Hageman <hageman.p@gmail.com>, 2017\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/23907/nl_NL/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nl_NL\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_display_name
msgid "Display Name"
msgstr "Weergavenaam"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_id
msgid "ID"
msgstr "ID"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend___last_update
msgid "Last Modified on"
msgstr ""
#. module: web_environment_ribbon
#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend
msgid "Web Environment Ribbon Backend"
msgstr ""

View File

@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_environment_ribbon
#
# Translators:
# Rodrigo de Almeida Sottomaior Macedo <rmsolucoeseminformatic4@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-13 16:06+0000\n"
"PO-Revision-Date: 2017-07-13 16:06+0000\n"
"Last-Translator: Rodrigo de Almeida Sottomaior Macedo <rmsolucoeseminformatic4@gmail.com>, 2017\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_display_name
msgid "Display Name"
msgstr "Exibir Nome"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_id
msgid "ID"
msgstr "Identificação"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend___last_update
msgid "Last Modified on"
msgstr "Última Modificação em"
#. module: web_environment_ribbon
#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend
msgid "Web Environment Ribbon Backend"
msgstr ""

View File

@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_environment_ribbon
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-13 16:06+0000\n"
"PO-Revision-Date: 2017-07-13 16:06+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_display_name
msgid "Display Name"
msgstr ""
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend_id
msgid "ID"
msgstr "ID"
#. module: web_environment_ribbon
#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend___last_update
msgid "Last Modified on"
msgstr ""
#. module: web_environment_ribbon
#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend
msgid "Web Environment Ribbon Backend"
msgstr ""

View File

@ -0,0 +1 @@
from . import web_environment_ribbon_backend

View File

@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, models
class WebEnvironmentRibbonBackend(models.AbstractModel):
_name = 'web.environment.ribbon.backend'
_description = 'Web Environment Ribbon Backend'
@api.model
def _prepare_ribbon_format_vals(self):
return {
'db_name': self.env.cr.dbname,
}
@api.model
def _prepare_ribbon_name(self):
name_tmpl = self.env['ir.config_parameter'].get_param('ribbon.name')
vals = self._prepare_ribbon_format_vals()
return name_tmpl.format(**vals)
@api.model
def get_environment_ribbon(self):
"""
This method returns the ribbon data from ir config parameters
:return: dictionary
"""
ir_config_model = self.env['ir.config_parameter']
name = self._prepare_ribbon_name()
return {
'name': name,
'color': ir_config_model.get_param('ribbon.color'),
'background_color': ir_config_model.get_param(
'ribbon.background.color'),
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -0,0 +1,28 @@
/* Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com>
Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu>
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
.test-ribbon{
width: 300px;
top: 25px;
left: -100px;
text-align: center;
padding: 10px;
line-height: 20px;
letter-spacing: 1px;
color: #f0f0f0;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
z-index: 9999;
position: fixed;
box-shadow: 0 0 3px rgba(0,0,0,.3);
background: rgba(255,0,0,.6);
pointer-events: none;
}
.test-ribbon b {
font-size: 20px;
}

View File

@ -0,0 +1,54 @@
/* Copyright 2015 Sylvain Calador <sylvain.calador@akretion.com>
Copyright 2015 Javi Melendez <javi.melendez@algios.com>
Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu>
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define('web_environment_ribbon.ribbon', function(require) {
"use strict";
var $ = require('jquery');
var Model = require('web.Model');
var core = require('web.core');
var backend_model = new Model('web.environment.ribbon.backend');
// Code from: http://jsfiddle.net/WK_of_Angmar/xgA5C/
function validStrColour(strToTest) {
if (strToTest === "") { return false; }
if (strToTest === "inherit") { return true; }
if (strToTest === "transparent") { return true; }
var image = document.createElement("img");
image.style.color = "rgb(0, 0, 0)";
image.style.color = strToTest;
if (image.style.color !== "rgb(0, 0, 0)") { return true; }
image.style.color = "rgb(255, 255, 255)";
image.style.color = strToTest;
return image.style.color !== "rgb(255, 255, 255)";
}
core.bus.on('web_client_ready', null, function () {
var ribbon = $('<div class="test-ribbon"/>');
$('body').append(ribbon);
ribbon.hide();
// Get ribbon data from backend
backend_model.call('get_environment_ribbon').then(
function (ribbon_data) {
// Ribbon name
if (ribbon_data.name && ribbon_data.name != 'False') {
ribbon.html(ribbon_data.name);
ribbon.show();
}
// Ribbon color
if (ribbon_data.color && validStrColour(ribbon_data.color)) {
ribbon.css('color', ribbon_data.color);
}
// Ribbon background color
if (ribbon_data.background_color && validStrColour(ribbon_data.background_color)) {
ribbon.css('background-color', ribbon_data.background_color);
}
}
);
});
}); // odoo.define

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com>
Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<!-- Load css for ribbons -->
<template id="assets_backend" name="ribbon_test assets"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet"
href="/web_environment_ribbon/static/src/css/ribbon.css"/>
<script type="text/javascript"
src="/web_environment_ribbon/static/src/js/ribbon.js"/>
</xpath>
</template>
</odoo>

View File

@ -1,7 +1,7 @@
#!/bin/bash
HOST='tbd'
HOST='lst.datenpol.at'
PORT=22
if [ $# -lt 1 ] || [ $# -gt 1 ]; then