mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
@@ -7,11 +7,11 @@ indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[.eslintrc,*.{json,yml,yaml,rst,md}]
|
||||
[*.{json,yml,yaml,rst,md}]
|
||||
indent_size = 2
|
||||
|
||||
# Do not configure editor for libs and autogenerated content
|
||||
[*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst]
|
||||
[{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}]
|
||||
charset = unset
|
||||
end_of_line = unset
|
||||
indent_size = unset
|
||||
|
||||
291
.eslintrc
291
.eslintrc
@@ -1,291 +0,0 @@
|
||||
{
|
||||
"globals": {
|
||||
"$": false,
|
||||
"_": false,
|
||||
"fuzzy": false,
|
||||
"jQuery": false,
|
||||
"moment": false,
|
||||
"odoo": false,
|
||||
"openerp": false,
|
||||
"self": false
|
||||
},
|
||||
"env": {
|
||||
"browser": true
|
||||
},
|
||||
"rules": {
|
||||
"no-alert": "warn",
|
||||
"no-array-constructor": "warn",
|
||||
"no-bitwise": "off",
|
||||
"no-caller": "warn",
|
||||
"no-case-declarations": "warn",
|
||||
"no-catch-shadow": "warn",
|
||||
"no-class-assign": "warn",
|
||||
"no-cond-assign": "warn",
|
||||
"no-confusing-arrow": "warn",
|
||||
"no-console": "off",
|
||||
"no-const-assign": "warn",
|
||||
"no-constant-condition": "warn",
|
||||
"no-continue": "off",
|
||||
"no-control-regex": "warn",
|
||||
"no-debugger": "warn",
|
||||
"no-delete-var": "warn",
|
||||
"no-div-regex": "warn",
|
||||
"no-dupe-args": "warn",
|
||||
"no-dupe-class-members": "warn",
|
||||
"no-dupe-keys": "warn",
|
||||
"no-duplicate-case": "warn",
|
||||
"no-duplicate-imports": "warn",
|
||||
"no-else-return": "warn",
|
||||
"no-empty": "warn",
|
||||
"no-empty-character-class": "warn",
|
||||
"no-empty-function": "warn",
|
||||
"no-empty-pattern": "warn",
|
||||
"no-eq-null": "warn",
|
||||
"no-eval": "warn",
|
||||
"no-ex-assign": "warn",
|
||||
"no-extend-native": "warn",
|
||||
"no-extra-bind": "warn",
|
||||
"no-extra-boolean-cast": "warn",
|
||||
"no-extra-label": "warn",
|
||||
"no-extra-parens": "warn",
|
||||
"no-extra-semi": "warn",
|
||||
"no-fallthrough": "warn",
|
||||
"no-floating-decimal": "warn",
|
||||
"no-func-assign": "warn",
|
||||
"no-implicit-coercion": ["warn", {
|
||||
"allow": ["~"]
|
||||
}],
|
||||
"no-implicit-globals": "warn",
|
||||
"no-implied-eval": "warn",
|
||||
"no-inline-comments": "warn",
|
||||
"no-inner-declarations": "warn",
|
||||
"no-invalid-regexp": "warn",
|
||||
"no-invalid-this": "off",
|
||||
"no-irregular-whitespace": "warn",
|
||||
"no-iterator": "warn",
|
||||
"no-label-var": "warn",
|
||||
"no-labels": "warn",
|
||||
"no-lone-blocks": "warn",
|
||||
"no-lonely-if": "warn",
|
||||
"no-loop-func": "off",
|
||||
"no-magic-numbers": "off",
|
||||
"no-mixed-operators": "warn",
|
||||
"no-mixed-requires": "warn",
|
||||
"no-mixed-spaces-and-tabs": "warn",
|
||||
"no-multi-spaces": "warn",
|
||||
"no-multi-str": "warn",
|
||||
"no-multiple-empty-lines": "warn",
|
||||
"no-native-reassign": "warn",
|
||||
"no-negated-condition": "warn",
|
||||
"no-negated-in-lhs": "warn",
|
||||
"no-nested-ternary": "off",
|
||||
"no-new": "warn",
|
||||
"no-new-func": "warn",
|
||||
"no-new-object": "warn",
|
||||
"no-new-require": "warn",
|
||||
"no-new-symbol": "warn",
|
||||
"no-new-wrappers": "warn",
|
||||
"no-obj-calls": "warn",
|
||||
"no-octal": "warn",
|
||||
"no-octal-escape": "warn",
|
||||
"no-param-reassign": "warn",
|
||||
"no-path-concat": "warn",
|
||||
"no-plusplus": "off",
|
||||
"no-process-env": "warn",
|
||||
"no-process-exit": "warn",
|
||||
"no-proto": "warn",
|
||||
"no-prototype-builtins": "warn",
|
||||
"no-redeclare": "warn",
|
||||
"no-regex-spaces": "warn",
|
||||
"no-restricted-globals": "warn",
|
||||
"no-restricted-imports": "warn",
|
||||
"no-restricted-modules": "warn",
|
||||
"no-restricted-syntax": "warn",
|
||||
"no-return-assign": "warn",
|
||||
"no-script-url": "warn",
|
||||
"no-self-assign": "warn",
|
||||
"no-self-compare": "warn",
|
||||
"no-sequences": "warn",
|
||||
"no-shadow": "warn",
|
||||
"no-shadow-restricted-names": "warn",
|
||||
"no-whitespace-before-property": "warn",
|
||||
"no-spaced-func": "warn",
|
||||
"no-sparse-arrays": "warn",
|
||||
"no-sync": "warn",
|
||||
"no-tabs": "warn",
|
||||
"no-ternary": "off",
|
||||
"no-trailing-spaces": "warn",
|
||||
"no-this-before-super": "warn",
|
||||
"no-throw-literal": "warn",
|
||||
"no-undef": "warn",
|
||||
"no-undef-init": "warn",
|
||||
"no-undefined": "off",
|
||||
"no-unexpected-multiline": "warn",
|
||||
"no-underscore-dangle": "off",
|
||||
"no-unmodified-loop-condition": "warn",
|
||||
"no-unneeded-ternary": "warn",
|
||||
"no-unreachable": "warn",
|
||||
"no-unsafe-finally": "warn",
|
||||
"no-unused-expressions": "warn",
|
||||
"no-unused-labels": "warn",
|
||||
"no-unused-vars": "warn",
|
||||
"no-use-before-define": "warn",
|
||||
"no-useless-call": "warn",
|
||||
"no-useless-computed-key": "warn",
|
||||
"no-useless-concat": "warn",
|
||||
"no-useless-constructor": "warn",
|
||||
"no-useless-escape": "warn",
|
||||
"no-useless-rename": "warn",
|
||||
"no-void": "warn",
|
||||
"no-var": "off",
|
||||
"no-warning-comments": "off",
|
||||
"no-with": "warn",
|
||||
"array-bracket-spacing": "off",
|
||||
"array-callback-return": "warn",
|
||||
"arrow-body-style": "warn",
|
||||
"arrow-parens": "warn",
|
||||
"arrow-spacing": "off",
|
||||
"accessor-pairs": "warn",
|
||||
"block-scoped-var": "off",
|
||||
"block-spacing": ["warn", "always"],
|
||||
"brace-style": "warn",
|
||||
"callback-return": "warn",
|
||||
"camelcase": "off",
|
||||
"capitalized-comments": ["warn", "always", {
|
||||
"ignoreConsecutiveComments": true,
|
||||
"ignoreInlineComments": true
|
||||
}],
|
||||
"comma-dangle": ["warn", "always-multiline"],
|
||||
"comma-spacing": ["warn", {
|
||||
"before": false,
|
||||
"after": true
|
||||
}],
|
||||
"comma-style": "warn",
|
||||
"complexity": [
|
||||
"warn",
|
||||
15
|
||||
],
|
||||
"computed-property-spacing": "off",
|
||||
"consistent-return": "off",
|
||||
"consistent-this": "off",
|
||||
"constructor-super": "warn",
|
||||
"curly": "warn",
|
||||
"default-case": "off",
|
||||
"dot-location": ["warn", "property"],
|
||||
"dot-notation": "warn",
|
||||
"eol-last": "warn",
|
||||
"eqeqeq": "warn",
|
||||
"func-names": "off",
|
||||
"func-style": "off",
|
||||
"generator-star-spacing": "off",
|
||||
"global-require": "warn",
|
||||
"guard-for-in": "off",
|
||||
"handle-callback-err": "warn",
|
||||
"id-blacklist": "warn",
|
||||
"id-length": "off",
|
||||
"id-match": "warn",
|
||||
"indent": "warn",
|
||||
"init-declarations": "warn",
|
||||
"jsx-quotes": "warn",
|
||||
"key-spacing": "off",
|
||||
"keyword-spacing": "warn",
|
||||
"linebreak-style": [
|
||||
"warn",
|
||||
"unix"
|
||||
],
|
||||
"lines-around-comment": "warn",
|
||||
"max-depth": "warn",
|
||||
"max-len": ["warn", {
|
||||
"code": 88,
|
||||
"ignorePattern": "odoo\\.define\\(",
|
||||
"tabWidth": 4
|
||||
}],
|
||||
"max-lines": "off",
|
||||
"max-nested-callbacks": "warn",
|
||||
"max-params": "off",
|
||||
"max-statements": "off",
|
||||
"max-statements-per-line": "warn",
|
||||
"multiline-ternary": "off",
|
||||
"new-cap": "off",
|
||||
"new-parens": "warn",
|
||||
"newline-after-var": "off",
|
||||
"newline-before-return": "off",
|
||||
"newline-per-chained-call": "off",
|
||||
"object-curly-newline": ["warn", { "consistent": true }],
|
||||
"object-curly-spacing": ["warn", "never"],
|
||||
"object-property-newline": ["warn", {
|
||||
"allowAllPropertiesOnSameLine": true
|
||||
}],
|
||||
"object-shorthand": "off",
|
||||
"one-var": "off",
|
||||
"one-var-declaration-per-line": "off",
|
||||
"operator-assignment": "warn",
|
||||
"operator-linebreak": "warn",
|
||||
"padded-blocks": "off",
|
||||
"prefer-arrow-callback": "off",
|
||||
"prefer-const": "warn",
|
||||
"prefer-reflect": "off",
|
||||
"prefer-rest-params": "off",
|
||||
"prefer-spread": "off",
|
||||
"prefer-template": "off",
|
||||
"quote-props": "off",
|
||||
"quotes": "off",
|
||||
"radix": "warn",
|
||||
"require-yield": "warn",
|
||||
"rest-spread-spacing": "off",
|
||||
"semi": [
|
||||
"warn",
|
||||
"always"
|
||||
],
|
||||
"semi-spacing": "warn",
|
||||
"sort-imports": "warn",
|
||||
"sort-vars": "off",
|
||||
"space-before-blocks": "warn",
|
||||
"space-before-function-paren": "warn",
|
||||
"space-in-parens": "off",
|
||||
"space-infix-ops": "off",
|
||||
"space-unary-ops": "off",
|
||||
"spaced-comment": ["warn", "always"],
|
||||
"strict": ["warn", "function"],
|
||||
"template-curly-spacing": "off",
|
||||
"unicode-bom": "warn",
|
||||
"use-isnan": "warn",
|
||||
"valid-jsdoc": ["warn", {
|
||||
"prefer": {
|
||||
"arg": "param",
|
||||
"argument": "param",
|
||||
"augments": "extends",
|
||||
"constructor": "class",
|
||||
"exception": "throws",
|
||||
"func": "function",
|
||||
"method": "function",
|
||||
"prop": "property",
|
||||
"return": "returns",
|
||||
"virtual": "abstract",
|
||||
"yield": "yields"
|
||||
},
|
||||
"preferType": {
|
||||
"array": "Array",
|
||||
"bool": "Boolean",
|
||||
"boolean": "Boolean",
|
||||
"number": "Number",
|
||||
"object": "Object",
|
||||
"str": "String",
|
||||
"string": "String"
|
||||
},
|
||||
"requireParamDescription": false,
|
||||
"requireReturn": false,
|
||||
"requireReturnDescription": false,
|
||||
"requireReturnType": false
|
||||
}],
|
||||
"valid-typeof": "warn",
|
||||
"vars-on-top": "off",
|
||||
"wrap-iife": "warn",
|
||||
"wrap-regex": "warn",
|
||||
"yield-star-spacing": "off",
|
||||
"yoda": "warn"
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2017
|
||||
}
|
||||
}
|
||||
180
.eslintrc.yml
Normal file
180
.eslintrc.yml
Normal file
@@ -0,0 +1,180 @@
|
||||
env:
|
||||
browser: true
|
||||
|
||||
# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
|
||||
parserOptions:
|
||||
ecmaVersion: 2017
|
||||
|
||||
# Globals available in Odoo that shouldn't produce errorings
|
||||
globals:
|
||||
_: readonly
|
||||
$: readonly
|
||||
fuzzy: readonly
|
||||
jQuery: readonly
|
||||
moment: readonly
|
||||
odoo: readonly
|
||||
openerp: readonly
|
||||
Promise: readonly
|
||||
|
||||
# Styling is handled by Prettier, so we only need to enable AST rules;
|
||||
# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
|
||||
rules:
|
||||
accessor-pairs: warn
|
||||
array-callback-return: warn
|
||||
callback-return: warn
|
||||
capitalized-comments:
|
||||
- warn
|
||||
- always
|
||||
- ignoreConsecutiveComments: true
|
||||
ignoreInlineComments: true
|
||||
complexity:
|
||||
- warn
|
||||
- 15
|
||||
constructor-super: warn
|
||||
dot-notation: warn
|
||||
eqeqeq: warn
|
||||
global-require: warn
|
||||
handle-callback-err: warn
|
||||
id-blacklist: warn
|
||||
id-match: warn
|
||||
init-declarations: error
|
||||
max-depth: warn
|
||||
max-nested-callbacks: warn
|
||||
max-statements-per-line: warn
|
||||
no-alert: warn
|
||||
no-array-constructor: warn
|
||||
no-caller: warn
|
||||
no-case-declarations: warn
|
||||
no-class-assign: warn
|
||||
no-cond-assign: error
|
||||
no-const-assign: error
|
||||
no-constant-condition: warn
|
||||
no-control-regex: warn
|
||||
no-debugger: error
|
||||
no-delete-var: warn
|
||||
no-div-regex: warn
|
||||
no-dupe-args: error
|
||||
no-dupe-class-members: error
|
||||
no-dupe-keys: error
|
||||
no-duplicate-case: error
|
||||
no-duplicate-imports: error
|
||||
no-else-return: warn
|
||||
no-empty-character-class: warn
|
||||
no-empty-function: error
|
||||
no-empty-pattern: error
|
||||
no-empty: warn
|
||||
no-eq-null: error
|
||||
no-eval: error
|
||||
no-ex-assign: error
|
||||
no-extend-native: warn
|
||||
no-extra-bind: warn
|
||||
no-extra-boolean-cast: warn
|
||||
no-extra-label: warn
|
||||
no-fallthrough: warn
|
||||
no-func-assign: error
|
||||
no-global-assign: error
|
||||
no-implicit-coercion:
|
||||
- warn
|
||||
- allow: ["~"]
|
||||
no-implicit-globals: warn
|
||||
no-implied-eval: warn
|
||||
no-inline-comments: warn
|
||||
no-inner-declarations: warn
|
||||
no-invalid-regexp: warn
|
||||
no-irregular-whitespace: warn
|
||||
no-iterator: warn
|
||||
no-label-var: warn
|
||||
no-labels: warn
|
||||
no-lone-blocks: warn
|
||||
no-lonely-if: error
|
||||
no-mixed-requires: error
|
||||
no-multi-str: warn
|
||||
no-native-reassign: error
|
||||
no-negated-condition: warn
|
||||
no-negated-in-lhs: error
|
||||
no-new-func: warn
|
||||
no-new-object: warn
|
||||
no-new-require: warn
|
||||
no-new-symbol: warn
|
||||
no-new-wrappers: warn
|
||||
no-new: warn
|
||||
no-obj-calls: warn
|
||||
no-octal-escape: warn
|
||||
no-octal: warn
|
||||
no-param-reassign: warn
|
||||
no-path-concat: warn
|
||||
no-process-env: warn
|
||||
no-process-exit: warn
|
||||
no-proto: warn
|
||||
no-prototype-builtins: warn
|
||||
no-redeclare: warn
|
||||
no-regex-spaces: warn
|
||||
no-restricted-globals: warn
|
||||
no-restricted-imports: warn
|
||||
no-restricted-modules: warn
|
||||
no-restricted-syntax: warn
|
||||
no-return-assign: error
|
||||
no-script-url: warn
|
||||
no-self-assign: warn
|
||||
no-self-compare: warn
|
||||
no-sequences: warn
|
||||
no-shadow-restricted-names: warn
|
||||
no-shadow: warn
|
||||
no-sparse-arrays: warn
|
||||
no-sync: warn
|
||||
no-this-before-super: warn
|
||||
no-throw-literal: warn
|
||||
no-undef-init: warn
|
||||
no-undef: error
|
||||
no-unmodified-loop-condition: warn
|
||||
no-unneeded-ternary: error
|
||||
no-unreachable: error
|
||||
no-unsafe-finally: error
|
||||
no-unused-expressions: error
|
||||
no-unused-labels: error
|
||||
no-unused-vars: error
|
||||
no-use-before-define: error
|
||||
no-useless-call: warn
|
||||
no-useless-computed-key: warn
|
||||
no-useless-concat: warn
|
||||
no-useless-constructor: warn
|
||||
no-useless-escape: warn
|
||||
no-useless-rename: warn
|
||||
no-void: warn
|
||||
no-with: warn
|
||||
operator-assignment: [error, always]
|
||||
prefer-const: warn
|
||||
radix: warn
|
||||
require-yield: warn
|
||||
sort-imports: warn
|
||||
spaced-comment: [error, always]
|
||||
strict: [error, function]
|
||||
use-isnan: error
|
||||
valid-jsdoc:
|
||||
- warn
|
||||
- prefer:
|
||||
arg: param
|
||||
argument: param
|
||||
augments: extends
|
||||
constructor: class
|
||||
exception: throws
|
||||
func: function
|
||||
method: function
|
||||
prop: property
|
||||
return: returns
|
||||
virtual: abstract
|
||||
yield: yields
|
||||
preferType:
|
||||
array: Array
|
||||
bool: Boolean
|
||||
boolean: Boolean
|
||||
number: Number
|
||||
object: Object
|
||||
str: String
|
||||
string: String
|
||||
requireParamDescription: false
|
||||
requireReturn: false
|
||||
requireReturnDescription: false
|
||||
requireReturnType: false
|
||||
valid-typeof: warn
|
||||
yoda: warn
|
||||
@@ -1,68 +1,97 @@
|
||||
exclude: "^setup/|/static/lib/|/static/src/lib/"
|
||||
exclude: |
|
||||
(?x)
|
||||
# Files and folders generated by bots, to avoid loops
|
||||
^setup/|/static/description/index\.html$|
|
||||
# Maybe reactivate this when all README files include prettier ignore tags?
|
||||
^README\.md$|
|
||||
# Library files can have extraneous formatting (even minimized)
|
||||
/static/(src/)?lib/|
|
||||
# Repos using Sphinx to generate docs don't need prettying
|
||||
^docs/_templates/.*\.html$|
|
||||
# You don't usually want a bot to modify your legal texts
|
||||
/(LICENSE|COPYING)
|
||||
default_language_version:
|
||||
python: python3
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 19.3b0
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
# exclude autogenerated files
|
||||
exclude: /README\.rst$|\.pot?$
|
||||
- id: end-of-file-fixer
|
||||
# exclude autogenerated files
|
||||
exclude: /README\.rst$|\.pot?$
|
||||
- id: debug-statements
|
||||
- id: flake8
|
||||
name: flake8 except __init__.py
|
||||
exclude: /__init__\.py$
|
||||
additional_dependencies: ["flake8-bugbear==19.8.0"]
|
||||
- id: flake8
|
||||
name: flake8 only __init__.py
|
||||
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py
|
||||
files: /__init__\.py$
|
||||
additional_dependencies: ["flake8-bugbear==19.8.0"]
|
||||
- id: fix-encoding-pragma
|
||||
args: ["--remove"]
|
||||
- id: check-case-conflict
|
||||
- id: check-docstring-first
|
||||
- id: check-executables-have-shebangs
|
||||
- id: check-merge-conflict
|
||||
- id: check-symlinks
|
||||
- id: check-xml
|
||||
- id: mixed-line-ending
|
||||
args: ["--fix=lf"]
|
||||
- repo: https://github.com/pre-commit/mirrors-pylint
|
||||
rev: v2.3.1
|
||||
hooks:
|
||||
- id: pylint
|
||||
name: pylint with optional checks
|
||||
args: ["--rcfile=.pylintrc", "--exit-zero"]
|
||||
verbose: true
|
||||
additional_dependencies: ["pylint-odoo==3.0.3"]
|
||||
- id: pylint
|
||||
name: pylint with mandatory checks
|
||||
args: ["--rcfile=.pylintrc-mandatory"]
|
||||
additional_dependencies: ["pylint-odoo==3.0.3"]
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v1.24.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
- repo: https://github.com/asottile/seed-isort-config
|
||||
rev: v1.9.3
|
||||
hooks:
|
||||
- id: seed-isort-config
|
||||
- repo: https://github.com/pre-commit/mirrors-isort
|
||||
rev: v4.3.21
|
||||
hooks:
|
||||
- id: isort
|
||||
name: isort except __init__.py
|
||||
exclude: /__init__\.py$
|
||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||
rev: v6.5.1
|
||||
hooks:
|
||||
- id: eslint
|
||||
verbose: true
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 19.10b0
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/prettier/prettier
|
||||
rev: "1.19.1"
|
||||
hooks:
|
||||
- id: prettier
|
||||
# TODO Avoid awebdeveloper/pre-commit-prettier if possible
|
||||
# HACK https://github.com/prettier/prettier/issues/7407
|
||||
- repo: https://github.com/awebdeveloper/pre-commit-prettier
|
||||
rev: v0.0.1
|
||||
hooks:
|
||||
- id: prettier
|
||||
name: prettier xml plugin
|
||||
additional_dependencies:
|
||||
- "prettier@1.19.1"
|
||||
- "@prettier/plugin-xml@0.5.0"
|
||||
files: \.xml$
|
||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||
rev: v6.8.0
|
||||
hooks:
|
||||
- id: eslint
|
||||
verbose: true
|
||||
args:
|
||||
- --color
|
||||
- --fix
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.4.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
# exclude autogenerated files
|
||||
exclude: /README\.rst$|\.pot?$
|
||||
- id: end-of-file-fixer
|
||||
# exclude autogenerated files
|
||||
exclude: /README\.rst$|\.pot?$
|
||||
- id: debug-statements
|
||||
- id: flake8
|
||||
name: flake8 except __init__.py
|
||||
exclude: /__init__\.py$
|
||||
additional_dependencies: ["flake8-bugbear==19.8.0"]
|
||||
- id: flake8
|
||||
name: flake8 only __init__.py
|
||||
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py
|
||||
files: /__init__\.py$
|
||||
additional_dependencies: ["flake8-bugbear==19.8.0"]
|
||||
- id: fix-encoding-pragma
|
||||
args: ["--remove"]
|
||||
- id: check-case-conflict
|
||||
- id: check-docstring-first
|
||||
- id: check-executables-have-shebangs
|
||||
- id: check-merge-conflict
|
||||
- id: check-symlinks
|
||||
- id: check-xml
|
||||
- id: mixed-line-ending
|
||||
args: ["--fix=lf"]
|
||||
- repo: https://github.com/pre-commit/mirrors-pylint
|
||||
rev: v2.3.1
|
||||
hooks:
|
||||
- id: pylint
|
||||
name: pylint with optional checks
|
||||
args: ["--rcfile=.pylintrc", "--exit-zero"]
|
||||
verbose: true
|
||||
additional_dependencies: ["pylint-odoo==3.0.3"]
|
||||
- id: pylint
|
||||
name: pylint with mandatory checks
|
||||
args: ["--rcfile=.pylintrc-mandatory"]
|
||||
additional_dependencies: ["pylint-odoo==3.0.3"]
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v1.26.2
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
- repo: https://github.com/asottile/seed-isort-config
|
||||
rev: v1.9.4
|
||||
hooks:
|
||||
- id: seed-isort-config
|
||||
- repo: https://github.com/pre-commit/mirrors-isort
|
||||
rev: v4.3.21
|
||||
hooks:
|
||||
- id: isort
|
||||
name: isort except __init__.py
|
||||
exclude: /__init__\.py$
|
||||
|
||||
7
.prettierrc.yml
Normal file
7
.prettierrc.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
# Defaults for all prettier-supported languages.
|
||||
# Prettier will complete this with settings from .editorconfig file.
|
||||
bracketSpacing: false
|
||||
printWidth: 88
|
||||
proseWrap: always
|
||||
semi: true
|
||||
trailingComma: "es5"
|
||||
13
.travis.yml
13
.travis.yml
@@ -1,8 +1,8 @@
|
||||
language: python
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/pip
|
||||
- $HOME/.cache/pre-commit
|
||||
- $HOME/.cache/pip
|
||||
- $HOME/.cache/pre-commit
|
||||
|
||||
python:
|
||||
- "3.6"
|
||||
@@ -11,7 +11,7 @@ addons:
|
||||
postgresql: "9.6"
|
||||
apt:
|
||||
packages:
|
||||
- expect-dev # provides unbuffer utility
|
||||
- expect-dev # provides unbuffer utility
|
||||
|
||||
stages:
|
||||
- linting
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
name: "pre-commit"
|
||||
before_install:
|
||||
install: pip install pre-commit
|
||||
script: pre-commit run --all --show-diff-on-failure
|
||||
script: pre-commit run --all --show-diff-on-failure --verbose --color always
|
||||
after_success:
|
||||
- stage: test
|
||||
env:
|
||||
@@ -34,10 +34,11 @@ jobs:
|
||||
|
||||
env:
|
||||
global:
|
||||
- VERSION="13.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"
|
||||
- VERSION="13.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"
|
||||
|
||||
install:
|
||||
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
|
||||
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git
|
||||
${HOME}/maintainer-quality-tools
|
||||
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
|
||||
- travis_install_nightly
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||
|
||||
odoo.define("web_decimal_numpad_dot.FieldFloat", function (require) {
|
||||
odoo.define("web_decimal_numpad_dot.FieldFloat", function(require) {
|
||||
"use strict";
|
||||
|
||||
var basic_fields = require("web.basic_fields");
|
||||
var translation = require("web.translation");
|
||||
|
||||
var NumpadDotReplaceMixin = {
|
||||
l10n_decimal_point: function () {
|
||||
l10n_decimal_point: function() {
|
||||
return this.formatType === "float_time"
|
||||
? ":" : translation._t.database.parameters.decimal_point;
|
||||
? ":"
|
||||
: translation._t.database.parameters.decimal_point;
|
||||
},
|
||||
|
||||
_replaceAt: function (cur_val, from, to, replacement) {
|
||||
return cur_val.substring(0, from) + replacement +
|
||||
cur_val.substring(to);
|
||||
_replaceAt: function(cur_val, from, to, replacement) {
|
||||
return cur_val.substring(0, from) + replacement + cur_val.substring(to);
|
||||
},
|
||||
|
||||
_onKeydown: function (event) {
|
||||
_onKeydown: function(event) {
|
||||
// Only act on numpad dot key
|
||||
if (event.keyCode !== 110) {
|
||||
return this._super.apply(this, arguments);
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<template id="assets_backend"
|
||||
name="numpad_dot assets" inherit_id="web.assets_backend">
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="numpad_dot assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<script type="text/javascript" src="/web_decimal_numpad_dot/static/src/js/numpad_dot.js"></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_decimal_numpad_dot/static/src/js/numpad_dot.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
odoo.define('web_dialog_size.web_dialog_size', function (require) {
|
||||
'use strict';
|
||||
odoo.define("web_dialog_size.web_dialog_size", function(require) {
|
||||
"use strict";
|
||||
|
||||
var rpc = require('web.rpc');
|
||||
var Dialog = require('web.Dialog');
|
||||
var rpc = require("web.rpc");
|
||||
var Dialog = require("web.Dialog");
|
||||
|
||||
var config = rpc.query({
|
||||
model: 'ir.config_parameter',
|
||||
method: 'get_web_dialog_size_config',
|
||||
model: "ir.config_parameter",
|
||||
method: "get_web_dialog_size_config",
|
||||
});
|
||||
|
||||
Dialog.include({
|
||||
|
||||
willStart: function () {
|
||||
willStart: function() {
|
||||
var self = this;
|
||||
return this._super.apply(this, arguments).then(function () {
|
||||
self.$modal.find('.dialog_button_extend').on('click',
|
||||
self.proxy('_extending')
|
||||
);
|
||||
self.$modal.find('.dialog_button_restore').on('click',
|
||||
self.proxy('_restore')
|
||||
);
|
||||
return config.then(function (r) {
|
||||
return this._super.apply(this, arguments).then(function() {
|
||||
self.$modal
|
||||
.find(".dialog_button_extend")
|
||||
.on("click", self.proxy("_extending"));
|
||||
self.$modal
|
||||
.find(".dialog_button_restore")
|
||||
.on("click", self.proxy("_restore"));
|
||||
return config.then(function(r) {
|
||||
if (r.default_maximize) {
|
||||
self._extending();
|
||||
} else {
|
||||
@@ -30,18 +29,20 @@ odoo.define('web_dialog_size.web_dialog_size', function (require) {
|
||||
});
|
||||
},
|
||||
|
||||
opened: function () {
|
||||
return this._super.apply(this, arguments).then(function () {
|
||||
if (this.$modal) {
|
||||
this.$modal.draggable({
|
||||
handle: '.modal-header',
|
||||
helper: false,
|
||||
});
|
||||
}
|
||||
}.bind(this));
|
||||
opened: function() {
|
||||
return this._super.apply(this, arguments).then(
|
||||
function() {
|
||||
if (this.$modal) {
|
||||
this.$modal.draggable({
|
||||
handle: ".modal-header",
|
||||
helper: false,
|
||||
});
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
},
|
||||
|
||||
close: function () {
|
||||
close: function() {
|
||||
if (this.$modal) {
|
||||
var draggable = this.$modal.draggable("instance");
|
||||
if (draggable) {
|
||||
@@ -51,20 +52,18 @@ odoo.define('web_dialog_size.web_dialog_size', function (require) {
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
_extending: function () {
|
||||
var dialog = this.$modal.find('.modal-dialog');
|
||||
dialog.addClass('dialog_full_screen');
|
||||
dialog.find('.dialog_button_extend').hide();
|
||||
dialog.find('.dialog_button_restore').show();
|
||||
_extending: function() {
|
||||
var dialog = this.$modal.find(".modal-dialog");
|
||||
dialog.addClass("dialog_full_screen");
|
||||
dialog.find(".dialog_button_extend").hide();
|
||||
dialog.find(".dialog_button_restore").show();
|
||||
},
|
||||
|
||||
_restore: function () {
|
||||
var dialog = this.$modal.find('.modal-dialog');
|
||||
dialog.removeClass('dialog_full_screen');
|
||||
dialog.find('.dialog_button_restore').hide();
|
||||
dialog.find('.dialog_button_extend').show();
|
||||
_restore: function() {
|
||||
var dialog = this.$modal.find(".modal-dialog");
|
||||
dialog.removeClass("dialog_full_screen");
|
||||
dialog.find(".dialog_button_restore").hide();
|
||||
dialog.find(".dialog_button_extend").show();
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
.modal {
|
||||
.dialog_full_screen {
|
||||
@include media-breakpoint-up(sm) {
|
||||
@@ -15,7 +14,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
&.dialog_button_extend, .dialog_button_restore {
|
||||
&.dialog_button_extend,
|
||||
.dialog_button_restore {
|
||||
@include media-breakpoint-down(sm) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-extend="Dialog">
|
||||
<t t-jquery="button.close" t-operation="inner">
|
||||
<i class="fa fa-close" />
|
||||
</t>
|
||||
<t t-jquery="button.close" t-operation="before">
|
||||
<button type="button" class="dialog_button_extend close"><i class="fa fa-expand" /></button>
|
||||
<button type="button" class="dialog_button_restore close"><i class="fa fa-compress" /></button>
|
||||
<button type="button" class="dialog_button_extend close"><i
|
||||
class="fa fa-expand"
|
||||
/></button>
|
||||
<button type="button" class="dialog_button_restore close"><i
|
||||
class="fa fa-compress"
|
||||
/></button>
|
||||
</t>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<template id="assets_backend" name="web_dialog_size assets" inherit_id="web.assets_backend">
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="web_dialog_size assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<link rel="stylesheet" href="/web_dialog_size/static/src/scss/web_dialog_size.scss"/>
|
||||
<script type="text/javascript" src="/web_dialog_size/static/src/js/web_dialog_size.js"></script>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/web_dialog_size/static/src/scss/web_dialog_size.scss"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_dialog_size/static/src/js/web_dialog_size.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<template id="assets_backend" name="web_domain_field assets" inherit_id="web.assets_backend">
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="web_domain_field assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="script[last()]" position="after">
|
||||
<script type="text/javascript" src="/web_domain_field/static/src/js/pyeval.js" />
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_domain_field/static/src/js/pyeval.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu>
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||
|
||||
.test-ribbon{
|
||||
.test-ribbon {
|
||||
width: 300px;
|
||||
top: 25px;
|
||||
left: -100px;
|
||||
@@ -18,8 +18,8 @@
|
||||
transform: rotate(-45deg);
|
||||
z-index: 9999;
|
||||
position: fixed;
|
||||
box-shadow: 0 0 3px rgba(0,0,0,.3);
|
||||
background: rgba(255,0,0,.6);
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
|
||||
background: rgba(255, 0, 0, 0.6);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
Copyright 2017 Xavier Jiménez <xavier.jimenez@qubiq.es>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||
|
||||
odoo.define('web_environment_ribbon.ribbon', function (require) {
|
||||
odoo.define("web_environment_ribbon.ribbon", function(require) {
|
||||
"use strict";
|
||||
|
||||
var rpc = require('web.rpc');
|
||||
var core = require('web.core');
|
||||
var rpc = require("web.rpc");
|
||||
var core = require("web.core");
|
||||
|
||||
// Code from: http://jsfiddle.net/WK_of_Angmar/xgA5C/
|
||||
function validStrColour (strToTest) {
|
||||
function validStrColour(strToTest) {
|
||||
if (strToTest === "") {
|
||||
return false;
|
||||
}
|
||||
@@ -33,31 +33,31 @@ odoo.define('web_environment_ribbon.ribbon', function (require) {
|
||||
return image.style.color !== "rgb(255, 255, 255)";
|
||||
}
|
||||
|
||||
core.bus.on('web_client_ready', null, function () {
|
||||
core.bus.on("web_client_ready", null, function() {
|
||||
var ribbon = $('<div class="test-ribbon hidden"/>');
|
||||
$('body').append(ribbon);
|
||||
$("body").append(ribbon);
|
||||
ribbon.hide();
|
||||
// Get ribbon data from backend
|
||||
rpc.query({
|
||||
model: 'web.environment.ribbon.backend',
|
||||
method: '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);
|
||||
}
|
||||
model: "web.environment.ribbon.backend",
|
||||
method: "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);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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">
|
||||
<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"/>
|
||||
<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>
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
// Copyright 2017 - 2018 Modoolar <info@modoolar.com>
|
||||
// Copyright 2018 Modoolar <info@modoolar.com>
|
||||
// License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
odoo.define('web_ir_actions_act_view_reload.ir_actions_act_view_reload', function (require) {
|
||||
odoo.define("web_ir_actions_act_view_reload.ir_actions_act_view_reload", function(
|
||||
require
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
var ActionManager = require('web.ActionManager');
|
||||
var ActionManager = require("web.ActionManager");
|
||||
|
||||
ActionManager.include({
|
||||
|
||||
/**
|
||||
* Intercept action handling to detect extra action type
|
||||
* @override
|
||||
*/
|
||||
_handleAction: function (action, options) {
|
||||
if (action.type === 'ir.actions.act_view_reload') {
|
||||
_handleAction: function(action, options) {
|
||||
if (action.type === "ir.actions.act_view_reload") {
|
||||
return this._executeReloadAction(action, options);
|
||||
}
|
||||
|
||||
@@ -24,7 +25,7 @@ odoo.define('web_ir_actions_act_view_reload.ir_actions_act_view_reload', functio
|
||||
* Handle 'ir.actions.act_view_reload' action
|
||||
* @returns {Promise} Resolved promise
|
||||
*/
|
||||
_executeReloadAction: function () {
|
||||
_executeReloadAction: function() {
|
||||
var controller = this.getCurrentController();
|
||||
if (controller && controller.widget) {
|
||||
controller.widget.reload();
|
||||
@@ -32,7 +33,5 @@ odoo.define('web_ir_actions_act_view_reload.ir_actions_act_view_reload', functio
|
||||
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2017 - 2018 Modoolar <info@modoolar.com>
|
||||
Copyright 2018 Brainbean Apps
|
||||
License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html).
|
||||
-->
|
||||
<odoo>
|
||||
<template id="assets_backend" name="web_ir_actions_act_view_reload assets" inherit_id="web.assets_backend">
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="web_ir_actions_act_view_reload assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<script type="text/javascript"
|
||||
src="/web_ir_actions_act_view_reload/static/src/js/web_ir_actions_act_view_reload.js"/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_ir_actions_act_view_reload/static/src/js/web_ir_actions_act_view_reload.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.o_tooltip {
|
||||
&.o_animated {
|
||||
display: none;
|
||||
}
|
||||
&.o_animated {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<template id="assets_backend" name="web_no_bubble_assets" inherit_id="web.assets_backend">
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="web_no_bubble_assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<link rel="stylesheet" href="/web_no_bubble/static/src/css/web_no_bubble.scss"/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/web_no_bubble/static/src/css/web_no_bubble.scss"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
</data>
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
odoo.define('web_notify.WebClient', function (require) {
|
||||
odoo.define("web_notify.WebClient", function(require) {
|
||||
"use strict";
|
||||
|
||||
var WebClient = require('web.WebClient');
|
||||
var base_bus = require('bus.Longpolling');
|
||||
var session = require('web.session');
|
||||
require('bus.BusService');
|
||||
|
||||
var WebClient = require("web.WebClient");
|
||||
var session = require("web.session");
|
||||
require("bus.BusService");
|
||||
|
||||
WebClient.include({
|
||||
show_application: function () {
|
||||
show_application: function() {
|
||||
var res = this._super();
|
||||
this.start_polling();
|
||||
return res;
|
||||
},
|
||||
start_polling: function () {
|
||||
this.channel_success = 'notify_success_' + session.uid;
|
||||
this.channel_danger = 'notify_danger_' + session.uid;
|
||||
this.channel_warning = 'notify_warning_' + session.uid;
|
||||
this.channel_info = 'notify_info_' + session.uid;
|
||||
this.channel_default = 'notify_default_' + session.uid;
|
||||
start_polling: function() {
|
||||
this.channel_success = "notify_success_" + session.uid;
|
||||
this.channel_danger = "notify_danger_" + session.uid;
|
||||
this.channel_warning = "notify_warning_" + session.uid;
|
||||
this.channel_info = "notify_info_" + session.uid;
|
||||
this.channel_default = "notify_default_" + session.uid;
|
||||
this.all_channels = [
|
||||
this.channel_success,
|
||||
this.channel_danger,
|
||||
@@ -26,40 +24,35 @@ odoo.define('web_notify.WebClient', function (require) {
|
||||
this.channel_info,
|
||||
this.channel_default,
|
||||
];
|
||||
this.call('bus_service', 'addChannel', this.channel_success);
|
||||
this.call('bus_service', 'addChannel', this.channel_danger);
|
||||
this.call('bus_service', 'addChannel', this.channel_warning);
|
||||
this.call('bus_service', 'addChannel', this.channel_info);
|
||||
this.call('bus_service', 'addChannel', this.channel_default);
|
||||
this.call(
|
||||
'bus_service', 'on', 'notification',
|
||||
this, this.bus_notification);
|
||||
this.call('bus_service', 'startPolling');
|
||||
this.call("bus_service", "addChannel", this.channel_success);
|
||||
this.call("bus_service", "addChannel", this.channel_danger);
|
||||
this.call("bus_service", "addChannel", this.channel_warning);
|
||||
this.call("bus_service", "addChannel", this.channel_info);
|
||||
this.call("bus_service", "addChannel", this.channel_default);
|
||||
this.call("bus_service", "on", "notification", this, this.bus_notification);
|
||||
this.call("bus_service", "startPolling");
|
||||
},
|
||||
bus_notification: function (notifications) {
|
||||
bus_notification: function(notifications) {
|
||||
var self = this;
|
||||
_.each(notifications, function (notification) {
|
||||
_.each(notifications, function(notification) {
|
||||
var channel = notification[0];
|
||||
var message = notification[1];
|
||||
if (
|
||||
self.all_channels != null &&
|
||||
self.all_channels !== null &&
|
||||
self.all_channels.indexOf(channel) > -1
|
||||
) {
|
||||
self.on_message(message);
|
||||
}
|
||||
});
|
||||
},
|
||||
on_message: function (message) {
|
||||
return this.call(
|
||||
'notification', 'notify', {
|
||||
type: message.type,
|
||||
title: message.title,
|
||||
message: message.message,
|
||||
sticky: message.sticky,
|
||||
className: message.className,
|
||||
}
|
||||
);
|
||||
on_message: function(message) {
|
||||
return this.call("notification", "notify", {
|
||||
type: message.type,
|
||||
title: message.title,
|
||||
message: message.message,
|
||||
sticky: message.sticky,
|
||||
className: message.className,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
odoo.define('web_notify.Notification', function (require) {
|
||||
odoo.define("web_notify.Notification", function(require) {
|
||||
"use strict";
|
||||
|
||||
var Notification = require('web.Notification');
|
||||
var Notification = require("web.Notification");
|
||||
|
||||
Notification.include({
|
||||
icon_mapping: {
|
||||
'success': 'fa-thumbs-up',
|
||||
'danger': 'fa-exclamation-triangle',
|
||||
'warning': 'fa-exclamation',
|
||||
'info': 'fa-info',
|
||||
'default': 'fa-lightbulb-o',
|
||||
success: "fa-thumbs-up",
|
||||
danger: "fa-exclamation-triangle",
|
||||
warning: "fa-exclamation",
|
||||
info: "fa-info",
|
||||
default: "fa-lightbulb-o",
|
||||
},
|
||||
init: function () {
|
||||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
// Delete default classes
|
||||
this.className = this.className.replace(' o_error', '');
|
||||
this.className = this.className.replace(" o_error", "");
|
||||
// Add custom icon and custom class
|
||||
this.icon = (this.type in this.icon_mapping) ?
|
||||
this.icon_mapping[this.type] :
|
||||
this.icon_mapping['default'];
|
||||
this.className += ' o_' + this.type;
|
||||
this.icon =
|
||||
this.type in this.icon_mapping
|
||||
? this.icon_mapping[this.type]
|
||||
: this.icon_mapping.default;
|
||||
this.className += " o_" + this.type;
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
.o_notification {
|
||||
&.o_success {
|
||||
color: white;
|
||||
background-color: theme-color('success');
|
||||
background-color: theme-color("success");
|
||||
}
|
||||
&.o_danger {
|
||||
color: white;
|
||||
background-color: theme-color('danger');
|
||||
background-color: theme-color("danger");
|
||||
}
|
||||
&.o_warning {
|
||||
color: white;
|
||||
background-color: theme-color('warning');
|
||||
background-color: theme-color("warning");
|
||||
}
|
||||
&.o_info {
|
||||
color: white;
|
||||
background-color: theme-color('info');
|
||||
background-color: theme-color("info");
|
||||
}
|
||||
&.o_default {
|
||||
color: black;
|
||||
background-color: theme-color('default');
|
||||
background-color: theme-color("default");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2018 Aitor Bouzas <aitor.bouzas@adaptivecity.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record id="view_users_form_simple_modif_inherit" model="ir.ui.view">
|
||||
<field name="name">res.users.form.simple.view.modif.inherit</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form"/>
|
||||
<field name="inherit_id" ref="base.view_users_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//notebook/page[1]" position="after">
|
||||
<page string="Test web notify" name="test_web_notify">
|
||||
<group>
|
||||
<group>
|
||||
<button name="notify_success"
|
||||
type="object"
|
||||
string="Test success notification"
|
||||
class="oe_highlight"/>
|
||||
<button
|
||||
name="notify_success"
|
||||
type="object"
|
||||
string="Test success notification"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
</group>
|
||||
<group>
|
||||
<button name="notify_danger"
|
||||
type="object"
|
||||
string="Test danger notification"
|
||||
class="oe_highlight"/>
|
||||
<button
|
||||
name="notify_danger"
|
||||
type="object"
|
||||
string="Test danger notification"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
</group>
|
||||
<group>
|
||||
<button name="notify_warning"
|
||||
type="object"
|
||||
string="Test warning notification"
|
||||
class="oe_highlight"/>
|
||||
<button
|
||||
name="notify_warning"
|
||||
type="object"
|
||||
string="Test warning notification"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
</group>
|
||||
<group>
|
||||
<button name="notify_info"
|
||||
type="object"
|
||||
string="Test info notification"
|
||||
class="oe_highlight"/>
|
||||
<button
|
||||
name="notify_info"
|
||||
type="object"
|
||||
string="Test info notification"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
</group>
|
||||
<group>
|
||||
<button name="notify_default"
|
||||
type="object"
|
||||
string="Test default notification"
|
||||
class="oe_highlight"/>
|
||||
<button
|
||||
name="notify_default"
|
||||
type="object"
|
||||
string="Test default notification"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
@@ -1,12 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<template id="assets_backend" name="web_notify assets" inherit_id="web.assets_backend">
|
||||
<link rel="stylesheet" type="text/scss" href="/web/static/src/scss/webclient.scss" position="after">
|
||||
<link rel="stylesheet" type="text/scss" href="/web_notify/static/src/scss/webclient.scss"/>
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="web_notify assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/scss"
|
||||
href="/web/static/src/scss/webclient.scss"
|
||||
position="after"
|
||||
>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/scss"
|
||||
href="/web_notify/static/src/scss/webclient.scss"
|
||||
/>
|
||||
</link>
|
||||
<xpath expr="." position="inside">
|
||||
<script type="text/javascript" src="/web_notify/static/src/js/web_client.js"/>
|
||||
<script type="text/javascript" src="/web_notify/static/src/js/widgets/notification.js"/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_notify/static/src/js/web_client.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_notify/static/src/js/widgets/notification.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
@@ -42,8 +42,7 @@ $chatter_zone_width: 35%;
|
||||
}
|
||||
|
||||
.o_menu_sections,
|
||||
.o_menu_systray,
|
||||
{
|
||||
.o_menu_systray {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
@@ -56,8 +55,7 @@ $chatter_zone_width: 35%;
|
||||
// Hide big things
|
||||
.o_menu_brand,
|
||||
.o_menu_sections,
|
||||
.oe_topbar_name,
|
||||
{
|
||||
.oe_topbar_name {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -85,8 +83,7 @@ $chatter_zone_width: 35%;
|
||||
|
||||
> li,
|
||||
.o_menu_entry_lvl_1,
|
||||
.o_menu_header_lvl_1,
|
||||
{
|
||||
.o_menu_header_lvl_1 {
|
||||
// Homogeneous background color
|
||||
background-color: $dropdown-bg;
|
||||
color: $dropdown-link-color;
|
||||
@@ -137,7 +134,6 @@ $chatter_zone_width: 35%;
|
||||
|
||||
// Iconized full screen apps menu
|
||||
.o_menu_apps {
|
||||
|
||||
.search-input:focus {
|
||||
border-color: $o-brand-primary;
|
||||
}
|
||||
@@ -238,8 +234,7 @@ html .o_web_client .o_action_manager .o_action {
|
||||
.o_cp_buttons,
|
||||
.o_cp_left,
|
||||
.o_cp_right,
|
||||
.o_cp_searchview,
|
||||
{
|
||||
.o_cp_searchview {
|
||||
flex: 1 1 100%;
|
||||
@include media-breakpoint-up(md) {
|
||||
flex-basis: 50%;
|
||||
@@ -251,8 +246,7 @@ html .o_web_client .o_action_manager .o_action {
|
||||
}
|
||||
|
||||
.o_cp_searchview,
|
||||
.o_cp_right,
|
||||
{
|
||||
.o_cp_right {
|
||||
flex-basis: 10%;
|
||||
}
|
||||
|
||||
@@ -276,7 +270,7 @@ html .o_web_client .o_action_manager .o_action {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
&:nth-last-of-type(1n+3) {
|
||||
&:nth-last-of-type(1n + 3) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -333,7 +327,8 @@ html .o_web_client .o_action_manager .o_action {
|
||||
}
|
||||
|
||||
// Normal views
|
||||
.o_content, .modal-content {
|
||||
.o_content,
|
||||
.modal-content {
|
||||
max-width: 100%;
|
||||
|
||||
// Form views
|
||||
@@ -380,14 +375,13 @@ html .o_web_client .o_action_manager .o_action {
|
||||
.oe_button_box {
|
||||
.o_dropdown_more {
|
||||
button:last-child {
|
||||
border-right: 1px solid gray('400');
|
||||
border-right: 1px solid gray("400");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Avoid overflow on forms with title and/or button box
|
||||
.oe_title,
|
||||
{
|
||||
.oe_title {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
@@ -442,8 +436,7 @@ html .o_web_client .o_action_manager .o_action {
|
||||
|
||||
// Full width in form sheets
|
||||
.o_form_sheet,
|
||||
.oe_chatter,
|
||||
{
|
||||
.oe_chatter {
|
||||
min-width: auto;
|
||||
max-width: 98%;
|
||||
}
|
||||
@@ -460,7 +453,7 @@ html .o_web_client .o_action_manager .o_action {
|
||||
|
||||
// Display send button on small screens
|
||||
.o_thread_composer {
|
||||
padding-left: $o-mail-thread-avatar-size*0.5;
|
||||
padding-left: $o-mail-thread-avatar-size * 0.5;
|
||||
|
||||
.o_composer_button_send {
|
||||
display: initial !important; // Forced in core
|
||||
@@ -508,7 +501,7 @@ html .o_web_client .o_action_manager .o_action {
|
||||
}
|
||||
|
||||
.o_chatter {
|
||||
border-left: 1px solid gray('400');
|
||||
border-left: 1px solid gray("400");
|
||||
flex: 0 0 $chatter_zone_width;
|
||||
max-width: initial;
|
||||
min-width: initial;
|
||||
@@ -544,10 +537,11 @@ html .o_web_client .o_action_manager .o_action {
|
||||
|
||||
// Sticky Header & Footer in List View
|
||||
.o_list_view {
|
||||
.table-responsive {
|
||||
.table-responsive {
|
||||
.o_list_table {
|
||||
// th & td are here for compatibility with chrome
|
||||
thead, thead tr:nth-child(1) th {
|
||||
thead,
|
||||
thead tr:nth-child(1) th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
@@ -555,7 +549,8 @@ html .o_web_client .o_action_manager .o_action {
|
||||
thead tr:nth-child(1) th {
|
||||
background-color: $o-list-footer-bg-color;
|
||||
}
|
||||
tfoot, tfoot tr:nth-child(1) td {
|
||||
tfoot,
|
||||
tfoot tr:nth-child(1) td {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
}
|
||||
@@ -568,7 +563,7 @@ html .o_web_client .o_action_manager .o_action {
|
||||
|
||||
// Waiting Cursor
|
||||
.oe_wait {
|
||||
cursor: progress;
|
||||
cursor: progress;
|
||||
}
|
||||
|
||||
// Document Viewer
|
||||
@@ -585,10 +580,12 @@ html .o_web_client .o_action_manager .o_action {
|
||||
right: 0;
|
||||
|
||||
/* Show/Hide control buttons (next, prev, etc..) */
|
||||
&:hover .arrow, &:hover .o_viewer_toolbar {
|
||||
&:hover .arrow,
|
||||
&:hover .o_viewer_toolbar {
|
||||
display: flex;
|
||||
}
|
||||
.arrow, .o_viewer_toolbar {
|
||||
.arrow,
|
||||
.o_viewer_toolbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -611,7 +608,8 @@ html .o_web_client .o_action_manager .o_action {
|
||||
}
|
||||
}
|
||||
@include media-breakpoint-down(lg) {
|
||||
.o_minimize_btn, .o_maximize_btn {
|
||||
.o_minimize_btn,
|
||||
.o_maximize_btn {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -619,7 +617,8 @@ html .o_web_client .o_action_manager .o_action {
|
||||
}
|
||||
/* Max/Min buttons only are usefull in sided mode */
|
||||
.o_web_client:not(.o_chatter_position_sided) {
|
||||
.o_minimize_btn, .o_maximize_btn {
|
||||
.o_minimize_btn,
|
||||
.o_maximize_btn {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
/* Copyright 2018 Tecnativa - Jairo Llopis
|
||||
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
||||
|
||||
odoo.define('web_responsive', function (require) {
|
||||
'use strict';
|
||||
odoo.define("web_responsive", function(require) {
|
||||
"use strict";
|
||||
|
||||
const ActionManager = require('web.ActionManager');
|
||||
const ActionManager = require("web.ActionManager");
|
||||
const AbstractWebClient = require("web.AbstractWebClient");
|
||||
const AppsMenu = require("web.AppsMenu");
|
||||
const BasicController = require('web.BasicController');
|
||||
const BasicController = require("web.BasicController");
|
||||
const config = require("web.config");
|
||||
const core = require("web.core");
|
||||
const FormRenderer = require('web.FormRenderer');
|
||||
const FormRenderer = require("web.FormRenderer");
|
||||
const Menu = require("web.Menu");
|
||||
const RelationalFields = require('web.relational_fields');
|
||||
const Chatter = require('mail.Chatter');
|
||||
const ListRenderer = require('web.ListRenderer');
|
||||
const DocumentViewer = require('mail.DocumentViewer');
|
||||
const RelationalFields = require("web.relational_fields");
|
||||
const Chatter = require("mail.Chatter");
|
||||
const ListRenderer = require("web.ListRenderer");
|
||||
const DocumentViewer = require("mail.DocumentViewer");
|
||||
|
||||
/*
|
||||
* Helper function to know if are waiting
|
||||
*
|
||||
*/
|
||||
function isWaiting () {
|
||||
return $('.oe_wait').length !== 0;
|
||||
function isWaiting() {
|
||||
return $(".oe_wait").length !== 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ odoo.define('web_responsive', function (require) {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
function findNames (memo, menu) {
|
||||
function findNames(memo, menu) {
|
||||
if (menu.action) {
|
||||
var key = menu.parent_id ? menu.parent_id[1] + "/" : "";
|
||||
memo[key + menu.name] = menu;
|
||||
@@ -82,33 +82,31 @@ odoo.define('web_responsive', function (require) {
|
||||
}
|
||||
|
||||
AppsMenu.include({
|
||||
events: _.extend({
|
||||
"keydown .search-input input": "_searchResultsNavigate",
|
||||
"input .search-input input": "_searchMenusSchedule",
|
||||
"click .o-menu-search-result": "_searchResultChosen",
|
||||
"shown.bs.dropdown": "_searchFocus",
|
||||
"hidden.bs.dropdown": "_searchReset",
|
||||
"hide.bs.dropdown": "_hideAppsMenu",
|
||||
}, AppsMenu.prototype.events),
|
||||
events: _.extend(
|
||||
{
|
||||
"keydown .search-input input": "_searchResultsNavigate",
|
||||
"input .search-input input": "_searchMenusSchedule",
|
||||
"click .o-menu-search-result": "_searchResultChosen",
|
||||
"shown.bs.dropdown": "_searchFocus",
|
||||
"hidden.bs.dropdown": "_searchReset",
|
||||
"hide.bs.dropdown": "_hideAppsMenu",
|
||||
},
|
||||
AppsMenu.prototype.events
|
||||
),
|
||||
|
||||
/**
|
||||
* Rescue some menu data stripped out in original method.
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
init: function (parent, menuData) {
|
||||
init: function(parent, menuData) {
|
||||
this._super.apply(this, arguments);
|
||||
// Keep base64 icon for main menus
|
||||
for (let n in this._apps) {
|
||||
this._apps[n].web_icon_data =
|
||||
menuData.children[n].web_icon_data;
|
||||
for (const n in this._apps) {
|
||||
this._apps[n].web_icon_data = menuData.children[n].web_icon_data;
|
||||
}
|
||||
// Store menu data in a format searchable by fuzzy.js
|
||||
this._searchableMenus = _.reduce(
|
||||
menuData.children,
|
||||
findNames,
|
||||
{}
|
||||
);
|
||||
this._searchableMenus = _.reduce(menuData.children, findNames, {});
|
||||
// Search only after timeout, for fast typers
|
||||
this._search_def = false;
|
||||
},
|
||||
@@ -116,7 +114,7 @@ odoo.define('web_responsive', function (require) {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
start: function () {
|
||||
start: function() {
|
||||
this.$search_container = this.$(".search-container");
|
||||
this.$search_input = this.$(".search-input input");
|
||||
this.$search_results = this.$(".search-results");
|
||||
@@ -128,7 +126,7 @@ odoo.define('web_responsive', function (require) {
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
_onAppsMenuItemClicked: function (ev) {
|
||||
_onAppsMenuItemClicked: function(ev) {
|
||||
this._super.apply(this, arguments);
|
||||
ev.preventDefault();
|
||||
},
|
||||
@@ -142,17 +140,20 @@ odoo.define('web_responsive', function (require) {
|
||||
* @returns {Object}
|
||||
* Menu definition, plus extra needed keys.
|
||||
*/
|
||||
_menuInfo: function (key) {
|
||||
_menuInfo: function(key) {
|
||||
const original = this._searchableMenus[key];
|
||||
return _.extend({
|
||||
action_id: parseInt(original.action.split(',')[1], 10),
|
||||
}, original);
|
||||
return _.extend(
|
||||
{
|
||||
action_id: parseInt(original.action.split(",")[1], 10),
|
||||
},
|
||||
original
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Autofocus on search field on big screens.
|
||||
*/
|
||||
_searchFocus: function () {
|
||||
_searchFocus: function() {
|
||||
if (!config.device.isMobile) {
|
||||
this.$search_input.focus();
|
||||
}
|
||||
@@ -161,7 +162,7 @@ odoo.define('web_responsive', function (require) {
|
||||
/**
|
||||
* Reset search input and results
|
||||
*/
|
||||
_searchReset: function () {
|
||||
_searchReset: function() {
|
||||
this.$search_container.removeClass("has-results");
|
||||
this.$search_results.empty();
|
||||
this.$search_input.val("");
|
||||
@@ -170,8 +171,8 @@ odoo.define('web_responsive', function (require) {
|
||||
/**
|
||||
* Schedule a search on current menu items.
|
||||
*/
|
||||
_searchMenusSchedule: function () {
|
||||
this._search_def = new Promise((resolve) => {
|
||||
_searchMenusSchedule: function() {
|
||||
this._search_def = new Promise(resolve => {
|
||||
setTimeout(resolve, 50);
|
||||
});
|
||||
this._search_def.then(this._searchMenus.bind(this));
|
||||
@@ -180,33 +181,23 @@ odoo.define('web_responsive', function (require) {
|
||||
/**
|
||||
* Search among available menu items, and render that search.
|
||||
*/
|
||||
_searchMenus: function () {
|
||||
_searchMenus: function() {
|
||||
const query = this.$search_input.val();
|
||||
if (query === "") {
|
||||
this.$search_container.removeClass("has-results");
|
||||
this.$search_results.empty();
|
||||
return;
|
||||
}
|
||||
var results = fuzzy.filter(
|
||||
query,
|
||||
_.keys(this._searchableMenus),
|
||||
{
|
||||
pre: "<b>",
|
||||
post: "</b>",
|
||||
}
|
||||
);
|
||||
this.$search_container.toggleClass(
|
||||
"has-results",
|
||||
Boolean(results.length)
|
||||
);
|
||||
var results = fuzzy.filter(query, _.keys(this._searchableMenus), {
|
||||
pre: "<b>",
|
||||
post: "</b>",
|
||||
});
|
||||
this.$search_container.toggleClass("has-results", Boolean(results.length));
|
||||
this.$search_results.html(
|
||||
core.qweb.render(
|
||||
"web_responsive.MenuSearchResults",
|
||||
{
|
||||
results: results,
|
||||
widget: this,
|
||||
}
|
||||
)
|
||||
core.qweb.render("web_responsive.MenuSearchResults", {
|
||||
results: results,
|
||||
widget: this,
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
@@ -215,7 +206,7 @@ odoo.define('web_responsive', function (require) {
|
||||
*
|
||||
* @param {jQuery.Event} event
|
||||
*/
|
||||
_searchResultChosen: function (event) {
|
||||
_searchResultChosen: function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const $result = $(event.currentTarget),
|
||||
@@ -229,7 +220,7 @@ odoo.define('web_responsive', function (require) {
|
||||
previous_menu_id: data.parentId,
|
||||
});
|
||||
// Find app that owns the chosen menu
|
||||
const app = _.find(this._apps, function (_app) {
|
||||
const app = _.find(this._apps, function(_app) {
|
||||
return text.indexOf(_app.name + suffix) === 0;
|
||||
});
|
||||
// Update navbar menus
|
||||
@@ -241,7 +232,7 @@ odoo.define('web_responsive', function (require) {
|
||||
*
|
||||
* @param {jQuery.Event} event
|
||||
*/
|
||||
_searchResultsNavigate: function (event) {
|
||||
_searchResultsNavigate: function(event) {
|
||||
// Find current results and active element (1st by default)
|
||||
const all = this.$search_results.find(".o-menu-search-result"),
|
||||
pre_focused = all.filter(".active") || $(all[0]);
|
||||
@@ -257,20 +248,20 @@ odoo.define('web_responsive', function (require) {
|
||||
key = event.shiftKey ? "ArrowUp" : "ArrowDown";
|
||||
}
|
||||
switch (key) {
|
||||
// Pressing enter is the same as clicking on the active element
|
||||
case "Enter":
|
||||
pre_focused.click();
|
||||
break;
|
||||
// Navigate up or down
|
||||
case "ArrowUp":
|
||||
offset--;
|
||||
break;
|
||||
case "ArrowDown":
|
||||
offset++;
|
||||
break;
|
||||
default:
|
||||
// Other keys are useless in this event
|
||||
return;
|
||||
// Pressing enter is the same as clicking on the active element
|
||||
case "Enter":
|
||||
pre_focused.click();
|
||||
break;
|
||||
// Navigate up or down
|
||||
case "ArrowUp":
|
||||
offset--;
|
||||
break;
|
||||
case "ArrowDown":
|
||||
offset++;
|
||||
break;
|
||||
default:
|
||||
// Other keys are useless in this event
|
||||
return;
|
||||
}
|
||||
// Allow looping on results
|
||||
if (offset < 0) {
|
||||
@@ -290,44 +281,45 @@ odoo.define('web_responsive', function (require) {
|
||||
},
|
||||
|
||||
/*
|
||||
* Control if AppDrawer can be closed
|
||||
*/
|
||||
_hideAppsMenu: function () {
|
||||
return !isWaiting() && !this.$('input').is(':focus');
|
||||
* Control if AppDrawer can be closed
|
||||
*/
|
||||
_hideAppsMenu: function() {
|
||||
return !isWaiting() && !this.$("input").is(":focus");
|
||||
},
|
||||
});
|
||||
|
||||
BasicController.include({
|
||||
|
||||
/**
|
||||
* Close the AppDrawer if the data set is dirty and a discard dialog
|
||||
* is opened
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
canBeDiscarded: function (recordID) {
|
||||
canBeDiscarded: function(recordID) {
|
||||
if (this.model.isDirty(recordID || this.handle)) {
|
||||
$('.o_menu_apps .dropdown:has(.dropdown-menu.show) > a')
|
||||
.dropdown('toggle');
|
||||
$('.o_menu_sections li.show .dropdown-toggle')
|
||||
.dropdown('toggle');
|
||||
$(".o_menu_apps .dropdown:has(.dropdown-menu.show) > a").dropdown(
|
||||
"toggle"
|
||||
);
|
||||
$(".o_menu_sections li.show .dropdown-toggle").dropdown("toggle");
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
});
|
||||
|
||||
Menu.include({
|
||||
events: _.extend({
|
||||
// Clicking a hamburger menu item should close the hamburger
|
||||
"click .o_menu_sections [role=menuitem]": "_hideMobileSubmenus",
|
||||
// Opening any dropdown in the navbar should hide the hamburger
|
||||
"show.bs.dropdown .o_menu_systray, .o_menu_apps":
|
||||
"_hideMobileSubmenus",
|
||||
// Prevent close section menu
|
||||
"hide.bs.dropdown .o_menu_sections": "_hideMenuSection",
|
||||
}, Menu.prototype.events),
|
||||
events: _.extend(
|
||||
{
|
||||
// Clicking a hamburger menu item should close the hamburger
|
||||
"click .o_menu_sections [role=menuitem]": "_hideMobileSubmenus",
|
||||
// Opening any dropdown in the navbar should hide the hamburger
|
||||
"show.bs.dropdown .o_menu_systray, .o_menu_apps": "_hideMobileSubmenus",
|
||||
// Prevent close section menu
|
||||
"hide.bs.dropdown .o_menu_sections": "_hideMenuSection",
|
||||
},
|
||||
Menu.prototype.events
|
||||
),
|
||||
|
||||
start: function () {
|
||||
start: function() {
|
||||
this.$menu_toggle = this.$(".o-menu-toggle");
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
@@ -335,7 +327,7 @@ odoo.define('web_responsive', function (require) {
|
||||
/**
|
||||
* Hide menus for current app if you're in mobile
|
||||
*/
|
||||
_hideMobileSubmenus: function () {
|
||||
_hideMobileSubmenus: function() {
|
||||
if (
|
||||
this.$menu_toggle.is(":visible") &&
|
||||
this.$section_placeholder.is(":visible") &&
|
||||
@@ -350,7 +342,7 @@ odoo.define('web_responsive', function (require) {
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
_hideMenuSection: function () {
|
||||
_hideMenuSection: function() {
|
||||
return !isWaiting();
|
||||
},
|
||||
|
||||
@@ -359,7 +351,7 @@ odoo.define('web_responsive', function (require) {
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
_updateMenuBrand: function () {
|
||||
_updateMenuBrand: function() {
|
||||
if (!config.device.isMobile) {
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
@@ -370,7 +362,7 @@ odoo.define('web_responsive', function (require) {
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
_onMouseOverMenu: function () {
|
||||
_onMouseOverMenu: function() {
|
||||
if (!isWaiting()) {
|
||||
this._super.apply(this, arguments);
|
||||
}
|
||||
@@ -378,16 +370,15 @@ odoo.define('web_responsive', function (require) {
|
||||
});
|
||||
|
||||
RelationalFields.FieldStatus.include({
|
||||
|
||||
/**
|
||||
* Fold all on mobiles.
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
_setState: function () {
|
||||
_setState: function() {
|
||||
this._super.apply(this, arguments);
|
||||
if (config.device.isMobile) {
|
||||
_.map(this.status_information, (value) => {
|
||||
_.map(this.status_information, value => {
|
||||
value.fold = true;
|
||||
});
|
||||
}
|
||||
@@ -396,19 +387,20 @@ odoo.define('web_responsive', function (require) {
|
||||
|
||||
// Sticky Column Selector
|
||||
ListRenderer.include({
|
||||
_renderView: function () {
|
||||
_renderView: function() {
|
||||
const self = this;
|
||||
return this._super.apply(this, arguments).then(() => {
|
||||
const $col_selector = self.$el.find(
|
||||
'.o_optional_columns_dropdown_toggle');
|
||||
".o_optional_columns_dropdown_toggle"
|
||||
);
|
||||
if ($col_selector.length !== 0) {
|
||||
const $th = self.$el.find('thead>tr:first>th:last');
|
||||
const $th = self.$el.find("thead>tr:first>th:last");
|
||||
$col_selector.appendTo($th);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_onToggleOptionalColumnDropdown: function (ev) {
|
||||
_onToggleOptionalColumnDropdown: function(ev) {
|
||||
// FIXME: For some strange reason the 'stopPropagation' call
|
||||
// in the main method don't work. Invoking here the same method
|
||||
// does the expected behavior... O_O!
|
||||
@@ -421,13 +413,12 @@ odoo.define('web_responsive', function (require) {
|
||||
|
||||
// Responsive view "action" buttons
|
||||
FormRenderer.include({
|
||||
|
||||
/**
|
||||
* In mobiles, put all statusbar buttons in a dropdown.
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
_renderHeaderButtons: function () {
|
||||
_renderHeaderButtons: function() {
|
||||
const $buttons = this._super.apply(this, arguments);
|
||||
if (
|
||||
!config.device.isMobile ||
|
||||
@@ -438,9 +429,9 @@ odoo.define('web_responsive', function (require) {
|
||||
|
||||
// $buttons must be appended by JS because all events are bound
|
||||
$buttons.addClass("dropdown-menu");
|
||||
const $dropdown = $(core.qweb.render(
|
||||
'web_responsive.MenuStatusbarButtons'
|
||||
));
|
||||
const $dropdown = $(
|
||||
core.qweb.render("web_responsive.MenuStatusbarButtons")
|
||||
);
|
||||
$buttons.addClass("dropdown-menu").appendTo($dropdown);
|
||||
return $dropdown;
|
||||
},
|
||||
@@ -448,10 +439,12 @@ odoo.define('web_responsive', function (require) {
|
||||
|
||||
// Chatter Hide Composer
|
||||
Chatter.include({
|
||||
_openComposer: function (options) {
|
||||
if (this._composer &&
|
||||
options.isLog === this._composer.options.isLog &&
|
||||
this._composer.$el.is(':visible')) {
|
||||
_openComposer: function(options) {
|
||||
if (
|
||||
this._composer &&
|
||||
options.isLog === this._composer.options.isLog &&
|
||||
this._composer.$el.is(":visible")
|
||||
) {
|
||||
this._closeComposer(false);
|
||||
} else {
|
||||
this._super.apply(this, arguments);
|
||||
@@ -461,37 +454,43 @@ odoo.define('web_responsive', function (require) {
|
||||
|
||||
// Hide AppDrawer or Menu when the action has been completed
|
||||
ActionManager.include({
|
||||
|
||||
/**
|
||||
* Because the menu aren't closed when click, this method
|
||||
* searchs for the menu with the action executed to close it.
|
||||
* To avoid delays in pages with a lot of DOM nodes we make
|
||||
* 'sub-groups' with 'querySelector' to improve the performance.
|
||||
*
|
||||
* @param {action} action
|
||||
* The executed action
|
||||
*/
|
||||
_hideMenusByAction: function (action) {
|
||||
const uniq_sel = '[data-action-id='+action.id+']';
|
||||
* Because the menu aren't closed when click, this method
|
||||
* searchs for the menu with the action executed to close it.
|
||||
* To avoid delays in pages with a lot of DOM nodes we make
|
||||
* 'sub-groups' with 'querySelector' to improve the performance.
|
||||
*
|
||||
* @param {action} action
|
||||
* The executed action
|
||||
*/
|
||||
_hideMenusByAction: function(action) {
|
||||
const uniq_sel = "[data-action-id=" + action.id + "]";
|
||||
// Need close AppDrawer?
|
||||
const menu_apps_dropdown = document.querySelector(
|
||||
'.o_menu_apps .dropdown');
|
||||
$(menu_apps_dropdown).has('.dropdown-menu.show')
|
||||
.has(uniq_sel).find('> a').dropdown('toggle');
|
||||
const menu_apps_dropdown = document.querySelector(".o_menu_apps .dropdown");
|
||||
$(menu_apps_dropdown)
|
||||
.has(".dropdown-menu.show")
|
||||
.has(uniq_sel)
|
||||
.find("> a")
|
||||
.dropdown("toggle");
|
||||
// Need close Sections Menu?
|
||||
const menu_sections = document.querySelector(
|
||||
'.o_menu_sections li.show');
|
||||
$(menu_sections).has(uniq_sel).find('.dropdown-toggle')
|
||||
.dropdown('toggle');
|
||||
const menu_sections = document.querySelector(".o_menu_sections li.show");
|
||||
$(menu_sections)
|
||||
.has(uniq_sel)
|
||||
.find(".dropdown-toggle")
|
||||
.dropdown("toggle");
|
||||
// Need close Mobile?
|
||||
const menu_sections_mobile = document.querySelector(
|
||||
'.o_menu_sections.show');
|
||||
$(menu_sections_mobile).has(uniq_sel).hide();
|
||||
".o_menu_sections.show"
|
||||
);
|
||||
$(menu_sections_mobile)
|
||||
.has(uniq_sel)
|
||||
.hide();
|
||||
},
|
||||
|
||||
_handleAction: function (action) {
|
||||
return this._super.apply(this, arguments).finally(
|
||||
$.proxy(this, '_hideMenusByAction', action));
|
||||
_handleAction: function(action) {
|
||||
return this._super
|
||||
.apply(this, arguments)
|
||||
.finally($.proxy(this, "_hideMenusByAction", action));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -508,7 +507,6 @@ odoo.define('web_responsive', function (require) {
|
||||
* enable this behavior.
|
||||
*/
|
||||
var KeyboardNavigationShiftAltMixin = {
|
||||
|
||||
/**
|
||||
* Alter the key event to require pressing Shift.
|
||||
*
|
||||
@@ -526,7 +524,7 @@ odoo.define('web_responsive', function (require) {
|
||||
* @returns {keyEvent}
|
||||
* Altered event object
|
||||
*/
|
||||
_shiftPressed: function (keyEvent) {
|
||||
_shiftPressed: function(keyEvent) {
|
||||
const alt = keyEvent.altKey || keyEvent.key === "Alt",
|
||||
newEvent = _.extend({}, keyEvent),
|
||||
shift = keyEvent.shiftKey || keyEvent.key === "Shift";
|
||||
@@ -540,11 +538,11 @@ odoo.define('web_responsive', function (require) {
|
||||
return newEvent;
|
||||
},
|
||||
|
||||
_onKeyDown: function (keyDownEvent) {
|
||||
_onKeyDown: function(keyDownEvent) {
|
||||
return this._super(this._shiftPressed(keyDownEvent));
|
||||
},
|
||||
|
||||
_onKeyUp: function (keyUpEvent) {
|
||||
_onKeyUp: function(keyUpEvent) {
|
||||
return this._super(this._shiftPressed(keyUpEvent));
|
||||
},
|
||||
};
|
||||
@@ -559,38 +557,38 @@ odoo.define('web_responsive', function (require) {
|
||||
// this.$el is active, but now the modal have buttons that can obtain
|
||||
// the focus. For this reason we now listen core events, that are
|
||||
// dispatched every time.
|
||||
events: _.extend(_.omit(DocumentViewer.prototype.events, [
|
||||
'keydown',
|
||||
'keyup',
|
||||
]), {
|
||||
'click .o_maximize_btn': '_onClickMaximize',
|
||||
'click .o_minimize_btn': '_onClickMinimize',
|
||||
'shown.bs.modal': '_onShownModal',
|
||||
}),
|
||||
events: _.extend(
|
||||
_.omit(DocumentViewer.prototype.events, ["keydown", "keyup"]),
|
||||
{
|
||||
"click .o_maximize_btn": "_onClickMaximize",
|
||||
"click .o_minimize_btn": "_onClickMinimize",
|
||||
"shown.bs.modal": "_onShownModal",
|
||||
}
|
||||
),
|
||||
|
||||
start: function () {
|
||||
core.bus.on('keydown', this, this._onKeydown);
|
||||
core.bus.on('keyup', this, this._onKeyUp);
|
||||
start: function() {
|
||||
core.bus.on("keydown", this, this._onKeydown);
|
||||
core.bus.on("keyup", this, this._onKeyUp);
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
core.bus.off('keydown', this, this._onKeydown);
|
||||
core.bus.off('keyup', this, this._onKeyUp);
|
||||
destroy: function() {
|
||||
core.bus.off("keydown", this, this._onKeydown);
|
||||
core.bus.off("keyup", this, this._onKeyUp);
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
_onShownModal: function () {
|
||||
_onShownModal: function() {
|
||||
// Disable auto-focus to allow to use controls in edit mode.
|
||||
// This only affects the active modal.
|
||||
// More info: https://stackoverflow.com/a/14795256
|
||||
$(document).off('focusin.modal');
|
||||
$(document).off("focusin.modal");
|
||||
},
|
||||
_onClickMaximize: function () {
|
||||
this.$el.removeClass('o_responsive_document_viewer');
|
||||
_onClickMaximize: function() {
|
||||
this.$el.removeClass("o_responsive_document_viewer");
|
||||
},
|
||||
_onClickMinimize: function () {
|
||||
this.$el.addClass('o_responsive_document_viewer');
|
||||
_onClickMinimize: function() {
|
||||
this.$el.addClass("o_responsive_document_viewer");
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- Copyright 2018 Tecnativa - Jairo Llopis
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
||||
|
||||
<template>
|
||||
<t t-extend="AppsMenu">
|
||||
<!-- App icons must be clickable -->
|
||||
<t t-jquery=".o_app" t-operation="attributes">
|
||||
<attribute name="t-attf-href">#menu_id=#{app.menuID}&action_id=#{app.actionID}</attribute>
|
||||
<attribute
|
||||
name="t-attf-href"
|
||||
>#menu_id=#{app.menuID}&action_id=#{app.actionID}</attribute>
|
||||
</t>
|
||||
|
||||
<!-- App icons should be more than a text -->
|
||||
<t t-jquery=".o_app > t" t-operation="replace">
|
||||
<t t-call="web_responsive.AppIcon"/>
|
||||
<t t-call="web_responsive.AppIcon" />
|
||||
</t>
|
||||
|
||||
<!-- Same hotkey as in EE -->
|
||||
@@ -26,40 +27,46 @@
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<i class="fa fa-search"/>
|
||||
<i class="fa fa-search" />
|
||||
</div>
|
||||
</div>
|
||||
<input type="search"
|
||||
autocomplete="off"
|
||||
placeholder="Search menus..."
|
||||
class="form-control"/>
|
||||
<input
|
||||
type="search"
|
||||
autocomplete="off"
|
||||
placeholder="Search menus..."
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-results col-md-10 ml-auto mr-auto"/>
|
||||
<div class="search-results col-md-10 ml-auto mr-auto" />
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<!-- Separate app icon template, for easier inheritance -->
|
||||
<t t-name="web_responsive.AppIcon">
|
||||
<img class="o-app-icon"
|
||||
t-attf-src="data:image/png;base64,#{app.web_icon_data}"/>
|
||||
<img
|
||||
class="o-app-icon"
|
||||
t-attf-src="data:image/png;base64,#{app.web_icon_data}"
|
||||
/>
|
||||
<span class="o-app-name">
|
||||
<t t-esc="app.name"/>
|
||||
<t t-esc="app.name" />
|
||||
</span>
|
||||
</t>
|
||||
|
||||
<!-- A search result -->
|
||||
<t t-name="web_responsive.MenuSearchResults">
|
||||
<t t-foreach="results" t-as="result">
|
||||
<t t-set="menu" t-value="widget._menuInfo(result.original)"/>
|
||||
<a t-attf-class="o-menu-search-result dropdown-item col-12 ml-auto mr-auto #{result_first ? 'active' : ''}"
|
||||
t-attf-style="background-image:url('data:image/png;base64,#{menu.web_icon_data}')"
|
||||
t-attf-href="#menu_id=#{menu.id}&action_id=#{menu.action_id}"
|
||||
t-att-data-menu-id="menu.id"
|
||||
t-att-data-action-id="menu.action_id"
|
||||
t-att-data-parent-id="menu.parent_id[0]"
|
||||
t-raw="result.string"/>
|
||||
<t t-set="menu" t-value="widget._menuInfo(result.original)" />
|
||||
<a
|
||||
t-attf-class="o-menu-search-result dropdown-item col-12 ml-auto mr-auto #{result_first ? 'active' : ''}"
|
||||
t-attf-style="background-image:url('data:image/png;base64,#{menu.web_icon_data}')"
|
||||
t-attf-href="#menu_id=#{menu.id}&action_id=#{menu.action_id}"
|
||||
t-att-data-menu-id="menu.id"
|
||||
t-att-data-action-id="menu.action_id"
|
||||
t-att-data-parent-id="menu.parent_id[0]"
|
||||
t-raw="result.string"
|
||||
/>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- Copyright 2019 Tecnativa - Alexandre Díaz
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
||||
|
||||
<template>
|
||||
<t t-extend="DocumentViewer">
|
||||
<t t-jquery=".o_modal_fullscreen" t-operation="attributes">
|
||||
<attribute name="class">modal o_modal_fullscreen o_document_viewer o_responsive_document_viewer</attribute>
|
||||
<attribute
|
||||
name="class"
|
||||
>modal o_modal_fullscreen o_document_viewer o_responsive_document_viewer</attribute>
|
||||
<attribute name="data-backdrop">false</attribute>
|
||||
</t>
|
||||
</t>
|
||||
@@ -13,9 +14,27 @@
|
||||
<t t-extend="DocumentViewer.Content">
|
||||
<t t-jquery=".o_close_btn" t-operation="replace">
|
||||
<div class="o_buttons float-right mr8">
|
||||
<a role="button" class="mr8 o_maximize_btn" tabindex="0" aria-label="Maximize" title="Maximize"><i class="fa fa-window-maximize"></i></a>
|
||||
<a role="button" class="mr8 o_minimize_btn" tabindex="0" aria-label="Minimize" title="Minimize"><i class="fa fa-window-minimize"></i></a>
|
||||
<a role="button" class="o_close_btn" tabindex="0" aria-label="Close" title="Close"><i class="fa fa-close"></i></a>
|
||||
<a
|
||||
role="button"
|
||||
class="mr8 o_maximize_btn"
|
||||
tabindex="0"
|
||||
aria-label="Maximize"
|
||||
title="Maximize"
|
||||
><i class="fa fa-window-maximize" /></a>
|
||||
<a
|
||||
role="button"
|
||||
class="mr8 o_minimize_btn"
|
||||
tabindex="0"
|
||||
aria-label="Minimize"
|
||||
title="Minimize"
|
||||
><i class="fa fa-window-minimize" /></a>
|
||||
<a
|
||||
role="button"
|
||||
class="o_close_btn"
|
||||
tabindex="0"
|
||||
aria-label="Close"
|
||||
title="Close"
|
||||
><i class="fa fa-close" /></a>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2017 LasLabs Inc.
|
||||
Copyright 2018 Alexandre Díaz
|
||||
Copyright 2018 Tecnativa - Jairo Llopis
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
||||
-->
|
||||
|
||||
<templates id="form_view" xml:space="preserve">
|
||||
|
||||
<!-- Template for buttons that display only the icon in xs -->
|
||||
<t t-name="web_responsive.icon_button">
|
||||
<i t-attf-class="fa fa-#{icon}"
|
||||
t-att-title="label"/>
|
||||
<span class="d-none d-sm-inline" t-esc="label"/>
|
||||
<i t-attf-class="fa fa-#{icon}" t-att-title="label" />
|
||||
<span class="d-none d-sm-inline" t-esc="label" />
|
||||
</t>
|
||||
|
||||
<t t-name="web_responsive.MenuStatusbarButtons">
|
||||
<div class="dropdown">
|
||||
<button class="o_statusbar_buttons_dropdown btn btn-secondary dropdown-toggle"
|
||||
type="button"
|
||||
data-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false">
|
||||
<button
|
||||
class="o_statusbar_buttons_dropdown btn btn-secondary dropdown-toggle"
|
||||
type="button"
|
||||
data-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
>
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'cogs'"/>
|
||||
<t t-set="icon" t-value="'cogs'" />
|
||||
<t t-set="label">Quick actions</t>
|
||||
</t>
|
||||
</button>
|
||||
@@ -46,28 +46,28 @@
|
||||
<!-- Add responsive icons to buttons -->
|
||||
<t t-jquery=".o_form_button_edit" t-operation="inner">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'pencil'"/>
|
||||
<t t-set="icon" t-value="'pencil'" />
|
||||
<t t-set="label">Edit</t>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<t t-jquery=".o_form_button_create" t-operation="inner">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'plus'"/>
|
||||
<t t-set="icon" t-value="'plus'" />
|
||||
<t t-set="label">Create</t>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<t t-jquery=".o_form_button_save" t-operation="inner">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'check'"/>
|
||||
<t t-set="icon" t-value="'check'" />
|
||||
<t t-set="label">Save</t>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<t t-jquery=".o_form_button_cancel" t-operation="inner">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'times'"/>
|
||||
<t t-set="icon" t-value="'times'" />
|
||||
<t t-set="label">Discard</t>
|
||||
</t>
|
||||
</t>
|
||||
@@ -77,8 +77,8 @@
|
||||
<!-- Add responsive icons to buttons -->
|
||||
<t t-jquery="button" t-operation="inner">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'plus'"/>
|
||||
<t t-set="label" t-value="create_text || _t('Create')"/>
|
||||
<t t-set="icon" t-value="'plus'" />
|
||||
<t t-set="label" t-value="create_text || _t('Create')" />
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
@@ -92,21 +92,21 @@
|
||||
<!-- Add responsive icons to buttons -->
|
||||
<t t-jquery=".o_list_button_add" t-operation="inner">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'plus'"/>
|
||||
<t t-set="icon" t-value="'plus'" />
|
||||
<t t-set="label">Create</t>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<t t-jquery=".o_list_button_save" t-operation="inner">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'check'"/>
|
||||
<t t-set="icon" t-value="'check'" />
|
||||
<t t-set="label">Save</t>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<t t-jquery=".o_list_button_discard" t-operation="inner">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'times'"/>
|
||||
<t t-set="icon" t-value="'times'" />
|
||||
<t t-set="label">Discard</t>
|
||||
</t>
|
||||
</t>
|
||||
@@ -114,26 +114,28 @@
|
||||
|
||||
<t t-extend="Sidebar">
|
||||
<!-- Replace some common sections by icons in mobile -->
|
||||
<t t-jquery=".o_dropdown_toggler_btn t[t-esc='section.label']"
|
||||
t-operation="replace">
|
||||
<t t-set="label" t-value="section.label"/>
|
||||
<t
|
||||
t-jquery=".o_dropdown_toggler_btn t[t-esc='section.label']"
|
||||
t-operation="replace"
|
||||
>
|
||||
<t t-set="label" t-value="section.label" />
|
||||
<t t-if="section.name == 'files'">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'paperclip'"/>
|
||||
<t t-set="icon" t-value="'paperclip'" />
|
||||
</t>
|
||||
</t>
|
||||
<t t-elif="section.name == 'print'">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'print'"/>
|
||||
<t t-set="icon" t-value="'print'" />
|
||||
</t>
|
||||
</t>
|
||||
<t t-elif="section.name == 'other'">
|
||||
<t t-call="web_responsive.icon_button">
|
||||
<t t-set="icon" t-value="'wrench'"/>
|
||||
<t t-set="icon" t-value="'wrench'" />
|
||||
</t>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<span t-esc="label"/>
|
||||
<span t-esc="label" />
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
@@ -142,7 +144,7 @@
|
||||
<t t-jquery=".o_chatter_topbar" t-operation="replace">
|
||||
<div class="o_chatter_header_container">
|
||||
<div class="o_chatter_topbar">
|
||||
<div class="o_topbar_right_area"/>
|
||||
<div class="o_topbar_right_area" />
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- Copyright 2017-2018 Tecnativa - Jairo Llopis
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
||||
|
||||
<template>
|
||||
<t t-extend="Menu">
|
||||
<t t-jquery=".o_menu_apps" t-operation="after">
|
||||
<!-- Hamburger button to show submenus in sm screens -->
|
||||
<button class="o-menu-toggle d-md-none"
|
||||
data-toggle="collapse"
|
||||
data-target=".o_main_navbar .o_menu_sections">
|
||||
<i class="fa fa-bars"/>
|
||||
<button
|
||||
class="o-menu-toggle d-md-none"
|
||||
data-toggle="collapse"
|
||||
data-target=".o_main_navbar .o_menu_sections"
|
||||
>
|
||||
<i class="fa fa-bars" />
|
||||
</button>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2016 LasLabs Inc.
|
||||
@author Dave Lasley <dave@laslabs.com>
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
<template id="assets_backend" name="Open Mobile Assets" inherit_id="web.assets_backend">
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="Open Mobile Assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr=".">
|
||||
<link rel="stylesheet"
|
||||
href="/web_responsive/static/src/css/web_responsive.scss"
|
||||
/>
|
||||
<script type="application/javascript"
|
||||
src="/web_responsive/static/src/js/web_responsive.js"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/web_responsive/static/src/css/web_responsive.scss"
|
||||
/>
|
||||
<script
|
||||
type="application/javascript"
|
||||
src="/web_responsive/static/src/js/web_responsive.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<?xml version="1.0" ?>
|
||||
<!--
|
||||
Copyright 2018
|
||||
@author Alexanre Díaz <dev@redneboa.es>
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_users_form_simple_modif" model="ir.ui.view">
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2018 Alexandre Díaz
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<template id="webclient_bootstrap"
|
||||
inherit_id="web.webclient_bootstrap"
|
||||
name="App Drawer - Web Client"
|
||||
>
|
||||
<template
|
||||
id="webclient_bootstrap"
|
||||
inherit_id="web.webclient_bootstrap"
|
||||
name="App Drawer - Web Client"
|
||||
>
|
||||
<xpath expr="//t[@t-set='body_classname']" position="attributes">
|
||||
<attribute name="t-value" add="+ ' o_chatter_position_' + (request.env.user.chatter_position or 'normal')" separator=" " />
|
||||
<attribute
|
||||
name="t-value"
|
||||
add="+ ' o_chatter_position_' + (request.env.user.chatter_position or 'normal')"
|
||||
separator=" "
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
td.o_many2one_cell {
|
||||
a {
|
||||
margin-left: 0.5em;
|
||||
visibility: hidden;
|
||||
}
|
||||
a {
|
||||
margin-left: 0.5em;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
&:hover a {
|
||||
visibility: visible;
|
||||
}
|
||||
&:hover a {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,54 +6,58 @@
|
||||
* Copyright 2019 Alexandre Díaz <alexandre.diaz@tecnativa.com>
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||
|
||||
odoo.define('web_tree_many2one_clickable.many2one_clickable', function (require) {
|
||||
'use strict';
|
||||
odoo.define("web_tree_many2one_clickable.many2one_clickable", function(require) {
|
||||
"use strict";
|
||||
|
||||
var ListRenderer = require('web.ListRenderer');
|
||||
var ListFieldMany2One = require('web.relational_fields').ListFieldMany2One;
|
||||
var ListRenderer = require("web.ListRenderer");
|
||||
var ListFieldMany2One = require("web.relational_fields").ListFieldMany2One;
|
||||
|
||||
ListRenderer.include({
|
||||
_renderBodyCell: function (record, node, colIndex, options) {
|
||||
if (!node.attrs.widget && node.attrs.name &&
|
||||
_renderBodyCell: function(record, node, colIndex, options) {
|
||||
if (
|
||||
!node.attrs.widget &&
|
||||
node.attrs.name &&
|
||||
this.state.fields[node.attrs.name] &&
|
||||
this.state.fields[node.attrs.name].type === 'many2one') {
|
||||
this.state.fields[node.attrs.name].type === "many2one"
|
||||
) {
|
||||
// No explicit widget provided on a many2one field,
|
||||
// force `many2one` widget
|
||||
node.attrs.widget = 'many2one';
|
||||
node.attrs.widget = "many2one";
|
||||
}
|
||||
return this._super(record, node, colIndex, options);
|
||||
},
|
||||
});
|
||||
|
||||
ListFieldMany2One.include({
|
||||
_renderReadonly: function () {
|
||||
_renderReadonly: function() {
|
||||
this._super.apply(this, arguments);
|
||||
var self = this;
|
||||
|
||||
if (!this.noOpen && this.value) {
|
||||
// Replace '<a>' element
|
||||
this.$el.removeClass('o_form_uri');
|
||||
this.$el = $('<span/>', {
|
||||
this.$el.removeClass("o_form_uri");
|
||||
this.$el = $("<span/>", {
|
||||
html: this.$el.html(),
|
||||
class: this.$el.attr('class') + ' o_field_text',
|
||||
name: this.$el.attr('name'),
|
||||
class: this.$el.attr("class") + " o_field_text",
|
||||
name: this.$el.attr("name"),
|
||||
});
|
||||
|
||||
// Append button
|
||||
var $a = $('<a/>', {
|
||||
href: '#',
|
||||
class: 'o_form_uri btn btn-sm btn-secondary' +
|
||||
' fa fa-angle-double-right',
|
||||
}).on('click', function (ev) {
|
||||
var $a = $("<a/>", {
|
||||
href: "#",
|
||||
class:
|
||||
"o_form_uri btn btn-sm btn-secondary" +
|
||||
" fa fa-angle-double-right",
|
||||
}).on("click", function(ev) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
|
||||
self.do_action({
|
||||
type: 'ir.actions.act_window',
|
||||
type: "ir.actions.act_window",
|
||||
res_model: self.field.relation,
|
||||
res_id: self.value.res_id,
|
||||
views: [[false, 'form']],
|
||||
target: 'target',
|
||||
views: [[false, "form"]],
|
||||
target: "target",
|
||||
});
|
||||
});
|
||||
this.$el.append($a);
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2015 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
|
||||
Copyright 2019 Alexandre Díaz <alexandre.diaz@tecnativa.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
|
||||
<template id="assets_backend" name="web_tree_many2one_clickable assets"
|
||||
inherit_id="web.assets_backend">
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="web_tree_many2one_clickable assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<link rel="stylesheet"
|
||||
href="/web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss" />
|
||||
<script type="text/javascript"
|
||||
src="/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js"/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
odoo.define('web_widget_bokeh_chart', function (require) {
|
||||
"use strict";
|
||||
odoo.define("web_widget_bokeh_chart", function(require) {
|
||||
"use strict";
|
||||
|
||||
var fieldRegistry = require('web.field_registry');
|
||||
var AbstractField = require('web.AbstractField');
|
||||
var fieldRegistry = require("web.field_registry");
|
||||
var AbstractField = require("web.AbstractField");
|
||||
|
||||
var BokehChartWidget = AbstractField.extend({
|
||||
_renderReadonly: function() {
|
||||
var val = this.value;
|
||||
this.$el.html(val);
|
||||
}
|
||||
},
|
||||
});
|
||||
fieldRegistry.add('bokeh_chart', BokehChartWidget);
|
||||
fieldRegistry.add("bokeh_chart", BokehChartWidget);
|
||||
return {
|
||||
BokehChartWidget: BokehChartWidget
|
||||
BokehChartWidget: BokehChartWidget,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
/* Overriding this styling option Odoo menu is now displayed on top of bokeh graphs */
|
||||
z-index: 0;
|
||||
height: inherit !important;
|
||||
|
||||
}
|
||||
.bk-root > .bk {
|
||||
height: inherit !important;
|
||||
|
||||
}
|
||||
.bk-root > .bk > .bk {
|
||||
height: inherit !important;
|
||||
|
||||
}
|
||||
.bk-root > .bk > .bk > .bk-canvas {
|
||||
height: inherit !important;
|
||||
|
||||
@@ -1,16 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<template id="assets_backend" name="web_widget_bokeh_chart assets"
|
||||
inherit_id="web.assets_backend">
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="web_widget_bokeh_chart assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<link rel="stylesheet" type="text/css" href="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-1.1.0.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-1.1.0.css"/>
|
||||
<link rel="stylesheet" type="text/scss" href="/web_widget_bokeh_chart/static/src/scss/custom-bokeh.scss"/>
|
||||
<script type="text/javascript" src="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-1.1.0.js"/>
|
||||
<script type="text/javascript" src="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-1.1.0.js"/>
|
||||
<script type="text/javascript" src="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-1.1.0.js"/>
|
||||
<script type="text/javascript" src="/web_widget_bokeh_chart/static/src/js/web_widget_bokeh_chart.js"/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-1.1.0.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-1.1.0.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/scss"
|
||||
href="/web_widget_bokeh_chart/static/src/scss/custom-bokeh.scss"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-1.1.0.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-1.1.0.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-1.1.0.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_widget_bokeh_chart/static/src/js/web_widget_bokeh_chart.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user