From e9b7102033824db05620a31ebded93947e146861 Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Mon, 8 Jul 2019 17:12:23 +0000 Subject: [PATCH] publish muk_web_theme - 12.0 --- muk_web_theme/__manifest__.py | 2 +- .../static/src/js/fields/relational.js | 65 +++++++++++++++++++ .../{fields/status.js => views/form_view.js} | 26 +++++--- muk_web_theme/static/src/scss/fields.scss | 7 ++ muk_web_theme/static/src/scss/form_view.scss | 6 ++ muk_web_theme/template/assets.xml | 3 +- 6 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 muk_web_theme/static/src/js/fields/relational.js rename muk_web_theme/static/src/js/{fields/status.js => views/form_view.js} (66%) diff --git a/muk_web_theme/__manifest__.py b/muk_web_theme/__manifest__.py index 4fed6cb..5076188 100644 --- a/muk_web_theme/__manifest__.py +++ b/muk_web_theme/__manifest__.py @@ -19,7 +19,7 @@ { "name": "MuK Backend Theme", "summary": "Odoo Community Backend Theme", - "version": "12.0.1.6.6", + "version": "12.0.1.6.8", "category": "Themes/Backend", "license": "AGPL-3", "author": "MuK IT", diff --git a/muk_web_theme/static/src/js/fields/relational.js b/muk_web_theme/static/src/js/fields/relational.js new file mode 100644 index 0000000..2edd385 --- /dev/null +++ b/muk_web_theme/static/src/js/fields/relational.js @@ -0,0 +1,65 @@ +/********************************************************************************** +* +* Copyright (C) 2017 MuK IT GmbH +* +* 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 . +* +**********************************************************************************/ + +odoo.define('muk_web_theme.RelationalFields', function (require) { +"use strict"; + +var core = require('web.core'); +var config = require("web.config"); +var fields = require('web.relational_fields'); + +var _t = core._t; +var QWeb = core.qweb; + +fields.FieldStatus.include({ + _setState: function () { + this._super.apply(this, arguments); + if (config.device.isMobile) { + _.map(this.status_information, function (value) { + value.fold = true; + }); + } + }, +}); + +fields.FieldOne2Many.include({ + _renderButtons: function () { + var result = this._super.apply(this, arguments); + if (config.device.isMobile && this.$buttons) { + var $buttons = this.$buttons.find('.btn-secondary'); + $buttons.addClass('btn-primary mk_mobile_add'); + $buttons.removeClass('btn-secondary'); + } + return result; + } +}); + +fields.FieldMany2Many.include({ + _renderButtons: function () { + var result = this._super.apply(this, arguments); + if (config.device.isMobile && this.$buttons) { + var $buttons = this.$buttons.find('.btn-secondary'); + $buttons.addClass('btn-primary mk_mobile_add'); + $buttons.removeClass('btn-secondary'); + } + return result; + } +}); + +}); \ No newline at end of file diff --git a/muk_web_theme/static/src/js/fields/status.js b/muk_web_theme/static/src/js/views/form_view.js similarity index 66% rename from muk_web_theme/static/src/js/fields/status.js rename to muk_web_theme/static/src/js/views/form_view.js index ca241a7..5e7175c 100644 --- a/muk_web_theme/static/src/js/fields/status.js +++ b/muk_web_theme/static/src/js/views/form_view.js @@ -17,25 +17,35 @@ * **********************************************************************************/ -odoo.define('muk_web_theme.FieldStatus', function (require) { +odoo.define('muk_web_theme.FormView', function (require) { "use strict"; +var dom = require('web.dom'); var core = require('web.core'); var config = require("web.config"); -var fields = require('web.relational_fields'); + +var FormView = require('web.FormView'); +var QuickCreateFormView = require('web.QuickCreateFormView'); var _t = core._t; var QWeb = core.qweb; -fields.FieldStatus.include({ - _setState: function () { +FormView.include({ + init: function () { + this._super.apply(this, arguments); + if (config.device.isMobile) { + this.controllerParams.disableAutofocus = true; + } + }, +}); + +QuickCreateFormView.include({ + init: function () { this._super.apply(this, arguments); if (config.device.isMobile) { - _.map(this.status_information, function (value) { - value.fold = true; - }); + this.controllerParams.disableAutofocus = true; } }, }); -}); \ No newline at end of file +}); diff --git a/muk_web_theme/static/src/scss/fields.scss b/muk_web_theme/static/src/scss/fields.scss index bcee382..d466be5 100644 --- a/muk_web_theme/static/src/scss/fields.scss +++ b/muk_web_theme/static/src/scss/fields.scss @@ -27,4 +27,11 @@ &.o_input, .o_input { background-color: $mk-required-color !important; } +} + +@include media-breakpoint-down(sm) { + .o_form_view .mk_mobile_add { + margin-left: 0 !important; + margin-bottom: 10px !important; + } } \ No newline at end of file diff --git a/muk_web_theme/static/src/scss/form_view.scss b/muk_web_theme/static/src/scss/form_view.scss index 6a4fe4f..8b090b6 100644 --- a/muk_web_theme/static/src/scss/form_view.scss +++ b/muk_web_theme/static/src/scss/form_view.scss @@ -121,6 +121,12 @@ display: none; } } + .o_cp_buttons { + width: 100%; + div, .o-kanban-button-new { + width: 100%; + } + } } @include media-breakpoint-down(xs) { .oe_button_box { diff --git a/muk_web_theme/template/assets.xml b/muk_web_theme/template/assets.xml index 2a07197..841e32a 100644 --- a/muk_web_theme/template/assets.xml +++ b/muk_web_theme/template/assets.xml @@ -66,8 +66,9 @@