Merge branch 'mig-13.0' of https://github.com/hootel/hootel into mig-13.0

This commit is contained in:
Pablo Quesada Barriuso
2020-08-05 01:11:56 +02:00
527 changed files with 8625 additions and 45000 deletions

20
.editorconfig Normal file
View File

@@ -0,0 +1,20 @@
# Configuration for known file extensions
[*.{css,js,json,less,md,py,rst,sass,scss,xml,yaml,yml}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{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}]
charset = unset
end_of_line = unset
indent_size = unset
indent_style = unset
insert_final_newline = false
trim_trailing_whitespace = false

180
.eslintrc.yml Normal file
View 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

10
.flake8 Normal file
View File

@@ -0,0 +1,10 @@
[flake8]
max-line-length = 80
max-complexity = 16
# B = bugbear
# B9 = bugbear opinionated (incl line length)
select = C,E,F,W,B,B9
# E203: whitespace before ':' (black behaviour)
# E501: flake8 line length (covered by bugbear B950)
# W503: line break before binary operator (black behaviour)
ignore = E203,E501,W503

13
.isort.cfg Normal file
View File

@@ -0,0 +1,13 @@
[settings]
; see https://github.com/psf/black
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
combine_as_imports=True
use_parentheses=True
line_length=88
known_odoo=odoo
known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
default_section=THIRDPARTY
known_third_party=openerp,werkzeug

102
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,102 @@
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.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.7.2"
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: fix-encoding-pragma
args: ["--remove"]
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
# exclude files where underlines are not distinguishable from merge conflicts
exclude: /README\.rst$|^docs/.*\.rst$
- id: check-symlinks
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- 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"]
- 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.1.0"]
- id: pylint
name: pylint with mandatory checks
args: ["--rcfile=.pylintrc-mandatory"]
additional_dependencies: ["pylint-odoo==3.1.0"]
- repo: https://github.com/asottile/pyupgrade
rev: v1.26.2
hooks:
- id: pyupgrade
- 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/acsone/setuptools-odoo
rev: 2.5.2
hooks:
- id: setuptools-odoo-make-default

8
.prettierrc.yml Normal file
View File

@@ -0,0 +1,8 @@
# 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"
xmlWhitespaceSensitivity: "ignore"

87
.pylintrc Normal file
View File

@@ -0,0 +1,87 @@
[MASTER]
load-plugins=pylint_odoo
score=n
[ODOOLINT]
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest_required_authors=Odoo Community Association (OCA)
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid_odoo_versions=13.0
[MESSAGES CONTROL]
disable=all
# This .pylintrc contains optional AND mandatory checks and is meant to be
# loaded in an IDE to have it check everything, in the hope this will make
# optional checks more visible to contributors who otherwise never look at a
# green travis to see optional checks that failed.
# .pylintrc-mandatory containing only mandatory checks is used the pre-commit
# config as a blocking check.
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-author,
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
missing-import-error,
missing-manifest-dependency,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
# messages that do not cause the lint step to fail
consider-merging-classes-inherited,
create-user-wo-reset-password,
dangerous-filter-wo-user,
deprecated-module,
file-not-used,
invalid-commit,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
redefined-builtin,
too-complex,
unnecessary-utf8-coding-comment
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

65
.pylintrc-mandatory Normal file
View File

@@ -0,0 +1,65 @@
[MASTER]
load-plugins=pylint_odoo
score=n
[ODOOLINT]
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest_required_authors=Odoo Community Association (OCA)
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid_odoo_versions=13.0
[MESSAGES CONTROL]
disable=all
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-author,
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
missing-import-error,
missing-manifest-dependency,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

View File

@@ -10,28 +10,34 @@ addons:
postgresql: "9.2" # minimal postgresql version for the daterange method
apt:
packages:
- expect-dev # provides unbuffer utility
- python-lxml # because pip installation is slow
- expect-dev # provides unbuffer utility
- python-lxml # because pip installation is slow
env:
global:
- VERSION="11.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0" MAKEPOT="0"
# - TRANSIFEX_USER='transbot@odoo-community.org'
# - secure: "XLhGdCIh86zcqww9qBpnk8Xqsf1Pcgw9SKr7X0KYBHJofHj4Z6Kq/oVFjpZ1LSjadsaABKbwY7h4hvKEpxZwptCv+fNTOKYy7hXFLGYnDeNeWu4zA4LI7TA5uPvyZjZ+g2xc+9dzR/VbfRHNqjvmgiEidxxqLeOnNFZ5CHdOdCw="
- VERSION="11.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0" MAKEPOT="0"
# - TRANSIFEX_USER='transbot@odoo-community.org'
# - secure: "XLhGdCIh86zcqww9qBpnk8Xqsf1Pcgw9SKr7X0KYBHJofHj4Z6Kq/oVFjpZ1LSjadsaABKbwY7h4hvKEpxZwptCv+fNTOKYy7hXFLGYnDeNeWu4zA4LI7TA5uPvyZjZ+g2xc+9dzR/VbfRHNqjvmgiEidxxqLeOnNFZ5CHdOdCw="
matrix:
# Option temporarily disabled
#- LINT_CHECK="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB"
# Option temporarily disabled
#- LINT_CHECK="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB"
install:
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools --depth=1
- git clone https://github.com/OCA/maintainer-quality-tools.git
${HOME}/maintainer-quality-tools --depth=1
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- git clone -b ${VERSION} https://github.com/OCA/web.git ${HOME}/dependencies/web --depth=1
- git clone -b ${VERSION} https://github.com/OCA/partner-contact.git ${HOME}/dependencies/partner-contact --depth=1
- git clone -b ${VERSION} https://github.com/OCA/account-payment.git ${HOME}/dependencies/account-payment --depth=1
- git clone -b ${VERSION} https://github.com/OCA/connector.git ${HOME}/dependencies/connector --depth=1
- git clone -b ${VERSION} https://github.com/OCA/queue.git ${HOME}/dependencies/queue --depth=1
- git clone -b ${VERSION} https://github.com/OCA/web.git ${HOME}/dependencies/web
--depth=1
- git clone -b ${VERSION} https://github.com/OCA/partner-contact.git
${HOME}/dependencies/partner-contact --depth=1
- git clone -b ${VERSION} https://github.com/OCA/account-payment.git
${HOME}/dependencies/account-payment --depth=1
- git clone -b ${VERSION} https://github.com/OCA/connector.git
${HOME}/dependencies/connector --depth=1
- git clone -b ${VERSION} https://github.com/OCA/queue.git ${HOME}/dependencies/queue
--depth=1
- pip install odoorpc
- pip install cachetools>=2.0.1
- travis_install_nightly

661
LICENSE Normal file
View File

@@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

View File

@@ -1,6 +0,0 @@
CALL CENTER REPORT
=============
Export call center report in xls format

View File

@@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import wizard

View File

@@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Call Center Report',
'version': '1.0',
'author': "Dario Lodeiros",
'website': 'https://www.eiqui.com',
'category': 'reports',
'summary': "Export services and reservation report in xls format",
'description': "Call Center Report",
'depends': [
'hotel',
],
'external_dependencies': {
'python': ['xlsxwriter']
},
'data': [
'wizard/call_center_report.xml',
'data/menus.xml',
],
'qweb': [],
'test': [
],
'installable': True,
'auto_install': False,
'application': False,
'license': 'AGPL-3',
}

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<menuitem id="call_center_report_wizard" name="Call Center Report"
parent="hotel.hotel_management_menu"
groups="hotel.group_hotel_call,hotel.group_hotel_manager"
action="action_open_call_center_report_wizard" sequence="1000" />
</data>
</odoo>

View File

@@ -1,171 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * cash_daily_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-20 07:33+0000\n"
"PO-Revision-Date: 2018-05-20 09:34+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: es\n"
"X-Generator: Poedit 1.8.7.1\n"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:85
#, python-format
msgid "Amount"
msgstr "Importe"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:78
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
#, python-format
msgid "Cash Daily Report"
msgstr "Informe de caja"
#. module: cash_daily_report
#: model:ir.actions.act_window,name:cash_daily_report.action_open_cash_daily_report_wizard
#: model:ir.ui.menu,name:cash_daily_report.cash_daily_report_wizard
msgid "Cash Daily Report Wizard"
msgstr "Informe de caja diaria"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:82
#, python-format
msgid "Client"
msgstr "Cliente"
#. module: cash_daily_report
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
msgid "Close"
msgstr "Cerrar"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_create_uid
msgid "Created by"
msgstr "Creado por"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_create_date
msgid "Created on"
msgstr "Creado en"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:83
#, python-format
msgid "Date"
msgstr "Fecha"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_display_name
msgid "Display Name"
msgstr "Mostrar Nombre"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_date_end
msgid "End Date"
msgstr "Fecha finalización"
#. module: cash_daily_report
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
msgid "Generate XLS"
msgstr "Generar XLS"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_id
msgid "ID"
msgstr "ID"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:84
#, python-format
msgid "Journal"
msgstr "Diario"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard___last_update
msgid "Last Modified on"
msgstr "Última modificación en"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_write_uid
msgid "Last Updated by"
msgstr "Última actualización por"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_write_date
msgid "Last Updated on"
msgstr "Última actualización en"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:80
#, python-format
msgid "Name"
msgstr "Nombre"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:128
#, python-format
msgid "Not Any Payments"
msgstr "No hay movimientos"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:81
#, python-format
msgid "Reference"
msgstr "Referencia"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_date_start
msgid "Start Date"
msgstr "Fecha de inicio"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:143
#, python-format
msgid "TOTAL"
msgstr "TOTAL"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:139
#, python-format
msgid "TOTAL PAYMENT RETURNS"
msgstr "TOTAL DEVOLUCIONES"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:134
#, python-format
msgid "TOTAL PAYMENTS"
msgstr "TOTAL PAGOS"
#. module: cash_daily_report
#: model:ir.ui.menu,name:cash_daily_report.menu_account_finance_xls_reports
msgid "XLS Reports"
msgstr "XLS Reports"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_xls_binary
msgid "Xls binary"
msgstr "Xls archivo"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_xls_filename
msgid "Xls filename"
msgstr "Xls nombre de archivo"
#. module: cash_daily_report
#: model:ir.model,name:cash_daily_report.model_cash_daily_report_wizard
msgid "cash.daily.report.wizard"
msgstr "cash.daily.report.wizard"
#. module: cash_daily_report
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
msgid "or"
msgstr "o"

View File

@@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import call_center_report

View File

@@ -1,348 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from io import BytesIO
from datetime import datetime, date
import xlsxwriter
import base64
from odoo import api, fields, models, _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
class CallCenterReportWizard(models.TransientModel):
_name = 'call.center.report.wizard'
@api.model
def _get_default_date_start(self):
return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
@api.model
def _get_default_date_end(self):
return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
date_start = fields.Date("Start Date", default=_get_default_date_start)
date_end = fields.Date("End Date", default=_get_default_date_end)
xls_filename = fields.Char()
xls_binary = fields.Binary()
@api.model
def _export(self):
date_format = "%d-%m-%Y"
time_format = "%H:%M"
file_data = BytesIO()
workbook = xlsxwriter.Workbook(file_data, {
'strings_to_numbers': True,
'default_date_format': 'dd/mm/yyyy'
})
company_id = self.env.user.company_id
workbook.set_properties({
'title': 'Exported data from ' + company_id.name,
'subject': 'Payments Data from Odoo of ' + company_id.name,
'author': 'Odoo',
'manager': u'Call Center',
'company': company_id.name,
'category': 'Hoja de Calculo',
'keywords': 'payments, odoo, data, ' + company_id.name,
'comments': 'Created with Python in Odoo and XlsxWriter'})
workbook.use_zip64()
xls_cell_format_date = workbook.add_format({
'num_format': 'dd/mm/yyyy'
})
xls_cell_format_money = workbook.add_format({
'num_format': '#,##0.00'
})
xls_cell_format_header = workbook.add_format({
'bg_color': '#CCCCCC'
})
worksheet = workbook.add_worksheet(_('Call Center Report - Production'))
worksheet.write('A1', _('Ficha'), xls_cell_format_header)
worksheet.write('B1', _('Fecha de Pedido'), xls_cell_format_header)
worksheet.write('C1', _('Cliente'), xls_cell_format_header)
worksheet.write('D1', _('Producto'), xls_cell_format_header)
worksheet.write('E1', _('Noches/Uds'), xls_cell_format_header)
worksheet.write('F1', _('Adultos'), xls_cell_format_header)
worksheet.write('G1', _('Checkin'), xls_cell_format_header)
worksheet.write('H1', _('In-Hora'), xls_cell_format_header)
worksheet.write('I1', _('Checkout'), xls_cell_format_header)
worksheet.write('J1', _('Creado por'), xls_cell_format_header)
worksheet.write('K1', _('Total'), xls_cell_format_header)
worksheet.set_column('B:B', 20)
worksheet.set_column('C:C', 20)
worksheet.set_column('D:D', 20)
worksheet.set_column('E:E', 20)
worksheet.set_column('F:F', 13)
reservations_obj = self.env['hotel.reservation']
reservations = reservations_obj.search([
('checkin', '>=', self.date_start),
('checkout', '<=', self.date_end),
('state', '=', 'done'),
('channel_type', '=', 'call'),
('folio_id.pending_amount', '<', 1),
])
offset = 1
total_reservation_amount = 0.0
for k_res, v_res in enumerate(reservations):
checkin_date = datetime.strptime(v_res.checkin, DEFAULT_SERVER_DATE_FORMAT)
checkout_date = datetime.strptime(v_res.checkout, DEFAULT_SERVER_DATE_FORMAT)
worksheet.write(k_res+offset, 0, v_res.folio_id.name)
worksheet.write(k_res+offset, 1, v_res.folio_id.date_order,
xls_cell_format_date)
worksheet.write(k_res+offset, 2, v_res.partner_id.name)
worksheet.write(k_res+offset, 3, v_res.room_type_id.name)
worksheet.write(k_res+offset, 4, v_res.nights)
worksheet.write(k_res+offset, 5, v_res.adults)
worksheet.write(k_res+offset, 6, checkin_date.strftime(date_format),
xls_cell_format_date)
worksheet.write(k_res+offset, 7, v_res.arrival_hour)
worksheet.write(k_res+offset, 8, checkout_date.strftime(date_format),
xls_cell_format_date)
worksheet.write(k_res+offset, 9, v_res.create_uid.name)
worksheet.write(k_res+offset, 10, v_res.price_total,
xls_cell_format_money)
total_reservation_amount += v_res.price_total
folio_ids = reservations.mapped('folio_id.id')
folios = self.env['hotel.folio'].browse(folio_ids)
services = self.env['hotel.service'].browse()
for folio in folios:
services += folio.service_ids.filtered(lambda r:
r.channel_type == 'call' and r.folio_id.pending_amount < 1)
offset += len(reservations)
total_service_amount = k_line = 0.0
for k_service, v_service in enumerate(services):
worksheet.write(k_service+offset, 0, v_service.folio_id.name)
worksheet.write(k_service+offset, 1, v_service.folio_id.date_order,
xls_cell_format_date)
worksheet.write(k_service+offset, 2, v_service.folio_id.partner_id.name)
worksheet.write(k_service+offset, 3, v_service.product_id.name)
worksheet.write(k_service+offset, 4, v_service.product_qty)
worksheet.write(k_service+offset, 5, '')
worksheet.write(k_service+offset, 6, '')
worksheet.write(k_service+offset, 7, '')
worksheet.write(k_service+offset, 8, '')
worksheet.write(k_service+offset, 9, v_service .create_uid.name)
worksheet.write(k_service+offset, 10, v_service.price_total,
xls_cell_format_money)
total_service_amount += v_service.price_total
offset += len(services)
#~ if total_reservation_amount == 0 and total_service_amount == 0:
#~ raise UserError(_('No Hay reservas de Call Center'))
line = offset
if k_line:
line = k_line + offset
if total_reservation_amount > 0:
line += 1
worksheet.write(line, 9, _('TOTAL RESERVAS'))
worksheet.write(line, 10, total_reservation_amount,
xls_cell_format_money)
if total_service_amount > 0:
line += 1
worksheet.write(line, 9, _('TOTAL SERVICIOS'))
worksheet.write(line, 10, total_service_amount,
xls_cell_format_money)
line += 1
worksheet.write(line, 9, _('TOTAL'))
worksheet.write(line, 10 , total_reservation_amount + total_service_amount,
xls_cell_format_money)
worksheet = workbook.add_worksheet(_('Call Center Report - Sales'))
worksheet.write('A1', _('Estado'), xls_cell_format_header)
worksheet.write('B1', _('Ficha'), xls_cell_format_header)
worksheet.write('C1', _('Fecha de Pedido'), xls_cell_format_header)
worksheet.write('D1', _('Cliente'), xls_cell_format_header)
worksheet.write('E1', _('Producto'), xls_cell_format_header)
worksheet.write('F1', _('Noches/Uds'), xls_cell_format_header)
worksheet.write('G1', _('Adultos'), xls_cell_format_header)
worksheet.write('H1', _('Checkin'), xls_cell_format_header)
worksheet.write('I1', _('In-Hora'), xls_cell_format_header)
worksheet.write('J1', _('Checkout'), xls_cell_format_header)
worksheet.write('K1', _('Creado por'), xls_cell_format_header)
worksheet.write('L1', _('Total'), xls_cell_format_header)
worksheet.set_column('B:B', 20)
worksheet.set_column('C:C', 20)
worksheet.set_column('D:D', 20)
worksheet.set_column('E:E', 20)
worksheet.set_column('F:F', 13)
reservations_obj = self.env['hotel.reservation']
reservations = reservations_obj.search([
('folio_id.date_order', '>=', self.date_start),
('folio_id.date_order', '<=', self.date_end),
('channel_type','=','call'),
])
offset = 1
total_reservation_amount = 0.0
for k_res, v_res in enumerate(reservations):
checkin_date = datetime.strptime(v_res.checkin, DEFAULT_SERVER_DATE_FORMAT)
checkout_date = datetime.strptime(v_res.checkout, DEFAULT_SERVER_DATE_FORMAT)
worksheet.write(k_res+offset, 0, v_res.state)
worksheet.write(k_res+offset, 1, v_res.folio_id.name)
worksheet.write(k_res+offset, 2, v_res.folio_id.date_order,
xls_cell_format_date)
worksheet.write(k_res+offset, 3, v_res.partner_id.name)
worksheet.write(k_res+offset, 4, v_res.room_type_id.name)
worksheet.write(k_res+offset, 5, v_res.nights)
worksheet.write(k_res+offset, 6, v_res.adults)
worksheet.write(k_res+offset, 7, checkin_date.strftime(date_format),
xls_cell_format_date)
worksheet.write(k_res+offset, 8, v_res.arrival_hour)
worksheet.write(k_res+offset, 9, checkout_date.strftime(date_format),
xls_cell_format_date)
worksheet.write(k_res+offset, 10, v_res.create_uid.name)
worksheet.write(k_res+offset, 11, v_res.price_total,
xls_cell_format_money)
total_reservation_amount += v_res.price_total
folio_ids = reservations.mapped('folio_id.id')
folios = self.env['hotel.folio'].browse(folio_ids)
services = self.env['hotel.service'].browse()
for folio in folios:
services += folio.service_ids.filtered(lambda r:
r.channel_type == 'call' and r.folio_id.pending_amount < 1)
offset += len(reservations)
total_service_amount = k_line = 0.0
for k_service, v_service in enumerate(services):
worksheet.write(k_service+offset, 1, v_service.folio_id.state)
worksheet.write(k_service+offset, 1, v_service.folio_id.name)
worksheet.write(k_service+offset, 2, v_service.folio_id.date_order,
xls_cell_format_date)
worksheet.write(k_service+offset, 3, v_service.folio_id.partner_id.name)
worksheet.write(k_service+offset, 4, v_service.product_id.name)
worksheet.write(k_service+offset, 5, v_service.product_qty)
worksheet.write(k_service+offset, 6, '')
worksheet.write(k_service+offset, 7, '')
worksheet.write(k_service+offset, 8, '')
worksheet.write(k_service+offset, 9, '')
worksheet.write(k_service+offset, 10, v_service .create_uid.name)
worksheet.write(k_service+offset, 11, v_service.price_total,
xls_cell_format_money)
total_service_amount += v_service.price_total
offset += len(services)
#~ if total_reservation_amount == 0 and total_service_amount == 0:
#~ raise UserError(_('No Hay reservas de Call Center'))
line = offset
if k_line:
line = k_line + offset
if total_reservation_amount > 0:
line += 1
worksheet.write(line, 10, _('TOTAL RESERVAS'))
worksheet.write(line, 11, total_reservation_amount,
xls_cell_format_money)
if total_service_amount > 0:
line += 1
worksheet.write(line, 10, _('TOTAL SERVICIOS'))
worksheet.write(line, 11, total_service_amount,
xls_cell_format_money)
line += 1
worksheet.write(line, 10, _('TOTAL'))
worksheet.write(line, 11 , total_reservation_amount + total_service_amount,
xls_cell_format_money)
worksheet = workbook.add_worksheet(_('Call Center Report - Cancelations'))
worksheet.write('A1', _('Estado'), xls_cell_format_header)
worksheet.write('B1', _('Ficha'), xls_cell_format_header)
worksheet.write('C1', _('Fecha de Pedido'), xls_cell_format_header)
worksheet.write('D1', _('Cliente'), xls_cell_format_header)
worksheet.write('E1', _('Producto'), xls_cell_format_header)
worksheet.write('F1', _('Noches/Uds'), xls_cell_format_header)
worksheet.write('G1', _('Adultos'), xls_cell_format_header)
worksheet.write('H1', _('Checkin'), xls_cell_format_header)
worksheet.write('I1', _('In-Hora'), xls_cell_format_header)
worksheet.write('J1', _('Checkout'), xls_cell_format_header)
worksheet.write('K1', _('Creado por'), xls_cell_format_header)
worksheet.write('K1', _('Cancelado en'), xls_cell_format_header)
worksheet.write('L1', _('Precio Final'), xls_cell_format_header)
worksheet.write('M1', _('Precio Original'), xls_cell_format_header)
worksheet.set_column('B:B', 20)
worksheet.set_column('C:C', 20)
worksheet.set_column('D:D', 20)
worksheet.set_column('E:E', 20)
worksheet.set_column('F:F', 13)
reservations_obj = self.env['hotel.reservation']
reservations = reservations_obj.search([
('last_updated_res', '>=', self.date_start),
('last_updated_res', '<=', self.date_end),
('channel_type','=','call'),
('state','=','cancelled'),
])
offset = 1
total_reservation_amount = 0.0
for k_res, v_res in enumerate(reservations):
checkin_date = datetime.strptime(v_res.checkin, DEFAULT_SERVER_DATE_FORMAT)
checkout_date = datetime.strptime(v_res.checkout, DEFAULT_SERVER_DATE_FORMAT)
worksheet.write(k_res+offset, 0, v_res.state)
worksheet.write(k_res+offset, 1, v_res.folio_id.name)
worksheet.write(k_res+offset, 2, v_res.folio_id.date_order,
xls_cell_format_date)
worksheet.write(k_res+offset, 3, v_res.partner_id.name)
worksheet.write(k_res+offset, 4, v_res.room_type_id.name)
worksheet.write(k_res+offset, 5, v_res.nights)
worksheet.write(k_res+offset, 6, v_res.adults)
worksheet.write(k_res+offset, 7, checkin_date.strftime(date_format),
xls_cell_format_date)
worksheet.write(k_res+offset, 8, v_res.arrival_hour)
worksheet.write(k_res+offset, 9, checkout_date.strftime(date_format),
xls_cell_format_date)
worksheet.write(k_res+offset, 10, v_res.create_uid.name)
worksheet.write(k_res+offset, 9, v_res.last_updated_res,
xls_cell_format_date)
worksheet.write(k_res+offset, 11, v_res.price_total,
xls_cell_format_money)
worksheet.write(k_res+offset, 12, v_res.price_total - v_res.discount,
xls_cell_format_money)
total_reservation_amount += v_res.price_total
offset += len(reservations)
#~ if total_reservation_amount == 0 and total_service_amount == 0:
#~ raise UserError(_('No Hay reservas de Call Center'))
line = offset
if k_line:
line = k_line + offset
if total_reservation_amount > 0:
line += 1
worksheet.write(line, 11, _('TOTAL RESERVAS'))
worksheet.write(line, 12, total_reservation_amount,
xls_cell_format_money)
workbook.close()
file_data.seek(0)
tnow = fields.Datetime.now().replace(' ', '_')
return {
'xls_filename': 'call_%s.xlsx' %self.env.user.company_id.property_name,
'xls_binary': base64.encodestring(file_data.read()),
}
def export(self):
self.write(self._export())
return {
"type": "ir.actions.do_nothing",
}

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" ?>
<odoo>
<record model="ir.ui.view" id="view_call_center_report_wizard">
<field name="name">call.center.report.wizard</field>
<field name="model">call.center.report.wizard</field>
<field name="arch" type="xml">
<form string="Call Center Report" >
<group>
<group>
<field name="date_start" required="1" />
</group>
<group>
<field name="date_end" required="1" />
</group>
</group>
<group>
<group>
<field name="xls_filename" invisible="1"/>
<field name="xls_binary" filename="xls_filename" readonly="1" />
</group>
</group>
<footer>
<button name="export" string="Generate XLS" type="object" class="oe_highlight" />
or
<button string="Close" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_open_call_center_report_wizard" model="ir.actions.act_window">
<field name="name">Call Center Report Wizard</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">call.center.report.wizard</field>
<field name="view_id" ref="view_call_center_report_wizard"/>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>

View File

@@ -1,13 +0,0 @@
CASH DAILY REPORT
=============
Export payments report in xls format
Credits
=======
Creator
------------
* Alexandre Díaz <dev@redneboa.es>

View File

@@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import wizard

View File

@@ -1,51 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Cash Daily Report',
'version': '1.0',
'author': "Alexandre Díaz <dev@redneboa.es>",
'website': 'https://www.eiqui.com',
'category': 'reports',
'summary': "Export payments report in xls format",
'description': "Cash Daily Report",
'depends': [
'account',
'account_payment_return',
'hotel',
],
'external_dependencies': {
'python': ['xlsxwriter']
},
'data': [
'wizard/cash_daily_report.xml',
'data/menus.xml',
'data/cron_jobs.xml',
],
'qweb': [],
'test': [
],
'installable': True,
'auto_install': False,
'application': False,
'license': 'AGPL-3',
}

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<!-- Scheduler For To Inform Guest About Reservation Before 24 Hours -->
<record model="ir.cron" id="period_lock_date">
<field name="name">Automatic Period Lock Date</field>
<field name="interval_number">1</field>
<field name="user_id" ref="base.user_root" />
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="state">code</field>
<field name="model_id" ref="model_cash_daily_report_wizard" />
<field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 04:00:00')"/>
<field name="code">model.automatic_period_lock_date()</field>
</record>
</data>
</odoo>

View File

@@ -1,43 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem id="cash_daily_report_wizard" name="Cash Daily Report Wizard"
parent="hotel.hotel_reports_menu"
action="action_open_cash_daily_report_wizard"
sequence="45" />
<menuitem id="hotel_payments_menu" name="Payments"
sequence="80"
parent="hotel.hotel_management_menu"
groups="hotel.group_hotel_user"/>
<menuitem id="hotel_supplier_payment_menu" name="Supplier Payments"
sequence="80"
parent="hotel_payments_menu"
groups="hotel.group_hotel_user"
action="account.action_account_payments_payable"/>
<record id="action_account_payments_internal" model="ir.actions.act_window">
<field name="name">Internal Transfers</field>
<field name="res_model">account.payment</field>
<field name="view_mode">tree,kanban,form,graph</field>
<field name="context">{'default_payment_type': 'transfer', 'search_default_transfers_filter': 1}</field>
<field name="domain">[]</field>
<field name="view_id" ref="account.view_account_supplier_payment_tree"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to register a payment
</p><p>
Payments are used to register liquidity movements (send, collect or transfer money).
You can then process those payments by your own means or by using installed facilities.
</p>
</field>
</record>
<menuitem id="hotel_transfer_menu" name="Internal Transfer"
sequence="100"
parent="hotel_payments_menu"
groups="hotel.group_hotel_user"
action="cash_daily_report.action_account_payments_internal"/>
</odoo>

View File

@@ -1,203 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * cash_daily_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-02 10:07+0000\n"
"PO-Revision-Date: 2019-08-02 10:07+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:85
#, python-format
msgid "Amount"
msgstr "Importe"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:78
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
#, python-format
msgid "Cash Daily Report"
msgstr "Informe de caja"
#. module: cash_daily_report
#: model:ir.actions.act_window,name:cash_daily_report.action_open_cash_daily_report_wizard
#: model:ir.ui.menu,name:cash_daily_report.cash_daily_report_wizard
msgid "Cash Daily Report Wizard"
msgstr "Informe de caja diaria"
#. module: cash_daily_report
#: model:ir.actions.act_window,help:cash_daily_report.action_account_payments_internal
msgid "Click to register a payment"
msgstr "Pulse para registrar un pago"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:82
#, python-format
msgid "Client/Supplier"
msgstr "Client/Supplier"
#. module: cash_daily_report
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
msgid "Close"
msgstr "Cerrar"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_create_uid
msgid "Created by"
msgstr "Creado por"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_create_date
msgid "Created on"
msgstr "Creado en"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:83
#, python-format
msgid "Date"
msgstr "Fecha"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_display_name
msgid "Display Name"
msgstr "Nombre mostrado"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_date_end
msgid "End Date"
msgstr "Fecha de finalización"
#. module: cash_daily_report
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
msgid "Generate XLS"
msgstr "Generar XLS"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_id
msgid "ID"
msgstr "ID (identificación)"
#. module: cash_daily_report
#: model:ir.ui.menu,name:cash_daily_report.hotel_transfer_menu
msgid "Internal Transfer"
msgstr "Transferencias Internas"
#. module: cash_daily_report
#: model:ir.actions.act_window,name:cash_daily_report.action_account_payments_internal
msgid "Internal Transfers"
msgstr "Internal Transfers"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:84
#, python-format
msgid "Journal"
msgstr "Diario"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard___last_update
msgid "Last Modified on"
msgstr "Última modificación en"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_write_uid
msgid "Last Updated by"
msgstr "Última actualización de"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_write_date
msgid "Last Updated on"
msgstr "Última actualización en"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:80
#, python-format
msgid "Name"
msgstr "Nombre"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:159
#, python-format
msgid "Not Any Payments"
msgstr "No hay movimientos"
#. module: cash_daily_report
#: model:ir.ui.menu,name:cash_daily_report.hotel_payments_menu
msgid "Payments"
msgstr "Pagos"
#. module: cash_daily_report
#: model:ir.actions.act_window,help:cash_daily_report.action_account_payments_internal
msgid "Payments are used to register liquidity movements (send, collect or transfer money).\n"
" You can then process those payments by your own means or by using installed facilities."
msgstr "Los pagos se utilizan para registrar movimientos de liquidez (enviar, recibir o transferir dinero).\n"
"Puede procesar esos pagos por sus propios medios o utilizando los servicios instalados."
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:81
#, python-format
msgid "Reference"
msgstr "Referencia"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_date_start
msgid "Start Date"
msgstr "Fecha de Inicio"
#. module: cash_daily_report
#: model:ir.ui.menu,name:cash_daily_report.hotel_supplier_payment_menu
msgid "Supplier Payments"
msgstr "Pagos a Proveedor"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:216
#, python-format
msgid "TOTAL"
msgstr "TOTAL"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:201
#, python-format
msgid "TOTAL EXPENSES"
msgstr "TOTAL EXPENSES"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:185
#, python-format
msgid "TOTAL PAYMENT RETURNS"
msgstr "TOTAL DEVOLUCIONES"
#. module: cash_daily_report
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:169
#, python-format
msgid "TOTAL PAYMENTS"
msgstr "TOTAL PAGOS"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_xls_binary
msgid "Xls Binary"
msgstr "Xls Binary"
#. module: cash_daily_report
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_xls_filename
msgid "Xls Filename"
msgstr "Xls Filename"
#. module: cash_daily_report
#: model:ir.model,name:cash_daily_report.model_cash_daily_report_wizard
msgid "cash.daily.report.wizard"
msgstr "cash.daily.report.wizard"
#. module: cash_daily_report
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
msgid "or"
msgstr "o"

View File

@@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import cash_daily_report

View File

@@ -1,307 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from io import BytesIO
import datetime
import xlsxwriter
import base64
from odoo import api, fields, models, _
from openerp.exceptions import UserError
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
class CashDailyReportWizard(models.TransientModel):
FILENAME = 'cash_daily_report.xls'
_name = 'cash.daily.report.wizard'
@api.model
def automatic_period_lock_date(self):
# The secong month day close the mont previous
days = 2
closeday = datetime.date.today().replace(day=days)
if datetime.date.today() >= closeday:
companies = self.env['res.company'].search([])
for record in companies:
lastday = datetime.date.today().replace(day=1) + \
datetime.timedelta(days=-1)
if record.period_lock_date != lastday:
record.write({
'period_lock_date': lastday
})
@api.model
@api.model
def _get_default_date_start(self):
return datetime.datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
@api.model
def _get_default_date_end(self):
return datetime.datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
date_start = fields.Date("Start Date", default=_get_default_date_start)
date_end = fields.Date("End Date", default=_get_default_date_end)
xls_filename = fields.Char()
xls_binary = fields.Binary()
@api.model
def _export(self):
file_data = BytesIO()
workbook = xlsxwriter.Workbook(file_data, {
'strings_to_numbers': True,
'default_date_format': 'dd/mm/yyyy'
})
company_id = self.env.user.company_id
workbook.set_properties({
'title': 'Exported data from ' + company_id.name,
'subject': 'Payments Data from Odoo of ' + company_id.name,
'author': 'Odoo',
'manager': u'Alexandre Díaz Cuadrado',
'company': company_id.name,
'category': 'Hoja de Calculo',
'keywords': 'payments, odoo, data, ' + company_id.name,
'comments': 'Created with Python in Odoo and XlsxWriter'})
workbook.use_zip64()
xls_cell_format_date = workbook.add_format({
'num_format': 'dd/mm/yyyy'
})
xls_cell_format_money = workbook.add_format({
'num_format': '#,##0.00'
})
xls_cell_format_header = workbook.add_format({
'bg_color': '#CCCCCC'
})
worksheet = workbook.add_worksheet(_('Cash Daily Report'))
worksheet.write('A1', _('Name'), xls_cell_format_header)
worksheet.write('B1', _('Reference'), xls_cell_format_header)
worksheet.write('C1', _('Client/Supplier'), xls_cell_format_header)
worksheet.write('D1', _('Date'), xls_cell_format_header)
worksheet.write('E1', _('Journal'), xls_cell_format_header)
worksheet.write('F1', _('Amount'), xls_cell_format_header)
worksheet.set_column('C:C', 50)
worksheet.set_column('D:D', 11)
account_payments_obj = self.env['account.payment']
account_payments = account_payments_obj.search([
('payment_date', '>=', self.date_start),
('payment_date', '<=', self.date_end),
])
offset = 1
total_account_payment_amount = 0.0
total_account_payment = 0.0
total_account_expenses = 0.0
payment_journals = {}
expense_journals = {}
total_dates = {}
for k_payment, v_payment in enumerate(account_payments):
where = v_payment.partner_id.name
amount = v_payment.amount if v_payment.payment_type in ('inbound') \
else -v_payment.amount
if v_payment.payment_type == 'transfer':
where = v_payment.destination_journal_id.name
total_account_payment += -amount
if v_payment.destination_journal_id.name not in payment_journals:
payment_journals.update({v_payment.destination_journal_id.name: -amount})
else:
payment_journals[v_payment.destination_journal_id.name] += -amount
if v_payment.payment_date not in total_dates:
total_dates.update({v_payment.payment_date: {v_payment.destination_journal_id.name: -amount}})
else:
if v_payment.destination_journal_id.name not in total_dates[v_payment.payment_date]:
total_dates[v_payment.payment_date].update({v_payment.destination_journal_id.name: -amount})
else:
total_dates[v_payment.payment_date][v_payment.destination_journal_id.name] += -amount
if amount < 0:
total_account_expenses += -amount
if v_payment.journal_id.name not in expense_journals:
expense_journals.update({v_payment.journal_id.name: amount})
else:
expense_journals[v_payment.journal_id.name] += amount
if v_payment.payment_date not in total_dates:
total_dates.update({v_payment.payment_date: {v_payment.journal_id.name: amount}})
else:
if v_payment.journal_id.name not in total_dates[v_payment.payment_date]:
total_dates[v_payment.payment_date].update({v_payment.journal_id.name: amount})
else:
total_dates[v_payment.payment_date][v_payment.journal_id.name] += amount
else:
total_account_payment += amount
if v_payment.journal_id.name not in payment_journals:
payment_journals.update({v_payment.journal_id.name: amount})
else:
payment_journals[v_payment.journal_id.name] += amount
if v_payment.payment_date not in total_dates:
total_dates.update({v_payment.payment_date: {v_payment.journal_id.name: amount}})
else:
if v_payment.journal_id.name not in total_dates[v_payment.payment_date]:
total_dates[v_payment.payment_date].update({v_payment.journal_id.name: amount})
else:
total_dates[v_payment.payment_date][v_payment.journal_id.name] += amount
worksheet.write(k_payment+offset, 0, v_payment.create_uid.login)
worksheet.write(k_payment+offset, 1, v_payment.communication)
worksheet.write(k_payment+offset, 2, where)
worksheet.write(k_payment+offset, 3, v_payment.payment_date,
xls_cell_format_date)
worksheet.write(k_payment+offset, 4, v_payment.journal_id.name)
worksheet.write(k_payment+offset, 5, amount,
xls_cell_format_money)
total_account_payment_amount += amount
payment_returns_obj = self.env['payment.return']
payment_returns = payment_returns_obj.search([
('date', '>=', self.date_start),
('date', '<=', self.date_end),
])
offset += len(account_payments)
total_payment_returns_amount = k_line = 0.0
return_journals = {}
for k_payment, v_payment in enumerate(payment_returns):
for k_line, v_line in enumerate(v_payment.line_ids):
if v_payment.journal_id.name not in return_journals:
return_journals.update({v_payment.journal_id.name: -v_line.amount})
else:
return_journals[v_payment.journal_id.name] += -v_line.amount
if v_payment.date not in total_dates:
total_dates.update({v_payment.date: {v_payment.journal_id.name: -v_line.amount}})
else:
if v_payment.journal_id.name not in total_dates[v_payment.date]:
total_dates[v_payment.date].update({v_payment.journal_id.name: -v_line.amount})
else:
total_dates[v_payment.date][v_payment.journal_id.name] += -v_line.amount
worksheet.write(k_line+offset, 0, v_payment.create_uid.login)
worksheet.write(k_line+offset, 1, v_line.reference)
worksheet.write(k_line+offset, 2, v_line.partner_id.name)
worksheet.write(k_line+offset, 3, v_payment.date,
xls_cell_format_date)
worksheet.write(k_line+offset, 4, v_payment.journal_id.name)
worksheet.write(k_line+offset, 5, -v_line.amount,
xls_cell_format_money)
total_payment_returns_amount += -v_line.amount
offset += len(v_payment.line_ids)
if total_account_payment_amount == 0 and total_payment_returns_amount == 0:
raise UserError(_('Not Any Payments'))
line = offset
if k_line:
line = k_line + offset
result_journals = {}
# NORMAL PAYMENTS
if total_account_payment != 0:
line += 1
worksheet.write(line, 4, _('TOTAL PAYMENTS'), xls_cell_format_header)
worksheet.write(line, 5, total_account_payment,
xls_cell_format_header)
for journal in payment_journals:
line += 1
worksheet.write(line, 4, _(journal))
worksheet.write(line, 5, payment_journals[journal],
xls_cell_format_money)
if journal not in result_journals:
result_journals.update({journal: payment_journals[journal]})
else:
result_journals[journal] += payment_journals[journal]
# RETURNS
if total_payment_returns_amount != 0:
line += 1
worksheet.write(line, 4, _('TOTAL PAYMENT RETURNS'), xls_cell_format_header)
worksheet.write(line, 5, total_payment_returns_amount,
xls_cell_format_header)
for journal in return_journals:
line += 1
worksheet.write(line, 4, _(journal))
worksheet.write(line, 5, return_journals[journal],
xls_cell_format_money)
if journal not in result_journals:
result_journals.update({journal: return_journals[journal]})
else:
result_journals[journal] += return_journals[journal]
# EXPENSES
if total_account_expenses != 0:
line += 1
worksheet.write(line, 4, _('TOTAL EXPENSES'), xls_cell_format_header)
worksheet.write(line, 5, -total_account_expenses,
xls_cell_format_header)
for journal in expense_journals:
line += 1
worksheet.write(line, 4, _(journal))
worksheet.write(line, 5, -expense_journals[journal],
xls_cell_format_money)
if journal not in result_journals:
result_journals.update({journal: expense_journals[journal]})
else:
result_journals[journal] += expense_journals[journal]
#TOTALS
line += 1
worksheet.write(line, 4, _('TOTAL'), xls_cell_format_header)
worksheet.write(
line,
5,
total_account_payment + total_payment_returns_amount - total_account_expenses,
xls_cell_format_header)
for journal in result_journals:
line += 1
worksheet.write(line, 4, _(journal))
worksheet.write(line, 5, result_journals[journal],
xls_cell_format_money)
worksheet = workbook.add_worksheet(_('Por dia'))
worksheet.write('A1', _('Date'), xls_cell_format_header)
columns = ('B1','C1','D1','E1','F1','G1','H1')
i = 0
column_journal = {}
for journal in result_journals:
worksheet.write(columns[i], _(journal), xls_cell_format_header)
i += 1
column_journal.update({journal: i})
worksheet.set_column('C:C', 50)
worksheet.set_column('D:D', 11)
offset = 1
total_dates = sorted(total_dates.items(), key=lambda x: x[0])
for k_day, v_day in enumerate(total_dates):
worksheet.write(k_day+offset, 0, v_day[0])
for journal in v_day[1]:
worksheet.write(k_day+offset, column_journal[journal], v_day[1][journal])
workbook.close()
file_data.seek(0)
tnow = fields.Datetime.now().replace(' ', '_')
return {
'xls_filename': 'cash_daily_report_%s.xlsx' % tnow,
'xls_binary': base64.encodestring(file_data.read()),
}
def export(self):
self.write(self._export())
return {
"type": "ir.actions.do_nothing",
}

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" ?>
<odoo>
<record model="ir.ui.view" id="view_cash_daily_report_wizard">
<field name="name">cash.daily.report.wizard</field>
<field name="model">cash.daily.report.wizard</field>
<field name="arch" type="xml">
<form string="Cash Daily Report" >
<group>
<group>
<field name="date_start" required="1" />
</group>
<group>
<field name="date_end" required="1" />
</group>
</group>
<group>
<group>
<field name="xls_filename" invisible="1"/>
<field name="xls_binary" filename="xls_filename" readonly="1" />
</group>
</group>
<footer>
<button name="export" string="Generate XLS" type="object" class="oe_highlight" />
or
<button string="Close" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_open_cash_daily_report_wizard" model="ir.actions.act_window">
<field name="name">Cash Daily Report Wizard</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cash.daily.report.wizard</field>
<field name="view_id" ref="view_cash_daily_report_wizard"/>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>

View File

@@ -1,15 +0,0 @@
GLASOF EXPORTER
=============
** UNDER DEVELOPMENT: NOT USE IN PRODUCTION **
Export Odoo data to glasof xls format
Credits
=======
Creator
------------
* Alexandre Díaz <dev@redneboa.es>

View File

@@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import wizard

View File

@@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Glasof Exporter',
'version': '1.0',
'author': "Alexandre Díaz <dev@redneboa.es>",
'website': 'https://www.eiqui.com',
'category': 'hotel/glasof',
'summary': "Export Odoo Data to xls compatible with Glasof",
'description': "Glasof Exporter",
'depends': [
'account',
],
'external_dependencies': {
'python': ['xlsxwriter']
},
'data': [
'wizard/glasof_wizard.xml',
'data/menus.xml',
],
'qweb': [],
'test': [
],
'installable': True,
'auto_install': False,
'application': False,
'license': 'AGPL-3',
}

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<menuitem id="glasof_exporter" name="Glasof Exporter"
parent="account.menu_finance_legal_statement"
groups="account.group_account_manager,account.group_account_user"
action="action_open_glasof_exporter" sequence="10" />
</data>
</odoo>

View File

@@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import glasof_wizard

View File

@@ -1,256 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from io import BytesIO
import xlsxwriter
import base64
from odoo import api, fields, models, _
class GlassofExporterWizard(models.TransientModel):
FILENAME = 'invoices_glasof.xls'
_name = 'glasof.exporter.wizard'
date_start = fields.Date("Start Date")
date_end = fields.Date("End Date")
export_journals = fields.Boolean("Export Account Movements?", default=True)
export_invoices = fields.Boolean("Export Invoices?", default=True)
seat_num = fields.Integer("Seat Number Start", default=1)
xls_journals_filename = fields.Char()
xls_journals_binary = fields.Binary()
xls_invoices_filename = fields.Char()
xls_invoices_binary = fields.Binary()
@api.model
def _export_journals(self):
file_data = BytesIO()
workbook = xlsxwriter.Workbook(file_data, {
'strings_to_numbers': True,
'default_date_format': 'dd/mm/yyyy'
})
company_id = self.env.user.company_id
workbook.set_properties({
'title': 'Exported data from ' + company_id.name,
'subject': 'PMS Data from Odoo of ' + company_id.name,
'author': 'Odoo ALDA PMS',
'manager': 'Jose Luis Algara',
'company': company_id.name,
'category': 'Hoja de Calculo',
'keywords': 'pms, odoo, alda, data, ' + company_id.name,
'comments': 'Created with Python in Odoo and XlsxWriter'})
workbook.use_zip64()
xls_cell_format_seat = workbook.add_format({'num_format': '#'})
xls_cell_format_date = workbook.add_format({
'num_format': 'dd/mm/yyyy'
})
xls_cell_format_saccount = workbook.add_format({
'num_format': '000000'
})
xls_cell_format_money = workbook.add_format({
'num_format': '#,##0.00'
})
xls_cell_format_header = workbook.add_format({
'bg_color': '#CCCCCC'
})
worksheet = workbook.add_worksheet('Simples-1')
worksheet.write('A1', _('Seat'), xls_cell_format_header)
worksheet.write('B1', _('Date'), xls_cell_format_header)
worksheet.write('C1', _('SubAccount'), xls_cell_format_header)
worksheet.write('D1', _('Description'), xls_cell_format_header)
worksheet.write('E1', _('Concept'), xls_cell_format_header)
worksheet.write('F1', _('Debit'), xls_cell_format_header)
worksheet.write('G1', _('Credit'), xls_cell_format_header)
worksheet.write('H1', _('Seat Type'), xls_cell_format_header)
worksheet.set_column('B:B', 11)
worksheet.set_column('E:E', 50)
account_move_obj = self.env['account.move']
account_moves = account_move_obj.search([
('date', '>=', self.date_start),
('date', '<=', self.date_end),
])
start_seat = self.seat_num
nrow = 1
for move in account_moves:
nmove = True
for line in move.line_ids:
if line.journal_id.type in ('cash', 'bank'):
worksheet.write(nrow, 0, nmove and start_seat or '',
xls_cell_format_seat)
worksheet.write(nrow, 1, nmove and line.date or '',
xls_cell_format_date)
worksheet.write(nrow, 2, line.account_id.code,
xls_cell_format_saccount)
worksheet.write(nrow, 3, '')
worksheet.write(nrow, 4, line.ref and line.ref[:50] or '')
worksheet.write(nrow, 5, line.debit, xls_cell_format_money)
worksheet.write(nrow, 6, line.credit,
xls_cell_format_money)
worksheet.write(nrow, 7, '')
nmove = False
nrow += 1
start_seat += 1
workbook.close()
file_data.seek(0)
tnow = fields.Datetime.now().replace(' ', '_')
return {
'xls_journals_filename': 'journals_glasof_%s.xlsx' % tnow,
'xls_journals_binary': base64.encodestring(file_data.read()),
}
@api.model
def _export_invoices(self):
file_data = BytesIO()
workbook = xlsxwriter.Workbook(file_data, {
'strings_to_numbers': True,
'default_date_format': 'dd/mm/yyyy'
})
company_id = self.env.user.company_id
workbook.set_properties({
'title': 'Exported data from ' + company_id.name,
'subject': 'PMS Data from Odoo of ' + company_id.name,
'author': 'Odoo ALDA PMS',
'manager': 'Jose Luis Algara',
'company': company_id.name,
'category': 'Hoja de Calculo',
'keywords': 'pms, odoo, alda, data, ' + company_id.name,
'comments': 'Created with Python in Odoo and XlsxWriter'})
workbook.use_zip64()
xls_cell_format_seat = workbook.add_format({'num_format': '#'})
xls_cell_format_date = workbook.add_format({
'num_format': 'dd/mm/yyyy'
})
xls_cell_format_saccount = workbook.add_format({
'num_format': '000000'
})
xls_cell_format_money = workbook.add_format({
'num_format': '#,##0.00'
})
xls_cell_format_odec = workbook.add_format({
'num_format': '#,#0.0'
})
xls_cell_format_header = workbook.add_format({
'bg_color': '#CCCCCC'
})
worksheet = workbook.add_worksheet('ventas')
account_inv_obj = self.env['account.invoice']
account_invs = account_inv_obj.search([
('date', '>=', self.date_start),
('date', '<=', self.date_end),
])
nrow = 1
for inv in account_invs:
if inv.partner_id.parent_id:
firstname = inv.partner_id.parent_id.firstname or ''
lastname = inv.partner_id.parent_id.lastname or ''
else:
firstname = inv.partner_id.firstname or ''
lastname = inv.partner_id.lastname or ''
worksheet.write(nrow, 0, inv.number)
worksheet.write(nrow, 1, inv.date_invoice, xls_cell_format_date)
worksheet.write(nrow, 2, '')
worksheet.write(nrow, 3, inv.partner_id.vat and
inv.partner_id.vat[:2] or '')
worksheet.write(nrow, 4, inv.partner_id.vat and
inv.partner_id.vat[2:] or '')
worksheet.write(nrow, 5, lastname)
worksheet.write(nrow, 6, '')
worksheet.write(nrow, 7, firstname)
worksheet.write(nrow, 8, 705.0, xls_cell_format_odec)
worksheet.write(nrow, 9, inv.amount_untaxed, xls_cell_format_money)
if any(inv.tax_line_ids):
worksheet.write(nrow,
10,
inv.tax_line_ids[0].tax_id.amount,
xls_cell_format_money)
else:
worksheet.write(nrow, 10, '')
worksheet.write(nrow, 11, inv.tax_line_ids and
inv.tax_line_ids[0].amount or '',
xls_cell_format_money)
worksheet.write(nrow, 12, '')
worksheet.write(nrow, 13, '')
worksheet.write(nrow, 14, '')
worksheet.write(nrow, 15, '')
worksheet.write(nrow, 16, '')
worksheet.write(nrow, 17, '')
worksheet.write(nrow, 18, '')
worksheet.write(nrow, 19, '')
worksheet.write(nrow, 20, '')
worksheet.write(nrow, 21, 'S')
worksheet.write(nrow, 22, '')
if inv.type == 'out_refund':
worksheet.write(nrow, 23, inv.invoice_origin)
else:
worksheet.write(nrow, 23, '')
worksheet.write(nrow, 24, '')
worksheet.write(nrow, 25, '')
worksheet.write(nrow, 27, '')
worksheet.write(nrow, 28, '')
worksheet.write(nrow, 29, '')
worksheet.write(nrow, 30, '')
worksheet.write(nrow, 31, '')
worksheet.write(nrow, 32, '')
worksheet.write(nrow, 33, '')
worksheet.write(nrow, 34, '')
worksheet.write(nrow, 35, '')
worksheet.write(nrow, 36, '')
worksheet.write(nrow, 37, '')
worksheet.write(nrow, 38, '')
worksheet.write(nrow, 39, '')
worksheet.write(nrow, 40, '')
worksheet.write(nrow, 41, '')
worksheet.write(nrow, 42, '')
worksheet.write(nrow, 43, '430')
nrow += 1
workbook.add_worksheet('compras')
workbook.close()
file_data.seek(0)
tnow = fields.Datetime.now().replace(' ', '_')
return {
'xls_invoices_filename': 'invoices_glasof_%s.xlsx' % tnow,
'xls_invoices_binary': base64.encodestring(file_data.read()),
}
def export(self):
towrite = {}
if self.export_journals:
towrite.update(self._export_journals())
if self.export_invoices:
towrite.update(self._export_invoices())
if any(towrite):
self.write(towrite)
return {
"type": "ir.actions.do_nothing",
}

View File

@@ -1,52 +0,0 @@
<?xml version="1.0" ?>
<odoo>
<record model="ir.ui.view" id="view_glasof_exporter_wizard">
<field name="name">glasof.exporter.wizard</field>
<field name="model">glasof.exporter.wizard</field>
<field name="arch" type="xml">
<form string="Export to Glasof" >
<group>
<group>
<field name="date_start" required="1" />
</group>
<group>
<field name="date_end" required="1" />
</group>
</group>
<group>
<field name="export_journals" />
<field name="export_invoices" />
</group>
<group attrs="{'invisible': [('export_journals', '=', False)]}">
<field name="seat_num" />
</group>
<group>
<group attrs="{'invisible': [('export_journals', '=', False)]}">
<field name="xls_journals_filename" invisible="1"/>
<field name="xls_journals_binary" filename="xls_journals_filename" readonly="1" />
</group>
<group attrs="{'invisible': [('export_invoices', '=', False)]}">
<field name="xls_invoices_filename" invisible="1"/>
<field name="xls_invoices_binary" filename="xls_invoices_filename" readonly="1" />
</group>
</group>
<footer>
<button name="export" string="Generate XLS" type="object" class="oe_highlight" />
or
<button string="Close" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_open_glasof_exporter" model="ir.actions.act_window">
<field name="name">Export to Glasof</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">glasof.exporter.wizard</field>
<field name="view_id" ref="view_glasof_exporter_wizard"/>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>

View File

@@ -1,61 +0,0 @@
.. This file is going to be generated by oca-gen-addon-readme. Manual changes will be overwritten.
HOTEL CALENDAR
==============
This module allows you to handle reservations, prices and restriction plans in a user friendly calendar view.
Description
------------
This module extends the functionality of roomdoo.
The calendar displays your rooms in a range of dates.
The rooms can be filtered by class, type or even amenities creating new calendars for easily manage all your reservations.
You can manage prices and restrictions day by day using the calendar management view.
This module adds two new view types: ``pms`` and ``mpms``.
The module also incorporates a longpolling for delivering instant notification when using the calendar.
Installation
------------
This module depends on modules ``hotel``, ``bus``, ``web``, ``calendar``, and ``web_widget_color``.
Ensure yourself to have all them in your addons list.
Configuration
-------------
No action required. The module is pre-configured with default values.
You will find the hotel calendar settings in `Settings > Users & Companies > Hotels > Your Hotel > Calendar Settings Tab`.
Reservation colors can be configured by company in `Settings > Users & Companies > Companies > Your Company > Hotel Preferences Tab.`
Usage
-----
To use this module, you need to:
* Go to Hotel Calendar menu for managing reservations.
* Go to Hotel Calendar Management for managing prices and restrictions.
* Go to Hotel Management/Configuration/Calendars menu for managing calendar tabs.
Shortcuts
_________
* ``CTRL + LEFT MOUSE CLICK`` on a reservation - start reservation swap
* ``ESC`` - cancel active action (ie. swap)
Credits
-------
Authors
_______
- Alexandre Díaz <dev@redneboa.es>
Contributors
____________
* Pablo Quesada <pabloqb@gmail.com>
Roadmap
-------
* [ ] Implement the calendar view as an Odoo native view type.
* [ ] Re-design the calendar using SVG or other Odoo native approach.
Do you want to contribute? Please, do not hesitate to contact any of the authors or contributors.

View File

@@ -1,4 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
from . import controllers

View File

@@ -1,42 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Roomdoo Calendar',
'summary': 'A calendar view for user friendly handling your roomdoo property.',
'version': '11.0.2.0',
'development_status': 'Beta',
'category': 'Generic Modules/Hotel Management',
'website': 'https://github.com/hootel/hootel',
'author': 'Alexandre Díaz <dev@redneboa.es>',
'license': "AGPL-3",
'application': False,
'installable': True,
'depends': [
'bus',
'web',
'calendar',
'hotel',
'web_widget_color',
],
# 'external_dependencies': {
# 'python': []
# },
'data': [
'views/general.xml',
'views/actions.xml',
'views/inherited_hotel_property_views.xml',
'views/inherited_res_company_views.xml',
'views/inherited_res_users_views.xml',
'views/hotel_reservation_views.xml',
'views/hotel_calendar_management_views.xml',
'views/hotel_calendar_views.xml',
'data/menus.xml',
'security/ir.model.access.csv',
],
'qweb': [
'static/src/xml/hotel_calendar_management_view.xml',
'static/src/xml/hotel_calendar_templates.xml',
'static/src/xml/hotel_calendar_view.xml',
],
}

View File

@@ -1,3 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import bus

View File

@@ -1,21 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.http import request
from odoo.addons.bus.controllers.main import BusController
HOTEL_BUS_CHANNEL_ID = 'hpublic'
# More info...
# https://github.com/odoo/odoo/commit/092cf33f93830daf5e704b964724bdf8586da8d9
class Controller(BusController):
def _poll(self, dbname, channels, last, options):
if request.session.uid:
# registry, cr, uid, context = request.registry, request.cr, \
# request.session.uid, request.context
channels = channels + [(
request.db,
'hotel.reservation',
HOTEL_BUS_CHANNEL_ID
)]
return super(Controller, self)._poll(dbname, channels, last, options)

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="action_hotel_calendar" model="ir.actions.act_window">
<field name="name">Hotel Calendar</field>
<field name="res_model">hotel.reservation</field>
<field name="view_mode">pms</field>
</record>
<record id="action_hotel_calendar_management" model="ir.actions.act_window">
<field name="name">Hotel Calendar Management</field>
<field name="res_model">hotel.calendar.management</field>
<field name="view_mode">mpms</field>
</record>
<menuitem id="hotel_calendar_menu" name="Hotel Calendar" sequence="10"
web_icon="hotel_calendar,static/description/icon.png"
action="action_hotel_calendar" />
<menuitem id="hotel_calendar_management_menu" name="Hotel Calendar Management" sequence="20"
web_icon="hotel_calendar,static/description/icon_calendar_configurator.png"
action="action_hotel_calendar_management" groups="hotel.group_hotel_manager" />
<menuitem id="hotel_calendar_record_menu" name="Calendars"
parent="hotel.hotel_configuration_menu" sequence="10"
groups="hotel.group_hotel_manager"
action="hotel_calendar_action_form_tree" />
</odoo>

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import inherited_hotel_property
from . import hotel_calendar
from . import bus_hotel_calendar
from . import hotel_calendar_management
from . import inherited_hotel_reservation
from . import inherited_res_company
from . import inherited_res_users
from . import inherited_hotel_room_type_restriction_item
from . import inherited_product_pricelist_item
from . import inherited_hotel_folio
from . import ir_actions_act_window_view
from . import ir_ui_view

View File

@@ -1,137 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import datetime
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
from odoo import models, api
from odoo.addons.hotel_calendar.controllers.bus import HOTEL_BUS_CHANNEL_ID
class BusHotelCalendar(models.TransientModel):
_name = 'bus.hotel.calendar'
'''
action:
- create
- write
- unlink
- cancelled
ntype:
- notif : Show a normal notification
- warn : Show a warning notification
- noshow : Don't show any notification
'''
# Business methods
@api.model
def _generate_reservation_notif(self, vals):
user_id = self.env['res.users'].browse(self.env.uid)
return {
'type': 'reservation',
'action': vals['action'],
'subtype': vals['type'],
'title': vals['title'],
'username': user_id.partner_id.name,
'userid': user_id.id,
'reservation': {
'room_id': vals['room_id'],
'id': vals['reserv_id'],
'name': vals['partner_name'],
'adults': vals['adults'],
'childer': vals['children'],
'checkin': vals['checkin'],
'checkout': vals['checkout'],
'folio_id': vals['folio_id'],
'bgcolor': vals['reserve_color'],
'color': vals['reserve_color_text'],
'splitted': vals['splitted'],
'parent_reservation': vals['parent_reservation'],
'room_name': vals['room_name'],
'state': vals['state'],
'only_read': False,
'fix_days': vals['fix_days'],
'fix_room': False,
'overbooking': vals['overbooking'],
'price_room_services_set': vals['price_room_services_set'],
'amount_total': vals['pending_amount'] + vals['invoices_paid'],
'real_dates': vals['real_dates'],
'channel_type': vals['channel_type'],
},
'tooltip': {
'folio_name': vals['folio_name'],
'name': vals['partner_name'],
'phone': vals['partner_phone'],
'email': vals['partner_email'],
'room_type_name': vals['room_type_name'],
'adults': vals['adults'],
'children': vals['children'],
'checkin': vals['checkin'],
'checkout': vals['checkout'],
'arrival_hour': vals['arrival_hour'],
'departure_hour': vals['departure_hour'],
'price_room_services_set': vals['price_room_services_set'],
'invoices_paid': vals['invoices_paid'],
'pending_amount': vals['pending_amount'],
'type': vals['reservation_type'],
'closure_reason': vals['closure_reason'],
'out_service_description': vals['out_service_description'],
'splitted': vals['splitted'],
'real_dates': vals['real_dates'],
'channel_type': vals['channel_type'],
'board_service_name': vals['board_service_name'],
'services': vals['services'],
}
}
@api.model
def _generate_pricelist_notification(self, vals):
date_dt = datetime.strptime(vals['date'], DEFAULT_SERVER_DATE_FORMAT)
return {
'type': 'pricelist',
'price': {
vals['pricelist_id']: [{
'days': {
date_dt.strftime("%d/%m/%Y"): vals['price'],
},
'room': vals['room_id'],
'id': vals['id'],
}],
},
}
@api.model
def _generate_restriction_notification(self, vals):
date_dt = datetime.strptime(vals['date'], DEFAULT_SERVER_DATE_FORMAT)
return {
'type': 'restriction',
'restriction': {
vals['room_type_id']: {
date_dt.strftime("%d/%m/%Y"): [
vals['min_stay'],
vals['min_stay_arrival'],
vals['max_stay'],
vals['max_stay_arrival'],
vals['closed'],
vals['closed_arrival'],
vals['closed_departure'],
vals['id'],
],
},
},
}
@api.model
def send_reservation_notification(self, vals):
notif = self._generate_reservation_notif(vals)
self.env['bus.bus'].sendone((self._cr.dbname, 'hotel.reservation',
HOTEL_BUS_CHANNEL_ID), notif)
@api.model
def send_pricelist_notification(self, vals):
notif = self._generate_pricelist_notification(vals)
self.env['bus.bus'].sendone((self._cr.dbname, 'hotel.reservation',
HOTEL_BUS_CHANNEL_ID), notif)
@api.model
def send_restriction_notification(self, vals):
notif = self._generate_restriction_notification(vals)
self.env['bus.bus'].sendone((self._cr.dbname, 'hotel.reservation',
HOTEL_BUS_CHANNEL_ID), notif)

View File

@@ -1,23 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api
class HotelCalendar(models.Model):
""" Used to show and filter rooms and reservations in the PMS Calendar. """
_name = 'hotel.calendar'
# Default methods
@api.model
def _get_default_hotel(self):
return self.env.user.hotel_id
# Fields declaration
name = fields.Char('Name', required=True)
hotel_id = fields.Many2one('hotel.property', 'Hotel', required=True, ondelete='restrict',
default=_get_default_hotel)
room_type_ids = fields.Many2many('hotel.room.type', string='Room Type')
segmentation_ids = fields.Many2many('hotel.room.type.class', string='Segmentation')
location_ids = fields.Many2many('hotel.floor', string='Location')
amenity_ids = fields.Many2many('hotel.amenity', string='Amenity')

View File

@@ -1,277 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from datetime import timedelta
from odoo.tools import (
DEFAULT_SERVER_DATE_FORMAT,
DEFAULT_SERVER_DATETIME_FORMAT)
from odoo import models, api, _, fields
from odoo.exceptions import AccessError, ValidationError
_logger = logging.getLogger(__name__)
class HotelCalendarManagement(models.TransientModel):
_name = 'hotel.calendar.management'
# Business methods
def get_hcalendar_settings(self):
return {
'eday_week': self.env.user.hotel_id.pms_end_day_week,
'eday_week_offset': self.env.user.hotel_id.pms_end_day_week_offset,
'days': self.env.user.hotel_id.pms_default_num_days,
'show_notifications': self.env.user.pms_show_notifications,
'show_num_rooms': self.env.user.hotel_id.pms_show_num_rooms,
}
@api.model
def _get_prices_values(self, price):
vals = {
'fixed_price': price['price'],
}
return vals
@api.model
def _get_restrictions_values(self, restriction):
vals = {
'min_stay': restriction['min_stay'],
'min_stay_arrival': restriction['min_stay_arrival'],
'max_stay': restriction['max_stay'],
'max_stay_arrival': restriction['max_stay_arrival'],
'closed': restriction['closed'],
'closed_arrival': restriction['closed_arrival'],
'closed_departure': restriction['closed_departure'],
}
return vals
@api.model
def _hcalendar_room_json_data(self, rooms):
json_data = []
for room in rooms:
json_data.append({
'id': room.id,
'name': room.name,
'capacity': room.get_capacity(),
'price': room.list_price,
'total_rooms': room.total_rooms_count,
})
return json_data
@api.model
def _hcalendar_pricelist_json_data(self, prices):
json_data = {}
room_type_obj = self.env['hotel.room.type']
for rec in prices:
room_type_id = room_type_obj.search([
('product_id.product_tmpl_id', '=', rec.product_tmpl_id.id)
], limit=1)
if not room_type_id:
continue
# TODO: date_end - date_start loop
json_data.setdefault(room_type_id.id, []).append({
'id': rec.id,
'price': rec.fixed_price,
'date': rec.date_start,
})
return json_data
@api.model
def _hcalendar_restriction_json_data(self, restrictions):
json_data = {}
for rec in restrictions:
json_data.setdefault(rec.room_type_id.id, []).append({
'id': rec.id,
'date': rec.date,
'min_stay': rec.min_stay,
'min_stay_arrival': rec.min_stay_arrival,
'max_stay': rec.max_stay,
'max_stay_arrival': rec.max_stay_arrival,
'closed': rec.closed,
'closed_departure': rec.closed_departure,
'closed_arrival': rec.closed_arrival,
})
return json_data
@api.model
def _hcalendar_events_json_data(self, dfrom, dto):
date_start = fields.Date.from_string(dfrom) - timedelta(days=1)
date_start_str = date_start.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
user_id = self.env['res.users'].browse(self.env.uid)
domain = []
if self.env.user.hotel_id.pms_allowed_events_tags:
domain.append(('categ_ids', 'in', self.env.user.hotel_id.pms_allowed_events_tags))
if self.env.user.hotel_id.pms_denied_events_tags:
domain.append(
('categ_ids', 'not in', self.env.user.hotel_id.pms_denied_events_tags))
events_raw = self.env['calendar.event'].search(domain)
events_ll = self.env['calendar.event'].search([
('start', '<=', dto),
('stop', '>=', date_start_str)
])
events_lr = self.env['calendar.event'].search([
('start', '>=', date_start_str),
('stop', '<=', dto)
])
events = (events_ll | events_lr) & events_raw
json_data = []
for event in events:
json_data.append([
event.id,
event.name,
event.start,
event.location,
])
return json_data
@api.model
def _hcalendar_get_count_reservations_json_data(self, dfrom, dto):
date_start = fields.Date.from_string(dfrom)
date_end = fields.Date.from_string(dto)
date_diff = abs((date_end - date_start).days) + 1
room_type_obj = self.env['hotel.room.type']
room_types = room_type_obj.search([])
json_data = {}
for room_type in room_types:
for i in range(0, date_diff):
cur_date = date_start + timedelta(days=i)
cur_date_str = cur_date.strftime(DEFAULT_SERVER_DATE_FORMAT)
self.env.cr.execute('''
SELECT
hrl.id
FROM hotel_reservation_line AS hrl
WHERE date = %s
''', ((cur_date_str),))
line_ids = [r[0] for r in self.env.cr.fetchall()]
reservation_ids = self.env['hotel.reservation.line'].browse(line_ids).\
mapped('reservation_id.id')
reservations = self.env['hotel.reservation'].\
browse(reservation_ids).filtered(
lambda r: r.state != 'cancelled'
and not r.overbooking and not r.reselling
)
reservations_rooms = reservations.mapped('room_id.id')
free_rooms = self.env['hotel.room'].search([
('id', 'not in', reservations_rooms),
])
rooms_linked = self.env['hotel.room.type'].search([
('id', '=', room_type.id)
]).room_ids
free_rooms = free_rooms & rooms_linked
json_data.setdefault(room_type.id, []).append({
'date': cur_date_str,
'num': len(free_rooms),
})
return json_data
@api.model
def get_hcalendar_all_data(self, dfrom, dto, pricelist_id, restriction_id,
withRooms):
hotel_id = self.env.user.hotel_id.id
if not dfrom or not dto:
raise ValidationError(_('Input Error: No dates defined!'))
vals = {}
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
if not pricelist_id:
pricelist_id = self.env.user.hotel_id.default_pricelist_id.id
# TODO: refactoring res.config.settings', 'default_restriction_id by the current hotel.property.restriction_id
if not restriction_id:
restriction_id = self.env.user.hotel_id.default_restriction_id.id
# TODO: ensure pricelist_id and restriction_id belong to the current hotel
vals.update({'pricelist_id': pricelist_id})
vals.update({'restriction_id': restriction_id})
restriction_item_ids = self.env['hotel.room.type.restriction.item'].search([
('date', '>=', dfrom), ('date', '<=', dto),
('restriction_id', '=', restriction_id),
])
pricelist_item_ids = self.env['product.pricelist.item'].search([
('date_start', '>=', dfrom), ('date_end', '<=', dto),
('pricelist_id', '=', pricelist_id),
('applied_on', '=', '1_product'),
('compute_price', '=', 'fixed'),
])
json_prices = self._hcalendar_pricelist_json_data(pricelist_item_ids)
json_rest = self._hcalendar_restriction_json_data(restriction_item_ids)
# TODO REVIEW: what are json_rc and json_events used for in calendar management ¿?
json_rc = self._hcalendar_get_count_reservations_json_data(dfrom, dto)
json_events = self._hcalendar_events_json_data(dfrom, dto)
vals.update({
'prices': json_prices or [],
'restrictions': json_rest or [],
'count_reservations': json_rc or [],
'events': json_events or [],
})
if withRooms:
room_ids = self.env['hotel.room.type'].search([
('hotel_id', '=', hotel_id)
], order='sequence ASC') or None
if not room_ids:
raise AccessError(
_("Wrong hotel and company access settings for this user. "
"No room types found for hotel %s") % self.env.user.hotel_id.name)
json_rooms = self._hcalendar_room_json_data(room_ids)
vals.update({'rooms': json_rooms or []})
return vals
@api.model
def save_changes(self, pricelist_id, restriction_id, pricelist,
restrictions, availability=False):
room_type_obj = self.env['hotel.room.type']
product_pricelist_item_obj = self.env['product.pricelist.item']
room_type_rest_item_obj = self.env['hotel.room.type.restriction.item']
# Save Pricelist
for k_price in pricelist.keys():
room_type_id = room_type_obj.browse([int(k_price)])
room_type_prod_tmpl_id = room_type_id.product_id.product_tmpl_id
for price in pricelist[k_price]:
price_id = product_pricelist_item_obj.search([
('date_start', '>=', price['date']),
('date_end', '<=', price['date']),
('pricelist_id', '=', int(pricelist_id)),
('applied_on', '=', '1_product'),
('compute_price', '=', 'fixed'),
('product_tmpl_id', '=', room_type_prod_tmpl_id.id),
], limit=1)
vals = self._get_prices_values(price)
if not price_id:
vals.update({
'date_start': price['date'],
'date_end': price['date'],
'pricelist_id': int(pricelist_id),
'applied_on': '1_product',
'compute_price': 'fixed',
'product_tmpl_id': room_type_prod_tmpl_id.id,
})
price_id = product_pricelist_item_obj.create(vals)
else:
price_id.write(vals)
# Save Restrictions
for k_res in restrictions.keys():
for restriction in restrictions[k_res]:
res_id = room_type_rest_item_obj.search([
('date', '=', restriction['date']),
('restriction_id', '=', int(restriction_id)),
('room_type_id', '=', int(k_res)),
], limit=1)
vals = self._get_restrictions_values(restriction)
if not res_id:
vals.update({
'date': restriction['date'],
'restriction_id': int(restriction_id),
'room_type_id': int(k_res),
})
res_id = room_type_rest_item_obj.create(vals)
else:
res_id.write(vals)

View File

@@ -1,34 +0,0 @@
# Copyright 2018-2019 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, api, _
class HotelFolio(models.Model):
_inherit = 'hotel.folio'
# ORM overrides
def write(self, vals):
ret = super(HotelFolio, self).write(vals)
fields_to_check = ('reservation_ids', 'service_ids', 'pending_amount')
fields_checked = [elm for elm in fields_to_check if elm in vals]
if any(fields_checked):
for record in self:
record.reservation_ids.send_bus_notification('write', 'noshow')
return ret
def unlink(self):
for record in self:
record.reservation_ids.send_bus_notification('unlink', 'warn',
_("Folio Deleted"))
return super(HotelFolio, self).unlink()
# Business methods
def compute_amount(self):
ret = super(HotelFolio, self).compute_amount()
with self.env.norecompute():
for record in self:
record.reservation_ids.send_bus_notification('write', 'noshow')
return ret

View File

@@ -1,51 +0,0 @@
# Copyright 2019 Pablo Quesada
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class HotelProperty(models.Model):
_inherit = 'hotel.property'
# Fields declaration
pms_show_num_rooms = fields.Integer('Number of rooms to show',
default=0)
pms_divide_rooms_by_capacity = fields.Boolean('Divide rooms by capacity',
default=True)
pms_end_day_week = fields.Selection([
('1', 'Monday'),
('2', 'Tuesday'),
('3', 'Wednesday'),
('4', 'Thursday'),
('5', 'Friday'),
('6', 'Saturday'),
('7', 'Sunday')
], string='Highlight column of day', default='6')
pms_end_day_week_offset = fields.Selection([
('0', '0 Days'),
('1', '1 Days'),
('2', '2 Days'),
('3', '3 Days'),
('4', '4 Days'),
('5', '5 Days'),
('6', '6 Days')
], string='Also illuminate the previous', default='0')
pms_default_num_days = fields.Selection([
('month', '1 Month'),
('21', '3 Weeks'),
('14', '2 Weeks'),
('7', '1 Week')
], string='Default number of days', default='month')
# TODO: review the use of the following option in the calendar js functions
pms_type_move = fields.Selection([
('normal', 'Normal'),
('assisted', 'Assisted'),
('allow_invalid', 'Allow Invalid')
], string='Reservation move mode', default='normal')
pms_allowed_events_tags = fields.Many2many(
'calendar.event.type',
string="Allow Calendar Event Tags")
pms_denied_events_tags = fields.Many2many(
'calendar.event.type',
string="Deny Calendar Event Tags")

View File

@@ -1,521 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from datetime import timedelta
from odoo import models, fields, api, _
from odoo.models import operator
from odoo.exceptions import AccessError, ValidationError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
_logger = logging.getLogger(__name__)
class HotelReservation(models.Model):
_inherit = 'hotel.reservation'
# Fields declaration
reserve_color = fields.Char(compute='_compute_color', string='Color',
store=True)
reserve_color_text = fields.Char(compute='_compute_color', string='Color',
store=True)
# TODO: Add the following method into _compute_color
def _generate_color(self):
self.ensure_one()
company_id = self.env.user.company_id
if self.reservation_type == 'staff':
reserv_color = company_id.color_staff
reserv_color_text = company_id.color_letter_staff
elif self.reservation_type == 'out':
reserv_color = company_id.color_dontsell
reserv_color_text = company_id.color_letter_dontsell
elif self.to_assign:
reserv_color = company_id.color_to_assign
reserv_color_text = company_id.color_letter_to_assign
elif self.state == 'draft':
reserv_color = company_id.color_pre_reservation
reserv_color_text = company_id.color_letter_pre_reservation
elif self.state == 'confirm':
if self.folio_id.pending_amount <= 0:
reserv_color = company_id.color_reservation_pay
reserv_color_text = company_id.color_letter_reservation_pay
else:
reserv_color = company_id.color_reservation
reserv_color_text = company_id.color_letter_reservation
elif self.state == 'booking':
if self.folio_id.pending_amount <= 0:
reserv_color = company_id.color_stay_pay
reserv_color_text = company_id.color_letter_stay_pay
else:
reserv_color = company_id.color_stay
reserv_color_text = company_id.color_letter_stay
else:
if self.folio_id.pending_amount <= 0:
reserv_color = company_id.color_checkout
reserv_color_text = company_id.color_letter_checkout
else:
reserv_color = company_id.color_payment_pending
reserv_color_text = company_id.color_letter_payment_pending
return reserv_color, reserv_color_text
# Constraints and onchanges
@api.depends('state', 'reservation_type', 'folio_id.pending_amount', 'to_assign')
def _compute_color(self):
for record in self:
colors = record._generate_color()
record.update({
'reserve_color': colors[0],
'reserve_color_text': colors[1],
})
# ORM overrides
@api.model
def create(self, vals):
reservation_id = super(HotelReservation, self).create(vals)
reservation_id.send_bus_notification('create',
'notify',
_("Reservation Created"))
return reservation_id
def write(self, vals):
_logger.info("RESERV WRITE")
ret = super(HotelReservation, self).write(vals)
self.send_bus_notification('write', 'noshow')
return ret
def unlink(self):
self.send_bus_notification('unlink',
'warn',
_("Reservation Deleted"))
return super(HotelReservation, self).unlink()
# Business methods
@api.model
def _hcalendar_room_data(self, rooms):
_logger.warning('_found [%s] rooms for hotel [%s]', len(rooms), self.env.user.hotel_id.id)
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
pricelist_id = self.env.user.hotel_id.default_pricelist_id.id
json_rooms = [
{
'id': room.id,
'name': room.name,
'capacity': room.capacity,
'class_name': room.room_type_id.class_id.name,
'class_id': room.room_type_id.class_id.id,
'shared_id': room.shared_room_id,
'price': room.room_type_id
and ['pricelist', room.room_type_id.id, pricelist_id,
room.room_type_id.name] or 0,
'room_type_name': room.room_type_id.name,
'room_type_id': room.room_type_id.id,
'floor_id': room.floor_id.id,
'amentity_ids': room.room_type_id.room_amenity_ids.ids,
} for room in rooms]
return json_rooms
@api.model
def _hcalendar_reservation_data(self, reservations):
_logger.warning('_found [%s] reservations for hotel [%s]', len(reservations), self.env.user.hotel_id.id)
json_reservations = []
json_reservation_tooltips = {}
for reserv in reservations:
json_reservations.append({
'room_id': reserv['room_id'],
'id': reserv['id'],
'name': reserv['closure_reason'] or _('Out of service')
if reserv['reservation_type'] == 'out'
else reserv['partner_name'],
'adults': reserv['adults'],
'childrens': reserv['children'],
'checkin': reserv['checkin'],
'checkout': reserv['checkout'],
'folio_id': reserv['folio_id'],
'bgcolor': reserv['reserve_color'],
'color': reserv['reserve_color_text'],
'splitted': reserv['splitted'],
'parent_reservation': reserv['parent_reservation'] or False,
'read_only': False, # Read-Only
'fix_days': reserv['splitted'], # Fix Days
'fix_room': False, # Fix Rooms
'overbooking': reserv['overbooking'],
'state': reserv['state'],
'price_room_services_set': reserv['price_room_services_set'],
'amount_total': reserv['amount_total'],
'real_dates': [reserv['real_checkin'], reserv['real_checkout']],
'channel_type': reserv['channel_type'],
})
json_reservation_tooltips.update({
reserv['id']: {
'folio_name': reserv['folio_name'],
'name': _('Out of service')
if reserv['reservation_type'] == 'out'
else reserv['partner_name'],
'phone': reserv['mobile'] or reserv['phone']
or _('Phone not provided'),
'email': reserv['email'] or _('Email not provided'),
'room_type_name': reserv['room_type'],
'adults': reserv['adults'],
'children': reserv['children'],
'checkin': reserv['checkin'],
'checkout': reserv['checkout'],
'arrival_hour': reserv['arrival_hour'],
'departure_hour': reserv['departure_hour'],
'price_room_services_set': reserv['price_room_services_set'],
'invoices_paid': reserv['invoices_paid'],
'pending_amount': reserv['pending_amount'],
'type': reserv['reservation_type'] or 'normal',
'closure_reason': reserv['closure_reason'],
'out_service_description': reserv['out_service_description']
or _('No reason given'),
'splitted': reserv['splitted'],
'channel_type': reserv['channel_type'],
'real_dates': [reserv['real_checkin'], reserv['real_checkout']],
'board_service_name': reserv['board_service_name'] or _('No board services'),
'services': reserv['services'],
}
})
return json_reservations, json_reservation_tooltips
@api.model
def _hcalendar_event_data(self, events):
# TODO: Filter events by hotel
json_events = [
{
'id': event.id,
'name': event.name,
'date': event.start,
'location': event.location,
} for event in events]
return json_events
@api.model
def _hcalendar_calendar_data(self, calendars):
_logger.warning('_found [%s] calendars for hotel [%s]', len(calendars), self.env.user.hotel_id.id)
return [
{
'id': calendar.id,
'name': calendar.name,
'segmentation_ids': calendar.segmentation_ids.ids,
'location_ids': calendar.location_ids.ids,
'amenity_ids': calendar.amenity_ids.ids,
'room_type_ids': calendar.room_type_ids.ids,
} for calendar in calendars]
@api.model
def get_hcalendar_reservations_data(self, dfrom_dt, dto_dt, rooms):
rdfrom_dt = dfrom_dt + timedelta(days=1) # Ignore checkout
rdfrom_str = rdfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)
dto_str = dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)
self.env.cr.execute('''
SELECT
hr.id, hr.room_id, hr.adults, hr.children, hr.checkin, hr.checkout, hr.reserve_color, hr.reserve_color_text,
hr.splitted, hr.parent_reservation, hr.overbooking, hr.state, hr.real_checkin, hr.real_checkout,
hr.out_service_description, hr.arrival_hour, hr.departure_hour, hr.channel_type,
hr.price_room_services_set,
hf.id as folio_id, hf.name as folio_name, hf.reservation_type, hf.invoices_paid, hf.pending_amount,
hf.amount_total,
rp.mobile, rp.phone, rp.email, rp.name as partner_name,
pt.name as room_type,
array_agg(pt2.name) FILTER (WHERE pt2.show_in_calendar = TRUE) as services,
rcr.name as closure_reason,
hbs.name as board_service_name
FROM hotel_reservation AS hr
LEFT JOIN hotel_folio AS hf ON hr.folio_id = hf.id
LEFT JOIN hotel_room_type AS hrt ON hr.room_type_id = hrt.id
LEFT JOIN product_product AS pp ON hrt.product_id = pp.id
LEFT JOIN product_template AS pt ON pp.product_tmpl_id = pt.id
LEFT JOIN res_partner AS rp ON hf.partner_id = rp.id
LEFT JOIN room_closure_reason as rcr
ON hf.closure_reason_id = rcr.id
LEFT JOIN hotel_board_service_room_type_rel AS hbsrt ON hr.board_service_room_id = hbsrt.id
LEFT JOIN hotel_board_service AS hbs ON hbsrt.hotel_board_service_id = hbs.id
LEFT JOIN hotel_service AS hs ON hr.id = hs.reservation_id
LEFT JOIN product_product AS pp2 ON hs.product_id = pp2.id
LEFT JOIN product_template AS pt2 ON pp2.product_tmpl_id = pt2.id
WHERE room_id IN %s AND (
(checkin <= %s AND checkout >= %s AND checkout <= %s)
OR (checkin >= %s AND checkout <= %s)
OR (checkin >= %s AND checkin <= %s AND checkout >= %s)
OR (checkin <= %s AND checkout >= %s))
GROUP BY hr.id, hf.id, pt.name, rcr.name, hbs.name, rp.mobile, rp.phone, rp.email, rp.name
ORDER BY checkin DESC, checkout ASC, adults DESC, children DESC
''', (tuple(rooms.ids),
rdfrom_str, rdfrom_str, dto_str,
rdfrom_str, dto_str,
rdfrom_str, dto_str, dto_str,
rdfrom_str, dto_str))
return self._hcalendar_reservation_data(self.env.cr.dictfetchall())
@api.model
def get_hcalendar_pricelist_data(self, dfrom_dt, dto_dt):
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
pricelist_id = self.env.user.hotel_id.default_pricelist_id.id
hotel_id = self.env.user.hotel_id.id
room_types_ids = self.env['hotel.room.type'].search([
('hotel_id', '=', hotel_id)
])
dfrom_str = dfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)
dto_str = dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)
self.env.cr.execute('''
WITH RECURSIVE gen_table_days AS (
SELECT hrt.id, %s::Date AS date, hrt.sequence
FROM hotel_room_type AS hrt
UNION ALL
SELECT hrt.id, (td.date + INTERVAL '1 day')::Date, hrt.sequence
FROM gen_table_days as td
LEFT JOIN hotel_room_type AS hrt ON hrt.id=td.id
WHERE td.date < %s
)
SELECT
TO_CHAR(gtd.date, 'DD/MM/YYYY') as date, gtd.id as room_type_id, gtd.sequence,
pt.name, ppi.fixed_price as price, pt.list_price
FROM gen_table_days AS gtd
LEFT JOIN hotel_room_type AS hrt ON hrt.id = gtd.id
LEFT JOIN product_product AS pp ON pp.id = hrt.product_id
LEFT JOIN product_template AS pt ON pt.id = pp.product_tmpl_id
LEFT JOIN product_pricelist_item AS ppi ON ppi.date_start = gtd.date AND ppi.date_end = gtd.date AND ppi.product_tmpl_id = pt.id
WHERE gtd.id IN %s
ORDER BY gtd.id ASC, gtd.date ASC
''', (dfrom_str, dto_str, tuple(room_types_ids.ids)))
query_results = self.env.cr.dictfetchall()
json_data = {}
for results in query_results:
if results['room_type_id'] not in json_data:
json_data.setdefault(results['room_type_id'], {}).update({
'title': results['name'],
'room': results['room_type_id'],
'sequence': results['sequence'],
})
json_data[results['room_type_id']].setdefault('days', {}).update({
results['date']: results['price'] or results['list_price']
})
json_data_by_sequence = list(json_data.values())
json_data_by_sequence.sort(key=operator.itemgetter('sequence'))
json_rooms_prices = {}
for prices in json_data_by_sequence:
json_rooms_prices.setdefault(pricelist_id, []).append(prices)
return json_rooms_prices
@api.model
def get_hcalendar_restrictions_data(self, dfrom_dt, dto_dt):
""" Returns the room type restrictions between dfrom_dt and dto_dt
for the room types of the current_hotel within the default restriction plan
"""
hotel_id = self.env.user.hotel_id.id
restriction_id = self.env.user.hotel_id.default_restriction_id.id
json_rooms_rests = {}
room_typed_ids = self.env['hotel.room.type'].search([
('hotel_id', '=', hotel_id)
], order='sequence ASC')
room_type_rest_obj = self.env['hotel.room.type.restriction.item']
rtype_rest_ids = room_type_rest_obj.search([
('room_type_id', 'in', room_typed_ids.ids),
('date', '>=', dfrom_dt),
('date', '<=', dto_dt),
('restriction_id', '=', restriction_id)
])
for room_type in room_typed_ids:
days = {}
rest_ids = rtype_rest_ids.filtered(
lambda x: x.room_type_id == room_type)
for rest_id in rest_ids:
days.update({
fields.Date.from_string(rest_id.date).strftime("%d/%m/%Y"): (
rest_id.min_stay,
rest_id.min_stay_arrival,
rest_id.max_stay,
rest_id.max_stay_arrival,
rest_id.closed,
rest_id.closed_arrival,
rest_id.closed_departure)
})
json_rooms_rests.update({room_type.id: days})
return json_rooms_rests
@api.model
def get_hcalendar_events_data(self, dfrom_dt, dto_dt):
user_id = self.env['res.users'].browse(self.env.uid)
domain = [
'|', '&',
('start', '<=', dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)),
('stop', '>=', dfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)),
'&',
('start', '>=', dfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)),
('stop', '<=', dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT))
]
if self.env.user.hotel_id.pms_allowed_events_tags:
domain.append(('categ_ids', 'in', self.env.user.hotel_id.pms_allowed_events_tags))
if self.env.user.hotel_id.pms_denied_events_tags:
domain.append(
('categ_ids', 'not in', self.env.user.hotel_id.pms_denied_events_tags))
events_raw = self.env['calendar.event'].search(domain)
return self._hcalendar_event_data(events_raw)
@api.model
def get_hcalendar_calendar_data(self):
hotel_id = self.env.user.hotel_id.id
calendars = self.env['hotel.calendar'].search([
('hotel_id', '=', hotel_id)
])
res = self._hcalendar_calendar_data(calendars)
return res
@api.model
def get_hcalendar_all_data(self, dfrom, dto, withRooms=True):
if not dfrom or not dto:
raise ValidationError(_('Input Error: No dates defined!'))
hotel_id = self.env.user.hotel_id.id
dfrom_dt = fields.Date.from_string(dfrom)
dto_dt = fields.Date.from_string(dto)
rooms = self.env['hotel.room'].search([
('hotel_id', '=', hotel_id)
], order='sequence ASC') or None
if not rooms:
raise AccessError(
_("No rooms found for hotel %s. "
"Please, review the rooms configured for this hotel.") % self.env.user.hotel_id.name)
json_res, json_res_tooltips = self.get_hcalendar_reservations_data(
dfrom_dt, dto_dt, rooms)
vals = {
'rooms': withRooms and self._hcalendar_room_data(rooms) or [],
'reservations': json_res,
'tooltips': json_res_tooltips,
'pricelist': self.get_hcalendar_pricelist_data(dfrom_dt, dto_dt),
'restrictions': self.get_hcalendar_restrictions_data(dfrom_dt,
dto_dt),
'events': self.get_hcalendar_events_data(dfrom_dt, dto_dt),
'calendars': withRooms and self.get_hcalendar_calendar_data()
or []
}
return vals
@api.model
def get_hcalendar_settings(self):
type_move = self.env.user.hotel_id.pms_type_move
return {
'divide_rooms_by_capacity': self.env.user.hotel_id.pms_divide_rooms_by_capacity,
'eday_week': self.env.user.hotel_id.pms_end_day_week,
'eday_week_offset': self.env.user.hotel_id.pms_end_day_week_offset,
'days': self.env.user.hotel_id.pms_default_num_days,
'allow_invalid_actions': type_move == 'allow_invalid',
'assisted_movement': type_move == 'assisted',
'default_arrival_hour': self.env.user.hotel_id.default_arrival_hour,
'default_departure_hour': self.env.user.hotel_id.default_departure_hour,
'show_notifications': self.env.user.pms_show_notifications,
'show_pricelist': self.env.user.pms_show_pricelist,
'show_availability': self.env.user.pms_show_availability,
'show_num_rooms': self.env.user.hotel_id.pms_show_num_rooms,
}
def generate_bus_values(self, naction, ntype, ntitle=''):
self.ensure_one()
return {
'action': naction,
'type': ntype,
'title': ntitle,
'room_id': self.room_id.id,
'reserv_id': self.id,
'folio_name': self.folio_id.name,
'partner_name': (self.closure_reason_id.name or _('Out of service'))
if self.reservation_type == 'out' else self.partner_id.name,
'adults': self.adults,
'children': self.children,
'checkin': self.checkin,
'checkout': self.checkout,
'arrival_hour': self.arrival_hour,
'departure_hour': self.departure_hour,
'folio_id': self.folio_id.id,
'reserve_color': self.reserve_color,
'reserve_color_text': self.reserve_color_text,
'splitted': self.splitted,
'parent_reservation': self.parent_reservation
and self.parent_reservation.id or 0,
'room_name': self.room_id.name,
'room_type_name': self.room_type_id.name,
'partner_phone': self.partner_id.mobile
or self.partner_id.phone or _('Undefined'),
'partner_email': self.partner_id.email or _('Undefined'),
'state': self.state,
'fix_days': self.splitted,
'overbooking': self.overbooking,
'price_room_services_set': self.price_room_services_set,
'invoices_paid': self.folio_id.invoices_paid,
'pending_amount': self.folio_id.pending_amount,
'reservation_type': self.reservation_type or 'normal',
'closure_reason': self.closure_reason_id.name,
'out_service_description': self.out_service_description
or _('No reason given'),
'real_dates': [self.real_checkin, self.real_checkout],
'channel_type': self.channel_type,
'board_service_name': self.board_service_room_id.hotel_board_service_id.name or _('No board services'),
'services': [service.product_id.name for service in self.service_ids
if service.product_id.show_in_calendar] or False,
}
def send_bus_notification(self, naction, ntype, ntitle=''):
hotel_cal_obj = self.env['bus.hotel.calendar']
for record in self:
if not isinstance(record.id, models.NewId) \
and not isinstance(record.folio_id.id, models.NewId) \
and not isinstance(record.partner_id.id, models.NewId):
hotel_cal_obj.send_reservation_notification(
record.generate_bus_values(naction, ntype, ntitle))
@api.model
def swap_reservations(self, fromReservsIds, toReservsIds):
from_reservs = self.env['hotel.reservation'].browse(fromReservsIds)
to_reservs = self.env['hotel.reservation'].browse(toReservsIds)
if not any(from_reservs) or not any(to_reservs):
raise ValidationError(_("Invalid swap parameters"))
max_from_persons = max(
from_reservs.mapped(lambda x: x.adults))
max_to_persons = max(
to_reservs.mapped(lambda x: x.adults))
from_room = from_reservs[0].room_id
to_room = to_reservs[0].room_id
from_overbooking = from_reservs[0].overbooking
to_overbooking = to_reservs[0].overbooking
if max_from_persons > to_room.capacity or \
max_to_persons > from_room.capacity:
raise ValidationError("Invalid swap operation: wrong capacity")
for record in from_reservs:
record.with_context({'ignore_avail_restrictions': True}).write({
'room_id': to_room.id,
'overbooking': to_overbooking,
})
for record in to_reservs:
record.with_context({'ignore_avail_restrictions': True}).write({
'room_id': from_room.id,
'overbooking': from_overbooking,
})
return True

View File

@@ -1,76 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import models, api
_logger = logging.getLogger(__name__)
class HotelRoomTypeRestrictionItem(models.Model):
_inherit = 'hotel.room.type.restriction.item'
# ORM overrides
@api.model
def create(self, vals):
res = super(HotelRoomTypeRestrictionItem, self).create(vals)
if res.restriction_id.id == self.env.user.hotel_id.default_restriction_id.id:
self.env['bus.hotel.calendar'].send_restriction_notification({
'restriction_id': res.restriction_id.id,
'date': res.date,
'min_stay': res.min_stay,
'min_stay_arrival': res.min_stay_arrival,
'max_stay': res.max_stay,
'max_stay_arrival': res.max_stay_arrival,
'closed': res.closed,
'closed_departure': res.closed_departure,
'closed_arrival': res.closed_arrival,
'room_type_id': res.room_type_id.id,
'id': res.id,
})
return res
def write(self, vals):
ret_vals = super(HotelRoomTypeRestrictionItem, self).write(vals)
bus_hotel_calendar_obj = self.env['bus.hotel.calendar']
for record in self:
bus_hotel_calendar_obj.send_restriction_notification({
'restriction_id': record.restriction_id.id,
'date': record.date,
'min_stay': record.min_stay,
'min_stay_arrival': record.min_stay_arrival,
'max_stay': record.max_stay,
'max_stay_arrival': record.max_stay_arrival,
'closed': record.closed,
'closed_departure': record.closed_departure,
'closed_arrival': record.closed_arrival,
'room_type_id': record.room_type_id.id,
'id': record.id,
})
return ret_vals
def unlink(self):
default_restriction_id = self.env.user.hotel_id.default_restriction_id.id
# Construct dictionary with relevant info of removed records
unlink_vals = []
for record in self:
if record.restriction_id.id != default_restriction_id:
continue
unlink_vals.append({
'restriction_id': record.restriction_id.id,
'date': record.date,
'min_stay': 0,
'min_stay_arrival': 0,
'max_stay': 0,
'max_stay_arrival': 0,
'closed': False,
'closed_departure': False,
'closed_arrival': False,
'room_type_id': record.room_type_id.id,
'id': record.id,
})
res = super(HotelRoomTypeRestrictionItem, self).unlink()
bus_hotel_calendar_obj = self.env['bus.hotel.calendar']
for uval in unlink_vals:
bus_hotel_calendar_obj.send_restriction_notification(uval)
return res

View File

@@ -1,122 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, api
class ProductPricelistItem(models.Model):
_inherit = 'product.pricelist.item'
# ORM overrides
@api.model
def create(self, vals):
res = super(ProductPricelistItem, self).create(vals)
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
pricelist_default_id = self.env['ir.default'].sudo().get(
'res.config.settings', 'default_pricelist_id')
if pricelist_default_id:
pricelist_default_id = int(pricelist_default_id)
pricelist_id = res.pricelist_id.id
product_tmpl_id = res.product_tmpl_id.id
date_start = res.date_start
room_type = self.env['hotel.room.type'].search([
('product_id.product_tmpl_id', '=', product_tmpl_id)
], limit=1)
if pricelist_id == pricelist_default_id and room_type:
prod = room_type.product_id.with_context(
quantity=1,
date=date_start,
pricelist=pricelist_id)
prod_price = prod.price
self.env['bus.hotel.calendar'].send_pricelist_notification({
'pricelist_id': pricelist_id,
'date': date_start,
'room_id': room_type.id,
'price': prod_price,
'id': self.id,
})
return res
def write(self, vals):
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
pricelist_default_id = self.env['ir.default'].sudo().get(
'res.config.settings', 'default_pricelist_id')
if pricelist_default_id:
pricelist_default_id = int(pricelist_default_id)
ret_vals = super(ProductPricelistItem, self).write(vals)
bus_calendar_obj = self.env['bus.hotel.calendar']
room_type_obj = self.env['hotel.room.type']
if vals.get('fixed_price'):
for record in self:
pricelist_id = vals.get('pricelist_id') or \
record.pricelist_id.id
if pricelist_id != pricelist_default_id:
continue
date_start = vals.get('date_start') or record.date_start
product_tmpl_id = vals.get('product_tmpl_id') or \
record.product_tmpl_id.id
room_type = room_type_obj.search([
('product_id.product_tmpl_id', '=', product_tmpl_id)
], limit=1)
if room_type and date_start:
prod = room_type.product_id.with_context(
quantity=1,
date=date_start,
pricelist=pricelist_id)
prod_price = prod.price
bus_calendar_obj.send_pricelist_notification({
'pricelist_id': pricelist_id,
'date': date_start,
'room_id': room_type.id,
'price': prod_price,
'id': record.id,
})
return ret_vals
def unlink(self):
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
pricelist_default_id = self.env['ir.default'].sudo().get(
'res.config.settings', 'default_pricelist_id')
if pricelist_default_id:
pricelist_default_id = int(pricelist_default_id)
# Construct dictionary with relevant info of removed records
unlink_vals = []
for record in self:
if record.pricelist_id.id != pricelist_default_id:
continue
room_type = self.env['hotel.room.type'].search([
('product_id.product_tmpl_id', '=', record.product_tmpl_id.id)
], limit=1)
unlink_vals.append({
'pricelist_id': record.pricelist_id.id,
'date': record.date_start,
'room': room_type,
'id': record.id,
})
# Do Normal Stuff
res = super(ProductPricelistItem, self).unlink()
# Do extra operations
bus_calendar_obj = self.env['bus.hotel.calendar']
for vals in unlink_vals:
pricelist_id = vals['pricelist_id']
date_start = vals['date']
room_type = vals['room']
prod = room_type.product_id.with_context(
quantity=1,
date=date_start,
pricelist=pricelist_id)
# Send Notification to update calendar pricelist
bus_calendar_obj.send_pricelist_notification({
'pricelist_id': pricelist_id,
'date': date_start,
'room_id': room_type.id,
'price': prod.price,
'id': vals['id'],
})
return res

View File

@@ -1,29 +0,0 @@
# Copyright 2019 Pablo Quesada
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class ResCompany(models.Model):
_inherit = 'res.company'
# Fields declaration
color_pre_reservation = fields.Char('Pre-reservation', default='#A24680')
color_reservation = fields.Char('Confirmed Reservation ', default='#7C7BAD')
color_reservation_pay = fields.Char('Paid Reservation', default='#584D76')
color_stay = fields.Char('Checkin', default='#FF4040')
color_stay_pay = fields.Char('Paid Checkin', default='#82BF07')
color_checkout = fields.Char('Checkout', default='#7E7E7E')
color_dontsell = fields.Char('Dont Sell', default='#000000')
color_staff = fields.Char('Staff', default='#C08686')
color_to_assign = fields.Char('Ota Reservation to Assign', default='#ED722E')
color_payment_pending = fields.Char('Payment Pending', default='#A24689')
color_letter_pre_reservation = fields.Char('Letter Pre-reservation', default='#FFFFFF')
color_letter_reservation = fields.Char('Letter Confirmed Reservation ', default='#FFFFFF')
color_letter_reservation_pay = fields.Char('Letter Paid Reservation', default='#FFFFFF')
color_letter_stay = fields.Char('Letter Checkin', default='#FFFFFF')
color_letter_stay_pay = fields.Char('Letter Stay Pay', default='#FFFFFF')
color_letter_checkout = fields.Char('Letter Checkout', default='#FFFFFF')
color_letter_dontsell = fields.Char('Letter Dont Sell', default='#FFFFFF')
color_letter_staff = fields.Char('Letter Staff', default='#FFFFFF')
color_letter_to_assign = fields.Char('Letter Ota to Assign', default='#FFFFFF')
color_letter_payment_pending = fields.Char('Letter Payment Pending', default='#FFFFFF')

View File

@@ -1,34 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class ResUsers(models.Model):
_inherit = 'res.users'
# Fields declaration
pms_show_notifications = fields.Boolean('Show Notifications', default=True)
pms_show_pricelist = fields.Boolean('Show Pricelist', default=True)
pms_show_availability = fields.Boolean('Show Availability', default=True)
# ORM overrides
def __init__(self, pool, cr):
""" Override of __init__ to add access rights.
Access rights are disabled by default, but allowed on some specific
fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS.
"""
super(ResUsers, self).__init__(pool, cr)
# duplicate list to avoid modifying the original reference
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
type(self).SELF_WRITEABLE_FIELDS.extend([
'pms_show_notifications',
'pms_show_pricelist',
'pms_show_availability',
])
# duplicate list to avoid modifying the original reference
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
type(self).SELF_READABLE_FIELDS.extend([
'pms_show_notifications',
'pms_show_pricelist',
'pms_show_availability',
])

View File

@@ -1,10 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class ActWindowView(models.Model):
_inherit = 'ir.actions.act_window.view'
# Fields declaration
view_mode = fields.Selection(selection_add=[('pms', "PMS"), ('mpms', 'Management PMS')])

View File

@@ -1,10 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class View(models.Model):
_inherit = 'ir.ui.view'
# Fields declaration
type = fields.Selection(selection_add=[('pms', "PMS"), ('mpms', 'Management PMS')])

View File

@@ -1,8 +0,0 @@
.. [ This file is optional, it should explain how to configure
the module before using it; it is aimed at advanced users. ]
No action required. The module is pre-configured with default values.
You will find the hotel calendar settings in `Settings > Users & Companies > Hotels > Your Hotel > Calendar Settings Tab`.
Reservation colors can be configured by company in `Settings > Users & Companies > Companies > Your Company > Hotel Preferences Tab.`

View File

@@ -1,2 +0,0 @@
# authors are taken from the __manifest__.py file
* Pablo Quesada <pabloqb@gmail.com>

View File

@@ -1,2 +0,0 @@
.. [ This file is optional and contains additional credits, other than
authors, contributors, and maintainers. ]

View File

@@ -1,10 +0,0 @@
.. [ This file must be max 2-3 paragraphs, and is required. ]
This module extends the functionality of roomdoo.
The calendar displays your rooms in a range of dates.
The rooms can be filtered by class, type or even amenities creating new calendars for easily manage all your reservations.
You can manage prices and restrictions day by day using the calendar management view.
This module adds two new view types: ``pms`` and ``mpms``.
The module also incorporates a longpolling for delivering instant notification when using the calendar.

View File

@@ -1,5 +0,0 @@
.. [ This file must only be present if there are very specific
installation instructions, such as installing non-python dependencies. The audience is systems administrators. ]
This module depends on modules ``hotel``, ``bus``, ``web``, ``calendar``, and ``web_widget_color``.
Ensure yourself to have all them in your addons list.

View File

@@ -1,5 +0,0 @@
.. [ Enumerate known caveats and future potential improvements.
It is mostly intended for end-users, and can also help potential new contributors discovering new features to implement. ]
- [ ] Implement the calendar view as an Odoo native view type.
- [ ] Re-design the calendar using SVG or other Odoo native approach.

View File

@@ -1,14 +0,0 @@
.. [ This file must be present and contains the usage instructions
for end-users. As all other rst files included in the README, it MUST NOT contain reStructuredText sections
only body text (paragraphs, lists, tables, etc). Should you need a more elaborate structure to explain the addon,
please create a Sphinx documentation (which may include this file as a "quick start" section). ]
To use this module, you need to:
* Go to Hotel Calendar menu for managing reservations.
* Go to Hotel Calendar Management for managing prices and restrictions.
* Go to Hotel Management/Configuration/Calendars menu for managing calendar tabs.
Shortcuts
* `CTRL + LEFT MOUSE CLICK`` on a reservation - Start reservation swap
* ``ESC`` - cancel active action (ie. swap)

View File

@@ -1,4 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hotel_product_pricelist_item_call,hotel_calendar.pricelist_item_call,hotel_calendar.model_product_pricelist_item,hotel.group_hotel_call,1,1,1,1
access_hotel_product_pricelist_item_user,hotel_calendar.pricelist_item_use,hotel_calendar.model_product_pricelist_item,hotel.group_hotel_user,1,1,1,1
access_hotel_calendar,access_hotel_calendar,model_hotel_calendar,base.group_user,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hotel_product_pricelist_item_call hotel_calendar.pricelist_item_call hotel_calendar.model_product_pricelist_item hotel.group_hotel_call 1 1 1 1
3 access_hotel_product_pricelist_item_user hotel_calendar.pricelist_item_use hotel_calendar.model_product_pricelist_item hotel.group_hotel_user 1 1 1 1
4 access_hotel_calendar access_hotel_calendar model_hotel_calendar base.group_user 1 0 0 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -1,396 +0,0 @@
/*
* Hotel Calendar JS v0.0.1a - 2017
* GNU Public License
* Aloxa Solucions S.L. <info@aloxa.eu>
* Alexandre Díaz <alex@aloxa.eu>
*/
/* .openerp .oe-view-manager {
overflow: initial !important;
}
*/
.o_hotel_calendar_view {
display: flex;
height: 100%;
}
.nopadding {
padding: 0 !important;
margin: 0 !important;
}
#pms-menu {
overflow: auto;
background-color: #f8f8f8;
height: 100%;
padding: 0 2.5em;
}
#pms-menu .input-group span, #pms-menu input {
border-radius: 0;
}
#pms-menu button {
border-radius: 0;
border: 1px solid lightgray;
font-size: x-small;
}
#pms-calendar: {
flex: 1 1 auto;
overflow: auto;
}
#pms-search {
position: fixed;
z-index: 9;
}
#hcal_widget {
max-height: 100%;
}
#multicalendar_panels {
background-color: white;
border-left: 1px solid #ddd;
}
.nav-tabs > li > a {
border-radius: 0;
}
.nav-tabs {
padding-top: 4px;
}
/* BUTTON STATES */
.navbar-default {
border-color: #f8f8f8;
}
.unify-enabled {
background-color: #43A200;
color: white;
}
.divide-enabled {
background-color: #43A200;
color: white;
}
.overbooking-enabled {
background-color: #43A200;
color: white;
}
.cancelled-enabled {
background-color: #43A200;
}
.swap-from {
background-color: #E7CF1D;
color: #7C7BAD;
}
.swap-to {
background-color: #43A200;
color: white;
}
.unify-enabled i, .divide-enabled i, .cancelled-enabled i, .overbooking-enabled i, .swap-to i {
color: white;
}
.swap-from i {
color: #7C7BAD;
}
/* END: BUTTON STATES */
input#bookings_search {
border-top-left-radius: 0;
border-top-right-radius: 0;
border: 1px solid lightgray;
}
#pms-menu .menu-date-box {
margin-top: 2px !important;
}
#pms-menu .menu-button-box, #pms-menu .menu-search-box, #pms-menu .menu-filter-box {
margin-top: 1em !important;
}
#pms-menu .menu-filter-box .filter-record {
margin-top: 1em;
}
#pms-menu .menu-filter-box h4 {
cursor: pointer;
}
#pms-menu .menu-filter-box h4 i {
transition: all 0.5s ease;
}
#pms-menu .button-box {
text-align: left;
min-height: 3.5em;
padding: 3px;
transition: all 0.5s ease;
overflow: hidden;
}
.overbooking-highlight {
color: white;
background-color: #FFA500;
}
.overbooking-highlight i {
color: white;
}
.multi-calendar-tab-plus {
background-color: darkgray;
font-weight: bold;
color: white;
}
#pms-menu div[id^=btn_] {
padding: 2px;
}
.warn-message {
text-align: center;
line-height: 100vh;
font-size: xx-large;
color: gray;
}
/** SELECT 2 **/
#pms-menu .select2-container, #pms-menu .select2-choice {
border-radius: 0;
}
#pms-menu .select2-choice {
height: 100%;
padding: 2px;
}
/** BOOTSTRAP **/
.badge-danger {
background-color: #d34f2a !important;
}
/** ODOO **/
.o_chat_window {
z-index: 8 !important;
}
.o_button_icon {
display: inline-block;
width: 37px;
padding: 0px 3px;
text-align: center;
vertical-align: middle;
color: #7C7BAD;
font-size: 24px;
}
.o_button_text {
display: inline-block;
vertical-align: middle;
max-width: 70%;
line-height: 1.2;
text-align: left;
}
.text-hidden-xs {
overflow: hidden;
text-overflow: ellipsis;
}
/** POPOVER **/
.popover-content {
font-family: Garuda, sans-serif;
font-size: 12px;
padding: 0px;
}
.popover .h3, .popover h3 {
margin-top: 2px;
margin-bottom: 2px;
}
.popover {
max-width: 400px;
border-radius: 0px;
padding: 0px;
}
.popover .container {
max-width: 100%;
}
.popover .container p {
margin-top: 2px;
margin-bottom: 0px;
}
.popover .container p.email {
word-wrap: break-word;
}
.popover .container p.board {
margin-top: 0px;
}
.popover header {
font-size: 1.2em;
}
.fa-1_5x {
font-size: 1.5em;
}
.fa-2_5x {
font-size: 2.5em;
}
.fa-text-inside {
font-family: Garuda, sans-serif;
font-size: 12px;
}
.popover .col-sm-2, .popover .col-sm-4, .popover .col-sm-6, .popover .col-sm-12 {
padding-top: 3px;
padding-bottom: 3px;
}
/* custom styles for popover info */
.popover .circle {
height:35px;
min-width:35px;
line-height:35px;
border-radius:50px;
text-align:center;
color:#fff;
background:#777;
margin-right: .65em;
padding: 0 5px;
}
.popover .bg-gray-lighter {
background-color: #ddd;
color: #777;
}
.popover .text-gray-dark {
color: #777;
}
/* Spacing in Bootstrap v4.0 */
.mt-3 {
margin-top: 3px;
}
.mt-5 {
margin-top: 5px;
}
.mt-10 {
margin-top: 10px !important;
}
.my-10 {
margin-top: 10px !important;
margin-bottom: 10px !important;
}
.mt-25 {
margin-top: 25px;
}
.mr-5 {
margin-right: 5px;
}
.mx-15 {
margin-left: 15px;
margin-right: 15px;
}
.mx-25 {
margin-left: 25px;
margin-right: 25px;
}
.px-0 {
padding-left: 0px;
padding-right: 0px;
}
.py-5 {
padding-top: 5px;
padding-bottom: 5px;
}
.pt-9 {
padding-top: 9px;
}
.pb-3 {
padding-bottom: 3px;
}
.pb-10 {
padding-bottom: 10px;
}
.pl-5 {
padding-left: 5px;
}
.pr-0 {
padding-right: 0px;
}
/* WARNING: The .row-eq-height class uses CSS3's flexbox layout mode,
which is not supported in Internet Explorer 9 and below. */
.row-eq-height {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
/* TODO: Use Odoo Colours based on http://www.odoo.com/openerp_website/static/src/less/variables.less */
div.diagonal {
overflow: hidden;
background-color: #777;
}
.diagonal:before {
content: "";
border-top: 700px solid #777;
border-right: 500px solid #ddd;
position: absolute;
left: 40%;
bottom: 0;
}
div.diagonal_pending_amount {
background-color: #A24689;
}
.diagonal_pending_amount::before {
border-top-color: #A24689;
}
div.triangle-right {
overflow: hidden;
color: white;
background-color: #7c7bad;
}
.triangle-right:before {
content: "";
position: absolute;
border: 26px solid #ddd;
height: 0;
width: 100%;
left: 47%;
top: 0;
bottom: 0;
margin: auto;
border-left-color: transparent;
}
div.on-top {
position: inherit;
}
div.pull-right-custom {
float: right !important;
margin-right: 15px;
color: #777;
text-align: right;
}
@keyframes blinker {
50% { opacity: 0; }
}

View File

@@ -1,192 +0,0 @@
// Copyright 2018 Alexandre Díaz <dev@redneboa.es>
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
odoo.define('hotel_calendar.PMSCalendarModel', function (require) {
"use strict";
var AbstractModel = require('web.AbstractModel'),
Context = require('web.Context'),
Core = require('web.core'),
FieldUtils = require('web.field_utils'),
Session = require('web.session');
return AbstractModel.extend({
init: function () {
this._super.apply(this, arguments);
},
load: function (params) {
this.modelName = params.modelName;
this.modelManagementName = 'hotel.calendar.management'
},
swap_reservations: function(fromIds, toIds) {
return this._rpc({
model: this.modelName,
method: 'swap_reservations',
args: [fromIds, toIds],
context: Session.user_context,
});
},
get_calendar_data: function(oparams) {
var dialog = bootbox.dialog({
message: '<div class="text-center"><i class="fa fa-spin fa-spinner"></i> Getting Calendar Data From Server...</div>',
onEscape: false,
closeButton: false,
size: 'small',
backdrop: false,
});
return this._rpc({
model: this.modelName,
method: 'get_hcalendar_all_data',
args: oparams,
context: Session.user_context,
}, {
xhr: function () {
var xhr = new window.XMLHttpRequest();
//Download progress
xhr.addEventListener("readystatechange", function() {
if (this.readyState == this.DONE) {
console.log(`[HotelCalendar] Downloaded ${(parseInt(xhr.getResponseHeader("Content-Length"), 10)/1024).toFixed(3)}KiB of data`);
}
}, false);
return xhr;
},
success: function() {
dialog.modal('hide');
},
shadow: true,
});
},
get_hcalendar_settings: function() {
return this._rpc({
model: this.modelName,
method: 'get_hcalendar_settings',
args: [false],
});
},
get_room_types: function() {
var domain = [['hotel_id', '=', Session.hotel_id]];
return this._rpc({
model: 'hotel.room.type',
method: 'search_read',
args: [domain, ['id','name']],
context: Session.user_context,
});
},
get_floors: function() {
var domain = [('|',
['hotel_ids', 'in', Session.hotel_id],
['hotel_ids', '=', false]
)];
return this._rpc({
model: 'hotel.floor',
method: 'search_read',
args: [domain, ['id','name']],
context: Session.user_context,
});
},
get_amenities: function() {
var domain = [('|',
['hotel_ids', 'in', Session.hotel_id],
['hotel_ids', '=', false]
)];
// TODO: Filter rooms by amenities is not working
return this._rpc({
model: 'hotel.amenity',
method: 'search_read',
args: [domain, ['id','name']],
context: Session.user_context,
});
},
get_room_type_class: function() {
var domain = [('|',
['hotel_ids', 'in', Session.hotel_id],
['hotel_ids', '=', false]
)];
return this._rpc({
model: 'hotel.room.type.class',
method: 'search_read',
args: [domain, ['id','name']],
context: Session.user_context,
});
},
search_count: function(domain) {
domain.push(['hotel_id', '=', Session.hotel_id]);
return this._rpc({
model: this.modelName,
method: 'search_count',
args: [domain],
context: Session.user_context,
});
},
update_records: function(ids, vals) {
return this._rpc({
model: this.modelName,
method: 'write',
args: [ids, vals],
context: Session.user_context,
});
},
update_or_create_calendar_record: function(ids, vals) {
if (!ids) {
return this._rpc({
model: 'hotel.calendar',
method: 'create',
args: [vals],
context: Session.user_context,
});
}
return this._rpc({
model: 'hotel.calendar',
method: 'write',
args: [ids, vals],
context: Session.user_context,
});
},
folio_search_count: function(domain) {
return this._rpc({
model: 'hotel.folio',
method: 'search_count',
args: [domain],
context: Session.user_context,
});
},
split_reservation: function(id, nights) {
return this._rpc({
model: this.modelName,
method: 'split',
args: [[id], nights],
context: Session.user_context,
})
},
unify_reservations: function(reserv_ids) {
return this._rpc({
model: this.modelName,
method: 'unify_ids',
args: [reserv_ids],
context: Session.user_context,
})
},
save_changes: function(params) {
// params.splice(0, 0, false); // FIXME: ID=False because first parameter its an integer
return this._rpc({
model: 'hotel.calendar.management',
method: 'save_changes',
args: params,
context: Session.user_context,
})
}
});
});

View File

@@ -1,284 +0,0 @@
/* global $, odoo, _, HotelCalendar, moment */
// Copyright 2018 Alexandre Díaz <dev@redneboa.es>
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
odoo.define('hotel_calendar.PMSCalendarRenderer', function (require) {
"use strict";
var Core = require('web.core'),
ViewDialogs = require('web.view_dialogs'),
Dialog = require('web.Dialog'),
Session = require('web.session'),
AbstractRenderer = require('web.AbstractRenderer'),
HotelConstants = require('hotel_calendar.Constants'),
//Formats = require('web.formats'),
_t = Core._t,
_lt = Core._lt,
QWeb = Core.qweb;
var HotelCalendarView = AbstractRenderer.extend({
/** VIEW OPTIONS **/
template: "hotel_calendar.HotelCalendarView",
display_name: _lt('Hotel Calendar'),
icon: 'fa fa-map-marker',
searchable: false,
searchview_hidden: true,
/** VIEW METHODS **/
init: function(parent, state, params) {
this._super.apply(this, arguments);
},
start: function () {
this.init_calendar_view();
return this._super();
},
on_attach_callback: function() {
this._super();
if (!this._is_visible) {
// FIXME: Workaround for restore "lost" reservations (Drawn when the view is hidden)
this.trigger_up('onViewAttached');
}
},
/** CUSTOM METHODS **/
get_view_filter_dates: function () {
var $dateTimePickerBegin = this.$el.find('#pms-menu #date_begin');
var $dateEndDays = this.$el.find('#pms-menu #date_end_days');
var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().clone();
var days = $dateEndDays.val();
if (days === 'month') {
days = date_begin.daysInMonth();
}
var date_end = date_begin.clone().add(days, 'd');
return [date_begin, date_end];
},
update_buttons_counter: function(ncheckouts, ncheckins, noverbookings, ncancelled) {
var self = this;
// Checkouts Button
var $ninfo = self.$el.find('#pms-menu #btn_action_checkout span.ninfo');
$ninfo.text(ncheckouts);
// Checkins Button
$ninfo = self.$el.find('#pms-menu #btn_action_checkin span.ninfo');
$ninfo.text(ncheckins);
// OverBookings
$ninfo = self.$el.find('#pms-menu #btn_action_overbooking span.ninfo');
$ninfo.text(noverbookings);
if (noverbookings) {
$ninfo.parent().parent().addClass('overbooking-highlight');
} else {
$ninfo.parent().parent().removeClass('overbooking-highlight');
}
// Cancelled
$ninfo = self.$el.find('#pms-menu #btn_action_cancelled span.ninfo');
$ninfo.text(ncancelled);
if (ncancelled) {
$ninfo.parent().parent().addClass('cancelled-highlight');
} else {
$ninfo.parent().parent().removeClass('cancelled-highlight');
}
},
init_calendar_view: function(){
var self = this;
/** VIEW CONTROLS INITIALIZATION **/
// DATE TIME PICKERS
var DTPickerOptions = {
viewMode: 'months',
icons : {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down'
},
//language : moment.locale(),
locale : moment.locale(),
format : HotelConstants.L10N_DATE_MOMENT_FORMAT,
widgetPositioning:{
horizontal: 'auto',
vertical: 'bottom'
}
};
var $dateTimePickerBegin = this.$el.find('#pms-menu #date_begin');
var $dateEndDays = this.$el.find('#pms-menu #date_end_days');
$dateTimePickerBegin.datetimepicker(DTPickerOptions);
$dateEndDays.select2({
data: [
{id:7, text: '1w'},
{id:12, text: '2w'},
{id:21, text: '3w'},
{id:'month', text: '1m'},
{id:60, text: '2m'},
{id:90, text: '3m'},
],
allowClear: true,
minimumResultsForSearch: -1
});
/* TOUCH EVENTS */
this.$el.on('touchstart', function(ev){
var orgEvent = ev.originalEvent;
this._mouseEventStartPos = [orgEvent.touches[0].screenX, orgEvent.touches[0].screenY];
});
this.$el.on('touchend', function(ev){
var orgEvent = ev.originalEvent;
if (orgEvent.changedTouches.length > 2) {
var mousePos = [orgEvent.changedTouches[0].screenX, orgEvent.changedTouches[0].screenY];
var mouseDiffX = mousePos[0] - this._mouseEventStartPos[0];
var moveLength = 40;
var date_begin = false;
var days = orgEvent.changedTouches.length == 3 && 7 || 1;
if (mouseDiffX < -moveLength) {
date_begin = $dateTimePickerBegin.data("DateTimePicker").date().set({'hour': 0, 'minute': 0, 'second': 0}).clone().add(days, 'd');
}
else if (mouseDiffX > moveLength) {
date_begin = $dateTimePickerBegin.data("DateTimePicker").date().set({'hour': 0, 'minute': 0, 'second': 0}).clone().subtract(days, 'd');
}
if (date_begin) {
$dateTimePickerBegin.data("DateTimePicker").date(date_begin);
}
}
});
/* BUTTONS */
var $button = this.$el.find('#pms-menu #btn_action_bookings');
$button.on('click', function(ev){ self._open_search_tree('book'); });
$button = this.$el.find('#pms-menu #btn_action_checkins');
$button.on('click', function(ev){ self._open_search_tree('checkin'); });
$button = this.$el.find('#pms-menu #btn_action_invoices');
$button.on('click', function(ev){ self._open_search_tree('invoice'); });
$button = this.$el.find('#pms-menu #btn_action_folios');
$button.on('click', function(ev){ self._open_search_tree('folio'); });
// $button = this.$el.find('#pms-menu #bookings_search');
// $button.on('keypress', function(ev){
// if (ev.keyCode === 13) {
// self._open_bookings_tree();
// }
// });
this.$el.find("button[data-action]").on('click', function(ev){
self.do_action(this.dataset.action);
});
return $.when(
this.trigger_up('onUpdateButtonsCounter'),
this.trigger_up('onLoadViewFilters'),
);
},
loadViewFilters: function(resultsHotelRoomType, resultsHotelFloor, resultsHotelRoomAmenities, resultsHotelVirtualRooms) {
var $list = this.$el.find('#pms-menu #type_list');
$list.html('');
resultsHotelRoomType.forEach(function(item, index){
$list.append(`<option value="${item.id}">${item.name}</option>`);
});
$list.select2();
$list.on('change', function(ev){
this.trigger_up('onApplyFilters');
}.bind(this));
// Get Floors
$list = this.$el.find('#pms-menu #floor_list');
$list.html('');
resultsHotelFloor.forEach(function(item, index){
$list.append(`<option value="${item.id}">${item.name}</option>`);
});
$list.select2();
$list.on('change', function(ev){
this.trigger_up('onApplyFilters');
}.bind(this));
// Get Amenities
$list = this.$el.find('#pms-menu #amenities_list');
$list.html('');
resultsHotelRoomAmenities.forEach(function(item, index){
$list.append(`<option value="${item.id}">${item.name}</option>`);
});
$list.select2();
$list.on('change', function(ev){
this.trigger_up('onApplyFilters');
}.bind(this));
// Get Virtual Rooms
$list = this.$el.find('#pms-menu #virtual_list');
$list.html('');
resultsHotelVirtualRooms.forEach(function(item, index){
$list.append(`<option value="${item.id}">${item.name}</option>`);
});
$list.select2();
$list.on('change', function(ev){
this.trigger_up('onApplyFilters');
}.bind(this));
},
_generate_search_domain: function(tsearch, type) {
var domain = [];
domain.push('|', '|', '|', '|',
['partner_id.name', 'ilike', tsearch],
['partner_id.mobile', 'ilike', tsearch],
['partner_id.vat', 'ilike', tsearch],
['partner_id.email', 'ilike', tsearch],
['partner_id.phone', 'ilike', tsearch]);
if (type === 'invoice') {
domain.splice(0, 0, '|');
domain.push(['number', 'ilike', tsearch]);
}
return domain;
},
_generate_search_res_model: function(type) {
var model = '';
var title = '';
if (type === 'book') {
model = 'hotel.reservation';
title = _t('Reservations');
} else if (type === 'checkin') {
model = 'hotel.checkin.partner';
title = _t('Checkins');
} else if (type === 'invoice') {
model = 'account.invoice';
title = _t('Invoices');
} else if (type === 'folio') {
model = 'hotel.folio'
title = _t('Folios');
}
return [model, title];
},
_open_search_tree: function(type) {
var $elm = this.$el.find('#pms-menu #bookings_search');
var searchQuery = $elm.val();
var domain = false;
if (searchQuery) {
domain = this._generate_search_domain(searchQuery, type);
} else {
domain = [];
}
var [model, title] = this._generate_search_res_model(type);
this.do_action({
type: 'ir.actions.act_window',
view_mode: 'form',
view_type: 'tree,form',
res_model: model,
views: [[false, 'list'], [false, 'form']],
domain: domain,
name: searchQuery?`${title} for ${searchQuery}`:`All ${title}`
});
$elm.val('');
},
});
return HotelCalendarView;
});

View File

@@ -1,179 +0,0 @@
// Copyright 2018 Alexandre Díaz <dev@redneboa.es>
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
odoo.define('hotel_calendar.PMSCalendarView', function (require) {
"use strict";
var AbstractView = require('web.AbstractView'),
PMSCalendarModel = require('hotel_calendar.PMSCalendarModel'),
PMSCalendarController = require('hotel_calendar.PMSCalendarController'),
PMSCalendarRenderer = require('hotel_calendar.PMSCalendarRenderer'),
ViewRegistry = require('web.view_registry'),
SystrayMenu = require('web.SystrayMenu'),
ControlPanel = require('web.ControlPanel'),
Widget = require('web.Widget'),
Session = require('web.session'),
Core = require('web.core'),
_lt = Core._lt,
QWeb = Core.qweb;
/* HIDE CONTROL PANEL */
/* FIXME: Look's like a hackish solution */
ControlPanel.include({
update: function(status, options) {
if (typeof options === 'undefined') {
options = {};
}
if (typeof options.toHide === 'undefined')
options.toHide = false;
var action_stack = this.getParent().action_stack;
if (action_stack && action_stack.length) {
var active_action = action_stack[action_stack.length-1];
if (active_action.widget && active_action.widget.active_view &&
active_action.widget.active_view.type === 'pms'){
options.toHide = true;
}
}
this._super(status, options);
this._toggle_visibility(!options.toHide);
}
});
/** SYSTRAY **/
var CalendarMenu = Widget.extend({
template: 'HotelCalendar.SettingsMenu',
events: {
"click a[data-action]": "perform_callback",
},
start: function(){
this.$dropdown = this.$(".o_calendar_settings_dropdown");
return $.when(
this._rpc({
model: 'res.users',
method: 'read',
args: [[Session.uid], ["pms_show_notifications", "pms_show_pricelist", "pms_show_availability"]],
context: Session.user_context,
})
).then(function(result) {
this._show_notifications = result[0]['pms_show_notifications'];
this._show_pricelist = result[0]['pms_show_pricelist'];
this._show_availability = result[0]['pms_show_availability'];
return this.update();
}.bind(this));
},
perform_callback: function (evt) {
evt.preventDefault();
var params = $(evt.target).data();
var callback = params.action;
if (callback && this[callback]) {
this[callback](params, evt);
} else {
console.warn("No handler for ", callback);
}
},
update: function() {
// var view_type = this.getParent().getParent()._current_state.view_type;
// if (view_type === 'pms') {
// this.do_show();
this.$dropdown
.empty()
.append(QWeb.render('HotelCalendar.SettingsMenu.Global', {
manager: this,
}));
// }
// else {
// this.do_hide();
// }
return $.when();
},
toggle_show_notification: function() {
this._show_notifications = !this._show_notifications;
this._rpc({
model: 'res.users',
method: 'write',
args: [[Session.uid], {pms_show_notifications: this._show_notifications}],
context: Session.user_context,
}).then(function () {
window.location.reload();
});
},
toggle_show_pricelist: function() {
this._show_pricelist = !this._show_pricelist;
this._rpc({
model: 'res.users',
method: 'write',
args: [[Session.uid], {pms_show_pricelist: this._show_pricelist}],
context: Session.user_context,
}).then(function () {
window.location.reload();
});
},
toggle_show_availability: function() {
this._show_availability = !this._show_availability;
this._rpc({
model: 'res.users',
method: 'write',
args: [[Session.uid], {pms_show_availability: this._show_availability}],
context: Session.user_context,
}).then(function () {
window.location.reload();
});
},
});
var PMSCalendarView = AbstractView.extend({
display_name: _lt('Calendar PMS'),
icon: 'fa-calendar',
//jsLibs: [],
cssLibs: ['/hotel_calendar/static/src/lib/hcalendar/css/hcalendar.css'],
config: {
Model: PMSCalendarModel,
Controller: PMSCalendarController,
Renderer: PMSCalendarRenderer,
},
init: function (viewInfo, params) {
this._super.apply(this, arguments);
var arch = viewInfo.arch;
var fields = viewInfo.fields;
var attrs = arch.attrs;
// If form_view_id is set, then the calendar view will open a form view
// with this id, when it needs to edit or create an event.
this.controllerParams.formViewId =
attrs.form_view_id ? parseInt(attrs.form_view_id, 10) : false;
if (!this.controllerParams.formViewId && params.action) {
var formViewDescr = _.find(params.action.views, function (v) {
return v[1] === 'form';
});
if (formViewDescr) {
this.controllerParams.formViewId = formViewDescr[0];
}
}
this.controllerParams.readonlyFormViewId = !attrs.readonly_form_view_id || !utils.toBoolElse(attrs.readonly_form_view_id, true) ? false : attrs.readonly_form_view_id;
this.controllerParams.context = params.context || {};
this.controllerParams.displayName = params.action && params.action.name;
this.loadParams.fields = fields;
this.loadParams.fieldsInfo = viewInfo.fieldsInfo;
this.loadParams.creatable = false;
this.loadParams.mode = attrs.mode;
},
});
SystrayMenu.Items.push(CalendarMenu);
ViewRegistry.add('pms', PMSCalendarView);
//Core.view_registry.add('pms', HotelCalendarView);
return PMSCalendarView;
});

View File

@@ -1,176 +0,0 @@
// Copyright 2018 Alexandre Díaz <dev@redneboa.es>
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
odoo.define('hotel_calendar.MPMSCalendarController', function (require) {
"use strict";
var AbstractController = require('web.AbstractController'),
Core = require('web.core'),
Bus = require('bus.bus').bus,
HotelConstants = require('hotel_calendar.Constants'),
_t = Core._t,
QWeb = Core.qweb;
var MPMSCalendarController = AbstractController.extend({
custom_events: _.extend({}, AbstractController.prototype.custom_events, {
viewUpdated: '_onViewUpdated',
onSaveChanges: '_onSaveChanges',
onLoadCalendar: '_onLoadCalendar',
onLoadCalendarSettings: '_onLoadCalendarSettings',
onLoadNewContentCalendar: '_onLoadNewContentCalendar',
}),
/**
* @override
* @param {Widget} parent
* @param {AbstractModel} model
* @param {AbstractRenderer} renderer
* @param {Object} params
*/
init: function (parent, model, renderer, params) {
this._super.apply(this, arguments);
this.displayName = params.displayName;
this.formViewId = params.formViewId;
this.context = params.context;
Bus.on("notification", this, this._onBusNotification);
},
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
* @param {Object} record
* @param {integer} record.id
* @returns {Deferred}
*/
_updateRecord: function (record) {
return this.model.updateRecord(record).then(this.reload.bind(this));
},
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
_onSaveChanges: function (ev) {
var self = this;
this.model.save_changes(_.toArray(ev.data)).then(function(results){
self.renderer.resetSaveState();
});
},
_onLoadNewContentCalendar: function (ev) {
var self = this;
var params = this.renderer.generate_params();
var oparams = [params['dates'][0], params['dates'][1], params['prices'], params['restrictions'], false];
this.model.get_hcalendar_data(oparams).then(function(results){
self.renderer._days_tooltips = results['events'];
self.renderer._hcalendar.setData(results['prices'], results['restrictions'], results['availability'], results['count_reservations']);
self.renderer._assign_extra_info();
});
this.renderer._last_dates = params['dates'];
this.renderer.$CalendarHeaderDays = this.renderer.$el.find("div.table-room_type-data-header");
this.renderer._on_scroll(); // FIXME: Workaround for update sticky header
},
_onLoadCalendar: function (ev) {
var self = this;
/** DO MAGIC **/
var params = this.renderer.generate_params();
var oparams = [params['dates'][0], params['dates'][1], false, false, true];
this.model.get_hcalendar_data(oparams).then(function(results){
self.renderer._days_tooltips = results['events'];
var rooms = [];
for (var r of results['rooms']) {
var nroom = new HRoomType(
r['id'],
r['name'],
r['capacity'],
r['price'],
);
rooms.push(nroom);
}
// Get Pricelists
self.renderer._pricelist_id = results['pricelist_id'];
self.renderer._restriction_id = results['restriction_id'];
$.when(
self.model.get_pricelist_plans(),
self.model.get_restriction_plans(),
).then(function(a1, a2){
self.renderer.loadViewFilters(a1, a2);
})
self.renderer.create_calendar(rooms);
self.renderer.setCalendarData(results['prices'], results['restrictions'], results['availability'], results['count_reservations']);
});
},
_onLoadCalendarSettings: function (ev) {
var self = this;
this.model.get_hcalendar_settings().then(function(results){
self.renderer.setHCalendarSettings(results);
});
},
_onBusNotification: function (notifications) {
if (!this.renderer._hcalendar) {
return;
}
for (var notif of notifications) {
if (notif[0][1] === 'hotel.reservation') {
switch (notif[1]['type']) {
case 'pricelist':
var prices = notif[1]['price'];
var pricelist_id = Object.keys(prices)[0];
var pr = {};
for (var price of prices[pricelist_id]) {
pr[price['room']] = [];
var days = Object.keys(price['days']);
for (var day of days) {
var dt = HotelCalendarManagement.toMoment(day);
pr[price['room']].push({
'date': dt.format(HotelConstants.ODOO_DATE_MOMENT_FORMAT),
'price': price['days'][day],
'id': price['id']
});
}
}
this.renderer._hcalendar.addPricelist(pr);
break;
case 'restriction':
// FIXME: Expected one day and one room_type
var restriction = notif[1]['restriction'];
var room_type = Object.keys(restriction)[0];
var day = Object.keys(restriction[room_type])[0];
var dt = HotelCalendarManagement.toMoment(day);
var rest = {};
rest[room_type] = [{
'date': dt.format(HotelConstants.ODOO_DATE_MOMENT_FORMAT),
'min_stay': restriction[room_type][day][0],
'min_stay_arrival': restriction[room_type][day][1],
'max_stay': restriction[room_type][day][2],
'max_stay_arrival': restriction[room_type][day][3],
'closed': restriction[room_type][day][4],
'closed_arrival': restriction[room_type][day][5],
'closed_departure': restriction[room_type][day][6],
'id': restriction[room_type][day][7]
}];
this.renderer._hcalendar.addRestrictions(rest);
break;
}
}
}
},
});
return MPMSCalendarController;
});

View File

@@ -1,72 +0,0 @@
// Copyright 2018 Alexandre Díaz <dev@redneboa.es>
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
odoo.define('hotel_calendar.MPMSCalendarModel', function (require) {
"use strict";
var AbstractModel = require('web.AbstractModel'),
Context = require('web.Context'),
Core = require('web.core'),
FieldUtils = require('web.field_utils'),
Session = require('web.session');
return AbstractModel.extend({
init: function () {
this._super.apply(this, arguments);
this.end_date = null;
},
load: function (params) {
this.modelName = params.modelName;
},
save_changes: function (params) {
// params.splice(0, 0, false); // FIXME: ID=False because first parameter its an integer
return this._rpc({
model: this.modelName,
method: 'save_changes',
args: params,
context: Session.user_context,
});
},
get_hcalendar_data: function (params) {
return this._rpc({
model: this.modelName,
method: 'get_hcalendar_all_data',
args: params,
context: Session.user_context,
});
},
get_pricelist_plans: function () {
var domain = [['pricelist_type', '=', 'daily']];
domain.push('|',['hotel_ids', 'in', Session.hotel_id],
['hotel_ids', '=', false]);
return this._rpc({
model: 'product.pricelist',
method: 'search_read',
args: [domain, ['id','name']],
context: Session.user_context,
});
},
get_restriction_plans: function () {
var domain = [['hotel_id', '=', Session.hotel_id]];
return this._rpc({
model: 'hotel.room.type.restriction',
method: 'search_read',
args: [domain, ['id','name']],
context: Session.user_context,
});
},
get_hcalendar_settings: function () {
return this._rpc({
model: this.modelName,
method: 'get_hcalendar_settings',
args: [false],
});
},
});
});

View File

@@ -1,512 +0,0 @@
/* global $, odoo, _, HotelCalendar, moment */
// Copyright 2018 Alexandre Díaz <dev@redneboa.es>
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
odoo.define('hotel_calendar.MPMSCalendarRenderer', function (require) {
"use strict";
var Core = require('web.core'),
ViewDialogs = require('web.view_dialogs'),
Dialog = require('web.Dialog'),
Session = require('web.session'),
AbstractRenderer = require('web.AbstractRenderer'),
HotelConstants = require('hotel_calendar.Constants'),
//Formats = require('web.formats'),
_t = Core._t,
_lt = Core._lt,
QWeb = Core.qweb;
var HotelCalendarManagementView = AbstractRenderer.extend({
/** VIEW OPTIONS **/
template: "hotel_calendar.HotelCalendarManagementView",
display_name: _lt('Hotel Calendar Management'),
icon: 'fa fa-map-marker',
searchable: false,
searchview_hidden: true,
// Custom Options
_view_options: {},
_hcalendar: null,
_last_dates: [false, false],
_pricelist_id: null,
_restriction_id: null,
_days_tooltips: [],
/** VIEW METHODS **/
init: function(parent, state, params) {
this._super.apply(this, arguments);
this.model = params.model;
},
start: function () {
var self = this;
return this._super().then(function() {
self.init_calendar_view();
$(window).trigger('resize');
});
},
do_show: function() {
if (this.$ehcal) {
this.$ehcal.show();
$('.o_content').css('overflow', 'hidden');
}
this.do_push_state({});
return this._super();
},
do_hide: function () {
if (this.$ehcal) {
this.$ehcal.hide();
$('.o_content').css('overflow', '');
}
return this._super();
},
destroy: function () {
return this._super.apply(this, arguments);
},
/** CUSTOM METHODS **/
get_values_to_save: function() {
var btn_save = this.$el.find('#btn_save_changes');
if (!btn_save.hasClass('need-save')) {
return false;
}
var pricelist = this._hcalendar.getPricelist(true);
var restrictions = this._hcalendar.getRestrictions(true);
var params = this.generate_params();
return [params['prices'], params['restrictions'], pricelist, restrictions];
},
save_changes: function() {
var oparams = this.get_values_to_save();
if (oparams) {
this.trigger_up('onSaveChanges', oparams);
}
},
resetSaveState: function() {
this.$el.find('#btn_save_changes').removeClass('need-save');
$('.hcal-management-record-changed').removeClass('hcal-management-record-changed');
$('.hcal-management-input-changed').removeClass('hcal-management-input-changed');
},
create_calendar: function(rooms) {
var self = this;
// CALENDAR
if (this._hcalendar) {
delete this._hcalendar;
}
this.$ehcal.empty();
var options = {
rooms: rooms,
days: self._view_options['days'],
endOfWeek: parseInt(self._view_options['eday_week']) || 6,
endOfWeekOffset: self._view_options['eday_week_offset'] || 0,
dateFormatLong: HotelConstants.ODOO_DATETIME_MOMENT_FORMAT,
dateFormatShort: HotelConstants.ODOO_DATE_MOMENT_FORMAT,
translations: {
'Open': _t('Open'),
'Closed': _t('Closed'),
'C. Departure': _t('C. Departure'),
'C. Arrival': _t('C. Arrival'),
'Price': _t('Price'),
'Availability': _t('Availability'),
'Min. Stay': _t('Min. Stay'),
'Max. Stay': _t('Max. Stay'),
'Min. Stay Arrival': _t('Min. Stay Arrival'),
'Max. Stay Arrival': _t('Max. Stay Arrival'),
'Clousure': _t('Clousure'),
'Free Rooms': _t('Free Rooms'),
'No OTA': _t('No OTA'),
'Options': _t('Options'),
'Reset': _t('Reset'),
'Copy': _t('Copy'),
'Paste': _t('Paste'),
'Clone': _t('Clone'),
'Cancel': _t('Cancel')
}
};
this._hcalendar = new HotelCalendarManagement('#hcal_management_widget', options, this.$el[0]);
this._assignHCalendarEvents();
this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header");
// Sticky Header Days
$('.o_content').scroll(this._on_scroll.bind(this));
// Initialize Save Button state to disable
document.getElementById("btn_save_changes").disabled = true;
},
setCalendarData: function (prices, restrictions, availability, count_reservations) {
this._hcalendar.setData(prices, restrictions, availability, count_reservations);
this._assign_extra_info();
},
_assignHCalendarEvents: function () {
var self = this;
this._hcalendar.addEventListener('hcOnChangeDate', function(ev){
var date_begin = moment(ev.detail.newDate);
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").date(date_begin);
self.reload_hcalendar_management();
});
this._hcalendar.addEventListener('hcmOnInputChanged', function(ev){
var btn_save = self.$el.find('#btn_save_changes');
if (self._hcalendar.hasChangesToSave()) {
btn_save.addClass('need-save');
document.getElementById("btn_save_changes").disabled = false;
} else {
btn_save.removeClass('need-save');
document.getElementById("btn_save_changes").disabled = true;
}
});
},
_on_scroll: function() {
var curScrollPos = $('.o_content').scrollTop();
if (curScrollPos > 0) {
this.$CalendarHeaderDays.css({
top: `${curScrollPos-this.$ehcal.position().top}px`,
position: 'sticky'
});
} else {
this.$CalendarHeaderDays.css({
top: '0px',
position: 'initial'
});
}
},
loadViewFilters: function (resultsPricelist, resultsRestrictions) {
var self = this;
var $list = self.$el.find('#mpms-search #price_list');
$list.html('');
resultsPricelist.forEach(function(item, index){
$list.append(`<option value="${item.id}" ${item.id==self._pricelist_id?'selected':''}>${item.name}</option>`);
});
$list.select2();
$list.on('change', function(ev){
self._check_unsaved_changes(function(){
self.reload_hcalendar_management();
});
});
$list = self.$el.find('#mpms-search #restriction_list');
$list.html('');
resultsRestrictions.forEach(function(item, index){
$list.append(`<option value="${item.id}" ${item.id==self._restriction_id?'selected':''}>${item.name}</option>`);
});
$list.select2();
$list.on('change', function(ev){
self._check_unsaved_changes(function(){
self.reload_hcalendar_management();
});
});
$list = self.$el.find('#mpms-search #mode_list');
$list.select2({
minimumResultsForSearch: -1
});
$list.on('change', function(ev){
var mode = HotelCalendarManagement.MODE.ALL;
if (this.value === 'low') {
mode = HotelCalendarManagement.MODE.LOW;
} else if (this.value === 'medium') {
mode = HotelCalendarManagement.MODE.MEDIUM;
}
self._hcalendar.setMode(mode);
});
},
call_action: function(action) {
this.do_action(action);
},
init_calendar_view: function(){
var self = this;
this.$ehcal = this.$el.find("div#hcal_management_widget");
/** VIEW CONTROLS INITIALIZATION **/
// DATE TIME PICKERS
var DTPickerOptions = {
viewMode: 'months',
icons : {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down'
},
locale : moment.locale(),
format : HotelConstants.L10N_DATE_MOMENT_FORMAT,
//disabledHours: [0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23]
};
var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin');
$dateTimePickerBegin.datetimepicker(DTPickerOptions);
$dateTimePickerBegin.on("dp.change", function (e) {
$dateTimePickerBegin.data("DateTimePicker").hide(); // TODO: Odoo uses old datetimepicker version
self.on_change_filter_date(e, true);
});
var $dateEndDays = this.$el.find('#mpms-search #date_end_days');
$dateEndDays.select2({
data: [
{id:7, text: '1w'},
{id:12, text: '2w'},
{id:21, text: '3w'},
{id:'month', text: '1m'},
{id:60, text: '2m'},
{id:90, text: '3m'},
],
allowClear: true,
minimumResultsForSearch: -1
});
$dateEndDays.on("change", function (e) {
self.on_change_filter_date();
});
// View Events
this.$el.find("#mpms-search #cal-pag-prev-plus").on('click', function(ev){
// FIXME: Ugly repeated code. Change place.
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().subtract(14, 'd');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").date(date_begin);
self.on_change_filter_date(ev, true);
ev.preventDefault();
});
this.$el.find("#mpms-search #cal-pag-prev").on('click', function(ev){
// FIXME: Ugly repeated code. Change place.
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().subtract(7, 'd');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").date(date_begin);
self.on_change_filter_date(ev, true);
ev.preventDefault();
});
this.$el.find("#mpms-search #cal-pag-next-plus").on('click', function(ev){
// FIXME: Ugly repeated code. Change place.
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().add(14, 'd');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").date(date_begin);
self.on_change_filter_date(ev, true);
ev.preventDefault();
});
this.$el.find("#mpms-search #cal-pag-next").on('click', function(ev){
// FIXME: Ugly repeated code. Change place.
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().add(7, 'd');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").date(date_begin);
self.on_change_filter_date(ev, true);
ev.preventDefault();
});
this.$el.find("#mpms-search #cal-pag-selector").on('click', function(ev){
// FIXME: Ugly repeated code. Change place.
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var date_begin = moment().startOf('day');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").date(date_begin);
self.on_change_filter_date(ev, true);
ev.preventDefault();
});
// Save Button
this.$el.find("#btn_save_changes").on('click', function(ev) {
document.getElementById(this.id).disabled = true;
self.save_changes();
});
// Launch Massive Changes
this.$el.find("#btn_massive_changes").on('click', function(ev){
self.call_action("hotel.action_hotel_massive_change");
});
/** RENDER CALENDAR **/
this.trigger_up('onLoadCalendarSettings');
},
setHCalendarSettings: function (results) {
this._view_options = results;
var date_begin = moment().startOf('day');
if (['xs', 'md'].indexOf(this._findBootstrapEnvironment()) >= 0) {
this._view_options['days'] = 7;
} else {
this._view_options['days'] = (this._view_options['days'] !== 'month')?parseInt(this._view_options['days']):date_begin.daysInMonth();
}
var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin');
$dateTimePickerBegin.data("DateTimePicker").date(date_begin);
var $dateEndDays = this.$el.find('#mpms-search #date_end_days');
$dateEndDays.val('month');
$dateEndDays.trigger('change');
this._last_dates = this.generate_params()['dates'];
this.trigger_up('onLoadCalendar');
},
on_change_filter_date: function(ev, isStartDate) {
var self = this;
isStartDate = isStartDate || false;
var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin');
var $dateEndDays = this.$el.find('#mpms-search #date_end_days');
// FIXME: Hackish onchange ignore (Used when change dates from code)
if ($dateTimePickerBegin.data("ignore_onchange") || $dateEndDays.data("ignore_onchange")) {
$dateTimePickerBegin.data("ignore_onchange", false);
$dateEndDays.data("ignore_onchange", false);
return true;
}
var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().set({'hour': 0, 'minute': 0, 'second': 0}).clone();
if (this._hcalendar && date_begin) {
var days = $dateEndDays.val();
if (days === 'month') {
days = date_begin.daysInMonth();
}
var date_end = date_begin.set({'hour': 23, 'minute': 59, 'second': 59}).clone().add(days, 'd');
this._check_unsaved_changes(function(){
self._hcalendar.setStartDate(date_begin, self._hcalendar.getDateDiffDays(date_begin, date_end));
self.reload_hcalendar_management();
});
}
},
reload_hcalendar_management: function() {
this.trigger_up('onLoadNewContentCalendar');
},
generate_params: function() {
var fullDomain = [];
var prices = this.$el.find('#mpms-search #price_list').val();
var restrictions = this.$el.find('#mpms-search #restriction_list').val();
var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin');
var $dateEndDays = this.$el.find('#mpms-search #date_end_days');
var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().set({'hour': 0, 'minute': 0, 'second': 0}).clone();
var days = $dateEndDays.val();
if (days === 'month') {
days = date_begin.daysInMonth();
}
var date_end = date_begin.set({'hour': 23, 'minute': 59, 'second': 59}).clone().add(days, 'd');
return {
'dates': [date_begin, date_end],
'prices': prices,
'restrictions': restrictions
};
},
_check_unsaved_changes: function(fnCallback) {
var self = this;
var btn_save = this.$el.find("#btn_save_changes");
if (!btn_save.hasClass('need-save')) {
btn_save.removeClass('need-save');
document.getElementById("btn_save_changes").disabled = true;
fnCallback();
return;
}
new Dialog(self, {
title: _t("Unsaved Changes!"),
buttons: [
{
text: _t("Yes, save it"),
classes: 'btn-primary',
close: true,
click: function() {
document.getElementById("btn_save_changes").disabled = true;
self.save_changes();
fnCallback();
}
},
{
text: _t("No"),
close: true,
click: function() {
btn_save.removeClass('need-save');
document.getElementById("btn_save_changes").disabled = true;
fnCallback();
}
}
],
$content: QWeb.render('HotelCalendarManagement.UnsavedChanges', {})
}).open();
},
_findBootstrapEnvironment: function() {
var envs = ['xs', 'sm', 'md', 'lg'];
var $el = $('<div>');
$el.appendTo($('body'));
for (var i = envs.length - 1; i >= 0; i--) {
var env = envs[i];
$el.addClass('hidden-'+env);
if ($el.is(':hidden')) {
$el.remove();
return env;
}
}
},
_assign_extra_info: function() {
var self = this;
$(this._hcalendar.etableHeader).find('.hcal-cell-header-day').each(function(index, elm){
var $elm = $(elm);
var cdate = HotelCalendarManagement.toMoment($elm.data('hcalDate'), HotelConstants.L10N_DATE_MOMENT_FORMAT);
var data = _.filter(self._days_tooltips, function(item) {
var ndate = HotelCalendarManagement.toMoment(item[2], HotelConstants.ODOO_DATE_MOMENT_FORMAT);
return ndate.isSame(cdate, 'd');
});
if (data.length > 0) {
$elm.addClass('hcal-event-day');
$elm.on("mouseenter", function(data){
var $this = $(this);
if (data.length > 0) {
var qdict = {
'date': $this.data('hcalDate'),
'events': _.map(data, function(item){
return {
'name': item[1],
'date': item[2],
'location': item[3]
};
})
};
$this.attr('title', '');
$this.tooltip({
animation: true,
html: true,
placement: 'bottom',
title: QWeb.render('HotelCalendar.TooltipEvent', qdict)
}).tooltip('show');
}
}.bind(elm, data));
}
});
},
});
return HotelCalendarManagementView;
});

View File

@@ -1,661 +0,0 @@
/* global $, odoo, _, HotelCalendarManagement, moment */
// Copyright 2018 Alexandre Díaz <dev@redneboa.es>
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
odoo.define('hotel_calendar.HotelCalendarManagementView', function (require) {
"use strict";
var Core = require('web.core'),
Bus = require('bus.bus').bus,
//Data = require('web.data'),
Time = require('web.time'),
Model = require('web.DataModel'),
View = require('web.View'),
Widgets = require('web_calendar.widgets'),
//Common = require('web.form_common'),
//Pyeval = require('web.pyeval'),
ActionManager = require('web.ActionManager'),
Utils = require('web.utils'),
Dialog = require('web.Dialog'),
//Ajax = require('web.ajax'),
ControlPanel = require('web.ControlPanel'),
//Session = require('web.session'),
formats = require('web.formats'),
_t = Core._t,
_lt = Core._lt,
QWeb = Core.qweb,
l10n = _t.database.parameters,
ODOO_DATETIME_MOMENT_FORMAT = "YYYY-MM-DD HH:mm:ss",
ODOO_DATE_MOMENT_FORMAT = "YYYY-MM-DD",
L10N_DATE_MOMENT_FORMAT = "DD/MM/YYYY", //FIXME: Time.strftime_to_moment_format(l10n.date_format);
L10N_DATETIME_MOMENT_FORMAT = L10N_DATE_MOMENT_FORMAT + ' ' + Time.strftime_to_moment_format(l10n.time_format);
/* HIDE CONTROL PANEL */
/* FIXME: Look's like a hackish solution */
ControlPanel.include({
update: function(status, options) {
if (typeof options.toHide === 'undefined')
options.toHide = false;
var action_stack = this.getParent().action_stack;
if (action_stack && action_stack.length) {
var active_action = action_stack[action_stack.length-1];
if (active_action.widget && active_action.widget.active_view &&
active_action.widget.active_view.type === 'mpms'){
options.toHide = true;
}
}
this._super(status, options);
this._toggle_visibility(!options.toHide);
}
});
var HotelCalendarManagementView = View.extend({
/** VIEW OPTIONS **/
template: "hotel_calendar.HotelCalendarManagementView",
display_name: _lt('Hotel Calendar Management'),
icon: 'fa fa-map-marker',
//view_type: "mpms",
searchable: false,
searchview_hidden: true,
quick_create_instance: Widgets.QuickCreate,
defaults: _.extend({}, View.prototype.defaults, {
confirm_on_delete: true,
}),
// Custom Options
_model: null,
_hcalendar: null,
_action_manager: null,
_last_dates: [false, false],
_pricelist_id: null,
_restriction_id: null,
_days_tooltips: [],
/** VIEW METHODS **/
init: function(parent, dataset, fields_view, options) {
this._super.apply(this, arguments);
this.shown = $.Deferred();
this.dataset = dataset;
this.model = dataset.model;
this.view_type = 'mpms';
this.selected_filters = [];
this.mutex = new Utils.Mutex();
this._model = new Model(this.dataset.model);
this._action_manager = this.findAncestor(function(ancestor){ return ancestor instanceof ActionManager; });
Bus.on("notification", this, this._on_bus_signal);
},
start: function () {
this.shown.done(this._do_show_init.bind(this));
return this._super();
},
_do_show_init: function () {
this.init_calendar_view().then(function() {
$(window).trigger('resize');
});
},
do_show: function() {
if (this.$ehcal) {
this.$ehcal.show();
$('.o_content').css('overflow', 'hidden');
}
this.do_push_state({});
this.shown.resolve();
return this._super();
},
do_hide: function () {
if (this.$ehcal) {
this.$ehcal.hide();
$('.o_content').css('overflow', '');
}
return this._super();
},
destroy: function () {
return this._super.apply(this, arguments);
},
/** CUSTOM METHODS **/
save_changes: function() {
var self = this;
var btn_save = this.$el.find('#btn_save_changes');
if (!btn_save.hasClass('need-save')) {
return;
}
var pricelist = this._hcalendar.getPricelist(true);
var restrictions = this._hcalendar.getRestrictions(true);
var availability = this._hcalendar.getAvailability(true);
var params = this.generate_params();
var oparams = [false, params['prices'], params['restrictions'], pricelist, restrictions, availability];
this._model.call('save_changes', oparams).then(function(results){
btn_save.removeClass('need-save');
$('.hcal-management-record-changed').removeClass('hcal-management-record-changed');
$('.hcal-management-input-changed').removeClass('hcal-management-input-changed');
});
},
create_calendar: function(options) {
var self = this;
// CALENDAR
if (this._hcalendar) {
delete this._hcalendar;
}
this.$ehcal.empty();
this._hcalendar = new HotelCalendarManagement('#hcal_management_widget', options, this.$el[0]);
this._hcalendar.addEventListener('hcOnChangeDate', function(ev){
var date_begin = moment(ev.detail.newDate);
var days = self._hcalendar.getOptions('days')-1;
var date_end = date_begin.clone().add(days, 'd');
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").setDate(date_begin);
$dateTimePickerEnd.data("DateTimePicker").setDate(date_end);
self.reload_hcalendar_management();
});
this._hcalendar.addEventListener('hcmOnInputChanged', function(ev){
var btn_save = self.$el.find('#btn_save_changes');
if (self._hcalendar.hasChangesToSave()) {
btn_save.addClass('need-save');
} else {
btn_save.removeClass('need-save');
}
});
this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header");
// Sticky Header Days
this.$ehcal.scroll(this._on_scroll.bind(this));
},
_on_scroll: function() {
var curScrollPos = this.$ehcal.scrollTop();
if (curScrollPos > 0) {
this.$CalendarHeaderDays.css({
top: `${curScrollPos}px`,
position: 'sticky'
});
} else {
this.$CalendarHeaderDays.css({
top: '0px',
position: 'initial'
});
}
},
generate_hotel_calendar: function(){
var self = this;
debugger;
/** DO MAGIC **/
var params = this.generate_params();
var oparams = [params['dates'][0], params['dates'][1], false, false, true];
this._model.call('get_hcalendar_all_data', oparams).then(function(results){
self._days_tooltips = results['events'];
var rooms = [];
for (var r of results['rooms']) {
var nroom = new HRoomType(
r[0], // Id
r[1], // Name
r[2], // Capacity
r[3], // Price
);
rooms.push(nroom);
}
// Get Pricelists
self._pricelist_id = results['pricelist_id'];
new Model('product.pricelist').query(['id','name']).all().then(function(resultsPricelist){
var $list = self.$el.find('#mpms-search #price_list');
$list.html('');
resultsPricelist.forEach(function(item, index){
$list.append(`<option value="${item.id}" ${item.id==self._pricelist_id?'selected':''}>${item.name}</option>`);
});
$list.select2();
$list.on('change', function(ev){
self._check_unsaved_changes(function(){
self.reload_hcalendar_management();
});
});
});
// Get Restrictions
self._restriction_id = results['restriction_id'];
new Model('hotel.room.type.restriction').query(['id','name']).all().then(function(resultsRestrictions){
var $list = self.$el.find('#mpms-search #restriction_list');
$list.html('');
resultsRestrictions.forEach(function(item, index){
$list.append(`<option value="${item.id}" ${item.id==self._restriction_id?'selected':''}>${item.name}</option>`);
});
$list.select2();
$list.on('change', function(ev){
self._check_unsaved_changes(function(){
self.reload_hcalendar_management();
});
});
});
// Calendar Mode
var $list = self.$el.find('#mpms-search #mode_list');
$list.select2({
minimumResultsForSearch: -1
});
$list.on('change', function(ev){
var mode = HotelCalendarManagement.MODE.ALL;
if (this.value === 'low') {
mode = HotelCalendarManagement.MODE.LOW;
} else if (this.value === 'medium') {
mode = HotelCalendarManagement.MODE.MEDIUM;
}
self._hcalendar.setMode(mode);
});
self.create_calendar({
rooms: rooms,
days: self._view_options['days'],
endOfWeek: parseInt(self._view_options['eday_week']) || 6,
endOfWeekOffset: self._view_options['eday_week_offset'] || 0,
dateFormatLong: ODOO_DATETIME_MOMENT_FORMAT,
dateFormatShort: ODOO_DATE_MOMENT_FORMAT,
translations: {
'Open': _t('Open'),
'Closed': _t('Closed'),
'C. Departure': _t('C. Departure'),
'C. Arrival': _t('C. Arrival'),
'Price': _t('Price'),
'Availability': _t('Availability'),
'Min. Stay': _t('Min. Stay'),
'Max. Stay': _t('Max. Stay'),
'Min. Stay Arrival': _t('Min. Stay Arrival'),
'Max. Stay Arrival': _t('Max. Stay Arrival'),
'Clousure': _t('Clousure'),
'Free Rooms': _t('Free Rooms'),
'No OTA': _t('No OTA'),
'Options': _t('Options'),
'Reset': _t('Reset'),
'Copy': _t('Copy'),
'Paste': _t('Paste'),
'Clone': _t('Clone'),
'Cancel': _t('Cancel')
}
});
self._hcalendar.setData(results['prices'], results['restrictions'], results['availability'], results['count_reservations']);
self._assign_extra_info();
});
},
call_action: function(action) {
this._action_manager.do_action(action);
},
init_calendar_view: function(){
var self = this;
this.$ehcal = this.$el.find("div#hcal_management_widget");
/** VIEW CONTROLS INITIALIZATION **/
// DATE TIME PICKERS
var l10nn = _t.database.parameters
var DTPickerOptions = {
viewMode: 'months',
icons : {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down'
},
language : moment.locale(),
format : L10N_DATE_MOMENT_FORMAT,
disabledHours: true // TODO: Odoo uses old datetimepicker version
};
var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin');
var $dateTimePickerEnd = this.$el.find('#mpms-search #date_end');
$dateTimePickerBegin.datetimepicker(DTPickerOptions);
$dateTimePickerEnd.datetimepicker($.extend({}, DTPickerOptions, { 'useCurrent': false }));
$dateTimePickerBegin.on("dp.change", function (e) {
$dateTimePickerEnd.data("DateTimePicker").setMinDate(e.date.add(3,'d'));
$dateTimePickerEnd.data("DateTimePicker").setMaxDate(e.date.add(2,'M'));
$dateTimePickerBegin.data("DateTimePicker").hide(); // TODO: Odoo uses old datetimepicker version
self.on_change_filter_date(e, true);
});
$dateTimePickerEnd.on("dp.change", function (e) {
self.on_change_filter_date(e, false);
$dateTimePickerEnd.data("DateTimePicker").hide(); // TODO: Odoo uses old datetimepicker version
});
// var date_begin = moment().startOf('day');
// var date_end = date_begin.clone().add(this._view_options['days'], 'd').endOf('day');
// $dateTimePickerBegin.data("ignore_onchange", true);
// $dateTimePickerBegin.data("DateTimePicker").setDate(date_begin);
// $dateTimePickerEnd.data("DateTimePicker").setDate(date_end);
// this._last_dates = this.generate_params()['dates'];
// View Events
this.$el.find("#mpms-search #cal-pag-prev-plus").on('click', function(ev){
// FIXME: Ugly repeated code. Change place.
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end');
//var days = moment($dateTimePickerBegin.data("DateTimePicker").getDate()).clone().local().daysInMonth();
var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().subtract(14, 'd');
var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().subtract(14, 'd');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").setDate(date_begin);
$dateTimePickerEnd.data("DateTimePicker").setDate(date_end);
ev.preventDefault();
});
this.$el.find("#mpms-search #cal-pag-prev").on('click', function(ev){
// FIXME: Ugly repeated code. Change place.
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end');
var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().subtract(7, 'd');
var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().subtract(7, 'd');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").setDate(date_begin);
$dateTimePickerEnd.data("DateTimePicker").setDate(date_end);
ev.preventDefault();
});
this.$el.find("#mpms-search #cal-pag-next-plus").on('click', function(ev){
// FIXME: Ugly repeated code. Change place.
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end');
//var days = moment($dateTimePickerBegin.data("DateTimePicker").getDate()).clone().local().daysInMonth();
var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().add(14, 'd');
var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().add(14, 'd');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").setDate(date_begin);
$dateTimePickerEnd.data("DateTimePicker").setDate(date_end);
ev.preventDefault();
});
this.$el.find("#mpms-search #cal-pag-next").on('click', function(ev){
// FIXME: Ugly repeated code. Change place.
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end');
var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().add(7, 'd');
var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().add(7, 'd');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").setDate(date_begin);
$dateTimePickerEnd.data("DateTimePicker").setDate(date_end);
ev.preventDefault();
});
this.$el.find("#mpms-search #cal-pag-selector").on('click', function(ev){
// FIXME: Ugly repeated code. Change place.
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end');
var date_begin = moment().startOf('day');
var date_end = date_begin.clone().add(self._view_options['days'], 'd').endOf('day');
$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").setDate(date_begin);
$dateTimePickerEnd.data("DateTimePicker").setDate(date_end);
ev.preventDefault();
});
// Save Button
this.$el.find("#btn_save_changes").on('click', function(ev){
self.save_changes();
});
// Launch Massive Changes
this.$el.find("#btn_massive_changes").on('click', function(ev){
self.call_action("hotel.action_hotel_massive_change");
});
/** RENDER CALENDAR **/
this._model.call('get_hcalendar_settings', [false]).then(function(results){
self._view_options = results;
var date_begin = moment().startOf('day');
if (['xs', 'md'].indexOf(self._findBootstrapEnvironment()) >= 0) {
self._view_options['days'] = 7;
} else {
self._view_options['days'] = (self._view_options['days'] !== 'month')?parseInt(self._view_options['days']):date_begin.daysInMonth();
}
var date_end = date_begin.clone().add(self._view_options['days'], 'd').endOf('day');
var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin');
var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end');
//$dateTimePickerBegin.data("ignore_onchange", true);
$dateTimePickerBegin.data("DateTimePicker").setDate(date_begin);
//$dateTimePickerEnd.data("ignore_onchange", true);
$dateTimePickerEnd.data("DateTimePicker").setDate(date_end);
self._last_dates = self.generate_params()['dates'];
self.generate_hotel_calendar();
});
return $.when();
},
on_change_filter_date: function(ev, isStartDate) {
var self = this;
isStartDate = isStartDate || false;
var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin');
var $dateTimePickerEnd = this.$el.find('#mpms-search #date_end');
// FIXME: Hackish onchange ignore (Used when change dates from code)
if ($dateTimePickerBegin.data("ignore_onchange") || $dateTimePickerEnd.data("ignore_onchange")) {
$dateTimePickerBegin.data("ignore_onchange", false);
$dateTimePickerEnd.data("ignore_onchange", false)
return true;
}
var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().set({'hour': 0, 'minute': 0, 'second': 0}).clone();
if (this._hcalendar && date_begin) {
if (isStartDate) {
var ndate_end = date_begin.clone().add(this._view_options['days'], 'd');
$dateTimePickerEnd.data("ignore_onchange", true);
$dateTimePickerEnd.data("DateTimePicker").setDate(ndate_end.local());
}
var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().set({'hour': 23, 'minute': 59, 'second': 59}).clone();
this._check_unsaved_changes(function(){
self._hcalendar.setStartDate(date_begin, self._hcalendar.getDateDiffDays(date_begin, date_end));
self.reload_hcalendar_management();
});
}
},
_on_bus_signal: function(notifications) {
if (!this._hcalendar) {
return;
}
for (var notif of notifications) {
if (notif[0][1] === 'hotel.reservation') {
switch (notif[1]['type']) {
case 'availability':
var avail = notif[1]['availability'];
var room_type = Object.keys(avail)[0];
var day = Object.keys(avail[room_type])[0];
var dt = HotelCalendarManagement.toMoment(day);
var availability = {};
availability[room_type] = [{
'date': dt.format(ODOO_DATE_MOMENT_FORMAT),
'avail': avail[room_type][day][0],
'no_ota': avail[room_type][day][1],
'id': avail[room_type][day][2]
}];
this._hcalendar.addAvailability(availability);
break;
case 'pricelist':
var prices = notif[1]['price'];
var pricelist_id = Object.keys(prices)[0];
var pr = {};
for (var price of prices[pricelist_id]) {
pr[price['room']] = [];
var days = Object.keys(price['days']);
for (var day of days) {
var dt = HotelCalendarManagement.toMoment(day);
pr[price['room']].push({
'date': dt.format(ODOO_DATE_MOMENT_FORMAT),
'price': price['days'][day],
'id': price['id']
});
}
}
this._hcalendar.addPricelist(pr);
break;
case 'restriction':
// FIXME: Expected one day and one room_type
var restriction = notif[1]['restriction'];
var room_type = Object.keys(restriction)[0];
var day = Object.keys(restriction[room_type])[0];
var dt = HotelCalendarManagement.toMoment(day);
var rest = {};
rest[room_type] = [{
'date': dt.format(ODOO_DATE_MOMENT_FORMAT),
'min_stay': restriction[room_type][day][0],
'min_stay_arrival': restriction[room_type][day][1],
'max_stay': restriction[room_type][day][2],
'max_stay_arrival': restriction[room_type][day][3],
'closed': restriction[room_type][day][4],
'closed_arrival': restriction[room_type][day][5],
'closed_departure': restriction[room_type][day][6],
'id': restriction[room_type][day][7]
}];
this._hcalendar.addRestrictions(rest);
break;
}
}
}
},
reload_hcalendar_management: function() {
var self = this;
var params = this.generate_params();
var oparams = [params['dates'][0], params['dates'][1], params['prices'], params['restrictions'], false];
this._model.call('get_hcalendar_all_data', oparams).then(function(results){
self._days_tooltips = results['events'];
self._hcalendar.setData(results['prices'], results['restrictions'], results['availability'], results['count_reservations']);
self._assign_extra_info();
});
this._last_dates = params['dates'];
this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header");
this._on_scroll(); // FIXME: Workaround for update sticky header
},
generate_params: function() {
var fullDomain = [];
var prices = this.$el.find('#mpms-search #price_list').val();
var restrictions = this.$el.find('#mpms-search #restriction_list').val();
var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin');
var $dateTimePickerEnd = this.$el.find('#mpms-search #date_end');
var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().set({'hour': 0, 'minute': 0, 'second': 0}).clone().utc().format(ODOO_DATE_MOMENT_FORMAT);
var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().set({'hour': 23, 'minute': 59, 'second': 59}).clone().utc().format(ODOO_DATE_MOMENT_FORMAT);
return {
'dates': [date_begin, date_end],
'prices': prices,
'restrictions': restrictions
};
},
_check_unsaved_changes: function(fnCallback) {
var self = this;
var btn_save = this.$el.find("#btn_save_changes");
if (!btn_save.hasClass('need-save')) {
btn_save.removeClass('need-save');
fnCallback();
return;
}
new Dialog(self, {
title: _t("Unsaved Changes!"),
buttons: [
{
text: _t("Yes, save it"),
classes: 'btn-primary',
close: true,
click: function() {
self.save_changes();
fnCallback();
}
},
{
text: _t("No"),
close: true,
click: function() {
btn_save.removeClass('need-save');
fnCallback();
}
}
],
$content: QWeb.render('HotelCalendarManagement.UnsavedChanges', {})
}).open();
},
_findBootstrapEnvironment: function() {
var envs = ['xs', 'sm', 'md', 'lg'];
var $el = $('<div>');
$el.appendTo($('body'));
for (var i = envs.length - 1; i >= 0; i--) {
var env = envs[i];
$el.addClass('hidden-'+env);
if ($el.is(':hidden')) {
$el.remove();
return env;
}
}
},
_assign_extra_info: function() {
var self = this;
$(this._hcalendar.etableHeader).find('.hcal-cell-header-day').each(function(index, elm){
var $elm = $(elm);
var cdate = HotelCalendar.toMoment($elm.data('hcalDate'), L10N_DATE_MOMENT_FORMAT);
var data = _.filter(self._days_tooltips, function(item) {
var ndate = HotelCalendar.toMoment(item[2], ODOO_DATE_MOMENT_FORMAT);
return ndate.isSame(cdate, 'd');
});
if (data.length > 0) {
$elm.addClass('hcal-event-day');
$elm.on("mouseenter", function(data){
var $this = $(this);
if (data.length > 0) {
var qdict = {
'date': $this.data('hcalDate'),
'events': _.map(data, function(item){
return {
'name': item[1],
'date': item[2],
'location': item[3]
};
})
};
$this.attr('title', '');
$this.tooltip({
animation: true,
html: true,
placement: 'bottom',
title: QWeb.render('HotelCalendar.TooltipEvent', qdict)
}).tooltip('show');
}
}.bind(elm, data));
}
});
},
});
Core.view_registry.add('mpms', HotelCalendarManagementView);
return HotelCalendarManagementView;
});

View File

@@ -1,93 +0,0 @@
// Copyright 2018 Alexandre Díaz <dev@redneboa.es>
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
odoo.define('hotel_calendar.MPMSCalendarView', function (require) {
"use strict";
var AbstractView = require('web.AbstractView'),
MPMSCalendarModel = require('hotel_calendar.MPMSCalendarModel'),
MPMSCalendarController = require('hotel_calendar.MPMSCalendarController'),
MPMSCalendarRenderer = require('hotel_calendar.MPMSCalendarRenderer'),
ViewRegistry = require('web.view_registry'),
SystrayMenu = require('web.SystrayMenu'),
ControlPanel = require('web.ControlPanel'),
Widget = require('web.Widget'),
Session = require('web.session'),
Core = require('web.core'),
_lt = Core._lt,
QWeb = Core.qweb;
/* HIDE CONTROL PANEL */
/* FIXME: Look's like a hackish solution */
ControlPanel.include({
update: function(status, options) {
if (typeof options === 'undefined') {
options = {};
}
if (typeof options.toHide === 'undefined')
options.toHide = false;
var action_stack = this.getParent().action_stack;
if (action_stack && action_stack.length) {
var active_action = action_stack[action_stack.length-1];
if (active_action.widget && active_action.widget.active_view &&
active_action.widget.active_view.type === 'mpms'){
options.toHide = true;
}
}
this._super(status, options);
this._toggle_visibility(!options.toHide);
}
});
var MPMSCalendarView = AbstractView.extend({
display_name: _lt('Calendar MPMS'),
icon: 'fa-calendar',
jsLibs: ['/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js'],
cssLibs: [
'/hotel_calendar/static/src/lib/hcalendar/css/hcalendar.css',
'/hotel_calendar/static/src/lib/hcalendar/css/hcalendar_management.css'
],
config: {
Model: MPMSCalendarModel,
Controller: MPMSCalendarController,
Renderer: MPMSCalendarRenderer,
},
init: function (viewInfo, params) {
this._super.apply(this, arguments);
var arch = viewInfo.arch;
var fields = viewInfo.fields;
var attrs = arch.attrs;
// If form_view_id is set, then the calendar view will open a form view
// with this id, when it needs to edit or create an event.
this.controllerParams.formViewId =
attrs.form_view_id ? parseInt(attrs.form_view_id, 10) : false;
if (!this.controllerParams.formViewId && params.action) {
var formViewDescr = _.find(params.action.views, function (v) {
return v[1] === 'form';
});
if (formViewDescr) {
this.controllerParams.formViewId = formViewDescr[0];
}
}
this.controllerParams.readonlyFormViewId = !attrs.readonly_form_view_id || !utils.toBoolElse(attrs.readonly_form_view_id, true) ? false : attrs.readonly_form_view_id;
this.controllerParams.context = params.context || {};
this.controllerParams.displayName = params.action && params.action.name;
this.rendererParams.model = viewInfo.model;
this.loadParams.fields = fields;
this.loadParams.fieldsInfo = viewInfo.fieldsInfo;
this.loadParams.creatable = false;
this.loadParams.mode = attrs.mode;
},
});
ViewRegistry.add('mpms', MPMSCalendarView);
return MPMSCalendarView;
});

View File

@@ -1,20 +0,0 @@
// Copyright 2018 Alexandre Díaz <dev@redneboa.es>
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
odoo.define('hotel_calendar.Constants', function (require) {
"use strict";
var Core = require('web.core'),
Time = require('web.time'),
l10n = Core._t.database.parameters;
return {
ODOO_DATE_MOMENT_FORMAT: 'YYYY-MM-DD',
ODOO_DATETIME_MOMENT_FORMAT: 'YYYY-MM-DD HH:mm:ss',
L10N_DATE_MOMENT_FORMAT: "DD/MM/YYYY", //FIXME: Time.strftime_to_moment_format(l10n.date_format),
L10N_DATETIME_MOMENT_FORMAT: 'DD/MM/YYYY ' + Time.strftime_to_moment_format(l10n.time_format),
CURRENCY_SYMBOL: "€",
};
});

View File

@@ -1,398 +0,0 @@
// Copyright 2018 Alexandre Díaz <dev@redneboa.es>
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
odoo.define('hotel_calendar.MultiCalendar', function(require) {
'use strict';
var core = require('web.core');
var session = require('web.session');
var Widget = require('web.Widget');
var HotelConstants = require('hotel_calendar.Constants');
var QWeb = core.qweb;
var MultiCalendar = Widget.extend({
_calendars: [],
_calendar_records: [],
_active_index: -1,
_events: {},
_tabs: [],
_dataset: {},
_base: null,
init: function(parent) {
this._super.apply(this, arguments);
},
start: function() {
this._super.apply(this, arguments);
this._create_tabs_panel();
},
on: function(event_name, callback) {
this.$el.on(event_name, callback.bind(this));
},
reset: function() {
for (var i in this._calendars) {
delete this._calendars[i];
}
for (var [$tab, $panel] of this._tabs) {
$tab.remove();
$panel.remove();
}
$('#multicalendar_tabs').remove();
$('#multicalendar_panels').remove();
this._calendars = [];
this._calendar_records = [];
this._tabs = [];
this._datasets = {};
this._active_index = -1;
this._events = {};
},
get_calendar: function(index) {
return this._calendars[index-1];
},
get_calendar_record: function(index) {
return this._calendar_records[index-1];
},
get_tab: function(index) {
return this._tabs[index];
},
get_active_index: function() {
return this._active_index;
},
get_active_calendar: function() {
return this._calendars[this._active_index-1];
},
get_active_tab: function() {
return this._tabs[this._active_index];
},
update_active_tab_name: function(name) {
var [$tab, $panel] = this.get_tab(this.get_active_index());
$tab.text(name);
},
get_active_filters: function() {
var calendar = this.get_active_calendar();
var domain = calendar.getDomain(HotelCalendar.DOMAIN.ROOMS);
var filters = {};
for (var rule of domain) {
filters[rule[0]] = rule[2];
}
return filters;
},
recalculate_reservation_positions: function() {
var active_calendar = this.get_active_calendar();
if (active_calendar) {
setTimeout(function(calendar){
calendar._updateOffsets();
calendar._updateReservations(false);
}.bind(this, active_calendar), 200);
}
},
remove_reservation: function(reserv_id) {
this._dataset['reservations'] = _.reject(this._dataset['reservations'], {id: reserv_id});
for (var calendar of this._calendars) {
var reserv = calendar.getReservation(reserv_id);
if (reserv) {
calendar.removeReservation(reserv);
}
}
},
remove_extra_room_row: function(reserv, only_active_calendar) {
if (only_active_calendar) {
this.get_active_calendar().removeExtraRoomRow(reserv);
} else {
for (var calendar of this._calendars) {
calendar.removeExtraRoomRow(reserv);
}
}
},
swap_reservations: function(outReservs, inReservs) {
for (var calendar of this._calendars) {
calendar.swapReservations(outReservs, inReservs);
}
},
set_active_calendar: function(index) {
this._tabs[index+1][0].tab('show');
},
set_datasets: function(pricelist, restrictions, reservations) {
this._dataset = {
pricelist: pricelist,
restrictions: restrictions,
reservations: reservations,
};
},
set_options: function(options) {
this._options = options;
},
set_base_element: function(element) {
this._base = element;
},
merge_pricelist: function(pricelist, calendar) {
var keys = _.keys(pricelist);
for (var k of keys) {
var pr = pricelist[k];
for (var pr_k in pr) {
var pr_item = pricelist[k][pr_k];
var pr_fk = _.findKey(this._dataset['pricelist'][k], {'room': pr_item.room});
if (pr_fk) {
this._dataset['pricelist'][k][pr_fk].room = pr_item.room;
this._dataset['pricelist'][k][pr_fk].days = _.extend(this._dataset['pricelist'][k][pr_fk].days, pr_item.days);
if (pr_item.title) {
this._dataset['pricelist'][k][pr_fk].title = pr_item.title;
}
} else {
if (!(k in this._dataset['pricelist'])) {
this._dataset['pricelist'][k] = [];
}
this._dataset['pricelist'][k].push({
'room': pr_item.room,
'days': pr_item.days,
'title': pr_item.title
});
}
}
}
if (!calendar) {
for (var calendar of this._calendars) {
calendar.setPricelist(this._dataset['pricelist']);
}
} else {
calendar.setPricelist(this._dataset['pricelist']);
}
},
merge_restrictions: function(restrictions, calendar) {
var room_type_ids = Object.keys(restrictions);
for (var vid of room_type_ids) {
if (vid in this._dataset['restrictions']) {
this._dataset['restrictions'][vid] = _.extend(this._dataset['restrictions'][vid], restrictions[vid]);
}
else {
this._dataset['restrictions'][vid] = restrictions[vid];
}
}
if (!calendar) {
for (var calendar of this._calendars) {
calendar.setRestrictions(this._dataset['restrictions']);
}
} else {
calendar.setRestrictions(this._dataset['restrictions']);
}
},
merge_reservations: function(reservations, calendar) {
for (var r of reservations) {
var rindex = _.findKey(this._dataset['reservations'], {'id': r.id});
if (rindex) {
this._dataset['reservations'][rindex] = r;
} else {
this._dataset['reservations'].push(r);
}
}
if (!calendar) {
for (var calendar of this._calendars) {
calendar.addReservations(reservations);
}
} else {
calendar.addReservations(reservations);
}
},
merge_days_tooltips: function(new_tooltips) {
for (var nt of new_tooltips) {
var fnt = _.find(this._days_tooltips, function(item) { return item['id'] === nt['id']});
if (fnt) {
fnt = nt;
} else {
this._days_tooltips.push(nt);
}
}
},
create_calendar: function(calendar_record) {
var [$tab, $panel] = this._create_tab(calendar_record['name'], `calendar-pane-${calendar_record['name']}`);
var calendar = new HotelCalendar(
$panel[0],
this._options,
this._dataset['pricelist'],
this._dataset['restrictions'],
this._base);
this._assign_calendar_events(calendar);
this._assign_extra_info(calendar);
calendar.setReservations(this._dataset['reservations']);
this._calendars.push(calendar);
this._calendar_records.push(calendar_record);
return this._calendars.length-1;
},
on_calendar: function(event_name, callback) {
this._events[event_name] = callback;
},
_create_tab: function(name, id, options) {
var self = this;
var sanitized_id = this._sanitizeId(id);
var $tab = $('<a/>', _.extend({
id: this._sanitizeId(name),
href: `#${sanitized_id}`,
text: name,
role: 'tab',
}, options)).data('tabindex', this._tabs.length).appendTo($('<li/>').prependTo(this.$tabs));
$tab.on('shown.bs.tab', function(ev){
self._active_index = $(ev.target).data('tabindex');
self.recalculate_reservation_positions();
if (ev.relatedTarget) {
var prev_index = $(ev.relatedTarget).data('tabindex');
if (prev_index) {
self.get_calendar(prev_index).cancelSwap();
}
}
self.$el.trigger('tab_changed', [self._active_index]);
});
$tab[0].dataset.toggle = 'tab';
var $panel = $('<div/>', {
id: sanitized_id,
class: 'tab-pane',
role: 'tabpanel'
}).appendTo(this.$tabs_content);
this._tabs.push([$tab, $panel]);
return this._tabs[this._tabs.length-1];
},
_create_tabs_panel: function() {
var self = this;
this.$el.empty();
this.$tabs = $('<ul/>', {
class: 'nav nav-tabs',
id: 'multicalendar_tabs'
}).appendTo(this.$el);
this.$tabs_content = $('<div/>', {
class: 'tab-content',
id: 'multicalendar_panels'
}).appendTo(this.$el);
// '+' Tab
var [$tab, $panel] = this._create_tab('+', 'default', {class: 'multi-calendar-tab-plus'});
$tab.on('shown.bs.tab', function(ev){
ev.preventDefault();
var calendar_record = {
id: false,
name: `Calendar #${self._calendars.length}`,
segmentation_ids: [],
location_ids: [],
amenity_ids: [],
room_type_ids: []
};
var new_calendar_id = self.create_calendar(calendar_record);
self.set_active_calendar(new_calendar_id);
});
$('<p/>', {
class: 'warn-message',
text: "NO CALENDAR DEFINED!",
}).appendTo($panel);
},
_assign_calendar_events: function(calendar) {
for (var event_name in this._events) {
calendar.addEventListener(event_name, this._events[event_name]);
}
},
_assign_extra_info: function(calendar) {
var self = this;
$(calendar.etable).find('.hcal-cell-room-type-group-item.btn-hcal-left').on("mouseenter", function(){
var $this = $(this);
var room = calendar.getRoom($this.parent().data("hcalRoomObjId"));
if (room.overbooking) {
$this.tooltip({
animation: true,
html: true,
placement: 'right',
title: QWeb.render('HotelCalendar.TooltipRoomOverbooking', {'name': room.number})
}).tooltip('show');
} else {
var qdict = {
'room_type_name': room.getUserData('room_type_name'),
'name': room.number
};
$this.tooltip({
animation: true,
html: true,
placement: 'right',
title: QWeb.render('HotelCalendar.TooltipRoom', qdict)
}).tooltip('show');
}
});
$(calendar.etableHeader).find('.hcal-cell-header-day').each(function(index, elm){
var $elm = $(elm);
var cdate = HotelCalendar.toMoment($elm.data('hcalDate'), HotelConstants.L10N_DATE_MOMENT_FORMAT);
var data = _.filter(self._days_tooltips, function(item) {
var ndate = HotelCalendar.toMoment(item['date'], HotelConstants.ODOO_DATE_MOMENT_FORMAT);
return ndate.isSame(cdate, 'd');
});
if (data.length > 0) {
$elm.addClass('hcal-event-day');
$elm.append("<i class='fa fa-bell' style='margin-right: 0.1em'></i>");
$elm.on("mouseenter", function(data){
var $this = $(this);
if (data.length > 0) {
var qdict = {
'date': $this.data('hcalDate'),
'events': _.map(data, function(item){
return {
'name': item['name'],
'date': item['date'],
'location': item['location']
};
})
};
$this.attr('title', '');
$this.tooltip({
animation: true,
html: true,
placement: 'bottom',
title: QWeb.render('HotelCalendar.TooltipEvent', qdict)
}).tooltip('show');
}
}.bind(elm, data));
}
});
},
_sanitizeId: function(/*String*/str) {
return str.replace(/[^a-zA-Z0-9\-_]/g, '_');
},
});
return MultiCalendar;
});

View File

@@ -1,985 +0,0 @@
/**
* bootbox.js [v4.4.0]
*
* http://bootboxjs.com/license.txt
*/
// @see https://github.com/makeusabrew/bootbox/issues/180
// @see https://github.com/makeusabrew/bootbox/issues/186
(function (root, factory) {
"use strict";
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define(["jquery"], factory);
} else if (typeof exports === "object") {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory(require("jquery"));
} else {
// Browser globals (root is window)
root.bootbox = factory(root.jQuery);
}
}(this, function init($, undefined) {
"use strict";
// the base DOM structure needed to create a modal
var templates = {
dialog:
"<div class='bootbox modal' tabindex='-1' role='dialog'>" +
"<div class='modal-dialog'>" +
"<div class='modal-content'>" +
"<div class='modal-body'><div class='bootbox-body'></div></div>" +
"</div>" +
"</div>" +
"</div>",
header:
"<div class='modal-header'>" +
"<h4 class='modal-title'></h4>" +
"</div>",
footer:
"<div class='modal-footer'></div>",
closeButton:
"<button type='button' class='bootbox-close-button close' data-dismiss='modal' aria-hidden='true'>&times;</button>",
form:
"<form class='bootbox-form'></form>",
inputs: {
text:
"<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />",
textarea:
"<textarea class='bootbox-input bootbox-input-textarea form-control'></textarea>",
email:
"<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />",
select:
"<select class='bootbox-input bootbox-input-select form-control'></select>",
checkbox:
"<div class='checkbox'><label><input class='bootbox-input bootbox-input-checkbox' type='checkbox' /></label></div>",
date:
"<input class='bootbox-input bootbox-input-date form-control' autocomplete=off type='date' />",
time:
"<input class='bootbox-input bootbox-input-time form-control' autocomplete=off type='time' />",
number:
"<input class='bootbox-input bootbox-input-number form-control' autocomplete=off type='number' />",
password:
"<input class='bootbox-input bootbox-input-password form-control' autocomplete='off' type='password' />"
}
};
var defaults = {
// default language
locale: "en",
// show backdrop or not. Default to static so user has to interact with dialog
backdrop: "static",
// animate the modal in/out
animate: true,
// additional class string applied to the top level dialog
className: null,
// whether or not to include a close button
closeButton: true,
// show the dialog immediately by default
show: true,
// dialog container
container: "body"
};
// our public object; augmented after our private API
var exports = {};
/**
* @private
*/
function _t(key) {
var locale = locales[defaults.locale];
return locale ? locale[key] : locales.en[key];
}
function processCallback(e, dialog, callback) {
e.stopPropagation();
e.preventDefault();
// by default we assume a callback will get rid of the dialog,
// although it is given the opportunity to override this
// so, if the callback can be invoked and it *explicitly returns false*
// then we'll set a flag to keep the dialog active...
var preserveDialog = $.isFunction(callback) && callback.call(dialog, e) === false;
// ... otherwise we'll bin it
if (!preserveDialog) {
dialog.modal("hide");
}
}
function getKeyLength(obj) {
// @TODO defer to Object.keys(x).length if available?
var k, t = 0;
for (k in obj) {
t ++;
}
return t;
}
function each(collection, iterator) {
var index = 0;
$.each(collection, function(key, value) {
iterator(key, value, index++);
});
}
function sanitize(options) {
var buttons;
var total;
if (typeof options !== "object") {
throw new Error("Please supply an object of options");
}
if (!options.message) {
throw new Error("Please specify a message");
}
// make sure any supplied options take precedence over defaults
options = $.extend({}, defaults, options);
if (!options.buttons) {
options.buttons = {};
}
buttons = options.buttons;
total = getKeyLength(buttons);
each(buttons, function(key, button, index) {
if ($.isFunction(button)) {
// short form, assume value is our callback. Since button
// isn't an object it isn't a reference either so re-assign it
button = buttons[key] = {
callback: button
};
}
// before any further checks make sure by now button is the correct type
if ($.type(button) !== "object") {
throw new Error("button with key " + key + " must be an object");
}
if (!button.label) {
// the lack of an explicit label means we'll assume the key is good enough
button.label = key;
}
if (!button.className) {
if (total <= 2 && index === total-1) {
// always add a primary to the main option in a two-button dialog
button.className = "btn-primary";
} else {
button.className = "btn-default";
}
}
});
return options;
}
/**
* map a flexible set of arguments into a single returned object
* if args.length is already one just return it, otherwise
* use the properties argument to map the unnamed args to
* object properties
* so in the latter case:
* mapArguments(["foo", $.noop], ["message", "callback"])
* -> { message: "foo", callback: $.noop }
*/
function mapArguments(args, properties) {
var argn = args.length;
var options = {};
if (argn < 1 || argn > 2) {
throw new Error("Invalid argument length");
}
if (argn === 2 || typeof args[0] === "string") {
options[properties[0]] = args[0];
options[properties[1]] = args[1];
} else {
options = args[0];
}
return options;
}
/**
* merge a set of default dialog options with user supplied arguments
*/
function mergeArguments(defaults, args, properties) {
return $.extend(
// deep merge
true,
// ensure the target is an empty, unreferenced object
{},
// the base options object for this type of dialog (often just buttons)
defaults,
// args could be an object or array; if it's an array properties will
// map it to a proper options object
mapArguments(
args,
properties
)
);
}
/**
* this entry-level method makes heavy use of composition to take a simple
* range of inputs and return valid options suitable for passing to bootbox.dialog
*/
function mergeDialogOptions(className, labels, properties, args) {
// build up a base set of dialog properties
var baseOptions = {
className: "bootbox-" + className,
buttons: createLabels.apply(null, labels)
};
// ensure the buttons properties generated, *after* merging
// with user args are still valid against the supplied labels
return validateButtons(
// merge the generated base properties with user supplied arguments
mergeArguments(
baseOptions,
args,
// if args.length > 1, properties specify how each arg maps to an object key
properties
),
labels
);
}
/**
* from a given list of arguments return a suitable object of button labels
* all this does is normalise the given labels and translate them where possible
* e.g. "ok", "confirm" -> { ok: "OK, cancel: "Annuleren" }
*/
function createLabels() {
var buttons = {};
for (var i = 0, j = arguments.length; i < j; i++) {
var argument = arguments[i];
var key = argument.toLowerCase();
var value = argument.toUpperCase();
buttons[key] = {
label: _t(value)
};
}
return buttons;
}
function validateButtons(options, buttons) {
var allowedButtons = {};
each(buttons, function(key, value) {
allowedButtons[value] = true;
});
each(options.buttons, function(key) {
if (allowedButtons[key] === undefined) {
throw new Error("button key " + key + " is not allowed (options are " + buttons.join("\n") + ")");
}
});
return options;
}
exports.alert = function() {
var options;
options = mergeDialogOptions("alert", ["ok"], ["message", "callback"], arguments);
if (options.callback && !$.isFunction(options.callback)) {
throw new Error("alert requires callback property to be a function when provided");
}
/**
* overrides
*/
options.buttons.ok.callback = options.onEscape = function() {
if ($.isFunction(options.callback)) {
return options.callback.call(this);
}
return true;
};
return exports.dialog(options);
};
exports.confirm = function() {
var options;
options = mergeDialogOptions("confirm", ["cancel", "confirm"], ["message", "callback"], arguments);
/**
* overrides; undo anything the user tried to set they shouldn't have
*/
options.buttons.cancel.callback = options.onEscape = function() {
return options.callback.call(this, false);
};
options.buttons.confirm.callback = function() {
return options.callback.call(this, true);
};
// confirm specific validation
if (!$.isFunction(options.callback)) {
throw new Error("confirm requires a callback");
}
return exports.dialog(options);
};
exports.prompt = function() {
var options;
var defaults;
var dialog;
var form;
var input;
var shouldShow;
var inputOptions;
// we have to create our form first otherwise
// its value is undefined when gearing up our options
// @TODO this could be solved by allowing message to
// be a function instead...
form = $(templates.form);
// prompt defaults are more complex than others in that
// users can override more defaults
// @TODO I don't like that prompt has to do a lot of heavy
// lifting which mergeDialogOptions can *almost* support already
// just because of 'value' and 'inputType' - can we refactor?
defaults = {
className: "bootbox-prompt",
buttons: createLabels("cancel", "confirm"),
value: "",
inputType: "text"
};
options = validateButtons(
mergeArguments(defaults, arguments, ["title", "callback"]),
["cancel", "confirm"]
);
// capture the user's show value; we always set this to false before
// spawning the dialog to give us a chance to attach some handlers to
// it, but we need to make sure we respect a preference not to show it
shouldShow = (options.show === undefined) ? true : options.show;
/**
* overrides; undo anything the user tried to set they shouldn't have
*/
options.message = form;
options.buttons.cancel.callback = options.onEscape = function() {
return options.callback.call(this, null);
};
options.buttons.confirm.callback = function() {
var value;
switch (options.inputType) {
case "text":
case "textarea":
case "email":
case "select":
case "date":
case "time":
case "number":
case "password":
value = input.val();
break;
case "checkbox":
var checkedItems = input.find("input:checked");
// we assume that checkboxes are always multiple,
// hence we default to an empty array
value = [];
each(checkedItems, function(_, item) {
value.push($(item).val());
});
break;
}
return options.callback.call(this, value);
};
options.show = false;
// prompt specific validation
if (!options.title) {
throw new Error("prompt requires a title");
}
if (!$.isFunction(options.callback)) {
throw new Error("prompt requires a callback");
}
if (!templates.inputs[options.inputType]) {
throw new Error("invalid prompt type");
}
// create the input based on the supplied type
input = $(templates.inputs[options.inputType]);
switch (options.inputType) {
case "text":
case "textarea":
case "email":
case "date":
case "time":
case "number":
case "password":
input.val(options.value);
break;
case "select":
var groups = {};
inputOptions = options.inputOptions || [];
if (!$.isArray(inputOptions)) {
throw new Error("Please pass an array of input options");
}
if (!inputOptions.length) {
throw new Error("prompt with select requires options");
}
each(inputOptions, function(_, option) {
// assume the element to attach to is the input...
var elem = input;
if (option.value === undefined || option.text === undefined) {
throw new Error("given options in wrong format");
}
// ... but override that element if this option sits in a group
if (option.group) {
// initialise group if necessary
if (!groups[option.group]) {
groups[option.group] = $("<optgroup/>").attr("label", option.group);
}
elem = groups[option.group];
}
elem.append("<option value='" + option.value + "'>" + option.text + "</option>");
});
each(groups, function(_, group) {
input.append(group);
});
// safe to set a select's value as per a normal input
input.val(options.value);
break;
case "checkbox":
var values = $.isArray(options.value) ? options.value : [options.value];
inputOptions = options.inputOptions || [];
if (!inputOptions.length) {
throw new Error("prompt with checkbox requires options");
}
if (!inputOptions[0].value || !inputOptions[0].text) {
throw new Error("given options in wrong format");
}
// checkboxes have to nest within a containing element, so
// they break the rules a bit and we end up re-assigning
// our 'input' element to this container instead
input = $("<div/>");
each(inputOptions, function(_, option) {
var checkbox = $(templates.inputs[options.inputType]);
checkbox.find("input").attr("value", option.value);
checkbox.find("label").append(option.text);
// we've ensured values is an array so we can always iterate over it
each(values, function(_, value) {
if (value === option.value) {
checkbox.find("input").prop("checked", true);
}
});
input.append(checkbox);
});
break;
}
// @TODO provide an attributes option instead
// and simply map that as keys: vals
if (options.placeholder) {
input.attr("placeholder", options.placeholder);
}
if (options.pattern) {
input.attr("pattern", options.pattern);
}
if (options.maxlength) {
input.attr("maxlength", options.maxlength);
}
// now place it in our form
form.append(input);
form.on("submit", function(e) {
e.preventDefault();
// Fix for SammyJS (or similar JS routing library) hijacking the form post.
e.stopPropagation();
// @TODO can we actually click *the* button object instead?
// e.g. buttons.confirm.click() or similar
dialog.find(".btn-primary").click();
});
dialog = exports.dialog(options);
// clear the existing handler focusing the submit button...
dialog.off("shown.bs.modal");
// ...and replace it with one focusing our input, if possible
dialog.on("shown.bs.modal", function() {
// need the closure here since input isn't
// an object otherwise
input.focus();
});
if (shouldShow === true) {
dialog.modal("show");
}
return dialog;
};
exports.dialog = function(options) {
options = sanitize(options);
var dialog = $(templates.dialog);
var innerDialog = dialog.find(".modal-dialog");
var body = dialog.find(".modal-body");
var buttons = options.buttons;
var buttonStr = "";
var callbacks = {
onEscape: options.onEscape
};
if ($.fn.modal === undefined) {
throw new Error(
"$.fn.modal is not defined; please double check you have included " +
"the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ " +
"for more details."
);
}
each(buttons, function(key, button) {
// @TODO I don't like this string appending to itself; bit dirty. Needs reworking
// can we just build up button elements instead? slower but neater. Then button
// can just become a template too
buttonStr += "<button data-bb-handler='" + key + "' type='button' class='btn " + button.className + "'>" + button.label + "</button>";
callbacks[key] = button.callback;
});
body.find(".bootbox-body").html(options.message);
if (options.animate === true) {
dialog.addClass("fade");
}
if (options.className) {
dialog.addClass(options.className);
}
if (options.size === "large") {
innerDialog.addClass("modal-lg");
} else if (options.size === "small") {
innerDialog.addClass("modal-sm");
}
if (options.title) {
body.before(templates.header);
}
if (options.closeButton) {
var closeButton = $(templates.closeButton);
if (options.title) {
dialog.find(".modal-header").prepend(closeButton);
} else {
closeButton.css("margin-top", "-10px").prependTo(body);
}
}
if (options.title) {
dialog.find(".modal-title").html(options.title);
}
if (buttonStr.length) {
body.after(templates.footer);
dialog.find(".modal-footer").html(buttonStr);
}
/**
* Bootstrap event listeners; used handle extra
* setup & teardown required after the underlying
* modal has performed certain actions
*/
dialog.on("hidden.bs.modal", function(e) {
// ensure we don't accidentally intercept hidden events triggered
// by children of the current dialog. We shouldn't anymore now BS
// namespaces its events; but still worth doing
if (e.target === this) {
dialog.remove();
}
});
/*
dialog.on("show.bs.modal", function() {
// sadly this doesn't work; show is called *just* before
// the backdrop is added so we'd need a setTimeout hack or
// otherwise... leaving in as would be nice
if (options.backdrop) {
dialog.next(".modal-backdrop").addClass("bootbox-backdrop");
}
});
*/
dialog.on("shown.bs.modal", function() {
dialog.find(".btn-primary:first").focus();
});
/**
* Bootbox event listeners; experimental and may not last
* just an attempt to decouple some behaviours from their
* respective triggers
*/
if (options.backdrop !== "static") {
// A boolean true/false according to the Bootstrap docs
// should show a dialog the user can dismiss by clicking on
// the background.
// We always only ever pass static/false to the actual
// $.modal function because with `true` we can't trap
// this event (the .modal-backdrop swallows it)
// However, we still want to sort of respect true
// and invoke the escape mechanism instead
dialog.on("click.dismiss.bs.modal", function(e) {
// @NOTE: the target varies in >= 3.3.x releases since the modal backdrop
// moved *inside* the outer dialog rather than *alongside* it
if (dialog.children(".modal-backdrop").length) {
e.currentTarget = dialog.children(".modal-backdrop").get(0);
}
if (e.target !== e.currentTarget) {
return;
}
dialog.trigger("escape.close.bb");
});
}
dialog.on("escape.close.bb", function(e) {
if (callbacks.onEscape) {
processCallback(e, dialog, callbacks.onEscape);
}
});
/**
* Standard jQuery event listeners; used to handle user
* interaction with our dialog
*/
dialog.on("click", ".modal-footer button", function(e) {
var callbackKey = $(this).data("bb-handler");
processCallback(e, dialog, callbacks[callbackKey]);
});
dialog.on("click", ".bootbox-close-button", function(e) {
// onEscape might be falsy but that's fine; the fact is
// if the user has managed to click the close button we
// have to close the dialog, callback or not
processCallback(e, dialog, callbacks.onEscape);
});
dialog.on("keyup", function(e) {
if (e.which === 27) {
dialog.trigger("escape.close.bb");
}
});
// the remainder of this method simply deals with adding our
// dialogent to the DOM, augmenting it with Bootstrap's modal
// functionality and then giving the resulting object back
// to our caller
$(options.container).append(dialog);
dialog.modal({
backdrop: options.backdrop ? "static": false,
keyboard: false,
show: false
});
if (options.show) {
dialog.modal("show");
}
// @TODO should we return the raw element here or should
// we wrap it in an object on which we can expose some neater
// methods, e.g. var d = bootbox.alert(); d.hide(); instead
// of d.modal("hide");
/*
function BBDialog(elem) {
this.elem = elem;
}
BBDialog.prototype = {
hide: function() {
return this.elem.modal("hide");
},
show: function() {
return this.elem.modal("show");
}
};
*/
return dialog;
};
exports.setDefaults = function() {
var values = {};
if (arguments.length === 2) {
// allow passing of single key/value...
values[arguments[0]] = arguments[1];
} else {
// ... and as an object too
values = arguments[0];
}
$.extend(defaults, values);
};
exports.hideAll = function() {
$(".bootbox").modal("hide");
return exports;
};
/**
* standard locales. Please add more according to ISO 639-1 standard. Multiple language variants are
* unlikely to be required. If this gets too large it can be split out into separate JS files.
*/
var locales = {
bg_BG : {
OK : "Ок",
CANCEL : "Отказ",
CONFIRM : "Потвърждавам"
},
br : {
OK : "OK",
CANCEL : "Cancelar",
CONFIRM : "Sim"
},
cs : {
OK : "OK",
CANCEL : "Zrušit",
CONFIRM : "Potvrdit"
},
da : {
OK : "OK",
CANCEL : "Annuller",
CONFIRM : "Accepter"
},
de : {
OK : "OK",
CANCEL : "Abbrechen",
CONFIRM : "Akzeptieren"
},
el : {
OK : "Εντάξει",
CANCEL : "Ακύρωση",
CONFIRM : "Επιβεβαίωση"
},
en : {
OK : "OK",
CANCEL : "Cancel",
CONFIRM : "OK"
},
es : {
OK : "OK",
CANCEL : "Cancelar",
CONFIRM : "Aceptar"
},
et : {
OK : "OK",
CANCEL : "Katkesta",
CONFIRM : "OK"
},
fa : {
OK : "قبول",
CANCEL : "لغو",
CONFIRM : "تایید"
},
fi : {
OK : "OK",
CANCEL : "Peruuta",
CONFIRM : "OK"
},
fr : {
OK : "OK",
CANCEL : "Annuler",
CONFIRM : "D'accord"
},
he : {
OK : "אישור",
CANCEL : "ביטול",
CONFIRM : "אישור"
},
hu : {
OK : "OK",
CANCEL : "Mégsem",
CONFIRM : "Megerősít"
},
hr : {
OK : "OK",
CANCEL : "Odustani",
CONFIRM : "Potvrdi"
},
id : {
OK : "OK",
CANCEL : "Batal",
CONFIRM : "OK"
},
it : {
OK : "OK",
CANCEL : "Annulla",
CONFIRM : "Conferma"
},
ja : {
OK : "OK",
CANCEL : "キャンセル",
CONFIRM : "確認"
},
lt : {
OK : "Gerai",
CANCEL : "Atšaukti",
CONFIRM : "Patvirtinti"
},
lv : {
OK : "Labi",
CANCEL : "Atcelt",
CONFIRM : "Apstiprināt"
},
nl : {
OK : "OK",
CANCEL : "Annuleren",
CONFIRM : "Accepteren"
},
no : {
OK : "OK",
CANCEL : "Avbryt",
CONFIRM : "OK"
},
pl : {
OK : "OK",
CANCEL : "Anuluj",
CONFIRM : "Potwierdź"
},
pt : {
OK : "OK",
CANCEL : "Cancelar",
CONFIRM : "Confirmar"
},
ru : {
OK : "OK",
CANCEL : "Отмена",
CONFIRM : "Применить"
},
sq : {
OK : "OK",
CANCEL : "Anulo",
CONFIRM : "Prano"
},
sv : {
OK : "OK",
CANCEL : "Avbryt",
CONFIRM : "OK"
},
th : {
OK : "ตกลง",
CANCEL : "ยกเลิก",
CONFIRM : "ยืนยัน"
},
tr : {
OK : "Tamam",
CANCEL : "İptal",
CONFIRM : "Onayla"
},
zh_CN : {
OK : "OK",
CANCEL : "取消",
CONFIRM : "确认"
},
zh_TW : {
OK : "OK",
CANCEL : "取消",
CONFIRM : "確認"
}
};
exports.addLocale = function(name, values) {
$.each(["OK", "CANCEL", "CONFIRM"], function(_, v) {
if (!values[v]) {
throw new Error("Please supply a translation for '" + v + "'");
}
});
locales[name] = {
OK: values.OK,
CANCEL: values.CANCEL,
CONFIRM: values.CONFIRM
};
return exports;
};
exports.removeLocale = function(name) {
delete locales[name];
return exports;
};
exports.setLocale = function(name) {
return exports.setDefaults("locale", name);
};
exports.init = function(_$) {
return init(_$ || $);
};
return exports;
}));

View File

@@ -1,537 +0,0 @@
/*
* Hotel Calendar JS v0.0.1a - 2017-2018
* GNU Public License
* Aloxa Solucions S.L. <info@aloxa.eu>
* Alexandre Díaz <alex@aloxa.eu>
*/
/** ANIMATIONS **/
@keyframes cell-invalid {
0% {
background: #ff0000;
background: repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 40%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%);
background: -webkit-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 40%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%);
background: -moz-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 40%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%);
}
50% {
background: #ff0000;
background: repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 40%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%);
background: -webkit-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 35%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%);
background: -moz-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 40%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%);
}
100% {
background: #ff0000;
background: repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 30%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%);
background: -webkit-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 30%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%);
background: -moz-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 30%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%);
}
}
#hcal_load {
width: 100%;
height: 90vh;
text-align: center;
line-height: 90vh;
color: darkgray;
}
#hcal_load > span {
line-height: 24px;
display: inline-block;
vertical-align: middle;
}
#cal-pag-prev-plus, #cal-pag-prev, #cal-pag-selector, #cal-pag-next, #cal-pag-next-plus {
min-height: 0px;
}
.hcalendar-container {
display: flex;
flex-flow: column;
}
.table-reservations-header {
order: 1;
flex-grow: 1;
overflow-y: scroll;
overflow-x: hidden;
}
.table-reservations {
order: 2;
flex-grow: 2;
overflow-y: scroll;
overflow-x: hidden;
position: relative;
max-height: 57vh;
}
.table-calcs-header {
order: 3;
flex-grow: 1;
overflow-y: scroll;
overflow-x: hidden;
}
.table-calcs {
order: 4;
flex-grow: 2;
overflow-y: scroll;
overflow-x: hidden;
font-size: 12px;
max-height: 20vh;
}
.table-calcs input, .table-reservations-header input {
border-radius: 0;
border: 1px solid lightgray;
width: 100%;
}
.table-calcs input {
text-align: center;
}
.btn-hcal { }
.btn-hcal.hcal-cell-current-day {
background-color: #7c7bad66;
color: #654a37;
}
.btn-hcal.hcal-cell-end-week {
background-color: #EDEDED83;
}
.btn-hcal-3d {
border: 1px solid #eaeaea;
border-top-width: 0;
border-bottom-width: 0;
/*border-color: white black black white !important;*/
}
.btn-hcal-flat {
background-color: white;
border: 1px solid #eaeaea;
}
.btn-hcal-left {
background-color: white;
border: 1px solid #eaeaea;
border-left-width: 0;
}
.hcal-warn-ob-indicator {
position: absolute;
background-color: red;
color: yellow;
border: 1px solid black;
z-index: 9;
width: 25px;
height: 20px;
text-align: center;
}
.table-calcs-header .hcal-table, .table-reservations-header .hcal-table {
height: 46px;
}
.hcal-table, .hcal-table-day {
border-collapse: initial !important;
width: 100%;
table-layout: fixed;
}
.hcal-table > tbody {
max-height: 50vh;
overflow: scroll;
}
.hcal-table td {
text-align: center;
min-width: 100px;
white-space: nowrap;
overflow: hidden;
}
.hcal-table a {
text-decoration: none;
}
.hcal-table tr:hover td:not(.hcal-unused-zone):not(.hcal-cell-highlight):not(.hcal-cell-current-day):not(.hcal-cell-end-week):not(.btn-hcal):not(.hcal-cell-invalid) {
/*background-color: #F6F6F6;
border: 5px solid red;*/
}
.hcal-table tr:hover td.hcal-cell-room-type-group-item {
background-color: #7c7bad80;
color: white;
}
.hcal-restriction-room-day {
background-color: #9b18704d !important;
}
.hcal-table-day {
height: 100%;
border-collapse: collapse !important;
border: 0 dotted #eaeaea;
border-width: 1px 0;
}
/*.hcal-table-day tr:first-child td{
border: 1px solid #727272 !important;
border-width: 0 1px 0 0 !important;
}
.hcal-table tr:not(:last-child) .hcal-table-day tr:last-child td {
border-style: solid;
border-color: #727272 !important;
border-bottom-width: 1px !important;
}
.hcal-table-day tr:not(:last-child):not(:first-child) td {
border-width: 0;
}*/
.hcal-table-day td {
padding: 2px;
height: 3em;
font-size: 7px;
vertical-align: middle;
font-weight: bold;
border: 0.5px solid #eaeaea !important;
}
.hcal-table-day td:hover:not(.hcal-cell-highlight):not(.hcal-cell-invalid) {
background-color: #FCFEE1 !important;
}
.hcal-cell-current-day {
background-color: #7C7BADA5;
}
.hcal-cell-end-week {
background-color: #EDEDED83;
}
.hcal-cell-day-selector {
text-align: center;
vertical-align: center;
max-width: 140px;
}
.hcal-cell-day-selector a {
font-size: 22px;
padding: 0 0.5em;
}
.hcal-cell-day-selector span {
cursor: pointer;
}
.hcal-cell-day-selector input {
border: 1px solid lightgray;
width: 120px;
font-size: large;
text-align: center;
}
.hcal-cell-month {
overflow: hidden;
max-width: 0;
text-align: center !important;
vertical-align: middle;
white-space: nowrap;
font-size: 12px;
}
.hcal-cell-month:nth-child(n+3) {
border-left-width: 2px !important;
}
.hcal-cell-start-month {
border-left-width: 2px !important;
}
.hcal-room-type:hover {
cursor:pointer;
}
.hcal-cell-highlight {
background-color: #F8FD9C;
}
.hcal-cell-invalid {
background-color: #e58e92;
}
.hcal-cell-room-type-group-item-day {
padding: 0 !important;
height: 100%;
}
.hcal-input-changed {
background-color: rgb(237,110,110);
border: 1px solid gray;
}
.hcal-cell-room-type-group-item-day-occupied {
/*background-color: #227eaf;*/
}
.hcal-cell-room-type-group-item-day-occupied[data-hcal-reservation-cell-type=soft-start] {
background-color: #729fcf;
/*border: 2px solid #3465a4;*/
}
.hcal-cell-pagination button {
padding: 0.1em;
border-radius: 0;
background-color: initial;
}
#btn_save_changes.need-save {
color: yellow;
background: orange;
}
.hcal-hidden {
display: none;
}
.hcal-reservation-unselect {
opacity: 0.3;
pointer-events: none;
}
.hcal-reservation {
position: absolute;
text-align: center;
/*background-color: #729fcf;*/
/*transform: skewX(-25deg);*/
/*border-radius: 5px;*/
border: 0 double #3465a4;
color: white;
white-space: nowrap;
overflow: hidden;
z-index: 8;
}
.hcal-reservation:hover {
background-color: #4e97bf;
}
.hcal-reservation span {
position: relative;
}
.hcal-reservation-splitted {
border-width: 0 6px;
border-style: solid;
}
.hcal-reservation-invalid {
background-color: #c8543b !important;
border-color: #6c3624 !important;
}
.hcal-reservation-invalid:hover {
background-color: #f5b595 !important;
border-color: #c8543b !important;
}
.hcal-reservation-foreground {
pointer-events: none;
opacity: 0.9;
color: transparent !important;
background: repeating-linear-gradient(
45deg,
#606dbc,
#606dbc 10px,
#465298 10px,
#465298 20px
);
}
.hcal-reservation-invalid-swap {
pointer-events: none;
opacity: 0.9;
color: transparent !important;
background: repeating-linear-gradient(
45deg,
#BA6359,
#BA6359 10px,
#dfe066 10px,
#dfe066 20px
);
}
.hcal-reservation-invalid-unify {
pointer-events: none;
opacity: 0.9;
color: transparent !important;
background: repeating-linear-gradient(
45deg,
#BA6359,
#BA6359 10px,
#dfe066 10px,
#dfe066 20px
);
}
.hcal-reservation-action {
border: 2px dashed #3465a4;
opacity: 0.9;
pointer-events: none;
z-index:10;
}
.hcal-reservation-readonly:not(.hcal-unused-zone) {
border: 2px solid #99995b;
color: white !important;
font-weight: bold;
background: #ffee00;
background: repeating-radial-gradient(circle farthest-corner at right center, #ffee00 0%, #2c2c2c 5%, #ffff00 10%, #2c2c2c 20%, #2c2c2c 100%);
background: -webkit-repeating-radial-gradient(circle farthest-corner at right center, #ffee00 0%, #2c2c2c 5%, #ffff00 10%, #2c2c2c 20%, #2c2c2c 100%);
background: -moz-repeating-radial-gradient(circle farthest-corner at right center, #ffee00 0%, #2c2c2c 5%, #ffff00 10%, #2c2c2c 20%, #2c2c2c 100%);
}
.hcal-reservation-unify-selected {
background-color: #005B96 !important;
border-color: #99bdd5 !important;
}
.hcal-reservation-swap-in-selected {
background-color: #005B96 !important;
border-color: #99bdd5 !important;
}
.hcal-reservation-swap-out-selected {
border-color: #005B96 !important;
background-color: #99bdd5 !important;
}
.hcal-reservation-unify-selected {
background-color: #005B96 !important;
border-color: #99bdd5 !important;
}
.hcal-reservation-to-divide {
pointer-events: none;
}
.hcal-reservation-divide-l {
background-color: transparent;
border: 2px dashed black;
cursor: copy;
pointer-events: none;
border-color: black;
border-right-style: solid;
position: absolute;
z-index: 9;
}
.hcal-reservation-divide-r {
background-color: transparent;
border: 2px dashed black;
cursor: copy;
pointer-events: none;
border-color: black;
border-left-style: solid;
position: absolute;
z-index: 9;
}
.hcal-row-room-type-group-item {
text-align: center;
}
tr.hcal-row-room-type-group-overbooking-item td {
background-color: #fccc9f;
}
tr.hcal-row-room-type-group-cancelled-item td {
background-color: #fcebeb;
}
.hcal-cell-month-day {
text-align: center !important;
}
.hcal-cell-room-type-group-day {
text-align: center !important;
}
.hcal-table-type-group-day {
border-collapse: collapse;
width:100%;
}
.hcal-table-type-group-day td {
border-width: 0;
}
.hcal-table-type-group-day tr:not(:last-child) td {
border-bottom-width: 1px;
}
.hcal-cell-room-type {
cursor: pointer;
}
td.hcal-cell-room-type {
border-right-width: 2px;
}
td.hcal-cell-room-type-group-day, td.hcal-cell-room-type {
border-top-width: 2px;
}
td.hcal-cell-room-type-group-day {
padding: 0;
}
td.hcal-cell-room-type-group-item {
text-align: center !important;
vertical-align: middle;
font-size: smaller;
white-space: nowrap;
text-overflow: ellipsis;
}
td.hcal-cell-room-type-group-item:last-child {
border-right-width: 2px;
}
.hcal-cell-type-group-day-free {
text-align: center;
font-weight: bold;
padding: 0 !important;
}
.hcal-cell-type-group-day-price {
text-align: center;
}
td.hcal-cell-header-day {
padding: 0;
vertical-align: middle;
font-size: 10px;
}
td.hcal-cell-month-day-occupied {
padding: 0;
text-align: center;
}
.hcal-cell-detail-room-free-type-group-item-day,
.hcal-cell-detail-room-free-total-group-item-day,
.hcal-cell-detail-room-perc-occup-group-item-day,
.hcal-cell-detail-room-price-type-group-item-day,
.hcal-cell-detail-room-min-stay-group-item-day {
border: 1px solid lightgray;
}
.hcal-cell-detail-room-min-stay-group-item-day {
border-color: #307CB0 lightgray lightgray lightgray;
border-width: 2px 1px 1px 1px;
}
.hcal-cell-detail-room-group-item {
white-space: nowrap;
text-align: right !important;
text-overflow: '...';
}
/* FIXME: Workaround for work with other currencies */
.hcal-cell-detail-room-group-item[data-currency-symbol='€'] {
text-overflow: '... €';
}
.hcal-unused-zone {
border-radius: 0px;
}
.input-price {
width: 100%;
border-style: none !important;
border-radius: 0 !important;
text-align: center;
}
.noselect {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
}

View File

@@ -1,198 +0,0 @@
/*
* Hotel Calendar Management JS v0.0.1a - 2017
* GNU Public License
* Aloxa Solucions S.L. <info@aloxa.eu>
* Alexandre Díaz <alex@aloxa.eu>
*/
#pms-search-cal-pag {
text-align: center;
}
#mpms-search {
padding: 0.5em;
}
.hcal-management-table, .hcal-management-table-day {
border-collapse: collapse !important;
table-layout: fixed;
}
.hcal-management-table > tbody {
max-height: 50vh;
overflow: scroll;
}
.hcal-management-table > thead > tr > td {
/*text-align: center !important;*/
width: 110px !important;
vertical-align: center;
min-width: 110px;
height: 1.5em;
min-height: 1.5em;
white-space: nowrap;
/*overflow: hidden;*/
border: 1px solid black !important;
}
.hcal-management-table > tbody > tr > td {
/*text-align: center !important;*/
width: 110px !important;
vertical-align: center;
min-width: 110px;
height: 130px;
min-height: 100px;
white-space: nowrap;
/*overflow: hidden;*/
padding: 5px !important;
border: 1px solid black;
}
.hcal-management-table thead td {
text-align: center !important;
}
.hcal-management-table a {
text-decoration: none;
}
.hcal-management-table tr:hover td:not(.hcal-cell-highlight):not(.hcal-cell-current-day):not(.hcal-cell-end-week):not(.btn-hcal):not(.hcal-cell-invalid) {
background-color: #F6F6F6;
}
.hcal-management-table tr:hover td.hcal-cell-room-type-group-item {
background-color: #9bcd9b;
color: black;
}
.hcal-management-table input[type='edit'] {
width: 100%;
font-size: 10px;
text-align: center;
}
.hcal-management-table select {
font-size: 9px;
}
.hcal-management-table-day {
height: 100%;
border-collapse: collapse !important;
}
.hcal-management-table-day td {
padding: 2px;
height: 2.3em;
font-size: 7px;
vertical-align: middle;
font-weight: bold;
border: 0;
}
.hcal-management-table-day td:hover:not(.hcal-cell-highlight):not(.hcal-cell-invalid) {
background-color: #FCFEE1 !important;
}
.hcal-management-low > tbody > tr > td, .hcal-management-low > table > tbody > tr > td {
height: 58px !important;
}
.hcal-management-medium > tbody > tr > td, .hcal-management-medium > table > tbody > tr > td {
height: 80px !important;
}
.hcal-management-medium tr[name='rest_b'], .hcal-management-medium tr[name='rest_c'],
.hcal-management-low tr[name='rest_a'], .hcal-management-low tr[name='rest_b'], .hcal-management-low tr[name='rest_c'] {
display: none;
visibility: hidden;
}
.table-room_types {
flex: 1 1 auto;
margin-top: 1.2em;
}
.table-room_type-data-header {
z-index: 1;
}
.table-room_type-data-header .hcal-management-table tr td {
background-color: white;
}
#hcal_management_widget {
overflow: auto;
display: flex;
}
#hcal-management-container-dd {
overflow: auto;
flex: 1 1 auto;
}
#btn_save_changes, #btn_massive_changes {
height: 56px;
}
#btn_save_changes i, #btn_massive_changes i {
top: 22%;
}
.hcal-management-input-changed {
background-color: rgb(237,110,110);
border: 1px solid gray;
}
.hcal-management-record-changed {
background-color: #FFFF66 !important;
}
table.hcal-management-table input {
border: 1px solid lightgray;
}
.hcal-border-radius-right {
border-top-right-radius: 25px;
border-bottom-right-radius: 25px;
}
.hcal-border-radius-left {
border-top-left-radius: 25px;
border-bottom-left-radius: 25px;
}
.hcal-management-record-options {
padding: 0.5em;
}
.filter-title {
overflow: hidden;
text-overflow: ellipsis;
}
button.hcal-management-input {
font-size: 9px;
border: 1px solid gray;
padding: 0.5em 2em 0.2em 2em;
border-radius: 3px;
margin: 0.2em;
background: rgba(255,255,255,1);
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(227,227,227,1) 47%, rgba(194,194,194,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(255,255,255,1)), color-stop(47%, rgba(227,227,227,1)), color-stop(100%, rgba(194,194,194,1)));
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(227,227,227,1) 47%, rgba(194,194,194,1) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(227,227,227,1) 47%, rgba(194,194,194,1) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(227,227,227,1) 47%, rgba(194,194,194,1) 100%);
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(227,227,227,1) 47%, rgba(194,194,194,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#c2c2c2', GradientType=0 );
}
button.hcal-management-input:hover {
background: rgba(255,255,255,1);
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(255,255,255,1)), color-stop(47%, rgba(246,246,246,1)), color-stop(100%, rgba(237,237,237,1)));
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed', GradientType=0 );
}
button.hcal-management-input-active {
background: rgba(245,215,93,1) !important;
background: -moz-linear-gradient(top, rgba(245,215,93,1) 0%, rgba(245,165,44,1) 47%, rgba(255,153,0,1) 100%) !important;
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(245,215,93,1)), color-stop(47%, rgba(245,165,44,1)), color-stop(100%, rgba(255,153,0,1))) !important;
background: -webkit-linear-gradient(top, rgba(245,215,93,1) 0%, rgba(245,165,44,1) 47%, rgba(255,153,0,1) 100%) !important;
background: -o-linear-gradient(top, rgba(245,215,93,1) 0%, rgba(245,165,44,1) 47%, rgba(255,153,0,1) 100%) !important;
background: -ms-linear-gradient(top, rgba(245,215,93,1) 0%, rgba(245,165,44,1) 47%, rgba(255,153,0,1) 100%) !important;
background: linear-gradient(to bottom, rgba(245,215,93,1) 0%, rgba(245,165,44,1) 47%, rgba(255,153,0,1) 100%) !important;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5d75d', endColorstr='#ff9900', GradientType=0 ) !important;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,551 +0,0 @@
//! moment.js
//! version : 2.17.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return od.apply(null,arguments)}
// This is done to register the method called with moment()
// without creating circular dependencies.
function b(a){od=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){
// IE8 will treat undefined and null as object if it wasn't for
// input != null
return null!=a&&"[object Object]"===Object.prototype.toString.call(a)}function e(a){var b;for(b in a)
// even if its not own property I'd still call it non-empty
return!1;return!0}function f(a){return"number"==typeof a||"[object Number]"===Object.prototype.toString.call(a)}function g(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function h(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function i(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function j(a,b){for(var c in b)i(b,c)&&(a[c]=b[c]);return i(b,"toString")&&(a.toString=b.toString),i(b,"valueOf")&&(a.valueOf=b.valueOf),a}function k(a,b,c,d){return rb(a,b,c,d,!0).utc()}function l(){
// We need to deep clone this object.
return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function m(a){return null==a._pf&&(a._pf=l()),a._pf}function n(a){if(null==a._isValid){var b=m(a),c=qd.call(b.parsedDateParts,function(a){return null!=a}),d=!isNaN(a._d.getTime())&&b.overflow<0&&!b.empty&&!b.invalidMonth&&!b.invalidWeekday&&!b.nullInput&&!b.invalidFormat&&!b.userInvalidated&&(!b.meridiem||b.meridiem&&c);if(a._strict&&(d=d&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour),null!=Object.isFrozen&&Object.isFrozen(a))return d;a._isValid=d}return a._isValid}function o(a){var b=k(NaN);return null!=a?j(m(b),a):m(b).userInvalidated=!0,b}function p(a){return void 0===a}function q(a,b){var c,d,e;if(p(b._isAMomentObject)||(a._isAMomentObject=b._isAMomentObject),p(b._i)||(a._i=b._i),p(b._f)||(a._f=b._f),p(b._l)||(a._l=b._l),p(b._strict)||(a._strict=b._strict),p(b._tzm)||(a._tzm=b._tzm),p(b._isUTC)||(a._isUTC=b._isUTC),p(b._offset)||(a._offset=b._offset),p(b._pf)||(a._pf=m(b)),p(b._locale)||(a._locale=b._locale),rd.length>0)for(c in rd)d=rd[c],e=b[d],p(e)||(a[d]=e);return a}
// Moment prototype object
function r(b){q(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),
// Prevent infinite loop in case updateOffset creates new moment
// objects.
sd===!1&&(sd=!0,a.updateOffset(this),sd=!1)}function s(a){return a instanceof r||null!=a&&null!=a._isAMomentObject}function t(a){return a<0?Math.ceil(a)||0:Math.floor(a)}function u(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=t(b)),c}
// compare two arrays, return the number of differences
function v(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;d<e;d++)(c&&a[d]!==b[d]||!c&&u(a[d])!==u(b[d]))&&g++;return g+f}function w(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function x(b,c){var d=!0;return j(function(){if(null!=a.deprecationHandler&&a.deprecationHandler(null,b),d){for(var e,f=[],g=0;g<arguments.length;g++){if(e="","object"==typeof arguments[g]){e+="\n["+g+"] ";for(var h in arguments[0])e+=h+": "+arguments[0][h]+", ";e=e.slice(0,-2)}else e=arguments[g];f.push(e)}w(b+"\nArguments: "+Array.prototype.slice.call(f).join("")+"\n"+(new Error).stack),d=!1}return c.apply(this,arguments)},c)}function y(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),td[b]||(w(c),td[b]=!0)}function z(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function A(a){var b,c;for(c in a)b=a[c],z(b)?this[c]=b:this["_"+c]=b;this._config=a,
// Lenient ordinal parsing accepts just a number in addition to
// number + (possibly) stuff coming from _ordinalParseLenient.
this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function B(a,b){var c,e=j({},a);for(c in b)i(b,c)&&(d(a[c])&&d(b[c])?(e[c]={},j(e[c],a[c]),j(e[c],b[c])):null!=b[c]?e[c]=b[c]:delete e[c]);for(c in a)i(a,c)&&!i(b,c)&&d(a[c])&&(
// make sure changes to properties don't modify parent config
e[c]=j({},e[c]));return e}function C(a){null!=a&&this.set(a)}function D(a,b,c){var d=this._calendar[a]||this._calendar.sameElse;return z(d)?d.call(b,c):d}function E(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function F(){return this._invalidDate}function G(a){return this._ordinal.replace("%d",a)}function H(a,b,c,d){var e=this._relativeTime[c];return z(e)?e(a,b,c,d):e.replace(/%d/i,a)}function I(a,b){var c=this._relativeTime[a>0?"future":"past"];return z(c)?c(b):c.replace(/%s/i,b)}function J(a,b){var c=a.toLowerCase();Dd[c]=Dd[c+"s"]=Dd[b]=a}function K(a){return"string"==typeof a?Dd[a]||Dd[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)i(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(a,b){Ed[a]=b}function N(a){var b=[];for(var c in a)b.push({unit:c,priority:Ed[c]});return b.sort(function(a,b){return a.priority-b.priority}),b}function O(b,c){return function(d){return null!=d?(Q(this,b,d),a.updateOffset(this,c),this):P(this,b)}}function P(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function Q(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}
// MOMENTS
function R(a){return a=K(a),z(this[a])?this[a]():this}function S(a,b){if("object"==typeof a){a=L(a);for(var c=N(a),d=0;d<c.length;d++)this[c[d].unit](a[c[d].unit])}else if(a=K(a),z(this[a]))return this[a](b);return this}function T(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}
// token: 'M'
// padded: ['MM', 2]
// ordinal: 'Mo'
// callback: function () { this.month() + 1 }
function U(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Id[a]=e),b&&(Id[b[0]]=function(){return T(e.apply(this,arguments),b[1],b[2])}),c&&(Id[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function V(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function W(a){var b,c,d=a.match(Fd);for(b=0,c=d.length;b<c;b++)Id[d[b]]?d[b]=Id[d[b]]:d[b]=V(d[b]);return function(b){var e,f="";for(e=0;e<c;e++)f+=d[e]instanceof Function?d[e].call(b,a):d[e];return f}}
// format date using native date object
function X(a,b){return a.isValid()?(b=Y(b,a.localeData()),Hd[b]=Hd[b]||W(b),Hd[b](a)):a.localeData().invalidDate()}function Y(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Gd.lastIndex=0;d>=0&&Gd.test(a);)a=a.replace(Gd,c),Gd.lastIndex=0,d-=1;return a}function Z(a,b,c){$d[a]=z(b)?b:function(a,d){return a&&c?c:b}}function $(a,b){return i($d,a)?$d[a](b._strict,b._locale):new RegExp(_(a))}
// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
function _(a){return aa(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function aa(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ba(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),f(b)&&(d=function(a,c){c[b]=u(a)}),c=0;c<a.length;c++)_d[a[c]]=d}function ca(a,b){ba(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function da(a,b,c){null!=b&&i(_d,a)&&_d[a](b,c._a,c,a)}function ea(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function fa(a,b){return a?c(this._months)?this._months[a.month()]:this._months[(this._months.isFormat||ke).test(b)?"format":"standalone"][a.month()]:this._months}function ga(a,b){return a?c(this._monthsShort)?this._monthsShort[a.month()]:this._monthsShort[ke.test(b)?"format":"standalone"][a.month()]:this._monthsShort}function ha(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._monthsParse)for(
// this is not used
this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],d=0;d<12;++d)f=k([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,"").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,"").toLocaleLowerCase();return c?"MMM"===b?(e=je.call(this._shortMonthsParse,g),e!==-1?e:null):(e=je.call(this._longMonthsParse,g),e!==-1?e:null):"MMM"===b?(e=je.call(this._shortMonthsParse,g),e!==-1?e:(e=je.call(this._longMonthsParse,g),e!==-1?e:null)):(e=je.call(this._longMonthsParse,g),e!==-1?e:(e=je.call(this._shortMonthsParse,g),e!==-1?e:null))}function ia(a,b,c){var d,e,f;if(this._monthsParseExact)return ha.call(this,a,b,c);
// TODO: add sorting
// Sorting makes sure if one month (or abbr) is a prefix of another
// see sorting in computeMonthsParse
for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;d<12;d++){
// test the regex
if(
// make the regex if we don't have it already
e=k([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}
// MOMENTS
function ja(a,b){var c;if(!a.isValid())
// No op
return a;if("string"==typeof b)if(/^\d+$/.test(b))b=u(b);else
// TODO: Another silent failure?
if(b=a.localeData().monthsParse(b),!f(b))return a;return c=Math.min(a.date(),ea(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ka(b){return null!=b?(ja(this,b),a.updateOffset(this,!0),this):P(this,"Month")}function la(){return ea(this.year(),this.month())}function ma(a){return this._monthsParseExact?(i(this,"_monthsRegex")||oa.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=ne),this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex)}function na(a){return this._monthsParseExact?(i(this,"_monthsRegex")||oa.call(this),a?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=oe),this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex)}function oa(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;b<12;b++)
// make the regex if we don't have it already
c=k([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(
// Sorting makes sure if one month (or abbr) is a prefix of another it
// will match the longer piece.
d.sort(a),e.sort(a),f.sort(a),b=0;b<12;b++)d[b]=aa(d[b]),e[b]=aa(e[b]);for(b=0;b<24;b++)f[b]=aa(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")","i")}
// HELPERS
function pa(a){return qa(a)?366:365}function qa(a){return a%4===0&&a%100!==0||a%400===0}function ra(){return qa(this.year())}function sa(a,b,c,d,e,f,g){
//can't just apply() to create a date:
//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
var h=new Date(a,b,c,d,e,f,g);
//the date constructor remaps years 0-99 to 1900-1999
return a<100&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function ta(a){var b=new Date(Date.UTC.apply(null,arguments));
//the Date.UTC function remaps years 0-99 to 1900-1999
return a<100&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}
// start-of-first-week - start-of-year
function ua(a,b,c){var// first-week day -- which january is always in the first week (4 for iso, 1 for other)
d=7+b-c,
// first-week day local weekday -- which local weekday is fwd
e=(7+ta(a,0,d).getUTCDay()-b)%7;return-e+d-1}
//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return j<=0?(f=a-1,g=pa(f)+j):j>pa(a)?(f=a+1,g=j-pa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return g<1?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(pa(a)-d+e)/7}
// HELPERS
// LOCALES
function ya(a){return wa(a,this._week.dow,this._week.doy).week}function za(){return this._week.dow}function Aa(){return this._week.doy}
// MOMENTS
function Ba(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function Ca(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}
// HELPERS
function Da(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function Ea(a,b){return"string"==typeof a?b.weekdaysParse(a)%7||7:isNaN(a)?null:a}function Fa(a,b){return a?c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]:this._weekdays}function Ga(a){return a?this._weekdaysShort[a.day()]:this._weekdaysShort}function Ha(a){return a?this._weekdaysMin[a.day()]:this._weekdaysMin}function Ia(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;d<7;++d)f=k([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=je.call(this._weekdaysParse,g),e!==-1?e:null):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:null):(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null):"dddd"===b?(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null))):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null))):(e=je.call(this._minWeekdaysParse,g),e!==-1?e:(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:null)))}function Ja(a,b,c){var d,e,f;if(this._weekdaysParseExact)return Ia.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;d<7;d++){
// test the regex
if(
// make the regex if we don't have it already
e=k([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}
// MOMENTS
function Ka(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Da(a,this.localeData()),this.add(a-b,"d")):b}function La(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ma(a){if(!this.isValid())return null!=a?this:NaN;
// behaves the same as moment#day except
// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
// as a setter, sunday should belong to the previous week.
if(null!=a){var b=Ea(a,this.localeData());return this.day(this.day()%7?b:b-7)}return this.day()||7}function Na(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=ue),this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex)}function Oa(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ve),this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Pa(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=we),this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Qa(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],h=[],i=[],j=[];for(b=0;b<7;b++)
// make the regex if we don't have it already
c=k([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),h.push(e),i.push(f),j.push(d),j.push(e),j.push(f);for(
// Sorting makes sure if one weekday (or abbr) is a prefix of another it
// will match the longer piece.
g.sort(a),h.sort(a),i.sort(a),j.sort(a),b=0;b<7;b++)h[b]=aa(h[b]),i[b]=aa(i[b]),j[b]=aa(j[b]);this._weekdaysRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}
// FORMATTING
function Ra(){return this.hours()%12||12}function Sa(){return this.hours()||24}function Ta(a,b){U(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}
// PARSING
function Ua(a,b){return b._meridiemParse}
// LOCALES
function Va(a){
// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
// Using charAt should be more compatible.
return"p"===(a+"").toLowerCase().charAt(0)}function Wa(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Xa(a){return a?a.toLowerCase().replace("_","-"):a}
// pick the locale from the array
// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
function Ya(a){for(var b,c,d,e,f=0;f<a.length;){for(e=Xa(a[f]).split("-"),b=e.length,c=Xa(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=Za(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&v(e,c,!0)>=b-1)
//the next array item is better than a shallower substring of this one
break;b--}f++}return null}function Za(a){var b=null;
// TODO: Find a better way to register and load all the locales in Node
if(!Be[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=xe._abbr,require("./locale/"+a),
// because defineLocale currently also sets the global locale, we
// want to undo that for lazy loaded locales
$a(b)}catch(a){}return Be[a]}
// This function will load locale and then set the global locale. If
// no arguments are passed in, it will simply return the current global
// locale key.
function $a(a,b){var c;
// moment.duration._locale = moment._locale = data;
return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}function _a(a,b){if(null!==b){var c=Ae;if(b.abbr=a,null!=Be[a])y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),c=Be[a]._config;else if(null!=b.parentLocale){if(null==Be[b.parentLocale])return Ce[b.parentLocale]||(Ce[b.parentLocale]=[]),Ce[b.parentLocale].push({name:a,config:b}),null;c=Be[b.parentLocale]._config}
// backwards compat for now: also set the locale
// make sure we set the locale AFTER all child locales have been
// created, so we won't end up with the child locale set.
return Be[a]=new C(B(c,b)),Ce[a]&&Ce[a].forEach(function(a){_a(a.name,a.config)}),$a(a),Be[a]}
// useful for testing
return delete Be[a],null}function ab(a,b){if(null!=b){var c,d=Ae;
// MERGE
null!=Be[a]&&(d=Be[a]._config),b=B(d,b),c=new C(b),c.parentLocale=Be[a],Be[a]=c,
// backwards compat for now: also set the locale
$a(a)}else
// pass null for config to unupdate, useful for tests
null!=Be[a]&&(null!=Be[a].parentLocale?Be[a]=Be[a].parentLocale:null!=Be[a]&&delete Be[a]);return Be[a]}
// returns locale data
function bb(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return xe;if(!c(a)){if(
//short-circuit everything else
b=Za(a))return b;a=[a]}return Ya(a)}function cb(){return wd(Be)}function db(a){var b,c=a._a;return c&&m(a).overflow===-2&&(b=c[be]<0||c[be]>11?be:c[ce]<1||c[ce]>ea(c[ae],c[be])?ce:c[de]<0||c[de]>24||24===c[de]&&(0!==c[ee]||0!==c[fe]||0!==c[ge])?de:c[ee]<0||c[ee]>59?ee:c[fe]<0||c[fe]>59?fe:c[ge]<0||c[ge]>999?ge:-1,m(a)._overflowDayOfYear&&(b<ae||b>ce)&&(b=ce),m(a)._overflowWeeks&&b===-1&&(b=he),m(a)._overflowWeekday&&b===-1&&(b=ie),m(a).overflow=b),a}
// date from iso format
function eb(a){var b,c,d,e,f,g,h=a._i,i=De.exec(h)||Ee.exec(h);if(i){for(m(a).iso=!0,b=0,c=Ge.length;b<c;b++)if(Ge[b][1].exec(i[1])){e=Ge[b][0],d=Ge[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=He.length;b<c;b++)if(He[b][1].exec(i[3])){
// match[2] should be 'T' or space
f=(i[2]||" ")+He[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!Fe.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),kb(a)}else a._isValid=!1}
// date from iso format or fallback
function fb(b){var c=Ie.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(eb(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}
// Pick the first defined of two or three arguments.
function gb(a,b,c){return null!=a?a:null!=b?b:c}function hb(b){
// hooks is actually the exported moment object
var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}
// convert an array to a date.
// the array should mirror the parameters below
// note: all values past the year are optional and will default to the lowest possible value.
// [year, month, day , hour, minute, second, millisecond]
function ib(a){var b,c,d,e,f=[];if(!a._d){
// Default to current date.
// * if no year, month, day of month are given, default to today
// * if day of month is given, default month and year
// * if month is given, default only year
// * if year is given, don't default anything
for(d=hb(a),
//compute day of the year from weeks and weekdays
a._w&&null==a._a[ce]&&null==a._a[be]&&jb(a),
//if the day of the year is set, figure out what it is
a._dayOfYear&&(e=gb(a._a[ae],d[ae]),a._dayOfYear>pa(e)&&(m(a)._overflowDayOfYear=!0),c=ta(e,0,a._dayOfYear),a._a[be]=c.getUTCMonth(),a._a[ce]=c.getUTCDate()),b=0;b<3&&null==a._a[b];++b)a._a[b]=f[b]=d[b];
// Zero out whatever was not defaulted, including time
for(;b<7;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];
// Check for 24:00:00.000
24===a._a[de]&&0===a._a[ee]&&0===a._a[fe]&&0===a._a[ge]&&(a._nextDay=!0,a._a[de]=0),a._d=(a._useUTC?ta:sa).apply(null,f),
// Apply timezone offset from input. The actual utcOffset can be changed
// with parseZone.
null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[de]=24)}}function jb(a){var b,c,d,e,f,g,h,i;if(b=a._w,null!=b.GG||null!=b.W||null!=b.E)f=1,g=4,
// TODO: We need to take the current isoWeekYear, but that depends on
// how we interpret now (local, utc, fixed offset). So create
// a now version of current config (take local/utc/offset flags, and
// create now).
c=gb(b.GG,a._a[ae],wa(sb(),1,4).year),d=gb(b.W,1),e=gb(b.E,1),(e<1||e>7)&&(i=!0);else{f=a._locale._week.dow,g=a._locale._week.doy;var j=wa(sb(),f,g);c=gb(b.gg,a._a[ae],j.year),
// Default to current week.
d=gb(b.w,j.week),null!=b.d?(
// weekday -- low day numbers are considered next week
e=b.d,(e<0||e>6)&&(i=!0)):null!=b.e?(
// local weekday -- counting starts from begining of week
e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):
// default to begining of week
e=f}d<1||d>xa(c,f,g)?m(a)._overflowWeeks=!0:null!=i?m(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[ae]=h.year,a._dayOfYear=h.dayOfYear)}
// date from string and format string
function kb(b){
// TODO: Move this to another part of the creation flow to prevent circular deps
if(b._f===a.ISO_8601)return void eb(b);b._a=[],m(b).empty=!0;
// This array is used to make a Date, either with `new Date` or `Date.UTC`
var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Y(b._f,b._locale).match(Fd)||[],c=0;c<e.length;c++)f=e[c],d=(h.match($(f,b))||[])[0],
// console.log('token', token, 'parsedInput', parsedInput,
// 'regex', getParseRegexForToken(token, config));
d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&m(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),
// don't parse if it's not a known token
Id[f]?(d?m(b).empty=!1:m(b).unusedTokens.push(f),da(f,d,b)):b._strict&&!d&&m(b).unusedTokens.push(f);
// add remaining unparsed input length to the string
m(b).charsLeftOver=i-j,h.length>0&&m(b).unusedInput.push(h),
// clear _12h flag if hour is <= 12
b._a[de]<=12&&m(b).bigHour===!0&&b._a[de]>0&&(m(b).bigHour=void 0),m(b).parsedDateParts=b._a.slice(0),m(b).meridiem=b._meridiem,
// handle meridiem
b._a[de]=lb(b._locale,b._a[de],b._meridiem),ib(b),db(b)}function lb(a,b,c){var d;
// Fallback
return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&b<12&&(b+=12),d||12!==b||(b=0),b):b}
// date from string and array of format strings
function mb(a){var b,c,d,e,f;if(0===a._f.length)return m(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;e<a._f.length;e++)f=0,b=q({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],kb(b),n(b)&&(
// if there is any input that was not parsed add a penalty for that format
f+=m(b).charsLeftOver,
//or tokens
f+=10*m(b).unusedTokens.length,m(b).score=f,(null==d||f<d)&&(d=f,c=b));j(a,c||b)}function nb(a){if(!a._d){var b=L(a._i);a._a=h([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),ib(a)}}function ob(a){var b=new r(db(pb(a)));
// Adding is smart enough around DST
return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function pb(a){var b=a._i,d=a._f;return a._locale=a._locale||bb(a._l),null===b||void 0===d&&""===b?o({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),s(b)?new r(db(b)):(g(b)?a._d=b:c(d)?mb(a):d?kb(a):qb(a),n(a)||(a._d=null),a))}function qb(b){var d=b._i;void 0===d?b._d=new Date(a.now()):g(d)?b._d=new Date(d.valueOf()):"string"==typeof d?fb(b):c(d)?(b._a=h(d.slice(0),function(a){return parseInt(a,10)}),ib(b)):"object"==typeof d?nb(b):f(d)?
// from milliseconds
b._d=new Date(d):a.createFromInputFallback(b)}function rb(a,b,f,g,h){var i={};
// object construction must be done this way.
// https://github.com/moment/moment/issues/1423
return f!==!0&&f!==!1||(g=f,f=void 0),(d(a)&&e(a)||c(a)&&0===a.length)&&(a=void 0),i._isAMomentObject=!0,i._useUTC=i._isUTC=h,i._l=f,i._i=a,i._f=b,i._strict=g,ob(i)}function sb(a,b,c,d){return rb(a,b,c,d,!1)}
// Pick a moment m from moments so that m[fn](other) is true for all
// other. This relies on the function fn to be transitive.
//
// moments should either be an array of moment objects or an array, whose
// first element is an array of moment objects.
function tb(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return sb();for(d=b[0],e=1;e<b.length;++e)b[e].isValid()&&!b[e][a](d)||(d=b[e]);return d}
// TODO: Use [].sort instead?
function ub(){var a=[].slice.call(arguments,0);return tb("isBefore",a)}function vb(){var a=[].slice.call(arguments,0);return tb("isAfter",a)}function wb(a){var b=L(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;
// representation for dateAddRemove
this._milliseconds=+k+1e3*j+// 1000
6e4*i+// 1000 * 60
1e3*h*60*60,//using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
// Because of dateAddRemove treats 24 hours as different from a
// day when working around DST, we need to store them separately
this._days=+g+7*f,
// It is impossible translate months into days without knowing
// which months you are are talking about, so we have to store
// it separately.
this._months=+e+3*d+12*c,this._data={},this._locale=bb(),this._bubble()}function xb(a){return a instanceof wb}function yb(a){return a<0?Math.round(-1*a)*-1:Math.round(a)}
// FORMATTING
function zb(a,b){U(a,0,0,function(){var a=this.utcOffset(),c="+";return a<0&&(a=-a,c="-"),c+T(~~(a/60),2)+b+T(~~a%60,2)})}function Ab(a,b){var c=(b||"").match(a);if(null===c)return null;var d=c[c.length-1]||[],e=(d+"").match(Me)||["-",0,0],f=+(60*e[1])+u(e[2]);return 0===f?0:"+"===e[0]?f:-f}
// Return a moment from input, that is local/utc/zone equivalent to model.
function Bb(b,c){var d,e;
// Use low-level api, because this fn is low-level api.
return c._isUTC?(d=c.clone(),e=(s(b)||g(b)?b.valueOf():sb(b).valueOf())-d.valueOf(),d._d.setTime(d._d.valueOf()+e),a.updateOffset(d,!1),d):sb(b).local()}function Cb(a){
// On Firefox.24 Date#getTimezoneOffset returns a floating point.
// https://github.com/moment/moment/pull/1871
return 15*-Math.round(a._d.getTimezoneOffset()/15)}
// MOMENTS
// keepLocalTime = true means only change the timezone, without
// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
// +0200, so we adjust the time as needed, to be valid.
//
// Keeping the time actually adds/subtracts (one hour)
// from the actual represented time. That is why we call updateOffset
// a second time. In case it wants us to change the offset again
// _changeInProgress == true case, then we have to adjust, because
// there is no such time in the given timezone.
function Db(b,c){var d,e=this._offset||0;if(!this.isValid())return null!=b?this:NaN;if(null!=b){if("string"==typeof b){if(b=Ab(Xd,b),null===b)return this}else Math.abs(b)<16&&(b=60*b);return!this._isUTC&&c&&(d=Cb(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?Tb(this,Ob(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?e:Cb(this)}function Eb(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Fb(a){return this.utcOffset(0,a)}function Gb(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Cb(this),"m")),this}function Hb(){if(null!=this._tzm)this.utcOffset(this._tzm);else if("string"==typeof this._i){var a=Ab(Wd,this._i);null!=a?this.utcOffset(a):this.utcOffset(0,!0)}return this}function Ib(a){return!!this.isValid()&&(a=a?sb(a).utcOffset():0,(this.utcOffset()-a)%60===0)}function Jb(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Kb(){if(!p(this._isDSTShifted))return this._isDSTShifted;var a={};if(q(a,this),a=pb(a),a._a){var b=a._isUTC?k(a._a):sb(a._a);this._isDSTShifted=this.isValid()&&v(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Lb(){return!!this.isValid()&&!this._isUTC}function Mb(){return!!this.isValid()&&this._isUTC}function Nb(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ob(a,b){var c,d,e,g=a,
// matching against regexp is expensive, do it on demand
h=null;// checks for null or undefined
return xb(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:f(a)?(g={},b?g[b]=a:g.milliseconds=a):(h=Ne.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:u(h[ce])*c,h:u(h[de])*c,m:u(h[ee])*c,s:u(h[fe])*c,ms:u(yb(1e3*h[ge]))*c}):(h=Oe.exec(a))?(c="-"===h[1]?-1:1,g={y:Pb(h[2],c),M:Pb(h[3],c),w:Pb(h[4],c),d:Pb(h[5],c),h:Pb(h[6],c),m:Pb(h[7],c),s:Pb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=Rb(sb(g.from),sb(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new wb(g),xb(a)&&i(a,"_locale")&&(d._locale=a._locale),d}function Pb(a,b){
// We'd normally use ~~inp for this, but unfortunately it also
// converts floats to ints.
// inp may be undefined, so careful calling replace on it.
var c=a&&parseFloat(a.replace(",","."));
// apply sign while we're at it
return(isNaN(c)?0:c)*b}function Qb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Rb(a,b){var c;return a.isValid()&&b.isValid()?(b=Bb(b,a),a.isBefore(b)?c=Qb(a,b):(c=Qb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}
// TODO: remove 'name' arg after deprecation is removed
function Sb(a,b){return function(c,d){var e,f;
//invert the arguments, but complain about it
return null===d||isNaN(+d)||(y(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ob(c,d),Tb(this,e,a),this}}function Tb(b,c,d,e){var f=c._milliseconds,g=yb(c._days),h=yb(c._months);b.isValid()&&(e=null==e||e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&Q(b,"Date",P(b,"Date")+g*d),h&&ja(b,P(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function Ub(a,b){var c=a.diff(b,"days",!0);return c<-6?"sameElse":c<-1?"lastWeek":c<0?"lastDay":c<1?"sameDay":c<2?"nextDay":c<7?"nextWeek":"sameElse"}function Vb(b,c){
// We want to compare the start of today, vs this.
// Getting start-of-today depends on whether we're local/utc/offset or not.
var d=b||sb(),e=Bb(d,this).startOf("day"),f=a.calendarFormat(this,e)||"sameElse",g=c&&(z(c[f])?c[f].call(this,d):c[f]);return this.format(g||this.localeData().calendar(f,this,sb(d)))}function Wb(){return new r(this)}function Xb(a,b){var c=s(a)?a:sb(a);return!(!this.isValid()||!c.isValid())&&(b=K(p(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()<this.clone().startOf(b).valueOf())}function Yb(a,b){var c=s(a)?a:sb(a);return!(!this.isValid()||!c.isValid())&&(b=K(p(b)?"millisecond":b),"millisecond"===b?this.valueOf()<c.valueOf():this.clone().endOf(b).valueOf()<c.valueOf())}function Zb(a,b,c,d){return d=d||"()",("("===d[0]?this.isAfter(a,c):!this.isBefore(a,c))&&(")"===d[1]?this.isBefore(b,c):!this.isAfter(b,c))}function $b(a,b){var c,d=s(a)?a:sb(a);return!(!this.isValid()||!d.isValid())&&(b=K(b||"millisecond"),"millisecond"===b?this.valueOf()===d.valueOf():(c=d.valueOf(),this.clone().startOf(b).valueOf()<=c&&c<=this.clone().endOf(b).valueOf()))}function _b(a,b){return this.isSame(a,b)||this.isAfter(a,b)}function ac(a,b){return this.isSame(a,b)||this.isBefore(a,b)}function bc(a,b,c){var d,e,f,g;// 1000
// 1000 * 60
// 1000 * 60 * 60
// 1000 * 60 * 60 * 24, negate dst
// 1000 * 60 * 60 * 24 * 7, negate dst
return this.isValid()?(d=Bb(a,this),d.isValid()?(e=6e4*(d.utcOffset()-this.utcOffset()),b=K(b),"year"===b||"month"===b||"quarter"===b?(g=cc(this,d),"quarter"===b?g/=3:"year"===b&&(g/=12)):(f=this-d,g="second"===b?f/1e3:"minute"===b?f/6e4:"hour"===b?f/36e5:"day"===b?(f-e)/864e5:"week"===b?(f-e)/6048e5:f),c?g:t(g)):NaN):NaN}function cc(a,b){
// difference in months
var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),
// b is in (anchor - 1 month, anchor + 1 month)
f=a.clone().add(e,"months");
//check for negative zero, return zero if negative zero
// linear across the month
// linear across the month
return b-f<0?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)||0}function dc(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ec(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?z(Date.prototype.toISOString)?this.toDate().toISOString():X(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):X(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}/**
* Return a human readable representation of a moment that can
* also be evaluated to get a new moment which is the same
*
* @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
*/
function fc(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var a="moment",b="";this.isLocal()||(a=0===this.utcOffset()?"moment.utc":"moment.parseZone",b="Z");var c="["+a+'("]',d=0<this.year()&&this.year()<=9999?"YYYY":"YYYYYY",e="-MM-DD[T]HH:mm:ss.SSS",f=b+'[")]';return this.format(c+d+e+f)}function gc(b){b||(b=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var c=X(this,b);return this.localeData().postformat(c)}function hc(a,b){return this.isValid()&&(s(a)&&a.isValid()||sb(a).isValid())?Ob({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function ic(a){return this.from(sb(),a)}function jc(a,b){return this.isValid()&&(s(a)&&a.isValid()||sb(a).isValid())?Ob({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function kc(a){return this.to(sb(),a)}
// If passed a locale key, it will set the locale for this
// instance. Otherwise, it will return the locale configuration
// variables for this instance.
function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}function mc(){return this._locale}function nc(a){
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch(a=K(a)){case"year":this.month(0);/* falls through */
case"quarter":case"month":this.date(1);/* falls through */
case"week":case"isoWeek":case"day":case"date":this.hours(0);/* falls through */
case"hour":this.minutes(0);/* falls through */
case"minute":this.seconds(0);/* falls through */
case"second":this.milliseconds(0)}
// weeks are a special case
// quarters are also special
return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function oc(a){
// 'date' is an alias for 'day', so it should be considered as such.
return a=K(a),void 0===a||"millisecond"===a?this:("date"===a&&(a="day"),this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms"))}function pc(){return this._d.valueOf()-6e4*(this._offset||0)}function qc(){return Math.floor(this.valueOf()/1e3)}function rc(){return new Date(this.valueOf())}function sc(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function tc(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function uc(){
// new Date(NaN).toJSON() === null
return this.isValid()?this.toISOString():null}function vc(){return n(this)}function wc(){return j({},m(this))}function xc(){return m(this).overflow}function yc(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function zc(a,b){U(0,[a,a.length],0,b)}
// MOMENTS
function Ac(a){return Ec.call(this,a,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Bc(a){return Ec.call(this,a,this.isoWeek(),this.isoWeekday(),1,4)}function Cc(){return xa(this.year(),1,4)}function Dc(){var a=this.localeData()._week;return xa(this.year(),a.dow,a.doy)}function Ec(a,b,c,d,e){var f;return null==a?wa(this,d,e).year:(f=xa(a,d,e),b>f&&(b=f),Fc.call(this,a,b,c,d,e))}function Fc(a,b,c,d,e){var f=va(a,b,c,d,e),g=ta(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}
// MOMENTS
function Gc(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}
// HELPERS
// MOMENTS
function Hc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function Ic(a,b){b[ge]=u(1e3*("0."+a))}
// MOMENTS
function Jc(){return this._isUTC?"UTC":""}function Kc(){return this._isUTC?"Coordinated Universal Time":""}function Lc(a){return sb(1e3*a)}function Mc(){return sb.apply(null,arguments).parseZone()}function Nc(a){return a}function Oc(a,b,c,d){var e=bb(),f=k().set(d,b);return e[c](f,a)}function Pc(a,b,c){if(f(a)&&(b=a,a=void 0),a=a||"",null!=b)return Oc(a,b,c,"month");var d,e=[];for(d=0;d<12;d++)e[d]=Oc(a,d,c,"month");return e}
// ()
// (5)
// (fmt, 5)
// (fmt)
// (true)
// (true, 5)
// (true, fmt, 5)
// (true, fmt)
function Qc(a,b,c,d){"boolean"==typeof a?(f(b)&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,f(b)&&(c=b,b=void 0),b=b||"");var e=bb(),g=a?e._week.dow:0;if(null!=c)return Oc(b,(c+g)%7,d,"day");var h,i=[];for(h=0;h<7;h++)i[h]=Oc(b,(h+g)%7,d,"day");return i}function Rc(a,b){return Pc(a,b,"months")}function Sc(a,b){return Pc(a,b,"monthsShort")}function Tc(a,b,c){return Qc(a,b,c,"weekdays")}function Uc(a,b,c){return Qc(a,b,c,"weekdaysShort")}function Vc(a,b,c){return Qc(a,b,c,"weekdaysMin")}function Wc(){var a=this._data;return this._milliseconds=Ze(this._milliseconds),this._days=Ze(this._days),this._months=Ze(this._months),a.milliseconds=Ze(a.milliseconds),a.seconds=Ze(a.seconds),a.minutes=Ze(a.minutes),a.hours=Ze(a.hours),a.months=Ze(a.months),a.years=Ze(a.years),this}function Xc(a,b,c,d){var e=Ob(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}
// supports only 2.0-style add(1, 's') or add(duration)
function Yc(a,b){return Xc(this,a,b,1)}
// supports only 2.0-style subtract(1, 's') or subtract(duration)
function Zc(a,b){return Xc(this,a,b,-1)}function $c(a){return a<0?Math.floor(a):Math.ceil(a)}function _c(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;
// if we have a mix of positive and negative values, bubble down first
// check: https://github.com/moment/moment/issues/2166
// The following code bubbles up values, see the tests for
// examples of what that means.
// convert days to months
// 12 months -> 1 year
return f>=0&&g>=0&&h>=0||f<=0&&g<=0&&h<=0||(f+=864e5*$c(bd(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=t(f/1e3),i.seconds=a%60,b=t(a/60),i.minutes=b%60,c=t(b/60),i.hours=c%24,g+=t(c/24),e=t(ad(g)),h+=e,g-=$c(bd(e)),d=t(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function ad(a){
// 400 years have 146097 days (taking into account leap year rules)
// 400 years have 12 months === 4800
return 4800*a/146097}function bd(a){
// the reverse of daysToMonths
return 146097*a/4800}function cd(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+ad(b),"month"===a?c:c/12;switch(
// handle milliseconds separately because of floating point math errors (issue #1867)
b=this._days+Math.round(bd(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;
// Math.floor prevents floating point math errors here
case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}
// TODO: Use this.as('ms')?
function dd(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*u(this._months/12)}function ed(a){return function(){return this.as(a)}}function fd(a){return a=K(a),this[a+"s"]()}function gd(a){return function(){return this._data[a]}}function hd(){return t(this.days()/7)}
// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function id(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function jd(a,b,c){var d=Ob(a).abs(),e=of(d.as("s")),f=of(d.as("m")),g=of(d.as("h")),h=of(d.as("d")),i=of(d.as("M")),j=of(d.as("y")),k=e<pf.s&&["s",e]||f<=1&&["m"]||f<pf.m&&["mm",f]||g<=1&&["h"]||g<pf.h&&["hh",g]||h<=1&&["d"]||h<pf.d&&["dd",h]||i<=1&&["M"]||i<pf.M&&["MM",i]||j<=1&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,id.apply(null,k)}
// This function allows you to set the rounding function for relative time strings
function kd(a){return void 0===a?of:"function"==typeof a&&(of=a,!0)}
// This function allows you to set a threshold for relative time strings
function ld(a,b){return void 0!==pf[a]&&(void 0===b?pf[a]:(pf[a]=b,!0))}function md(a){var b=this.localeData(),c=jd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function nd(){
// for ISO strings we do not use the normal bubbling rules:
// * milliseconds bubble up until they become hours
// * days do not bubble at all
// * months bubble up until they become years
// This is because there is no context-free conversion between hours and days
// (think of clock changes)
// and also not between days and months (28-31 days per month)
var a,b,c,d=qf(this._milliseconds)/1e3,e=qf(this._days),f=qf(this._months);
// 3600 seconds -> 60 minutes -> 1 hour
a=t(d/60),b=t(a/60),d%=60,a%=60,
// 12 months -> 1 year
c=t(f/12),f%=12;
// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(m<0?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var od,pd;pd=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;d<c;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};var qd=pd,rd=a.momentProperties=[],sd=!1,td={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var ud;ud=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)i(a,b)&&c.push(b);return c};var vd,wd=ud,xd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},yd={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},zd="Invalid date",Ad="%d",Bd=/\d{1,2}/,Cd={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Dd={},Ed={},Fd=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Gd=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Hd={},Id={},Jd=/\d/,Kd=/\d\d/,Ld=/\d{3}/,Md=/\d{4}/,Nd=/[+-]?\d{6}/,Od=/\d\d?/,Pd=/\d\d\d\d?/,Qd=/\d\d\d\d\d\d?/,Rd=/\d{1,3}/,Sd=/\d{1,4}/,Td=/[+-]?\d{1,6}/,Ud=/\d+/,Vd=/[+-]?\d+/,Wd=/Z|[+-]\d\d:?\d\d/gi,Xd=/Z|[+-]\d\d(?::?\d\d)?/gi,Yd=/[+-]?\d+(\.\d{1,3})?/,Zd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,$d={},_d={},ae=0,be=1,ce=2,de=3,ee=4,fe=5,ge=6,he=7,ie=8;vd=Array.prototype.indexOf?Array.prototype.indexOf:function(a){
// I know
var b;for(b=0;b<this.length;++b)if(this[b]===a)return b;return-1};var je=vd;
// FORMATTING
U("M",["MM",2],"Mo",function(){return this.month()+1}),U("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),U("MMMM",0,0,function(a){return this.localeData().months(this,a)}),
// ALIASES
J("month","M"),
// PRIORITY
M("month",8),
// PARSING
Z("M",Od),Z("MM",Od,Kd),Z("MMM",function(a,b){return b.monthsShortRegex(a)}),Z("MMMM",function(a,b){return b.monthsRegex(a)}),ba(["M","MM"],function(a,b){b[be]=u(a)-1}),ba(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);
// if we didn't find a month name, mark the date as invalid.
null!=e?b[be]=e:m(c).invalidMonth=a});
// LOCALES
var ke=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,le="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),me="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),ne=Zd,oe=Zd;
// FORMATTING
U("Y",0,0,function(){var a=this.year();return a<=9999?""+a:"+"+a}),U(0,["YY",2],0,function(){return this.year()%100}),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,!0],0,"year"),
// ALIASES
J("year","y"),
// PRIORITIES
M("year",1),
// PARSING
Z("Y",Vd),Z("YY",Od,Kd),Z("YYYY",Sd,Md),Z("YYYYY",Td,Nd),Z("YYYYYY",Td,Nd),ba(["YYYYY","YYYYYY"],ae),ba("YYYY",function(b,c){c[ae]=2===b.length?a.parseTwoDigitYear(b):u(b)}),ba("YY",function(b,c){c[ae]=a.parseTwoDigitYear(b)}),ba("Y",function(a,b){b[ae]=parseInt(a,10)}),
// HOOKS
a.parseTwoDigitYear=function(a){return u(a)+(u(a)>68?1900:2e3)};
// MOMENTS
var pe=O("FullYear",!0);
// FORMATTING
U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),
// ALIASES
J("week","w"),J("isoWeek","W"),
// PRIORITIES
M("week",5),M("isoWeek",5),
// PARSING
Z("w",Od),Z("ww",Od,Kd),Z("W",Od),Z("WW",Od,Kd),ca(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=u(a)});var qe={dow:0,// Sunday is the first day of the week.
doy:6};
// FORMATTING
U("d",0,"do","day"),U("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),U("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),U("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),
// ALIASES
J("day","d"),J("weekday","e"),J("isoWeekday","E"),
// PRIORITY
M("day",11),M("weekday",11),M("isoWeekday",11),
// PARSING
Z("d",Od),Z("e",Od),Z("E",Od),Z("dd",function(a,b){return b.weekdaysMinRegex(a)}),Z("ddd",function(a,b){return b.weekdaysShortRegex(a)}),Z("dddd",function(a,b){return b.weekdaysRegex(a)}),ca(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);
// if we didn't get a weekday name, mark the date as invalid
null!=e?b.d=e:m(c).invalidWeekday=a}),ca(["d","e","E"],function(a,b,c,d){b[d]=u(a)});
// LOCALES
var re="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),se="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),te="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ue=Zd,ve=Zd,we=Zd;U("H",["HH",2],0,"hour"),U("h",["hh",2],0,Ra),U("k",["kk",2],0,Sa),U("hmm",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)}),U("hmmss",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ta("a",!0),Ta("A",!1),
// ALIASES
J("hour","h"),
// PRIORITY
M("hour",13),Z("a",Ua),Z("A",Ua),Z("H",Od),Z("h",Od),Z("HH",Od,Kd),Z("hh",Od,Kd),Z("hmm",Pd),Z("hmmss",Qd),Z("Hmm",Pd),Z("Hmmss",Qd),ba(["H","HH"],de),ba(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),ba(["h","hh"],function(a,b,c){b[de]=u(a),m(c).bigHour=!0}),ba("hmm",function(a,b,c){var d=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d)),m(c).bigHour=!0}),ba("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d,2)),b[fe]=u(a.substr(e)),m(c).bigHour=!0}),ba("Hmm",function(a,b,c){var d=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d))}),ba("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d,2)),b[fe]=u(a.substr(e))});var xe,ye=/[ap]\.?m?\.?/i,ze=O("Hours",!0),Ae={calendar:xd,longDateFormat:yd,invalidDate:zd,ordinal:Ad,ordinalParse:Bd,relativeTime:Cd,months:le,monthsShort:me,week:qe,weekdays:re,weekdaysMin:te,weekdaysShort:se,meridiemParse:ye},Be={},Ce={},De=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ee=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Fe=/Z|[+-]\d\d(?::?\d\d)?/,Ge=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],
// YYYYMM is NOT allowed by the standard
["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],He=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ie=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=x("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),
// constant that refers to the ISO standard
a.ISO_8601=function(){};var Je=x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=sb.apply(null,arguments);return this.isValid()&&a.isValid()?a<this?this:a:o()}),Ke=x("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=sb.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:o()}),Le=function(){return Date.now?Date.now():+new Date};zb("Z",":"),zb("ZZ",""),
// PARSING
Z("Z",Xd),Z("ZZ",Xd),ba(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ab(Xd,a)});
// HELPERS
// timezone chunker
// '+10:00' > ['10', '00']
// '-1530' > ['-15', '30']
var Me=/([\+\-]|\d\d)/gi;
// HOOKS
// This function will be called whenever a moment is mutated.
// It is intended to keep the offset in sync with the timezone.
a.updateOffset=function(){};
// ASP.NET json date format regex
var Ne=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Oe=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Ob.fn=wb.prototype;var Pe=Sb(1,"add"),Qe=Sb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Re=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});
// FORMATTING
U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100}),zc("gggg","weekYear"),zc("ggggg","weekYear"),zc("GGGG","isoWeekYear"),zc("GGGGG","isoWeekYear"),
// ALIASES
J("weekYear","gg"),J("isoWeekYear","GG"),
// PRIORITY
M("weekYear",1),M("isoWeekYear",1),
// PARSING
Z("G",Vd),Z("g",Vd),Z("GG",Od,Kd),Z("gg",Od,Kd),Z("GGGG",Sd,Md),Z("gggg",Sd,Md),Z("GGGGG",Td,Nd),Z("ggggg",Td,Nd),ca(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=u(a)}),ca(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),
// FORMATTING
U("Q",0,"Qo","quarter"),
// ALIASES
J("quarter","Q"),
// PRIORITY
M("quarter",7),
// PARSING
Z("Q",Jd),ba("Q",function(a,b){b[be]=3*(u(a)-1)}),
// FORMATTING
U("D",["DD",2],"Do","date"),
// ALIASES
J("date","D"),
// PRIOROITY
M("date",9),
// PARSING
Z("D",Od),Z("DD",Od,Kd),Z("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),ba(["D","DD"],ce),ba("Do",function(a,b){b[ce]=u(a.match(Od)[0],10)});
// MOMENTS
var Se=O("Date",!0);
// FORMATTING
U("DDD",["DDDD",3],"DDDo","dayOfYear"),
// ALIASES
J("dayOfYear","DDD"),
// PRIORITY
M("dayOfYear",4),
// PARSING
Z("DDD",Rd),Z("DDDD",Ld),ba(["DDD","DDDD"],function(a,b,c){c._dayOfYear=u(a)}),
// FORMATTING
U("m",["mm",2],0,"minute"),
// ALIASES
J("minute","m"),
// PRIORITY
M("minute",14),
// PARSING
Z("m",Od),Z("mm",Od,Kd),ba(["m","mm"],ee);
// MOMENTS
var Te=O("Minutes",!1);
// FORMATTING
U("s",["ss",2],0,"second"),
// ALIASES
J("second","s"),
// PRIORITY
M("second",15),
// PARSING
Z("s",Od),Z("ss",Od,Kd),ba(["s","ss"],fe);
// MOMENTS
var Ue=O("Seconds",!1);
// FORMATTING
U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return 10*this.millisecond()}),U(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),U(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),U(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),U(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),U(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),
// ALIASES
J("millisecond","ms"),
// PRIORITY
M("millisecond",16),
// PARSING
Z("S",Rd,Jd),Z("SS",Rd,Kd),Z("SSS",Rd,Ld);var Ve;for(Ve="SSSS";Ve.length<=9;Ve+="S")Z(Ve,Ud);for(Ve="S";Ve.length<=9;Ve+="S")ba(Ve,Ic);
// MOMENTS
var We=O("Milliseconds",!1);
// FORMATTING
U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var Xe=r.prototype;Xe.add=Pe,Xe.calendar=Vb,Xe.clone=Wb,Xe.diff=bc,Xe.endOf=oc,Xe.format=gc,Xe.from=hc,Xe.fromNow=ic,Xe.to=jc,Xe.toNow=kc,Xe.get=R,Xe.invalidAt=xc,Xe.isAfter=Xb,Xe.isBefore=Yb,Xe.isBetween=Zb,Xe.isSame=$b,Xe.isSameOrAfter=_b,Xe.isSameOrBefore=ac,Xe.isValid=vc,Xe.lang=Re,Xe.locale=lc,Xe.localeData=mc,Xe.max=Ke,Xe.min=Je,Xe.parsingFlags=wc,Xe.set=S,Xe.startOf=nc,Xe.subtract=Qe,Xe.toArray=sc,Xe.toObject=tc,Xe.toDate=rc,Xe.toISOString=ec,Xe.inspect=fc,Xe.toJSON=uc,Xe.toString=dc,Xe.unix=qc,Xe.valueOf=pc,Xe.creationData=yc,
// Year
Xe.year=pe,Xe.isLeapYear=ra,
// Week Year
Xe.weekYear=Ac,Xe.isoWeekYear=Bc,
// Quarter
Xe.quarter=Xe.quarters=Gc,
// Month
Xe.month=ka,Xe.daysInMonth=la,
// Week
Xe.week=Xe.weeks=Ba,Xe.isoWeek=Xe.isoWeeks=Ca,Xe.weeksInYear=Dc,Xe.isoWeeksInYear=Cc,
// Day
Xe.date=Se,Xe.day=Xe.days=Ka,Xe.weekday=La,Xe.isoWeekday=Ma,Xe.dayOfYear=Hc,
// Hour
Xe.hour=Xe.hours=ze,
// Minute
Xe.minute=Xe.minutes=Te,
// Second
Xe.second=Xe.seconds=Ue,
// Millisecond
Xe.millisecond=Xe.milliseconds=We,
// Offset
Xe.utcOffset=Db,Xe.utc=Fb,Xe.local=Gb,Xe.parseZone=Hb,Xe.hasAlignedHourOffset=Ib,Xe.isDST=Jb,Xe.isLocal=Lb,Xe.isUtcOffset=Mb,Xe.isUtc=Nb,Xe.isUTC=Nb,
// Timezone
Xe.zoneAbbr=Jc,Xe.zoneName=Kc,
// Deprecations
Xe.dates=x("dates accessor is deprecated. Use date instead.",Se),Xe.months=x("months accessor is deprecated. Use month instead",ka),Xe.years=x("years accessor is deprecated. Use year instead",pe),Xe.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Eb),Xe.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Kb);var Ye=C.prototype;Ye.calendar=D,Ye.longDateFormat=E,Ye.invalidDate=F,Ye.ordinal=G,Ye.preparse=Nc,Ye.postformat=Nc,Ye.relativeTime=H,Ye.pastFuture=I,Ye.set=A,
// Month
Ye.months=fa,Ye.monthsShort=ga,Ye.monthsParse=ia,Ye.monthsRegex=na,Ye.monthsShortRegex=ma,
// Week
Ye.week=ya,Ye.firstDayOfYear=Aa,Ye.firstDayOfWeek=za,
// Day of Week
Ye.weekdays=Fa,Ye.weekdaysMin=Ha,Ye.weekdaysShort=Ga,Ye.weekdaysParse=Ja,Ye.weekdaysRegex=Na,Ye.weekdaysShortRegex=Oa,Ye.weekdaysMinRegex=Pa,
// Hours
Ye.isPM=Va,Ye.meridiem=Wa,$a("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===u(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),
// Side effect imports
a.lang=x("moment.lang is deprecated. Use moment.locale instead.",$a),a.langData=x("moment.langData is deprecated. Use moment.localeData instead.",bb);var Ze=Math.abs,$e=ed("ms"),_e=ed("s"),af=ed("m"),bf=ed("h"),cf=ed("d"),df=ed("w"),ef=ed("M"),ff=ed("y"),gf=gd("milliseconds"),hf=gd("seconds"),jf=gd("minutes"),kf=gd("hours"),lf=gd("days"),mf=gd("months"),nf=gd("years"),of=Math.round,pf={s:45,// seconds to minute
m:45,// minutes to hour
h:22,// hours to day
d:26,// days to month
M:11},qf=Math.abs,rf=wb.prototype;
// Deprecations
// Side effect imports
// FORMATTING
// PARSING
// Side effect imports
return rf.abs=Wc,rf.add=Yc,rf.subtract=Zc,rf.as=cd,rf.asMilliseconds=$e,rf.asSeconds=_e,rf.asMinutes=af,rf.asHours=bf,rf.asDays=cf,rf.asWeeks=df,rf.asMonths=ef,rf.asYears=ff,rf.valueOf=dd,rf._bubble=_c,rf.get=fd,rf.milliseconds=gf,rf.seconds=hf,rf.minutes=jf,rf.hours=kf,rf.days=lf,rf.weeks=hd,rf.months=mf,rf.years=nf,rf.humanize=md,rf.toISOString=nd,rf.toString=nd,rf.toJSON=nd,rf.locale=lc,rf.localeData=mc,rf.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",nd),rf.lang=Re,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Z("x",Vd),Z("X",Yd),ba("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),ba("x",function(a,b,c){c._d=new Date(u(a))}),a.version="2.17.1",b(sb),a.fn=Xe,a.min=ub,a.max=vb,a.now=Le,a.utc=k,a.unix=Lc,a.months=Rc,a.isDate=g,a.locale=$a,a.invalid=o,a.duration=Ob,a.isMoment=s,a.weekdays=Tc,a.parseZone=Mc,a.localeData=bb,a.isDuration=xb,a.monthsShort=Sc,a.weekdaysMin=Vc,a.defineLocale=_a,a.updateLocale=ab,a.locales=cb,a.weekdaysShort=Uc,a.normalizeUnits=K,a.relativeTimeRounding=kd,a.relativeTimeThreshold=ld,a.calendarFormat=Ub,a.prototype=Xe,a});

View File

@@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="hotel_calendar.HotelCalendarManagementView">
<div class="col-xs-12 col-lg-12 nopadding">
<div class="col-xs-12 col-lg-12 nopadding">
<div class="col-xs-12 col-lg-12" id="mpms-search">
<table class="col-xs-12 col-lg-12 nopadding" id="pms-search-table">
<tbody>
<tr>
<td class="col-xs-1 col-lg-1">
<button class="btn col-xs-12 col-lg-12" id="btn_save_changes" title="Save Changes">
<i class="fa fa-save fa-stack-2x"> </i>
</button>
</td>
<td class="col-xs-2 col-lg-2">
<select class="list form-control" id="price_list"/>
<select class="list form-control" id="restriction_list"/>
</td>
<td class="col-xs-4 col-lg-4">
<table style="margin: 0 auto">
<tbody>
<tr>
<td>
<span class="filter-title">FROM</span>
<div class="input-group date" id="date_begin">
<input type="text" class="o_datepicker_input form-control" name="date_begin" required="required" />
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
</td>
<td>
<span class="filter-title">RANGE</span>
<div class="input-group date">
<input id="date_end_days" required="required" class="form-control" />
</div>
<!-- <span class="filter-title">TO</span><br/>-->
<!-- <div class="input-group date" id="date_end">-->
<!-- <input type="text" class="o_datepicker_input form-control" name="date_end" required="required" />-->
<!-- <span class="input-group-addon">-->
<!-- <span class="fa fa-calendar"></span>-->
<!-- </span>-->
<!-- </div>-->
</td>
</tr>
</tbody>
</table>
</td>
<td class="col-xs-1 col-lg-1">
<strong class="filter-title">View Mode:</strong>
<select class="list form-control" id="mode_list">
<option value="all">All</option>
<option value="medium">Medium</option>
<option value="low">Low</option>
</select>
</td>
<td class="col-xs-2 col-lg-2" id="pms-search-cal-pag">
<button id="cal-pag-prev-plus" class="btn btn-sm"><i class="fa fa-2x fa-angle-double-left"></i></button>
<button id="cal-pag-prev" class="btn btn-sm"><i class="fa fa-2x fa-angle-left"></i></button>
<button id="cal-pag-selector" class="btn btn-sm"><i class="fa fa-2x fa-calendar"></i></button>
<button id="cal-pag-next" class="btn btn-sm"><i class="fa fa-2x fa-angle-right"></i></button>
<button id="cal-pag-next-plus" class="btn btn-sm"><i class="fa fa-2x fa-angle-double-right"></i></button>
</td>
<td class="col-xs-1 col-lg-1">
<button class="btn btn-default col-xs-12 col-lg-12" id="btn_massive_changes" title="Launch Massive Changes">
<i class="fa fa-bolt fa-stack-2x"> </i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<div id="hcal_management_widget" class="col-xs-12 col-lg-12 nopadding"></div>
<div style="clear:both;" />
</div>
</div>
</t>
</templates>

View File

@@ -1,378 +0,0 @@
<template>
<t t-name="HotelCalendar.ConfirmReservationChanges">
<div class="content">
<p>The following changes will be made...</p>
<p t-if="hasReservsLinked" style="color:red">This reservation belongs to a folio with more reservations!</p>
<div class="row">
<div class="col-xl-6 col-lg-6">
<strong>Reserve unchanged:</strong>
<div class="well well-small">
<t t-if="ocheckin != ncheckin">
<strong>Checkin:</strong> <t t-esc="ocheckin"/><br/>
</t>
<t t-if="ocheckout != ncheckout">
<strong>Checkout:</strong> <t t-esc="ocheckout"/><br/>
</t>
<t t-if="oroom != nroom">
<strong>Room:</strong> <t t-esc="oroom"/><br/>
</t>
<t t-if="oadults != nadults">
<strong>Adults:</strong> <t t-esc="oadults"/><br/>
</t>
<!--
<t t-if="oprice != nprice">
<strong>Price:</strong> <t t-esc="oprice" widget="monetary"/><br/>
</t>
-->
</div>
</div>
<div class="col-xl-6 col-lg-6">
<strong>Reserve changed:</strong>
<div class="well well-small">
<t t-if="ocheckin != ncheckin">
<strong>Checkin:</strong> <t t-esc="ncheckin"/><br/>
</t>
<t t-if="ocheckout != ncheckout">
<strong>Checkout:</strong> <t t-esc="ncheckout"/><br/>
</t>
<t t-if="oroom != nroom">
<strong>Room:</strong> <t t-esc="nroom"/><br/>
</t>
<t t-if="oadults != nadults">
<strong>Adults:</strong> <t t-esc="nadults"/><br/>
</t>
<!--
<t t-if="oprice != nprice">
<strong>Price:</strong> <t t-esc="nprice" widget="monetary"/><br/>
</t>
-->
</div>
</div>
</div>
<p>Are you sure you want to make this changes?</p>
</div>
</t>
<t t-name="HotelCalendar.ConfirmPriceChange">
<div class="content">
<p>Are you sure you want to change these prices?</p>
</div>
</t>
<t t-name="HotelCalendar.ConfirmSwapOperation">
<div class="content">
<p>The following changes will be made...</p>
<span><strong>Swap Reservations</strong></span><br/>
<p>Are you sure you want to make this changes?</p>
</div>
</t>
<t t-name="HotelCalendar.InvalidSwapOperation">
<div class="content">
<p>Invalid Swap Operation, can't make this movement :/</p>
</div>
</t>
<t t-name="HotelCalendar.ConfirmSplitOperation">
<div class="content">
<p>The following changes will be made...</p>
<span><strong>Split Reservation</strong></span><br/>
<p>Are you sure you want to make this changes?</p>
</div>
</t>
<t t-name="HotelCalendar.ConfirmUnifyOperation">
<div class="content">
<p>The following changes will be made...</p>
<span><strong>Unify Reservations</strong></span><br/>
<p>Are you sure you want to make this changes?</p>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation.Channel.ota">
<div id="channel_info"></div>
</t>
<t t-name="HotelCalendar.TooltipReservation.Channel.direct">
<div class="row row-eq-height">
<div class="col-sm-12 col-xs-12 bg-gray-light">
Sales Channel: <b class="mt-10"><t t-esc="channel_type"/></b>
</div>
</div>
<div class="row row-eq-height">
<div class="col-sm-12 col-xs-12 bg-gray-light">
<t t-if="channel_type =='call'">
TODO: add call center information
</t>
</div>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation.Customer">
<div class="row row-eq-height">
<div class="col-sm-6 col-xs-6 bg-gray-light">
<i class="fa fa-user-circle fa-2x fa-pull-left mt-5"/>
<header><t t-esc="name"/></header>
<p><t t-esc="phone"/></p>
<p class="email"><t t-esc="email"/></p>
</div>
<div class="col-sm-6 col-xs-6 bg-gray-lighter">
<i class="fa fa-hotel fa-2_5x fa-pull-left mt-5 text-gray-dark"/>
<header class="mt-5"><t t-esc="room_type_name"/></header>
<p><t t-esc="board_service_name"/></p>
<span class="circle pull-left" id="price_room">
<t t-if="!splitted">
<t t-esc="price_room_services_set" t-widget="monetary"/>
</t>
<t t-else="">
<i class="fa fa-chain-broken fa-1_5x pt-9"/>
</t>
</span>
<p>Adults: <t t-esc="adults"/></p>
<p class="children">Children: <t t-esc="children"/></p>
</div>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation.Sale">
<div class="row row-eq-height mt-3">
<div id="folio_pending_amount"
t-attf-class="col-sm-6 col-xs-6 bg-gray-light pb-3 pr-0 diagonal {{pending_amount gt 0 ? 'diagonal_pending_amount':''}}">
<div class="on-top">
<div class="pull-left">
<p>Folio Pending</p>
<t t-if="pending_amount.length > '6'">
<h3 t-attf-style="font-size:calc(22px - #{pending_amount.length}px)"><t t-esc="pending_amount" t-widget="monetary"/></h3> <!-- FIXME: HARD CURRENCY -->
</t>
<t t-else="">
<h3><t t-esc="pending_amount" t-widget="monetary"/></h3> <!-- FIXME: HARD CURRENCY -->
</t>
</div>
<div class="pull-right-custom">
<t t-if="invoices_paid.length > '6'">
<h3 t-attf-style="font-size:calc(22px - #{invoices_paid.length}px)"><t t-esc="invoices_paid" t-widget="monetary"/></h3> <!-- FIXME: HARD CURRENCY -->
</t>
<t t-else="">
<h3><t t-esc="invoices_paid" t-widget="monetary"/></h3> <!-- FIXME: HARD CURRENCY -->
</t>
<p>Total Paid</p>
</div>
</div>
</div>
<div class="col-sm-6 col-xs-6 bg-gray-light">
<t t-if="channel_type == 'web'">
<t t-call="HotelCalendar.TooltipReservation.Channel.ota"/>
</t>
<t t-else="">
<t t-call="HotelCalendar.TooltipReservation.Channel.direct"/>
</t>
</div>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation.Dates">
<div class="row row-eq-height mt-3">
<div class="col-sm-12 col-xs-12 triangle-right">
<div class="col-sm-6 col-xs-6 px-0">
<i class="fa fa-sign-in fa-2x fa-pull-left pl-5 py-5"/>
<h3><t t-esc="checkin"/></h3>
<p><t t-esc="checkin_day_of_week"/> <t t-esc="arrival_hour"/></p>
</div>
<div class="col-sm-6 col-xs-6 text-gray-dark">
<i class="fa fa-sign-out fa-2x fa-pull-left pl-5 py-5"/>
<h3><t t-esc="checkout"/></h3>
<p><t t-esc="checkout_day_of_week"/> <t t-esc="departure_hour"/></p>
</div>
</div>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation.Footer">
<div class="row row-eq-height mt-10">
<div class="col-sm-4 btn_popover_open_folio pr-0">
<i class="fa fa-file-text-o fa-2x fa-pull-left" role="button"
title="View Folio Details"> <span class="fa-text-inside"><t t-esc="folio_name"/></span></i>
</div>
<div class="col-sm-2 btn_popover_open_reservation">
<span class="fa fa-suitcase fa-2x" role="button"
title="View Reservation Details" />
</div>
<div class="col-sm-2 btn_popover_open_checkin">
<span class="fa fa-user-plus fa-2x" role="button"
title="Checkin" />
</div>
<div class="col-sm-2">
<span class="fa fa-envelope fa-2x" role="button"
title="Send Reservation Email" />
</div>
<div class="col-sm-2 btn_popover_open_payment_folio" data-toggle="collapse" data-target="#payment_reservation">
<span class="fa fa-money fa-2x" role="button"
title="Folio Payments" id="payment_folio" />
<span class="fa fa-money fa-2x collapse btn_popover_open_payment_reservation" role="button"
title="Reservation Payments" id="payment_reservation" />
</div>
<t t-if="reservation_type =='normal'">
<div class="col-sm-2 btn_popover_open_invoice">
<span class="fa fa-pencil-square-o fa-2x" role="button"
title="Invoice Folio" />
</div>
</t>
</div>
<div class="row row-eq-height mt-10">
<div class="col-sm-12">
<t t-if="services">
<t t-foreach='services' t-as='ps'>
<i class="fa fa-exclamation-circle"/> <t t-esc='ps'/>
</t>
</t>
<t t-if="splitted">
<p><i class="fa fa-exclamation-circle"/> This reservation is part of splitted reservation.</p>
</t>
</div>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation.normal">
<div class="container">
<t t-call="HotelCalendar.TooltipReservation.Customer"/>
<t t-call="HotelCalendar.TooltipReservation.Sale"/>
<t t-call="HotelCalendar.TooltipReservation.Dates"/>
<t t-call="HotelCalendar.TooltipReservation.Footer"/>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation.staff">
<div class="container">
<div class="row row-eq-height">
<div class="col-sm-6 col-xs-6 bg-danger">
<i class="fa fa-black-tie fa-2x fa-pull-left mt-5"/>
<header><t t-esc="name"/></header>
<p><t t-esc="phone"/></p>
<p class="email"><t t-esc="email"/></p>
</div>
<div class="col-sm-6 col-xs-6 bg-gray-lighter">
<i class="fa fa-hotel fa-2_5x fa-pull-left mt-5"/>
<header class="mt-5"><t t-esc="room_type_name"/></header>
<p><t t-esc="board_service_name"/></p>
<p>Adults: <t t-esc="adults"/></p>
<p class="children">Children: <t t-esc="children"/></p>
</div>
</div>
<t t-call="HotelCalendar.TooltipReservation.Dates"/>
<t t-call="HotelCalendar.TooltipReservation.Footer"/>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation.out">
<div class="container">
<div class="row row-eq-height">
<div class="col-sm-6 col-xs-6 bg-gray-lighter">
<i class="fa fa-ban fa-2x fa-pull-left"/>
<header><t t-esc="name"/></header>
<p><t t-esc="out_service_description"/></p>
</div>
<div class="col-sm-6 col-xs-6 bg-gray-light">
<i class="fa fa-hotel fa-2x fa-pull-left"/>
<header><t t-esc="room_type_name"/></header>
<p><t t-esc="closure_reason"/></p>
</div>
</div>
<t t-call="HotelCalendar.TooltipReservation.Dates"/>
<div class="row row-eq-height my-10">
<div class="col-sm-4 btn_popover_open_folio">
<i class="fa fa-file-text-o fa-2x fa-pull-left" role="button"
title="View Folio Details"> <span class="fa-text-inside"><t t-esc="folio_name"/></span></i>
</div>
<div class="col-sm-2 btn_popover_open_reservation">
<span class="fa fa-suitcase fa-2x" role="button"
title="View Reservation Details" />
</div>
</div>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation">
<t t-call="HotelCalendar.TooltipReservation.#{ reservation_type }"/>
</t>
<t t-name="HotelCalendar.TooltipRoom">
<div class="oe_tooltip_string"><t t-esc="name"/></div>
<p><b>Room Type:</b> <t t-esc="room_type_name"/></p>
</t>
<t t-name="HotelCalendar.TooltipEvent">
<div class="oe_tooltip_string"><t t-esc="date"/></div>
<ul>
<li t-foreach="events" t-as="event">
<t t-esc="event.name"/>
</li>
</ul>
</t>
<t t-name="HotelCalendar.TooltipRoomOverbooking">
<div class="oe_tooltip_string"><t t-esc="name"/></div>
<p><b>Overbooking Management</b></p>
</t>
<t t-name="HotelCalendar.TooltipSelection">
<!-- FIXME: HARD CURRENCY -->
<span><b t-esc="nights"/> Nights: <b t-esc="total_price" t-widget="monetary"/></span>
</t>
<t t-name="HotelCalendar.TooltipRestriction">
<ul class="oe_tooltip_technical">
<li><b>Min. Stay:</b> <t t-esc="min_stay"/></li>
<li><b>Max. Stay:</b> <t t-esc="max_stay"/></li>
<li><b>Max. Stay Arrival:</b> <t t-esc="max_stay_arrival"/></li>
<li><b>Closed:</b> <t t-esc="closed"/></li>
<li><b>Closed Arrival:</b> <t t-esc="closed_arrival"/></li>
<li><b>Closed Departure:</b> <t t-esc="closed_departure"/></li>
</ul>
</t>
<t t-name="HotelCalendar.ConfirmFolio">
<div class="content">
<p>Do you want to confirm this folio?</p>
</div>
</t>
<t t-name="HotelCalendar.Notification">
<ul>
<li><b>Name:</b> <t t-esc="partner_name"/></li>
<li><b>Room:</b> <t t-esc="room_name"/></li>
<li><b>Check-In:</b> <t t-esc="checkin"/></li>
<li><b>Check-Out:</b> <t t-esc="checkout"/></li>
<li><b>Made by:</b> <t t-esc="username"/></li>
</ul>
</t>
<t t-name="HotelCalendarManagement.UnsavedChanges">
<div class="content">
<p>Have unsaved changes!</p>
<p>Do you want to save these changes?</p>
</div>
</t>
<t t-name="HotelCalendar.SettingsMenu">
<li class="o_calendar_settings">
<a href="#" title="Calendar Settings" class="dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-calendar"/>
</a>
<ul class="dropdown-menu o_calendar_settings_dropdown" role="menu"/>
</li>
</t>
<t t-name="HotelCalendar.SettingsMenu.Global">
<li><a href="#" data-action="toggle_show_notification"><span t-if="manager._show_notifications" class="fa fa-check"/> Show Notifications</a></li>
<li><a href="#" data-action="toggle_show_pricelist"><span t-if="manager._show_pricelist" class="fa fa-check"/> Show Pricelist</a></li>
<li><a href="#" data-action="toggle_show_availability"><span t-if="manager._show_availability" class="fa fa-check"/> Show Availability</a></li>
</t>
</template>

View File

@@ -1,146 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="hotel_calendar.HotelCalendarView">
<div class="col-xs-12 col-md-12 nopadding o_hotel_calendar_view">
<div class="col-lg-2 hidden-xs hidden-sm" id="pms-menu">
<div class="row nopadding menu-date-box">
<div class="form-group nopadding col-xs-8 col-md-8">
<div class="input-group date" id="date_begin">
<input type="text" class="o_datepicker_input form-control" name="date_begin" required="required"/>
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
<div class="form-group nopadding col-xs-4 col-md-4">
<input id="date_end_days" required="required" class="pull-right" />
</div>
</div>
<div class="col-xs-12 col-md-12 nopadding menu-button-box">
<div class="col-xs-6 col-md-6" id="btn_action_checkout">
<button class="btn btn-default col-xs-12 col-md-12 button-box" data-action="hotel_calendar.hotel_reservation_action_checkout">
<i class="fa fa-fw o_button_icon fa-sign-out"> </i>
<div class="o_button_text">
<span class="ninfo">0</span><br/>
<span class="text-hidden-xs">Checkouts</span>
</div>
</button>
</div>
<div class="col-xs-6 col-md-6" id="btn_action_checkin">
<button class="btn btn-default col-xs-12 col-md-12 button-box" data-action="hotel_calendar.hotel_reservation_action_checkin">
<i class="fa fa-fw o_button_icon fa-sign-in"> </i>
<div class="o_button_text">
<span class="ninfo">0</span><br/>
<span class="text-hidden-xs">Checkins</span>
</div>
</button>
</div>
<div class="col-xs-6 col-md-6" id="btn_swap">
<button class="btn btn-default col-xs-12 col-md-12 button-box">
<div class='led led-disabled'></div>
<i class="fa fa-fw o_button_icon fa-retweet"> </i>
<div class="o_button_text">
<span class="text-hidden-xs ntext">Start Swap</span>
</div>
</button>
</div>
<div class="col-xs-6 col-md-6" id="btn_action_control">
<button class="btn btn-default col-xs-12 col-md-12 button-box" data-action="hotel.open_wizard_reservations">
<i class="fa fa-fw o_button_icon fa-magic"> </i>
<div class="o_button_text">
<span class="text-hidden-xs">Wizard</span>
</div>
</button>
</div>
<div class="col-xs-6 col-md-6" id="btn_action_overbooking">
<button class="btn btn-default col-xs-12 col-md-12 button-box">
<div class='led led-disabled'></div>
<i class="fa fa-fw o_button_icon fa-clock-o"> </i>
<div class="o_button_text">
<span class="ninfo">0</span><br/>
<span class="text-hidden-xs">Overbook.</span>
</div>
</button>
</div>
<div class="col-xs-6 col-md-6" id="btn_action_cancelled">
<button class="btn btn-default col-xs-12 col-md-12 button-box">
<div class='led led-disabled'></div>
<i class="fa fa-fw o_button_icon fa-calendar-times-o"> </i>
<div class="o_button_text">
<span class="ninfo">0</span><br/>
<span class="text-hidden-xs">Cancelled</span>
</div>
</button>
</div>
<div class="col-xs-6 col-md-6" id="btn_action_divide">
<button class="btn btn-default col-xs-12 col-md-12 button-box">
<div class='led led-disabled'></div>
<i class="fa fa-fw o_button_icon fa-scissors"> </i>
<div class="o_button_text">
<span class="text-hidden-xs">Divide</span>
</div>
</button>
</div>
<div class="col-xs-6 col-md-6" id="btn_action_unify">
<button class="btn btn-default col-xs-12 col-md-12 button-box">
<div class='led led-disabled'></div>
<i class="fa fa-fw o_button_icon fa-compress"> </i>
<div class="o_button_text">
<span class="text-hidden-xs">Unify</span>
</div>
</button>
</div>
</div>
<div class="col-xs-12 col-md-12 nopadding menu-search-box">
<div class="input-group">
<input type="edit" id="bookings_search" placeholder="Name, Mail, Vat, Book..." class="form-control extra-search" />
<span class="input-group-addon bg-primary">
<span class="fa fa-search"></span>
</span>
</div>
<button class="btn btn-primary col-xs-6 col-md-6" id="btn_action_bookings">
Books
</button>
<button class="btn btn-primary col-xs-6 col-md-6" id="btn_action_checkins">
Checkins
</button>
<button class="btn btn-primary col-xs-6 col-md-6" id="btn_action_invoices">
Invoices
</button>
<button class="btn btn-primary col-xs-6 col-md-6" id="btn_action_folios">
Folios
</button>
</div>
<div class="col-xs-12 col-md-12 nopadding menu-filter-box">
<h4 data-toggle="collapse" data-target="#filters"><i class="fa fa-chevron-circle-right"></i> Filters</h4>
<div id="filters" class="collapse">
<select class="form-control" id="type_list" placeholder="Select Segmentation..." multiple="multiple"/>
<select class="list form-control" id="floor_list" placeholder="Select Location..." multiple="multiple"/>
<select class="list form-control" id="amenities_list" placeholder="Select Amenities..." multiple="multiple"/>
<select class="list form-control" id="virtual_list" placeholder="Select Type..." multiple="multiple"/>
<div class="filter-record col-xs-12 col-md-12" style="padding:4px">
<div class="col-xs-8 col-md-8 nopadding">
<input type="edit" id="calendar_name" class="form-control" />
</div>
<div class="col-xs-2 col-md-2 nopadding">
<button class="btn btn-primary col-xs-12 col-md-12" id="btn_save_calendar_record">
<i class="fa fa-fw fa-save"> </i>
</button>
</div>
<div class="col-xs-2 col-md-2 nopadding">
<button class="btn btn-primary col-xs-12 col-md-12" id="btn_reload_calendar_filters">
<i class="fa fa-fw fa-refresh"> </i>
</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-10 nopadding" id="pms-calendar">
<div id="hcal_widget" class="col-xs-12 col-md-12 nopadding" />
</div>
</div>
</t>
</templates>

View File

@@ -1,2 +0,0 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo.addons.hotel.tests.common import TestHotel
class TestHotelCalendar(TestHotel):
@classmethod
def setUpClass(cls):
super(TestHotelCalendar, cls).setUpClass()
# Minimal Hotel Calendar Configuration
cls.tz_hotel = 'Europe/Madrid'
cls.default_pricelist_id = cls.pricelist_1.id
cls.default_restriction_id = cls.restriction_1.id
cls.env['ir.default'].sudo().set_default('res.config.settings',
'default_arrival_hour',
'14:00')
cls.env['ir.default'].sudo().set_default('res.config.settings',
'default_departure_hour',
'12:00')

View File

@@ -1,424 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from datetime import timedelta
from openerp.tools import (
DEFAULT_SERVER_DATETIME_FORMAT,
DEFAULT_SERVER_DATE_FORMAT)
from openerp.exceptions import ValidationError
from .common import TestHotelCalendar
from odoo.addons.hotel import date_utils
import logging
_logger = logging.getLogger(__name__)
class TestManagementCalendar(TestHotelCalendar):
def test_calendar_prices(self):
now_utc_dt = date_utils.now()
adv_utc_dt = now_utc_dt + timedelta(days=15)
room_types = (self.hotel_room_type_budget, self.hotel_room_type_special)
hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo(
self.user_hotel_manager)
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
self.default_pricelist_id,
self.default_restriction_id,
True)
for room_type in room_types:
for k_pr, v_pr in hcal_data['prices'].iteritems():
if k_pr == room_type.id: # Only Check Test Cases
for k_info, v_info in enumerate(v_pr):
if k_info >= len(self.prices_tmp[room_type.id]):
break
self.assertEqual(v_info['price'],
self.prices_tmp[room_type.id][k_info],
"Hotel Calendar Management Prices \
doesn't match!")
# REMOVE PRICES
prices_obj = self.env['product.pricelist.item'].sudo(
self.user_hotel_manager)
prod_tmpl_ids = (
self.hotel_room_type_budget.product_id.product_tmpl_id.id,
self.hotel_room_type_special.product_id.product_tmpl_id.id
)
pr_ids = prices_obj.search([
('pricelist_id', '=', self.default_pricelist_id),
('product_tmpl_id', 'in', prod_tmpl_ids),
])
pr_ids.sudo(self.user_hotel_manager).unlink()
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
self.default_pricelist_id,
self.default_restriction_id,
True)
self.assertFalse(any(hcal_data['prices']), "Hotel Calendar Management \
Prices doesn't match after remove!")
def test_calendar_restrictions(self):
now_utc_dt = date_utils.now()
adv_utc_dt = now_utc_dt + timedelta(days=15)
room_types = (self.hotel_room_type_budget, self.hotel_room_type_special)
hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo(
self.user_hotel_manager)
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
self.default_pricelist_id,
self.default_restriction_id,
True)
for room_type in room_types:
for k_pr, v_pr in hcal_data['restrictions'].iteritems():
if k_pr == room_type.id: # Only Check Test Cases
for k_info, v_info in enumerate(v_pr):
rest_items = self.restrictions_min_stay_tmp[room_type.id]
if k_info >= len(rest_items):
break
self.assertEqual(
v_info['min_stay'],
self.restrictions_min_stay_tmp[room_type.id][k_info],
"Hotel Calendar Management Restrictions \
doesn't match!")
# REMOVE RESTRICTIONS
rest_it_obj = self.env['hotel.room.type.restriction.item'].sudo(
self.user_hotel_manager)
rest_ids = rest_it_obj.search([
('restriction_id', '=', self.default_restriction_id),
('room_type_id', 'in', (self.hotel_room_type_budget.id,
self.hotel_room_type_special.id)),
])
rest_ids.sudo(self.user_hotel_manager).unlink()
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
self.default_pricelist_id,
self.default_restriction_id,
True)
self.assertFalse(
any(hcal_data['restrictions']),
"Hotel Calendar Management Restrictions doesn't match \
after remove!")
def test_calendar_availability(self):
now_utc_dt = date_utils.now()
adv_utc_dt = now_utc_dt + timedelta(days=6)
room_types = (self.hotel_room_type_budget, self.hotel_room_type_special)
hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo(
self.user_hotel_manager)
room_type_avail_obj = self.env['hotel.room.type.availability'].sudo(
self.user_hotel_manager)
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
self.default_pricelist_id,
self.default_restriction_id,
True)
for room_type in room_types:
for k_pr, v_pr in hcal_data['availability'].iteritems():
if k_pr == room_type.id: # Only Check Test Cases
for k_info, v_info in enumerate(v_pr):
if k_info >= len(self.avails_tmp[room_type.id]):
break
self.assertEqual(
v_info['avail'],
self.avails_tmp[room_type.id][k_info],
"Hotel Calendar Management Availability \
doesn't match!")
# CHANGE AVAIL
avail_ids = room_type_avail_obj.search([
('room_type_id', 'in', (self.hotel_room_type_budget.id,
self.hotel_room_type_special.id)),
])
for avail_id in avail_ids:
avail_id.sudo(self.user_hotel_manager).write({'avail': 1})
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
self.default_pricelist_id,
self.default_restriction_id,
True)
for room_type in room_types:
for k_pr, v_pr in hcal_data['availability'].iteritems():
if k_pr == room_type.id: # Only Check Test Cases
for k_info, v_info in enumerate(v_pr):
self.assertEqual(
v_info['avail'],
1,
"Hotel Calendar Management Availability \
doesn't match!")
# REMOVE AVAIL
avail_ids = room_type_avail_obj.search([
('room_type_id', 'in', (self.hotel_room_type_budget.id,
self.hotel_room_type_special.id)),
])
avail_ids.sudo(self.user_hotel_manager).unlink()
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
self.default_pricelist_id,
self.default_restriction_id,
True)
for room_type in room_types:
for k_pr, v_pr in hcal_data['availability'].iteritems():
if k_pr == room_type.id: # Only Check Test Cases
for k_info, v_info in enumerate(v_pr):
self.assertEqual(
v_info['avail'],
room_type.max_real_rooms,
"Hotel Calendar Management Availability \
doesn't match!")
def test_save_changes(self):
now_utc_dt = date_utils.now()
adv_utc_dt = now_utc_dt + timedelta(days=3)
room_types = (self.hotel_room_type_budget,)
hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo(
self.user_hotel_manager)
# Generate new prices
prices = (144.0, 170.0, 30.0, 50.0)
cprices = {}
for k_item, v_item in enumerate(prices):
ndate_utc_dt = now_utc_dt + timedelta(days=k_item)
cprices.setdefault(self.hotel_room_type_budget.id, []).append({
'date': ndate_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
'price': v_item
})
# Generate new restrictions
restrictions = {
'min_stay': (3, 2, 4, 1),
'max_stay': (5, 8, 9, 3),
'min_stay_arrival': (2, 3, 6, 2),
'max_stay_arrival': (4, 7, 7, 4),
'closed_departure': (False, True, False, True),
'closed_arrival': (True, False, False, False),
'closed': (False, False, True, True),
}
crestrictions = {}
for i in range(0, 4):
ndate_utc_dt = now_utc_dt + timedelta(days=i)
crestrictions.setdefault(self.hotel_room_type_budget.id, []).append({
'date': ndate_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
'closed_arrival': restrictions['closed_arrival'][i],
'max_stay': restrictions['max_stay'][i],
'min_stay': restrictions['min_stay'][i],
'closed_departure': restrictions['closed_departure'][i],
'closed': restrictions['closed'][i],
'min_stay_arrival': restrictions['min_stay_arrival'][i],
'max_stay_arrival': restrictions['max_stay_arrival'][i],
})
# Generate new availability
avails = (1, 2, 2, 1)
cavails = {}
for k_item, v_item in enumerate(avails):
ndate_utc_dt = now_utc_dt + timedelta(days=k_item)
ndate_dt = date_utils.dt_as_timezone(ndate_utc_dt, self.tz_hotel)
cavails.setdefault(self.hotel_room_type_budget.id, []).append({
'date': ndate_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
'avail': v_item,
'no_ota': False,
})
# Save new values
hotel_cal_mngt_obj.save_changes(
self.default_pricelist_id,
self.default_restriction_id,
cprices,
crestrictions,
cavails)
# Check data integrity
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
self.default_pricelist_id,
self.default_restriction_id,
True)
for room_type in room_types:
for k_pr, v_pr in hcal_data['availability'].iteritems():
if k_pr == room_type.id: # Only Check Test Cases
for k_info, v_info in enumerate(v_pr):
self.assertEqual(v_info['avail'],
avails[k_info],
"Hotel Calendar Management \
Availability doesn't match!")
for k_pr, v_pr in hcal_data['restrictions'].iteritems():
if k_pr == room_type.id: # Only Check Test Cases
for k_info, v_info in enumerate(v_pr):
self.assertEqual(v_info['min_stay'],
restrictions['min_stay'][k_info],
"Hotel Calendar Management \
Restrictions doesn't match!")
self.assertEqual(v_info['max_stay'],
restrictions['max_stay'][k_info],
"Hotel Calendar Management \
Restrictions doesn't match!")
self.assertEqual(
v_info['min_stay_arrival'],
restrictions['min_stay_arrival'][k_info],
"Hotel Calendar Management Restrictions \
doesn't match!")
self.assertEqual(
v_info['max_stay_arrival'],
restrictions['max_stay_arrival'][k_info],
"Hotel Calendar Management Restrictions \
doesn't match!")
self.assertEqual(
v_info['closed_departure'],
restrictions['closed_departure'][k_info],
"Hotel Calendar Management Restrictions \
doesn't match!")
self.assertEqual(
v_info['closed_arrival'],
restrictions['closed_arrival'][k_info],
"Hotel Calendar Management Restrictions \
doesn't match!")
self.assertEqual(
v_info['closed'],
restrictions['closed'][k_info],
"Hotel Calendar Management Restrictions \
doesn't match!")
for k_pr, v_pr in hcal_data['prices'].iteritems():
if k_pr == room_type.id: # Only Check Test Cases
for k_info, v_info in enumerate(v_pr):
self.assertEqual(v_info['price'],
prices[k_info], "Hotel Calendar \
Management Prices doesn't match!")
def test_calendar_reservations(self):
now_utc_dt = date_utils.now()
adv_utc_dt = now_utc_dt + timedelta(days=15)
room_types = (self.hotel_room_type_budget,)
hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo(
self.user_hotel_manager)
reserv_start_utc_dt = now_utc_dt + timedelta(days=3)
reserv_end_utc_dt = reserv_start_utc_dt + timedelta(days=3)
folio = self.create_folio(self.user_hotel_manager, self.partner_2)
reservation = self.create_reservation(
self.user_hotel_manager,
folio,
reserv_start_utc_dt,
reserv_end_utc_dt,
self.hotel_room_simple_100,
"Reservation Test #1")
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
self.default_pricelist_id,
self.default_restriction_id,
True)
avail_end_utc_dt = reserv_end_utc_dt - timedelta(days=1)
for room_type in room_types:
for k_pr, v_pr in hcal_data['count_reservations'].iteritems():
if k_pr == room_type.id: # Only Check Test Cases
for k_info, v_info in enumerate(v_pr):
ndate = date_utils.get_datetime(v_info['date'])
if date_utils.date_in(ndate,
reserv_start_utc_dt,
avail_end_utc_dt) == 0:
self.assertEqual(v_info['num'],
1,
"Hotel Calendar Management \
Availability doesn't match!")
def test_invalid_input_calendar_data(self):
now_utc_dt = date_utils.now()
adv_utc_dt = now_utc_dt + timedelta(days=15)
hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo(
self.user_hotel_manager)
with self.assertRaises(ValidationError):
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
False,
adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
self.default_pricelist_id,
self.default_restriction_id,
True)
with self.assertRaises(ValidationError):
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
False,
self.default_pricelist_id,
self.default_restriction_id,
True)
with self.assertRaises(ValidationError):
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
False,
False,
self.default_pricelist_id,
self.default_restriction_id,
True)
hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT),
False,
False,
True)
self.assertTrue(any(hcal_data), "Hotel Calendar invalid default \
management default models!")
def test_calendar_settings(self):
hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo(
self.user_hotel_manager)
settings = hotel_cal_mngt_obj.get_hcalendar_settings()
self.assertTrue(settings, "Hotel Calendar invalid settings")
self.assertEqual(settings['eday_week'],
self.user_hotel_manager.npms_end_day_week,
"Hotel Calendar invalid settings")
self.assertEqual(settings['eday_week_offset'],
self.user_hotel_manager.npms_end_day_week_offset,
"Hotel Calendar invalid settings")
self.assertEqual(settings['days'],
self.user_hotel_manager.npms_default_num_days,
"Hotel Calendar invalid settings")
self.assertEqual(settings['show_notifications'],
self.user_hotel_manager.pms_show_notifications,
"Hotel Calendar invalid settings")
self.assertEqual(settings['show_num_rooms'],
self.user_hotel_manager.pms_show_num_rooms,
"Hotel Calendar invalid settings")

View File

@@ -1,66 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
from .common import TestHotelCalendar
from odoo.addons.hotel import date_utils
class TestProductPricelist(TestHotelCalendar):
def test_update_price(self):
now_utc_dt = date_utils.now()
now_utc_str = now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)
room_type_tmpl_id = self.hotel_room_type_special.product_id.product_tmpl_id
pritem_obj = self.env['product.pricelist.item']
plitem = pritem_obj.search([
('pricelist_id', '=', self.default_pricelist_id),
('product_tmpl_id', '=', room_type_tmpl_id.id),
('date_start', '=', now_utc_str),
('date_end', '=', now_utc_str),
('applied_on', '=', '1_product'),
('compute_price', '=', 'fixed')
])
old_price = plitem.fixed_price
self.pricelist_1.update_price(
self.hotel_room_type_special.id,
now_utc_str,
999.9)
plitem = pritem_obj.search([
('pricelist_id', '=', self.default_pricelist_id),
('product_tmpl_id', '=', room_type_tmpl_id.id),
('date_start', '=', now_utc_str),
('date_end', '=', now_utc_str),
('applied_on', '=', '1_product'),
('compute_price', '=', 'fixed')
])
new_price = plitem.fixed_price
self.assertNotEqual(old_price,
new_price,
"Hotel Calendar can't change price")
self.assertEqual(new_price,
999.9,
"Hotel Calendar can't change price")

View File

@@ -1,289 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import datetime
from datetime import timedelta
from odoo import fields
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.exceptions import ValidationError
from .common import TestHotelCalendar
from odoo.addons.hotel import date_utils
import pytz
class TestReservationsCalendar(TestHotelCalendar):
def test_calendar_pricelist(self):
now_utc_dt = date_utils.now()
real_start_utc_dt = (now_utc_dt - timedelta(days=1))
adv_utc_dt = now_utc_dt + timedelta(days=15)
hotel_reserv_obj = self.env['hotel.reservation'].sudo(
self.user_hotel_manager)
hcal_data = hotel_reserv_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT))
# Check Pricelist Integrity
for k_pr, v_pr in hcal_data['pricelist'].iteritems():
for room_type_pr in v_pr:
# Only Check Test Cases
if room_type_pr['room'] in self.prices_tmp.keys():
sorted_dates = sorted(
room_type_pr['days'].keys(),
key=lambda x: datetime.datetime.strptime(x, '%d/%m/%Y')
)
init_date_dt = datetime.datetime.strptime(
sorted_dates[0],
'%d/%m/%Y').replace(tzinfo=pytz.utc)
end_date_dt = datetime.datetime.strptime(
sorted_dates[-1],
'%d/%m/%Y').replace(tzinfo=pytz.utc)
self.assertEqual(real_start_utc_dt, init_date_dt,
"Hotel Calendar don't start in \
the correct date!")
self.assertEqual(adv_utc_dt, end_date_dt,
"Hotel Calendar don't end in \
the correct date!")
room_type_prices = self.prices_tmp[room_type_pr['room']]
for k_price, v_price in enumerate(room_type_prices):
self.assertEqual(
v_price,
room_type_pr['days'][sorted_dates[k_price+1]],
"Hotel Calendar Pricelist doesn't match!")
# Check Pricelist Integrity after unlink
pricelist_item_obj = self.env['product.pricelist.item'].sudo(
self.user_hotel_manager)
pr_ids = pricelist_item_obj.search([
('pricelist_id', '=', self.default_pricelist_id),
('product_tmpl_id', 'in', (
self.hotel_room_type_budget.product_id.product_tmpl_id.id,
self.hotel_room_type_special.product_id.product_tmpl_id.id)),
])
pr_ids.sudo(self.user_hotel_manager).unlink()
reserv_obj = self.env['hotel.reservation'].sudo(
self.user_hotel_manager)
hcal_data = reserv_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT))
room_types = (self.hotel_room_type_budget, self.hotel_room_type_special)
for room_type in room_types:
for k_pr, v_pr in hcal_data['pricelist'].iteritems():
for room_type_pr in v_pr:
if room_type_pr['room'] == room_type.id: # Only Check Test Cases
self.assertEqual(
room_type.list_price,
room_type_pr['days'][sorted_dates[k_price+1]],
"Hotel Calendar Pricelist doesn't \
match after remove!")
def test_calendar_reservations(self):
now_utc_dt = date_utils.now()
adv_utc_dt = now_utc_dt + timedelta(days=15)
hotel_reserv_obj = self.env['hotel.reservation'].sudo(
self.user_hotel_manager)
def is_reservation_listed(reservation_id):
hcal_data = hotel_reserv_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT))
# TODO: Perhaps not the best way to do this test... :/
hasReservationTest = False
for reserv in hcal_data['reservations']:
if reserv[1] == reservation_id:
hasReservationTest = True
break
return hasReservationTest
# CREATE COMPLETE RESERVATION (3 Nigths)
reserv_start_utc_dt = now_utc_dt + timedelta(days=3)
reserv_end_utc_dt = reserv_start_utc_dt + timedelta(days=3)
folio = self.create_folio(self.user_hotel_manager, self.partner_2)
reservation = self.create_reservation(
self.user_hotel_manager,
folio,
reserv_start_utc_dt,
reserv_end_utc_dt,
self.hotel_room_double_200,
"Reservation Test #1")
# CHECK SUCCESSFULL CREATION
self.assertTrue(is_reservation_listed(reservation.id),
"Hotel Calendar can't found test reservation!")
# CONFIRM FOLIO
folio.sudo(self.user_hotel_manager).action_confirm()
self.assertTrue(is_reservation_listed(reservation.id),
"Hotel Calendar can't found test reservation!")
# CALENDAR LIMITS
now_utc_dt_tmp = now_utc_dt
adv_utc_dt_tmp = adv_utc_dt
# Start after reservation end
now_utc_dt = reserv_end_utc_dt + timedelta(days=2)
adv_utc_dt = now_utc_dt + timedelta(days=15)
self.assertFalse(
is_reservation_listed(reservation.id),
"Hotel Calendar found test reservation but expected not found it!")
# Ends before reservation start
adv_utc_dt = reserv_start_utc_dt - timedelta(days=1)
now_utc_dt = adv_utc_dt - timedelta(days=15)
self.assertFalse(
is_reservation_listed(reservation.id),
"Hotel Calendar found test reservation but expected not found it!")
now_utc_dt = now_utc_dt_tmp
adv_utc_dt = adv_utc_dt_tmp
# Start in the middle of the reservation days
now_utc_dt = reserv_end_utc_dt - timedelta(days=1)
adv_utc_dt = now_utc_dt + timedelta(days=15)
self.assertTrue(
is_reservation_listed(reservation.id),
"Hotel Calendar can't found test reservation!")
now_utc_dt = now_utc_dt_tmp
adv_utc_dt = adv_utc_dt_tmp
# CANCEL FOLIO
folio.sudo(self.user_hotel_manager).action_cancel()
self.assertFalse(
is_reservation_listed(reservation.id),
"Hotel Calendar can't found test reservation!")
# REMOVE FOLIO
folio.sudo().unlink() # FIXME: Can't use: self.user_hotel_manager
self.assertFalse(
is_reservation_listed(reservation.id),
"Hotel Calendar can't found test reservation!")
def test_invalid_input_calendar_data(self):
now_utc_dt = date_utils.now()
adv_utc_dt = now_utc_dt + timedelta(days=15)
hotel_reserv_obj = self.env['hotel.reservation'].sudo(
self.user_hotel_manager)
with self.assertRaises(ValidationError):
hcal_data = hotel_reserv_obj.get_hcalendar_all_data(
False,
adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT))
with self.assertRaises(ValidationError):
hcal_data = hotel_reserv_obj.get_hcalendar_all_data(
now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
False)
with self.assertRaises(ValidationError):
hcal_data = hotel_reserv_obj.get_hcalendar_all_data(
False,
False)
def test_calendar_settings(self):
hcal_options = self.env['hotel.reservation'].sudo(
self.user_hotel_manager).get_hcalendar_settings()
self.assertEqual(hcal_options['divide_rooms_by_capacity'],
self.user_hotel_manager.pms_divide_rooms_by_capacity,
"Hotel Calendar Invalid Options!")
self.assertEqual(hcal_options['eday_week'],
self.user_hotel_manager.pms_end_day_week,
"Hotel Calendar Invalid Options!")
self.assertEqual(hcal_options['days'],
self.user_hotel_manager.pms_default_num_days,
"Hotel Calendar Invalid Options!")
self.assertEqual(
hcal_options['allow_invalid_actions'],
self.user_hotel_manager.pms_type_move == 'allow_invalid',
"Hotel Calendar Invalid Options!")
self.assertEqual(
hcal_options['assisted_movement'],
self.user_hotel_manager.pms_type_move == 'assisted',
"Hotel Calendar Invalid Options!")
default_arrival_hour = self.env['ir.default'].sudo().get(
'res.config.settings', 'default_arrival_hour')
self.assertEqual(hcal_options['default_arrival_hour'],
default_arrival_hour,
"Hotel Calendar Invalid Options!")
default_departure_hour = self.env['ir.default'].sudo().get(
'res.config.settings', 'default_departure_hour')
self.assertEqual(hcal_options['default_departure_hour'],
default_departure_hour,
"Hotel Calendar Invalid Options!")
self.assertEqual(hcal_options['show_notifications'],
self.user_hotel_manager.pms_show_notifications,
"Hotel Calendar Invalid Options!")
self.assertEqual(hcal_options['show_num_rooms'],
self.user_hotel_manager.pms_show_num_rooms,
"Hotel Calendar Invalid Options!")
self.assertEqual(hcal_options['show_pricelist'],
self.user_hotel_manager.pms_show_pricelist,
"Hotel Calendar Invalid Options!")
self.assertEqual(hcal_options['show_availability'],
self.user_hotel_manager.pms_show_availability,
"Hotel Calendar Invalid Options!")
def test_swap_reservation(self):
hcal_reserv_obj = self.env['hotel.reservation'].sudo(
self.user_hotel_manager)
now_utc_dt = date_utils.now()
# CREATE RESERVATIONS
reserv_start_utc_dt = now_utc_dt + timedelta(days=3)
reserv_end_utc_dt = reserv_start_utc_dt + timedelta(days=3)
folio_a = self.create_folio(self.user_hotel_manager, self.partner_2)
reservation_a = self.create_reservation(
self.user_hotel_manager,
folio_a,
reserv_start_utc_dt,
reserv_end_utc_dt,
self.hotel_room_double_200,
"Reservation Test #1")
self.assertTrue(reservation_a,
"Hotel Calendar create test reservation!")
folio_a.sudo(self.user_hotel_manager).action_confirm()
folio_b = self.create_folio(self.user_hotel_manager, self.partner_2)
reservation_b = self.create_reservation(
self.user_hotel_manager,
folio_b,
reserv_start_utc_dt,
reserv_end_utc_dt,
self.hotel_room_simple_101,
"Reservation Test #2")
self.assertTrue(reservation_b,
"Hotel Calendar can't create test reservation!")
folio_b.sudo(self.user_hotel_manager).action_confirm()
self.assertTrue(
hcal_reserv_obj.swap_reservations(reservation_a.ids,
reservation_b.ids),
"Hotel Calendar invalid swap operation"
)
self.assertEqual(reservation_a.product_id.id,
self.hotel_room_simple_101.product_id.id,
"Hotel Calendar wrong swap operation")
self.assertEqual(reservation_b.product_id.id,
self.hotel_room_double_200.product_id.id,
"Hotel Calendar wrong swap operation")

View File

@@ -1,28 +0,0 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.actions.act_window" id="hotel_reservation_action_checkin">
<field name="name">Hotel folio checkin</field>
<field name="res_model">hotel.reservation</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('real_checkin','=', datetime.datetime.now().strftime('%Y-%m-%d')),
('state', 'in', ['confirm']),
('reservation_type', 'not in', ['out'])]</field>
</record>
<record model="ir.actions.act_window" id="hotel_reservation_action_checkout">
<field name="name">Hotel folio checkout</field>
<field name="res_model">hotel.reservation</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('real_checkout','=', datetime.datetime.now().strftime('%Y-%m-%d')),
('state', 'in', ['booking']),
('reservation_type', 'not in', ['out'])]</field>
</record>
<record model="ir.actions.act_window" id="hotel_calendar_action_form_tree">
<field name="name">Hotel Calendar</field>
<field name="res_model">hotel.calendar</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Use an updated momentJS library -->
<template id="assets_common" inherit_id="web.assets_common">
<xpath expr="//script[@src='/web/static/lib/moment/moment.js']" position="attributes">
<attribute name="src">/hotel_calendar/static/src/lib/moment.js</attribute>
</xpath>
</template>
<!-- Backend stuff -->
<template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/hotel_calendar/static/src/lib/bootbox.js"></script>
<!-- Hotel Calendar (Internal) -->
<link rel="stylesheet" href="/hotel_calendar/static/src/css/view.css" />
<script type="text/javascript" src="/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js"></script>
<script type="text/javascript" src="/hotel_calendar/static/src/js/widgets/MultiCalendar.js"></script>
<script type="text/javascript" src="/hotel_calendar/static/src/js/views/constants.js"></script>
<script type="text/javascript" src="/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js"></script>
<script type="text/javascript" src="/hotel_calendar/static/src/js/views/calendar/hotel_calendar_model.js"></script>
<script type="text/javascript" src="/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js"></script>
<script type="text/javascript" src="/hotel_calendar/static/src/js/views/calendar/hotel_calendar_view.js"></script>
<script type="text/javascript" src="/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_controller.js"></script>
<script type="text/javascript" src="/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_model.js"></script>
<script type="text/javascript" src="/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js"></script>
<script type="text/javascript" src="/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_view.js"></script>
</xpath>
</template>
</odoo>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="hotel_calendar_management_view_mpms">
<field name="name">hotel.calendar.management.mpms</field>
<field name="model">hotel.calendar.management</field>
<field name="arch" type="xml">
<mpms></mpms>
</field>
</record>
</odoo>

View File

@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Form view of hotel room -->
<record model="ir.ui.view" id="hotel_calendar_view_form">
<field name="name">hotel.calendar.form</field>
<field name="model">hotel.calendar</field>
<field name="arch" type="xml">
<form string="Hotel Calendar">
<sheet>
<group>
<field name="name" />
<field name="hotel_id" invisible="0"/>
</group>
<group>
<field name="segmentation_ids" />
<field name="location_ids" />
<field name="amenity_ids" />
<field name="room_type_ids" />
</group>
</sheet>
</form>
</field>
</record>
<!-- Tree view of hotel room -->
<record model="ir.ui.view" id="hotel_calendar_view_tree">
<field name="name">hotel.calendar.tree</field>
<field name="model">hotel.calendar</field>
<field name="arch" type="xml">
<tree string="Hotel Calendar">
<field name="hotel_id" />
<field name="name" />
</tree>
</field>
</record>
</odoo>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="hotel_reservation_view_pms">
<field name="name">hotel.reservation.pms</field>
<field name="model">hotel.reservation</field>
<field name="arch" type="xml">
<pms></pms>
</field>
</record>
</odoo>

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="hotel_property_views_form" model="ir.ui.view">
<field name="model">hotel.property</field>
<field name="inherit_id" ref="hotel.hotel_property_views_form" />
<field name="arch" type="xml">
<xpath expr="//page[@name='hotel_settings']" position="after">
<page string='Calendar Settings' name="hotel_calendar">
<group colspan="4">
<group string="Rooms and Reservations">
<field name="pms_show_num_rooms" />
<field name="pms_divide_rooms_by_capacity" />
<field name="pms_type_move" required="True" />
</group>
<group string="Calendar (PMS)">
<field name="pms_end_day_week" required="True" />
<field name="pms_end_day_week_offset" required="True" />
<field name="pms_default_num_days" required="True" />
</group>
<group string="Events">
<field name="pms_allowed_events_tags" widget="many2many_tags" />
<field name="pms_denied_events_tags" widget="many2many_tags" />
</group>
</group>
</page>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0"?>
<odoo>
<record id="room_type_view_form" model="ir.ui.view">
<field name="model">hotel.room.type</field>
<field name="inherit_id" ref="hotel.hotel_room_type_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="hcal_sequence" />
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0"?>
<odoo>
<record id="hotel_room_view_form" model="ir.ui.view">
<field name="model">hotel.room</field>
<field name="inherit_id" ref="hotel.hotel_room_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_title')]" position="inside">
<field name="hcal_sequence" />
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,43 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Hotel Settings -->
<record id="res_company_view_form" model="ir.ui.view">
<field name="name">view.company.form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//page" position="after">
<page string="Hotel Preferences" name="hotel_preferences">
<group>
<group string="Reservation Background Colors">
<field name="color_pre_reservation" widget="color" />
<field name="color_reservation" widget="color" />
<field name="color_reservation_pay" widget="color" />
<field name="color_stay" widget="color" />
<field name="color_stay_pay" widget="color" />
<field name="color_checkout" widget="color" />
<field name="color_dontsell" widget="color" />
<field name="color_staff" widget="color" />
<field name="color_to_assign" widget="color" />
<field name="color_payment_pending" widget="color" />
</group>
<group string="Reservation Letter Colors">
<field name="color_letter_pre_reservation" widget="color" />
<field name="color_letter_reservation" widget="color" />
<field name="color_letter_reservation_pay" widget="color" />
<field name="color_letter_stay" widget="color" />
<field name="color_letter_stay_pay" widget="color" />
<field name="color_letter_checkout" widget="color" />
<field name="color_letter_dontsell" widget="color" />
<field name="color_letter_staff" widget="color" />
<field name="color_letter_to_assign" widget="color" />
<field name="color_letter_payment_pending" widget="color" />
</group>
</group>
</page>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_users_form_simple_modif" model="ir.ui.view">
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif" />
<field name="arch" type="xml">
<xpath expr="//group[@name='preferences']" position="after">
<group string="Calendar (PMS) Preferences" name="preferences_calendar">
<group col="8" colspan="4">
<field name="pms_show_notifications" />
<field name="pms_show_pricelist" />
<field name="pms_show_availability" />
</group>
</group>
</xpath>
</field>
</record>
</odoo>

Some files were not shown because too many files have changed in this diff Show More