diff --git a/.eslintrc.yml b/.eslintrc.yml index 88f2881b4c128fc4762338a8f420272c44cc29ef..9429bc688aab4993eae460767368f65089afa323 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,9 +1,16 @@ env: browser: true + es6: true # See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 parserOptions: - ecmaVersion: 2017 + ecmaVersion: 2019 + +overrides: + - files: + - "**/*.esm.js" + parserOptions: + sourceType: module # Globals available in Odoo that shouldn't produce errorings globals: @@ -14,7 +21,7 @@ globals: moment: readonly odoo: readonly openerp: readonly - Promise: readonly + owl: 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 diff --git a/.gitignore b/.gitignore index 818770fb1bdc0a144e924c9a5940f0b035df8a0d..9c283fd41f6cc3330653f1d90a820b85e23caf65 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ build/ develop-eggs/ dist/ eggs/ -lib/ lib64/ parts/ sdist/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cb8b5ef27a4408c9767c962d0f4e70fb99715061..168470e2ed745631aefb772a4a864cf1de76d3cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,9 @@ exclude: | # Files and folders generated by bots, to avoid loops ^setup/|/static/description/index\.html$| # We don't want to mess with tool-generated files - .svg$|/tests/([^/]+/)?cassettes/| + .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| + # 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 @@ -14,7 +16,7 @@ exclude: | (LICENSE.*|COPYING.*) default_language_version: python: python3 - node: "14.13.0" + node: "14.18.0" repos: - repo: local hooks: @@ -26,10 +28,12 @@ repos: language: fail files: "\\.rej$" - repo: https://github.com/oca/maintainer-tools - rev: ab1d7f6 + rev: dfba427ba03900b69e0a7f2c65890dc48921d36a hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons + - id: oca-fix-manifest-website + args: ["https://le-filament.com"] - repo: https://github.com/myint/autoflake rev: v1.4 hooks: @@ -42,22 +46,22 @@ repos: - --remove-duplicate-keys - --remove-unused-variables - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.1.2 + rev: v2.4.1 hooks: - id: prettier name: prettier (with plugin-xml) additional_dependencies: - - "prettier@2.1.2" - - "@prettier/plugin-xml@0.12.0" + - "prettier@2.4.1" + - "@prettier/plugin-xml@1.1.0" args: - --plugin=@prettier/plugin-xml files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ - repo: https://github.com/pre-commit/mirrors-eslint - rev: v7.8.1 + rev: v7.32.0 hooks: - id: eslint verbose: true @@ -65,7 +69,7 @@ repos: - --color - --fix - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.0.1 hooks: - id: trailing-whitespace # exclude autogenerated files @@ -87,12 +91,12 @@ repos: - id: mixed-line-ending args: ["--fix=lf"] - repo: https://github.com/asottile/pyupgrade - rev: v2.7.2 + rev: v2.29.0 hooks: - id: pyupgrade args: ["--keep-percent-format"] - repo: https://github.com/PyCQA/isort - rev: 5.5.1 + rev: 5.9.3 hooks: - id: isort name: isort except __init__.py @@ -100,24 +104,20 @@ repos: - --settings=. exclude: /__init__\.py$ - repo: https://gitlab.com/PyCQA/flake8 - rev: 3.8.3 + rev: 3.9.2 hooks: - id: flake8 name: flake8 - additional_dependencies: ["flake8-bugbear==20.1.4"] - - repo: https://github.com/PyCQA/pylint - rev: pylint-2.5.3 + additional_dependencies: ["flake8-bugbear==21.9.2"] + - repo: https://github.com/OCA/pylint-odoo + rev: 7.0.2 hooks: - - id: pylint + - id: pylint_odoo name: pylint with optional checks args: - --rcfile=.pylintrc - --exit-zero verbose: true - additional_dependencies: &pylint_deps - - pylint-odoo==3.5.0 - - id: pylint - name: pylint with mandatory checks + - id: pylint_odoo args: - --rcfile=.pylintrc-mandatory - additional_dependencies: *pylint_deps diff --git a/.pylintrc b/.pylintrc index c3d0a5c839baeee21312961c56158de4936fdc91..d431ca78d44080ba32c20c6991c2655f2ab6423b 100644 --- a/.pylintrc +++ b/.pylintrc @@ -8,7 +8,7 @@ manifest_required_authors=Le Filament 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=14.0 +valid_odoo_versions=15.0 [MESSAGES CONTROL] disable=all @@ -64,6 +64,38 @@ enable=anomalous-backslash-in-string, use-vim-comment, wrong-tabs-instead-of-spaces, xml-syntax-error, + attribute-string-redundant, + character-not-valid-in-resource-link, + consider-merging-classes-inherited, + context-overridden, + create-user-wo-reset-password, + dangerous-filter-wo-user, + dangerous-qweb-replace-wo-priority, + deprecated-data-xml-node, + deprecated-openerp-xml-node, + duplicate-po-message-definition, + except-pass, + file-not-used, + invalid-commit, + manifest-maintainers-list, + missing-newline-extrafiles, + missing-readme, + missing-return, + odoo-addons-relative-import, + old-api7-method-defined, + po-msgstr-variables, + po-syntax-error, + renamed-field-parameter, + resource-not-exist, + str-format-used, + test-folder-imported, + translation-contains-variable, + translation-positional-used, + unnecessary-utf8-coding-comment, + website-manifest-key-not-valid-uri, + xml-attribute-translatable, + xml-deprecated-qweb-directive, + xml-deprecated-tree-attribute, # messages that do not cause the lint step to fail consider-merging-classes-inherited, create-user-wo-reset-password, @@ -73,7 +105,7 @@ enable=anomalous-backslash-in-string, invalid-commit, missing-manifest-dependency, missing-newline-extrafiles, - # missing-readme, + missing-readme, no-utf8-coding-comment, odoo-addons-relative-import, old-api7-method-defined, diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index 43ea23947166ff8080219007cfae43ec54a28f8e..189c548631665bef116fc4d0df3b986f9727df31 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -8,7 +8,7 @@ manifest_required_authors=Le Filament 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=14.0 +valid_odoo_versions=15.0 [MESSAGES CONTROL] disable=all @@ -56,7 +56,39 @@ enable=anomalous-backslash-in-string, unreachable, use-vim-comment, wrong-tabs-instead-of-spaces, - xml-syntax-error + xml-syntax-error, + attribute-string-redundant, + character-not-valid-in-resource-link, + consider-merging-classes-inherited, + context-overridden, + create-user-wo-reset-password, + dangerous-filter-wo-user, + dangerous-qweb-replace-wo-priority, + deprecated-data-xml-node, + deprecated-openerp-xml-node, + duplicate-po-message-definition, + except-pass, + file-not-used, + invalid-commit, + manifest-maintainers-list, + missing-newline-extrafiles, + missing-readme, + missing-return, + odoo-addons-relative-import, + old-api7-method-defined, + po-msgstr-variables, + po-syntax-error, + renamed-field-parameter, + resource-not-exist, + str-format-used, + test-folder-imported, + translation-contains-variable, + translation-positional-used, + unnecessary-utf8-coding-comment, + website-manifest-key-not-valid-uri, + xml-attribute-translatable, + xml-deprecated-qweb-directive, + xml-deprecated-tree-attribute [REPORTS] msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} diff --git a/__init__.py b/__init__.py index 31660d6a9650857f10c9dbdcd139145e0897ef6e..0650744f6bc69b9f0b865e8c7174c813a5f5995e 100644 --- a/__init__.py +++ b/__init__.py @@ -1,3 +1 @@ -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - from . import models diff --git a/__manifest__.py b/__manifest__.py index 43e10caefd9e7027612385268c9e2276504c352e..c766518f5b49e0d3699e768f2a63a0d30f6c3a76 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,24 +1,28 @@ -# © 2021 Le Filament (<https://www.le-filament.com>) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - { "name": "Le Filament - Tableau de Bord", "summary": "Rapports Le Filament", "author": "Le Filament", - "category": "dashboard", + "category": "Productivity", "website": "https://le-filament.com", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "license": "AGPL-3", - "depends": ["account", "crm", "hr_expense", "sale"], + "depends": ["automatic_statement_import", "crm", "hr_expense", "sale"], "data": [ "security/lefilament_dashboard_security.xml", "security/ir.model.access.csv", - "views/assets.xml", "views/views.xml", "views/schedule.xml", "data/ir_module_category.xml", ], - "qweb": [ - "static/src/xml/*.xml", - ], + "assets": { + "web.assets_qweb": [ + "lefilament_tdb/static/src/xml/*.xml", + ], + "web.assets_backend": [ + "lefilament_tdb/static/src/css/lefilament_tdb.css", + "lefilament_tdb/static/src/js/dashboard_year.js", + "lefilament_tdb/static/src/js/tresorerie.js", + "lefilament_tdb/static/src/js/previ_tresorerie.js", + ], + }, } diff --git a/data/ir_module_category.xml b/data/ir_module_category.xml index 33396edca10d09b1cf61479e7f03b019d07a8f59..6fbfb384ef714f916e2d4d3406ec6f237fdb859e 100644 --- a/data/ir_module_category.xml +++ b/data/ir_module_category.xml @@ -1,12 +1,10 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2017 Le Filament (<https://www.le-filament.com>) +<!-- Copyright 2017-2022 Le Filament (<https://le-filament.com>) License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <odoo> - <data> <record model="ir.module.category" id="module_category_dashboard"> <field name="name">Dashboard</field> <field name="description">Show main company dashboard</field> <field name="sequence">30</field> </record> - </data> </odoo> diff --git a/models/__init__.py b/models/__init__.py index f35384adde2fe69207e37b171d417cf8b17c29fa..e08731c1aae4421af4d5bad51cf766a6fda5bb37 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -1,5 +1,3 @@ -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - from . import lefilament_tdb from . import res_company from . import hr_employee diff --git a/models/hr_employee.py b/models/hr_employee.py index 6e4f417a9b7652a6f3b6da14c0fd14af19474cbe..cbe9d1667bc636c46b1410ae74ab8e6a11bb88ae 100644 --- a/models/hr_employee.py +++ b/models/hr_employee.py @@ -1,4 +1,4 @@ -# © 2019 Le Filament (<http://www.le-filament.com>) +# Copyright 2019-2022 Le Filament (<https://le-filament.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import fields, models diff --git a/models/lefilament_tdb.py b/models/lefilament_tdb.py index 32b947176ff9ddf3156475213434533b55d9c811..c8de027cb81c4bd8aa1af88ca8281776620e59d6 100644 --- a/models/lefilament_tdb.py +++ b/models/lefilament_tdb.py @@ -1,4 +1,4 @@ -# © 2019 Le Filament (<http://www.le-filament.com>) +# Copyright 2019-2022 Le Filament (<https://le-filament.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from datetime import date, datetime @@ -24,13 +24,11 @@ class LeFilamentTdb(models.Model): ) pipe_mois = fields.Float("Pipe", compute="_compute_dashboard_values", store=True) treso = fields.Float("Trésorerie", compute="_compute_dashboard_values", store=True) - variation = fields.Float( - "Variation", compute="_compute_dashboard_values", store=True - ) + variation = fields.Float(compute="_compute_dashboard_values", store=True) charges = fields.Float("Décaissé", compute="_compute_dashboard_values", store=True) encaisse = fields.Float("Encaissé", compute="_compute_dashboard_values", store=True) - charges_fixes = fields.Float("Charges Fixes", default=10000) - runway = fields.Float("Runway", compute="_compute_runway_value") + charges_fixes = fields.Float(default=10000) + runway = fields.Float(compute="_compute_runway_value") @api.depends("date_tdb") def _compute_dashboard_values(self): @@ -316,15 +314,16 @@ class LeFilamentTdb(models.Model): def tresorerie(self): self._cr.execute( """ - SELECT to_char(date_trunc('month', date),'YYYY-MM') AS mois, - SUM(CASE WHEN amount > 0 - THEN amount ELSE 0 END) AS entree, - SUM(CASE WHEN amount < 0 - THEN amount ELSE 0 END) AS sortie, + SELECT to_char(date_trunc('month', aml.date),'YYYY-MM') AS mois, + SUM(CASE WHEN absl.amount > 0 + THEN absl.amount ELSE 0 END) AS entree, + SUM(CASE WHEN absl.amount < 0 + THEN absl.amount ELSE 0 END) AS sortie, SUM(amount) AS variation - FROM account_bank_statement_line - GROUP BY date_trunc('month', date) - ORDER BY date_trunc('month', date); + FROM account_bank_statement_line absl + LEFT JOIN account_move_line aml ON aml.id = absl.move_id + GROUP BY date_trunc('month', aml.date) + ORDER BY date_trunc('month', aml.date); """ ) tresorerie = self._cr.dictfetchall() @@ -352,13 +351,14 @@ class LeFilamentTdb(models.Model): def previ_tresorerie(self): self._cr.execute( """ - SELECT to_char(date_trunc('month', date),'YYYY-MM') AS mois, - SUM(SUM(amount)) OVER ( - ORDER BY date_trunc('month', date) + SELECT to_char(date_trunc('month', aml.date),'YYYY-MM') AS mois, + SUM(SUM(absl.amount)) OVER ( + ORDER BY date_trunc('month', aml.date) ) AS treso - FROM account_bank_statement_line - GROUP BY date_trunc('month', date) - ORDER BY date_trunc('month', date) DESC LIMIT 6; + FROM account_bank_statement_line absl + LEFT JOIN account_move_line aml ON aml.id = absl.move_id + GROUP BY date_trunc('month', aml.date) + ORDER BY date_trunc('month', aml.date) DESC LIMIT 6; """ ) tresorerie = self._cr.dictfetchall() diff --git a/models/res_company.py b/models/res_company.py index b89844ebfd4f73822ab434cfe2122797993257f3..abd861701e6f61c36fb0c1c3a0dc4183de4912b6 100644 --- a/models/res_company.py +++ b/models/res_company.py @@ -1,4 +1,4 @@ -# © 2019 Le Filament (<http://www.le-filament.com>) +# Copyright 2019-2022 Le Filament (<https://le-filament.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import fields, models @@ -8,7 +8,7 @@ class ResCompany(models.Model): _inherit = "res.company" ca_target = fields.Integer("Objectif Chiffre d'Affaire") - charges_fixes = fields.Integer("Charges Fixes") + charges_fixes = fields.Integer() previ_treso_ids = fields.One2many("previ.treso", "company_id", "Prévisionnel") @@ -24,5 +24,5 @@ class PreviTreso(models.Model): periode = fields.Selection( [("12", "Mensuel"), ("3", "Trimestriel"), ("1", "Annuel")], string="Période" ) - date = fields.Date("Date") - montant = fields.Float("Montant") + date = fields.Date() + montant = fields.Float() diff --git a/security/lefilament_dashboard_security.xml b/security/lefilament_dashboard_security.xml index a305afe1d7980039e827ecd1adc09e8e0943ae60..db09e29044d8658bc83b529cee4f10f77cc579be 100644 --- a/security/lefilament_dashboard_security.xml +++ b/security/lefilament_dashboard_security.xml @@ -1,15 +1,11 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2017 Le Filament (<https://www.le-filament.com>) +<!-- Copyright 2017-2022 Le Filament (<https://le-filament.com>) License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <odoo> - <data noupdate="0"> - <!-- Définition des groupes utilisateurs --> - <record id="group_dashboard" model="res.groups"> - <field name="name">Voir les tableaux de bord</field> - <field name="category_id" ref="base.module_category_dashboard" /> - <field name="implied_ids" eval="[(4, ref('base.group_user'))]" /> - </record> - - </data> + <record id="group_dashboard" model="res.groups"> + <field name="name">Voir les tableaux de bord</field> + <field name="category_id" ref="base.module_category_dashboard" /> + <field name="implied_ids" eval="[(4, ref('base.group_user'))]" /> + </record> </odoo> diff --git a/static/src/js/dashboard_year.js b/static/src/js/dashboard_year.js index 82b69e7c48d5a9086dbf7e1a1dc9c50cc57817fb..cff4ec012d9d5dd7ad784808216fb38c4201a01b 100644 --- a/static/src/js/dashboard_year.js +++ b/static/src/js/dashboard_year.js @@ -1,4 +1,4 @@ -// © 2019 Le Filament (<http://www.le-filament.com>) +// Copyright 2019-2022 Le Filament (<https://le-filament.com>) // License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). odoo.define("lefilament_tdb.dashboard_year", function (require) { @@ -52,30 +52,6 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { this.values = {}; this.progess = 0; - this._rpc({ - model: "ir.model.data", - method: "xmlid_to_res_id", - args: ["account.view_invoice_form"], - }).then(function (results) { - self.invoice_view_id = results; - }); - - this._rpc({ - model: "ir.model.data", - method: "xmlid_to_res_id", - args: ["lefilament_tdb.view_invoice_tree"], - }).then(function (results) { - self.invoice_tree_id = results; - }); - - this._rpc({ - model: "ir.model.data", - method: "xmlid_to_res_id", - args: ["crm.crm_case_form_view_oppor"], - }).then(function (results) { - self.pipe_view_id = results; - }); - this._rpc({ model: "lefilament.dashboard", method: "retrieve_datas_dashboard", @@ -209,7 +185,7 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { titleFontColor: "#999", bodyFontColor: "#777", callbacks: { - label: function (tooltipItems, data) { + label: function (tooltipItems) { return ( ( (tooltipItems.xLabel * yeartarget) / @@ -277,10 +253,10 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { res_model: "account.move", view_mode: "tree,pivot,graph,form", views: [ - [self.invoice_tree_id, "list"], + [false, "list"], [false, "pivot"], [false, "graph"], - [self.invoice_view_id, "form"], + [false, "form"], ], domain: [ ["move_type", "in", ["out_invoice", "out_refund"]], @@ -321,7 +297,7 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { views: [ [false, "kanban"], [false, "list"], - [this.pipe_view_id, "form"], + [false, "form"], ], domain: [ "|", @@ -346,7 +322,7 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { views: [ [false, "kanban"], [false, "list"], - [this.pipe_view_id, "form"], + [false, "form"], ], domain: [ ["type", "=", "opportunity"], @@ -368,10 +344,10 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { res_model: "account.move", view_mode: "tree,pivot,graph,form", views: [ - [self.invoice_tree_id, "list"], + [false, "list"], [false, "pivot"], [false, "graph"], - [self.invoice_view_id, "form"], + [false, "form"], ], domain: [ ["state", "=", "posted"], @@ -394,7 +370,7 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { res_model: "account.move", view_mode: "tree,form", views: [ - [self.invoice_tree_id, "list"], + [false, "list"], [false, "form"], ], domain: [ diff --git a/static/src/js/previ_tresorerie.js b/static/src/js/previ_tresorerie.js index 3cd0838d53f220adbae8f0ecb328a71ef6ddc7fd..7d13dbb1eb86e9ffd9d44789c858d52513fbd7da 100644 --- a/static/src/js/previ_tresorerie.js +++ b/static/src/js/previ_tresorerie.js @@ -1,4 +1,4 @@ -// © 2017 Le Filament (<http://www.le-filament.com>) +// Copyright 2017-2022 Le Filament (<https://le-filament.com>) // License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). odoo.define("lefilament_tdb.previ_tresorerie", function (require) { @@ -140,20 +140,17 @@ odoo.define("lefilament_tdb.previ_tresorerie", function (require) { charges_fixes.push(null); } else if (k === 5) { charges_fixes.push(treso_r[5].treso); - } else { - // Trimestres - if (this.values.charges_periode.length > 0) { - if (["01", "04", "07", "10"].indexOf(data_months[k]) >= 0) { - charges_fixes.push( - this.values.charges_periode[0].sum + - this.values.charges_periode[1].sum - ); - } else { - charges_fixes.push(this.values.charges_periode[1].sum); - } + } else if (this.values.charges_periode.length > 0) { + if (["01", "04", "07", "10"].indexOf(data_months[k]) >= 0) { + charges_fixes.push( + this.values.charges_periode[0].sum + + this.values.charges_periode[1].sum + ); } else { - charges_fixes.push(null); + charges_fixes.push(this.values.charges_periode[1].sum); } + } else { + charges_fixes.push(null); } } diff --git a/static/src/js/tresorerie.js b/static/src/js/tresorerie.js index a1f6d7837d5e6b0c0c1c9be7622dfebe836a233b..86aa054f8c7dfaa8a662358eb48a45dc451db33b 100644 --- a/static/src/js/tresorerie.js +++ b/static/src/js/tresorerie.js @@ -1,4 +1,4 @@ -// © 2019 Le Filament (<http://www.le-filament.com>) +// Copyright 2019-2022 Le Filament (<https://le-filament.com>) // License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). odoo.define("lefilament_tdb.tresorerie", function (require) { diff --git a/static/src/xml/lefilament_tdb.xml b/static/src/xml/lefilament_tdb.xml index 5c8c32ef56f181b8b065f3ecaf341fb4d4bf5458..c7680cae9b928bff76ba21b3ebcc200475912297 100644 --- a/static/src/xml/lefilament_tdb.xml +++ b/static/src/xml/lefilament_tdb.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!-- Copyright 2017 Le Filament (<https://www.le-filament.com>) +<!-- Copyright 2017-2022 Le Filament (<https://le-filament.com>) License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <templates xml:space="preserve"> @@ -247,7 +247,7 @@ <p class="card-number"> <a id="statement_lines"> <t - t-raw="widget.render_monetary_color(widget.values.variation)" + t-esc="widget.render_monetary_color(widget.values.variation)" /> </a> </p> diff --git a/static/src/xml/lefilament_treso.xml b/static/src/xml/lefilament_treso.xml index bb04b7787310d5628e0e7be7498a9f4b5717a357..cca491c23b7411288a41fba9f9b0c76868090679 100644 --- a/static/src/xml/lefilament_treso.xml +++ b/static/src/xml/lefilament_treso.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!-- Copyright 2017 Le Filament (<https://www.le-filament.com>) +<!-- Copyright 2017-2022 Le Filament (<https://le-filament.com>) License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <templates xml:space="preserve"> diff --git a/views/assets.xml b/views/assets.xml deleted file mode 100644 index aa3657ebb6a71a1bd0a00c3b9364466bcd754bbb..0000000000000000000000000000000000000000 --- a/views/assets.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2017 Le Filament (<https://www.le-filament.com>) - License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> -<odoo> - <data> - - <template id="lefilament_tdb_assets_backend" inherit_id="web.assets_backend"> - <xpath expr="." position="inside"> - - <link - href="/lefilament_tdb/static/src/css/lefilament_tdb.css" - rel="stylesheet" - /> - - <script - type="text/javascript" - src="/lefilament_tdb/static/src/js/dashboard_year.js" - /> - <script - type="text/javascript" - src="/lefilament_tdb/static/src/js/tresorerie.js" - /> - <script - type="text/javascript" - src="/lefilament_tdb/static/src/js/previ_tresorerie.js" - /> - - </xpath> - </template> - - </data> -</odoo> diff --git a/views/schedule.xml b/views/schedule.xml index 08af0799a9e444c6c902d70d640ce2802746caaf..17facbc1ff10ead2e6c0f777a34713016a7ab6e9 100644 --- a/views/schedule.xml +++ b/views/schedule.xml @@ -1,21 +1,19 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2017 Le Filament (<https://www.le-filament.com>) +<!-- Copyright 2017-2022 Le Filament (<https://le-filament.com>) License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> -<odoo> - <data noupdate="1"> - <record id="ir_cron_lefilament_tdb" model="ir.cron"> - <field name="name">Tableau de Bord - Le Filament</field> - <field name="active" eval="True" /> - <field name="user_id" ref="base.user_root" /> - <field name="interval_number">1</field> - <field name="interval_type">months</field> - <field name="numbercall">-1</field> - <field name="doall" eval="True" /> - <field name="nextcall">2017-01-31 23:10:00</field> - <field name="model_id" ref="model_lefilament_dashboard" /> - <field name="code">model._new_data()</field> - <field name="state">code</field> - <field name="priority" eval="5" /> - </record> - </data> +<odoo noupdate="1"> + <record id="ir_cron_lefilament_tdb" model="ir.cron"> + <field name="name">Tableau de Bord - Le Filament</field> + <field name="active" eval="True" /> + <field name="user_id" ref="base.user_root" /> + <field name="interval_number">1</field> + <field name="interval_type">months</field> + <field name="numbercall">-1</field> + <field name="doall" eval="True" /> + <field name="nextcall">2017-01-31 23:10:00</field> + <field name="model_id" ref="model_lefilament_dashboard" /> + <field name="code">model._new_data()</field> + <field name="state">code</field> + <field name="priority" eval="5" /> + </record> </odoo> diff --git a/views/views.xml b/views/views.xml index 1be129bc7e73edf22826bf5aebfa81055ebb5283..64dc9418374d3afbbdb459fabac65f193546d32c 100644 --- a/views/views.xml +++ b/views/views.xml @@ -1,340 +1,332 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2017 Le Filament (<https://www.le-filament.com>) +<!-- Copyright 2017-2022 Le Filament (<https://le-filament.com>) License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <odoo> - <data> + <record id="lefilament_dashboard_action" model="ir.actions.act_window"> + <field name="name">Dashboard - Le Filament</field> + <field name="res_model">lefilament.dashboard</field> + <field name="view_mode">tree,graph,form,pivot</field> + </record> - <record id="lefilament_dashboard_action" model="ir.actions.act_window"> - <field name="name">Dashboard - Le Filament</field> - <field name="res_model">lefilament.dashboard</field> - <field name="view_mode">tree,graph,form,pivot</field> - </record> + <record id="lefilament_dashboard_variables_action" model="ir.actions.act_window"> + <field name="name">Variables Dashboard Le Filament</field> + <field name="res_model">res.company</field> + <field name="res_id">1</field> + <field name="view_mode">form</field> + </record> - <record - id="lefilament_dashboard_variables_action" - model="ir.actions.act_window" - > - <field name="name">Variables Dashboard Le Filament</field> - <field name="res_model">res.company</field> - <field name="res_id">1</field> - <field name="view_mode">form</field> - </record> + <record id="action_year_page" model="ir.actions.client"> + <field name="name">Rapport Annuel</field> + <field name="tag">lefilament_tdb.dashboard_year</field> + <field name="binding_model_id" ref="model_lefilament_dashboard" /> + <field name="binding_type">action</field> + </record> - <record id="action_year_page" model="ir.actions.client"> - <field name="name">Rapport Annuel</field> - <field name="tag">lefilament_tdb.dashboard_year</field> - <field name="binding_model_id" ref="model_lefilament_dashboard" /> - <field name="binding_type">action</field> - </record> + <record id="action_tresorerie" model="ir.actions.client"> + <field name="name">Trésorerie</field> + <field name="tag">lefilament_tdb.tresorerie</field> + <field name="target">current</field> + <field name="binding_model_id" ref="model_lefilament_dashboard" /> + <field name="binding_type">action</field> + </record> - <record id="action_tresorerie" model="ir.actions.client"> - <field name="name">Trésorerie</field> - <field name="tag">lefilament_tdb.tresorerie</field> - <field name="target">current</field> - <field name="binding_model_id" ref="model_lefilament_dashboard" /> - <field name="binding_type">action</field> - </record> + <record id="action_previ_tresorerie" model="ir.actions.client"> + <field name="name">Prévisionnel Trésorerie</field> + <field name="tag">lefilament_tdb.previ_tresorerie</field> + <field name="target">current</field> + <field name="binding_model_id" ref="model_lefilament_dashboard" /> + <field name="binding_type">action</field> + </record> - <record id="action_previ_tresorerie" model="ir.actions.client"> - <field name="name">Prévisionnel Trésorerie</field> - <field name="tag">lefilament_tdb.previ_tresorerie</field> - <field name="target">current</field> - <field name="binding_model_id" ref="model_lefilament_dashboard" /> - <field name="binding_type">action</field> - </record> + <menuitem + id="lefilament_dashboard_menu" + name="Dashboard" + sequence="10" + groups="group_dashboard" + web_icon="lefilament_tdb,static/description/icon_menu.png" + /> - <menuitem - id="lefilament_dashboard_menu" - name="Dashboard" - sequence="10" - groups="group_dashboard" - web_icon="lefilament_tdb,static/description/icon_menu.png" - /> + <menuitem + id="lefilament_dashboard_report" + parent="lefilament_dashboard_menu" + name="Rapports" + sequence="1" + /> - <menuitem - id="lefilament_dashboard_report" - parent="lefilament_dashboard_menu" - name="Rapports" - sequence="1" - /> + <menuitem + id="lefilament_dashboard_report_year" + parent="lefilament_dashboard_report" + name="Annuel" + sequence="1" + action="action_year_page" + /> + <menuitem + id="lefilament_tresorerie" + parent="lefilament_dashboard_report" + name="Tréso" + sequence="3" + action="action_tresorerie" + /> + <menuitem + id="lefilament_previ_tresorerie" + parent="lefilament_dashboard_report" + name="Prévi Tréso" + sequence="3" + action="action_previ_tresorerie" + /> - <menuitem - id="lefilament_dashboard_report_year" - parent="lefilament_dashboard_report" - name="Annuel" - sequence="1" - action="action_year_page" - /> - <menuitem - id="lefilament_tresorerie" - parent="lefilament_dashboard_report" - name="Tréso" - sequence="3" - action="action_tresorerie" - /> - <menuitem - id="lefilament_previ_tresorerie" - parent="lefilament_dashboard_report" - name="Prévi Tréso" - sequence="3" - action="action_previ_tresorerie" - /> + <menuitem + id="lefilament_dashboard_conf" + parent="lefilament_dashboard_menu" + name="Configuration" + sequence="10" + /> + <menuitem + id="lefilament_dashboard_datas" + parent="lefilament_dashboard_conf" + name="Données" + action="lefilament_dashboard_action" + sequence="10" + /> + <menuitem + id="lefilament_dashboard_variables" + parent="lefilament_dashboard_conf" + name="Variables" + action="lefilament_dashboard_variables_action" + sequence="10" + /> - <menuitem - id="lefilament_dashboard_conf" - parent="lefilament_dashboard_menu" - name="Configuration" - sequence="10" - /> - <menuitem - id="lefilament_dashboard_datas" - parent="lefilament_dashboard_conf" - name="Données" - action="lefilament_dashboard_action" - sequence="10" - /> - <menuitem - id="lefilament_dashboard_variables" - parent="lefilament_dashboard_conf" - name="Variables" - action="lefilament_dashboard_variables_action" - sequence="10" - /> - - <record id="view_invoice_tree" model="ir.ui.view"> - <field name="name">account.invoice.tree</field> - <field name="model">account.move</field> - <field name="arch" type="xml"> - <tree string="Invoices"> - <field name="name" decoration-bf="1" /> - <field name="invoice_date" string="Date Facturation" /> - <field name="partner_id" string="Client" /> - <field name="invoice_date_due" /> - <field name="invoice_origin" /> - <field name="payment_reference" optional="hide" /> - <field name="ref" optional="hide" /> - <field name="invoice_user_id" widget="many2one_avatar_user" /> - <field - name="amount_untaxed_signed" - string="Montant HT" - sum="Total" - decoration-bf="1" - /> - <field name="amount_tax_signed" sum="Total" optional="hide" /> - <field - name="amount_total_signed" - string="Total" - sum="Total" - optional="show" - /> - <field - name="amount_residual_signed" - string="Montant Dû" - sum="Amount Due" - optional="show" - /> - <field name="currency_id" invisible="1" /> - <field name="company_currency_id" invisible="1" /> - <field - name="state" - widget="badge" - decoration-success="state == 'posted'" - decoration-info="state == 'draft'" - optional="show" - /> - <field - name="payment_state" - widget="badge" - decoration-danger="payment_state == 'not_paid'" - decoration-warning="payment_state in ('partial', 'in_payment')" - decoration-success="payment_state in ('paid', 'reversed')" - attrs="{'invisible': [('payment_state', 'in', ('invoicing_legacy'))]}" - /> - <field name="move_type" invisible="1" /> - </tree> - </field> - </record> + <record id="view_invoice_tree" model="ir.ui.view"> + <field name="name">account.invoice.tree</field> + <field name="model">account.move</field> + <field name="arch" type="xml"> + <tree> + <field name="name" decoration-bf="1" /> + <field name="invoice_date" string="Date Facturation" /> + <field name="partner_id" string="Client" /> + <field name="invoice_date_due" /> + <field name="invoice_origin" /> + <field name="payment_reference" optional="hide" /> + <field name="ref" optional="hide" /> + <field name="invoice_user_id" widget="many2one_avatar_user" /> + <field + name="amount_untaxed_signed" + string="Montant HT" + sum="Total" + decoration-bf="1" + /> + <field name="amount_tax_signed" sum="Total" optional="hide" /> + <field + name="amount_total_signed" + string="Total" + sum="Total" + optional="show" + /> + <field + name="amount_residual_signed" + string="Montant Dû" + sum="Amount Due" + optional="show" + /> + <field name="currency_id" invisible="1" /> + <field name="company_currency_id" invisible="1" /> + <field + name="state" + widget="badge" + decoration-success="state == 'posted'" + decoration-info="state == 'draft'" + optional="show" + /> + <field + name="payment_state" + widget="badge" + decoration-danger="payment_state == 'not_paid'" + decoration-warning="payment_state in ('partial', 'in_payment')" + decoration-success="payment_state in ('paid', 'reversed')" + attrs="{'invisible': [('payment_state', 'in', ('invoicing_legacy'))]}" + /> + <field name="move_type" invisible="1" /> + </tree> + </field> + </record> - <record id="lefilament_dashboard_tree" model="ir.ui.view"> - <field name="name">Le Filament Dashboard Treeview</field> - <field name="model">lefilament.dashboard</field> - <field name="arch" type="xml"> - <tree string="Liste des Mois"> - <field name="date_tdb" widget="date" /> - <field name="name" /> - <field name="ca_mois" sum="Chiffre d'Affaire" /> - <field name="pipe_mois" avg="pipe" /> - <field name="treso" avg="Treso" /> - <field name="variation" avg="Variation" /> - <field name="charges" avg="Décaissé" /> - <field name="encaisse" avg="Encaissé" /> - <field name="charges_fixes" /> - <field name="runway" /> - </tree> - </field> - </record> + <record id="lefilament_dashboard_tree" model="ir.ui.view"> + <field name="name">Le Filament Dashboard Treeview</field> + <field name="model">lefilament.dashboard</field> + <field name="arch" type="xml"> + <tree> + <field name="date_tdb" widget="date" /> + <field name="name" /> + <field name="ca_mois" sum="Chiffre d'Affaire" /> + <field name="pipe_mois" avg="pipe" /> + <field name="treso" avg="Treso" /> + <field name="variation" avg="Variation" /> + <field name="charges" avg="Décaissé" /> + <field name="encaisse" avg="Encaissé" /> + <field name="charges_fixes" /> + <field name="runway" /> + </tree> + </field> + </record> - <record model="ir.ui.view" id="lefilament_dashboard_pivot"> - <field name="name">Le Filament Dashboard Pivot</field> - <field name="model">lefilament.dashboard</field> - <field name="type">pivot</field> - <field name="arch" type="xml"> - <graph string="TDB Le Filament"> - <field name="ca_mois" type="measure" /> - <field name="pipe_mois" type="measure" /> - <field name="date_tdb" type="row" /> - </graph> - </field> - </record> + <record model="ir.ui.view" id="lefilament_dashboard_pivot"> + <field name="name">Le Filament Dashboard Pivot</field> + <field name="model">lefilament.dashboard</field> + <field name="type">pivot</field> + <field name="arch" type="xml"> + <graph string="TDB Le Filament"> + <field name="ca_mois" type="measure" /> + <field name="pipe_mois" type="measure" /> + <field name="date_tdb" type="row" /> + </graph> + </field> + </record> - <record model="ir.ui.view" id="lefilament_dashboard_graph"> - <field name="name">Le Filament Dashboard Graph</field> - <field name="model">lefilament.dashboard</field> - <field name="type">graph</field> - <field name="arch" type="xml"> - <graph string="TDB Le Filament"> - <field name="ca_mois" type="measure" /> - <field name="date_tdb" type="col" /> - </graph> - </field> - </record> + <record model="ir.ui.view" id="lefilament_dashboard_graph"> + <field name="name">Le Filament Dashboard Graph</field> + <field name="model">lefilament.dashboard</field> + <field name="type">graph</field> + <field name="arch" type="xml"> + <graph string="TDB Le Filament"> + <field name="ca_mois" type="measure" /> + <field name="date_tdb" type="col" /> + </graph> + </field> + </record> - <record id="lefilament_dashboard_form" model="ir.ui.view"> - <field name="name">Le Filament Dashboard Formview</field> - <field name="model">lefilament.dashboard</field> - <field name="arch" type="xml"> - <form string="Liste des Mois"> - <header> - <button - string="MaJ Valeurs" - type="object" - name="get_month_values" - class="oe_highlight" - /> - </header> - <div class="container"> - <div class="col-xs-12 tdb_form"> - <h3>Mois</h3> - <hr /> - <group> - <field name="date_tdb" widget="date" /> - <field name="name" /> - </group> - </div> - <div class="col-xs-6 tdb_form"> - <h3>Chiffres</h3> - <hr /> - <group> - <field name="ca_mois" widget="monetary" /> - <field name="cmd_mois" widget="monetary" /> - <field name="pipe_mois" widget="monetary" /> - </group> - </div> - <div class="col-xs-6 tdb_form"> - <h3>Trésorerie</h3> - <hr /> - <group> - <field name="treso" widget="monetary" /> - <field name="variation" widget="monetary" /> - <field name="charges" widget="monetary" /> - <field name="encaisse" widget="monetary" /> - <field name="charges_fixes" widget="monetary" /> - <field name="runway" widget="monetary" /> - </group> - </div> + <record id="lefilament_dashboard_form" model="ir.ui.view"> + <field name="name">Le Filament Dashboard Formview</field> + <field name="model">lefilament.dashboard</field> + <field name="arch" type="xml"> + <form string="Liste des Mois"> + <header> + <button + string="MaJ Valeurs" + type="object" + name="get_month_values" + class="oe_highlight" + /> + </header> + <div class="container"> + <div class="col-xs-12 tdb_form"> + <h3>Mois</h3> + <hr /> + <group> + <field name="date_tdb" widget="date" /> + <field name="name" /> + </group> + </div> + <div class="col-xs-6 tdb_form"> + <h3>Chiffres</h3> + <hr /> + <group> + <field name="ca_mois" widget="monetary" /> + <field name="cmd_mois" widget="monetary" /> + <field name="pipe_mois" widget="monetary" /> + </group> </div> - </form> - </field> - </record> + <div class="col-xs-6 tdb_form"> + <h3>Trésorerie</h3> + <hr /> + <group> + <field name="treso" widget="monetary" /> + <field name="variation" widget="monetary" /> + <field name="charges" widget="monetary" /> + <field name="encaisse" widget="monetary" /> + <field name="charges_fixes" widget="monetary" /> + <field name="runway" widget="monetary" /> + </group> + </div> + </div> + </form> + </field> + </record> - <!-- FILTRES --> - <record id="lefilament_dashboard_search" model="ir.ui.view"> - <field name="name">Le Filament Dashboard Searchview</field> - <field name="model">lefilament.dashboard</field> - <field name="arch" type="xml"> - <search> - <field name="name" /> + <!-- FILTRES --> + <record id="lefilament_dashboard_search" model="ir.ui.view"> + <field name="name">Le Filament Dashboard Searchview</field> + <field name="model">lefilament.dashboard</field> + <field name="arch" type="xml"> + <search> + <field name="name" /> + <filter + string="Cette année" + name="this_year" + domain="[ ('date_tdb', '>=', (context_today()-relativedelta(years=0)).strftime('%Y-01-01')),]" + /> + <filter + string="L'année dernière" + name="last_year" + domain="[ ('date_tdb', '>=', (context_today()-relativedelta(years=1)).strftime('%Y-01-01')), ('date_tdb', '<=', (context_today()-relativedelta(years=1)).strftime('%Y-12-31'))]" + /> + + <group expand="0" name="group_by" string="Group By"> <filter - string="Cette année" - name="this_year" - domain="[ ('date_tdb', '>=', (context_today()-relativedelta(years=0)).strftime('%Y-01-01')),]" + string="Trimestre" + name="trimestre" + context="{'group_by':'date_tdb:quarter'}" + domain="[]" /> <filter - string="L'année dernière" - name="last_year" - domain="[ ('date_tdb', '>=', (context_today()-relativedelta(years=1)).strftime('%Y-01-01')), ('date_tdb', '<=', (context_today()-relativedelta(years=1)).strftime('%Y-12-31'))]" + string="An" + name="an" + context="{'group_by':'date_tdb:year'}" + domain="[]" /> + </group> + </search> + </field> + </record> - <group expand="0" name="group_by" string="Group By"> - <filter - string="Trimestre" - name="trimestre" - context="{'group_by':'date_tdb:quarter'}" - domain="[]" - /> - <filter - string="An" - name="an" - context="{'group_by':'date_tdb:year'}" - domain="[]" - /> - </group> - </search> - </field> - </record> - - <!-- Company Form --> - <record id="view_form_lefilament_company_form_inherited" model="ir.ui.view"> - <field name="name">res.company.form.tdb</field> - <field name="model">res.company</field> - <field name="inherit_id" ref="base.view_company_form" /> - <field name="arch" type="xml"> - <xpath expr="//page[1]" position="after"> - <page name="tdb" string="Tableau de Bord"> - <group> - <group string="Données Annuelles"> - <field name="ca_target" /> - </group> - <group string="Données Mensuelles"> - <field name="charges_fixes" /> - </group> + <!-- Company Form --> + <record id="view_form_lefilament_company_form_inherited" model="ir.ui.view"> + <field name="name">res.company.form.tdb</field> + <field name="model">res.company</field> + <field name="inherit_id" ref="base.view_company_form" /> + <field name="arch" type="xml"> + <xpath expr="//page[1]" position="after"> + <page name="tdb" string="Tableau de Bord"> + <group> + <group string="Données Annuelles"> + <field name="ca_target" /> </group> - </page> - <page name="tdb" string="Prévisonnel"> - <field name="previ_treso_ids" /> - </page> - </xpath> - </field> - </record> - - <!-- Company Form --> - <record id="view_form_lefilament_emplyee_form_inherited" model="ir.ui.view"> - <field name="name">hr.employee.form.tdb</field> - <field name="model">hr.employee</field> - <field name="inherit_id" ref="hr.view_employee_form" /> - <field name="arch" type="xml"> - <xpath expr="//field[@name='work_phone']" position="after"> - <field name="capital" /> - </xpath> - </field> - </record> - - <!-- Prévi Tréso --> - <record id="view_tree_lefilament_previ_treso" model="ir.ui.view"> - <field name="name">previ.treso</field> - <field name="model">previ.treso</field> - <field name="arch" type="xml"> - <tree string="Prévisionnel Tréso" editable="top"> - <field name="name" /> - <field name="periode" /> - <field name="date" /> - <field name="montant" sum="Total" /> - </tree> - </field> - </record> + <group string="Données Mensuelles"> + <field name="charges_fixes" /> + </group> + </group> + </page> + <page name="tdb" string="Prévisonnel"> + <field name="previ_treso_ids" /> + </page> + </xpath> + </field> + </record> + <!-- Company Form --> + <record id="view_form_lefilament_emplyee_form_inherited" model="ir.ui.view"> + <field name="name">hr.employee.form.tdb</field> + <field name="model">hr.employee</field> + <field name="inherit_id" ref="hr.view_employee_form" /> + <field name="arch" type="xml"> + <xpath expr="//field[@name='work_phone']" position="after"> + <field name="capital" /> + </xpath> + </field> + </record> - </data> + <!-- Prévi Tréso --> + <record id="view_tree_lefilament_previ_treso" model="ir.ui.view"> + <field name="name">previ.treso</field> + <field name="model">previ.treso</field> + <field name="arch" type="xml"> + <tree editable="top"> + <field name="name" /> + <field name="periode" /> + <field name="date" /> + <field name="montant" sum="Total" /> + </tree> + </field> + </record> </odoo>