diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..bfd7ac53df9f103f6dc8853738c63fd364445fde --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000000000000000000000000000000000000..88f2881b4c128fc4762338a8f420272c44cc29ef --- /dev/null +++ b/.eslintrc.yml @@ -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 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000000000000000000000000000000000000..e397e8ed4e3e7f7fe7785dd391bb80aa6d85575e --- /dev/null +++ b/.flake8 @@ -0,0 +1,12 @@ +[flake8] +max-line-length = 88 +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 +per-file-ignores= + __init__.py:F401 diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 0000000000000000000000000000000000000000..0ec187efd1bf802844749f508cda0c8f138970f9 --- /dev/null +++ b/.isort.cfg @@ -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 +ensure_newline_before_comments = True diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cb8b5ef27a4408c9767c962d0f4e70fb99715061 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,123 @@ +exclude: | + (?x) + # NOT INSTALLABLE ADDONS + # END NOT INSTALLABLE ADDONS + # 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/| + # 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 + node: "14.13.0" +repos: + - repo: local + hooks: + # These files are most likely copier diff rejection junks; if found, + # review them manually, fix the problem (if needed) and remove them + - id: forbidden-files + name: forbidden files + entry: found forbidden files; remove them + language: fail + files: "\\.rej$" + - repo: https://github.com/oca/maintainer-tools + rev: ab1d7f6 + hooks: + # update the NOT INSTALLABLE ADDONS section above + - id: oca-update-pre-commit-excluded-addons + - repo: https://github.com/myint/autoflake + rev: v1.4 + hooks: + - id: autoflake + args: + - --expand-star-imports + - --ignore-init-module-imports + - --in-place + - --remove-all-unused-imports + - --remove-duplicate-keys + - --remove-unused-variables + - repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.1.2 + hooks: + - id: prettier + name: prettier (with plugin-xml) + additional_dependencies: + - "prettier@2.1.2" + - "@prettier/plugin-xml@0.12.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 + hooks: + - id: eslint + verbose: true + args: + - --color + - --fix + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.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://github.com/asottile/pyupgrade + rev: v2.7.2 + hooks: + - id: pyupgrade + args: ["--keep-percent-format"] + - repo: https://github.com/PyCQA/isort + rev: 5.5.1 + hooks: + - id: isort + name: isort except __init__.py + args: + - --settings=. + exclude: /__init__\.py$ + - repo: https://gitlab.com/PyCQA/flake8 + rev: 3.8.3 + hooks: + - id: flake8 + name: flake8 + additional_dependencies: ["flake8-bugbear==20.1.4"] + - repo: https://github.com/PyCQA/pylint + rev: pylint-2.5.3 + hooks: + - id: pylint + 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 + args: + - --rcfile=.pylintrc-mandatory + additional_dependencies: *pylint_deps diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 0000000000000000000000000000000000000000..5b6d4b361ace92f3877993bf2848fac190d8fab6 --- /dev/null +++ b/.prettierrc.yml @@ -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: "strict" diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000000000000000000000000000000000000..c3d0a5c839baeee21312961c56158de4936fdc91 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,88 @@ +[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=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 + +[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, + development-status-allowed, + 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, + 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-manifest-dependency, + 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 diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory new file mode 100644 index 0000000000000000000000000000000000000000..43ea23947166ff8080219007cfae43ec54a28f8e --- /dev/null +++ b/.pylintrc-mandatory @@ -0,0 +1,64 @@ +[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=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 + +[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, + development-status-allowed, + 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, + 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 diff --git a/README.rst b/README.rst index f0117e16e08c51f6969964b535b8d1c0b59022e3..f4d1eb38bc79151c002440b22ce232e0c6720e38 100644 --- a/README.rst +++ b/README.rst @@ -28,13 +28,13 @@ Configuration des rapports Modification du Header ---------------------- -* `Configuration >> Paramètres généraux >> Editer l'entête de la page externe` +* `Configuration >> Paramètres généraux >> Editer l'entête de la page externe` Modification du Footer ---------------------- -* `Configuration >> Paramètres généraux >> Editer le pied de page de la page externe` +* `Configuration >> Paramètres généraux >> Editer le pied de page de la page externe` Credits @@ -53,4 +53,4 @@ Maintainer :alt: Le Filament :target: https://le-filament.com -This module is maintained by `Le Filament <https://le-filament.com>`_ \ No newline at end of file +This module is maintained by `Le Filament <https://le-filament.com>`_ diff --git a/__manifest__.py b/__manifest__.py index 5dd7ffcee2df9e0c7fca41765e030c66e5391282..7f586a7fbf20b0ea2d6b6432bccd0be1e668a24b 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,21 +1,20 @@ -{ - 'name': 'ARBRE & PAYSAGE - Rapports', - 'summary': "Création d'un template spécifique Arbre & Paysage", - 'description': "Création d'un template spécifique Arbre & Paysage", - 'author': 'LE FILAMENT', - 'version': '14.0.0.0.1', - 'license': "AGPL-3", - 'depends': ['web','ap_sale_project'], - 'qweb': [], - 'data': [ - 'data/paperformat_data.xml', - 'views/res_company_views.xml', - 'views/report_templates.xml', - 'views/report_sale.xml', - 'views/report_account.xml', - 'data/report_layout.xml', - 'views/report_compositions.xml', - 'views/report_composition_templates.xml', - 'views/report_delivery_ap_template.xml', - ], -} +{ + "name": "ARBRE & PAYSAGE - Rapports", + "summary": "Création d'un template spécifique Arbre & Paysage", + "author": "Le Filament", + "version": "14.0.0.0.1", + "license": "AGPL-3", + "depends": ["web", "ap_sale_project"], + "qweb": [], + "data": [ + "data/paperformat_data.xml", + "views/res_company_views.xml", + "views/report_templates.xml", + "views/report_sale.xml", + "views/report_account.xml", + "data/report_layout.xml", + "views/report_compositions.xml", + "views/report_composition_templates.xml", + "views/report_delivery_ap_template.xml", + ], +} diff --git a/data/paperformat_data.xml b/data/paperformat_data.xml index 8c8b8fc025a42fff0727653b7d595d7533a25151..f6250bbfd1e65a3aaacb2018ebe0a18d3c9d4c6a 100644 --- a/data/paperformat_data.xml +++ b/data/paperformat_data.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <data noupdate="1"> <record id="paperformat_landscape" model="report.paperformat"> @@ -18,4 +18,4 @@ </record> </data> -</odoo> \ No newline at end of file +</odoo> diff --git a/data/report_layout.xml b/data/report_layout.xml index fa78da642a0f54964f2a465cd20e6d051504a460..6539607d46cf5ed68e3ecc874ff39e646c8974ed 100644 --- a/data/report_layout.xml +++ b/data/report_layout.xml @@ -1,11 +1,11 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <data> <record id="ap_report_layout" model="report.layout"> <field name="name">Arbre et Paysage</field> <field name="sequence">5</field> - <field name="view_id" ref="ap_report.ap_external_layout_generic"/> + <field name="view_id" ref="ap_report.ap_external_layout_generic" /> <field name="image">/ap_report/static/src/img/preview_generic.png</field> <field name="pdf">/ap_report/static/pdf/preview_generic.pdf</field> </record> @@ -13,7 +13,7 @@ <record id="ap_report_layout_compo" model="report.layout"> <field name="name">Arbre et Paysage Composition</field> <field name="sequence">6</field> - <field name="view_id" ref="ap_report.ap_external_layout_generic_compo"/> + <field name="view_id" ref="ap_report.ap_external_layout_generic_compo" /> <field name="image">/ap_report/static/src/img/preview_generic.png</field> <field name="pdf">/ap_report/static/pdf/preview_generic.pdf</field> </record> diff --git a/models/base_document_layout.py b/models/base_document_layout.py index b9e7bcf881f0c35b00f8cf52e05600ea709e6426..99e39a710b64f25a6ddfdf3f4893ee275e70b635 100644 --- a/models/base_document_layout.py +++ b/models/base_document_layout.py @@ -1,7 +1,7 @@ # Copyright 2021 Le Filament (<http://www.le-filament.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import fields, models, api +from odoo import fields, models class BaseDocumentLayout(models.TransientModel): @@ -9,15 +9,15 @@ class BaseDocumentLayout(models.TransientModel): Customise the company document layout and display a live preview """ - _inherit = 'base.document.layout' + _inherit = "base.document.layout" # ------------------------------------------------------ # Fields declaration # ------------------------------------------------------ - formation = fields.Char(related='company_id.formation', readonly=True) - company_type = fields.Char(related='company_id.company_type', readonly=True) - siret = fields.Char(related='company_id.siret', readonly=True) - ape = fields.Char(related='company_id.ape', readonly=True) + formation = fields.Char(related="company_id.formation", readonly=True) + company_type = fields.Char(related="company_id.company_type", readonly=True) + siret = fields.Char(related="company_id.siret", readonly=True) + ape = fields.Char(related="company_id.ape", readonly=True) # ------------------------------------------------------ # SQL Constraints diff --git a/models/res_company.py b/models/res_company.py index 20fbc7346ab684485363040ceeb670bdef5a2de5..fae77ac1a4acfa6a0a5b93a1ea798b066b223e7d 100644 --- a/models/res_company.py +++ b/models/res_company.py @@ -1,12 +1,12 @@ # Copyright 2021 Le Filament (<http://www.le-filament.com>) # License AGPL-3 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import models, fields +from odoo import fields, models class FilResCompany(models.Model): - _inherit = 'res.company' + _inherit = "res.company" text_report = fields.Char("Texte à afficher sur les rapports") - formation = fields.Char('N° Organisme de formation') - company_type = fields.Char('Type de société') + formation = fields.Char("N° Organisme de formation") + company_type = fields.Char("Type de société") diff --git a/static/src/scss/layout_generic.scss b/static/src/scss/layout_generic.scss index f1787e521fef1c87cfcab90a1b3d70479c4bf342..ae4e4d13f936cc514147768c69225b60a210e305 100644 --- a/static/src/scss/layout_generic.scss +++ b/static/src/scss/layout_generic.scss @@ -3,7 +3,7 @@ address div:first-child { font-size: 17px; } -address .align-items-baseline{ +address .align-items-baseline { font-weight: normal !important; font-size: 15px !important; text-transform: lowercase !important; @@ -13,27 +13,30 @@ address .align-items-baseline{ border-bottom: 0px solid #e9ecef !important; } -.o_standard_footer{ - color: gray('700') !important; +.o_standard_footer { + color: gray("700") !important; font-size: 15px !important; } -.o_report_layout_boxed .row > div > table.table-compo tr:last-child td, -{ +.o_report_layout_boxed .row > div > table.table-compo tr:last-child td { background-color: inherit !important; color: inherit !important; } -.o_report_layout_boxed .row > div > table.table-compo tr:last-child td:first-child, -{ +.o_report_layout_boxed .row > div > table.table-compo tr:last-child td:first-child { border-right: 1px solid #495057; } -.o_report_layout_boxed table.table-compo tbody tr td{ +.o_report_layout_boxed table.table-compo tbody tr td { border-top: 1px solid; border-right: 1px solid #495057; } -.o_report_layout_boxed .row:not(#total) > div > table.table-compo tr:not(:first-child):not(:last-child) td:last-child { +.o_report_layout_boxed + .row:not(#total) + > div + > table.table-compo + tr:not(:first-child):not(:last-child) + td:last-child { background-color: inherit !important; -} \ No newline at end of file +} diff --git a/views/report_account.xml b/views/report_account.xml index f49467f25f8756734f19481b80eaa6185103b0d3..6ea4aaf2cf43c0e08bfb22b7f8e2eb8d18ed472d 100644 --- a/views/report_account.xml +++ b/views/report_account.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <template id="report_invoice_document" inherit_id="account.report_invoice_document"> @@ -7,47 +7,82 @@ </t> <xpath expr="//h2" position="replace"> <div class="row mb-16"> - <div class="col-6"></div> + <div class="col-6" /> <div class="col-6"> <h2> - <span t-if="o.move_type == 'out_invoice' and o.state == 'posted'">Facture</span> - <span t-if="o.move_type == 'out_invoice' and o.state == 'draft'">Facture en brouillon</span> - <span t-if="o.move_type == 'out_invoice' and o.state == 'cancel'">Facture annulée</span> + <span + t-if="o.move_type == 'out_invoice' and o.state == 'posted'" + >Facture</span> + <span + t-if="o.move_type == 'out_invoice' and o.state == 'draft'" + >Facture en brouillon</span> + <span + t-if="o.move_type == 'out_invoice' and o.state == 'cancel'" + >Facture annulée</span> <span t-if="o.move_type == 'out_refund'">Avoir</span> - <span t-if="o.move_type == 'in_refund'">Avoir de fournisseur</span> - <span t-if="o.move_type == 'in_invoice'">Facture fournisseur</span> - <span t-if="o.name != '/'" t-field="o.name"/> + <span + t-if="o.move_type == 'in_refund'" + >Avoir de fournisseur</span> + <span + t-if="o.move_type == 'in_invoice'" + >Facture fournisseur</span> + <span t-if="o.name != '/'" t-field="o.name" /> </h2> - <address t-field="o.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> + <address + t-field="o.partner_id" + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' + /> <div t-if="o.partner_id.vat" class="mt16"> - <t t-if="o.company_id.country_id.vat_label" t-esc="o.company_id.country_id.vat_label" id="inv_tax_id_label"/> - <t t-else="">Tax ID</t>: <span t-field="o.partner_id.vat"/> + <t + t-if="o.company_id.country_id.vat_label" + t-esc="o.company_id.country_id.vat_label" + id="inv_tax_id_label" + /> + <t t-else="">Tax ID</t>: <span t-field="o.partner_id.vat" /> </div> </div> </div> </xpath> <xpath expr="//p[@name='payment_communication']" position="before"> - <p t-if="o.company_id.text_report" name="payment_communication" class="mt-2 text-right"> - <t t-esc="o.company_id.text_report"/> + <p + t-if="o.company_id.text_report" + name="payment_communication" + class="mt-2 text-right" + > + <t t-esc="o.company_id.text_report" /> </p> </xpath> <div id="informations" position="replace"> - <div class="pt-3"></div> + <div class="pt-3" /> <div id="informations" class="row mt32 mb32"> - <div class="col-auto col-3 mw-100 mb-2" t-if="o.invoice_origin" name="origin"> + <div + class="col-auto col-3 mw-100 mb-2" + t-if="o.invoice_origin" + name="origin" + > <strong>Origine:</strong> - <p class="m-0" t-field="o.invoice_origin"/> + <p class="m-0" t-field="o.invoice_origin" /> </div> - <div class="col-auto col-3 mw-100 mb-2" t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'" name="due_date"> + <div + class="col-auto col-3 mw-100 mb-2" + t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'" + name="due_date" + > <strong>Echéance:</strong> - <p class="m-0" t-field="o.invoice_date_due"/> + <p class="m-0" t-field="o.invoice_date_due" /> </div> - <div class="col-auto col-3 mw-100 mb-2" t-if="o.invoice_user_id" name="referent"> + <div + class="col-auto col-3 mw-100 mb-2" + t-if="o.invoice_user_id" + name="referent" + > <strong>Référent:</strong> - <p class="m-0"><span t-field="o.invoice_user_id"/><t t-if="o.invoice_user_id.phone">, <t t-esc="o.invoice_user_id.phone"/></t></p> + <p class="m-0"><span t-field="o.invoice_user_id" /><t + t-if="o.invoice_user_id.phone" + >, <t t-esc="o.invoice_user_id.phone" /></t></p> </div> </div> </div> @@ -56,68 +91,143 @@ <table class="table table-sm o_main_table" name="invoice_line_table"> <thead> <tr> - <th name="th_description" class="text-left"><span>Description</span></th> - <th name="th_quantity" class="text-right"><span>Quantité</span></th> - <th name="th_priceunit" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"><span>Prix unitaire</span></th> - <th name="th_price_unit" t-if="display_discount" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"> + <th name="th_description" class="text-left"><span + >Description</span></th> + <th name="th_quantity" class="text-right"><span + >Quantité</span></th> + <th + name="th_priceunit" + t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" + ><span>Prix unitaire</span></th> + <th + name="th_price_unit" + t-if="display_discount" + t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" + > <span>Rem.%</span> </th> - <th t-if="o.company_id.vat" name="th_taxes" t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"><span>Taxes</span></th> + <th + t-if="o.company_id.vat" + name="th_taxes" + t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" + ><span>Taxes</span></th> <th name="th_subtotal" class="text-right"> - <t t-if="o.company_id.vat"><span groups="account.group_show_line_subtotals_tax_excluded">Montant HT</span></t> - <t t-else=""><span groups="account.group_show_line_subtotals_tax_excluded">Montant</span></t> - <span groups="account.group_show_line_subtotals_tax_included">Prix total</span> + <t t-if="o.company_id.vat"><span + groups="account.group_show_line_subtotals_tax_excluded" + >Montant HT</span></t> + <t t-else=""><span + groups="account.group_show_line_subtotals_tax_excluded" + >Montant</span></t> + <span + groups="account.group_show_line_subtotals_tax_included" + >Prix total</span> </th> </tr> </thead> <tbody class="invoice_tbody"> - <t t-set="current_subtotal" t-value="0"/> - <t t-set="lines" t-value="o.invoice_line_ids.sorted(key=lambda l: (-l.sequence, l.date, l.move_name, -l.id), reverse=True)"/> + <t t-set="current_subtotal" t-value="0" /> + <t + t-set="lines" + t-value="o.invoice_line_ids.sorted(key=lambda l: (-l.sequence, l.date, l.move_name, -l.id), reverse=True)" + /> <t t-foreach="lines" t-as="line"> - <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/> - <t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/> + <t + t-set="current_subtotal" + t-value="current_subtotal + line.price_subtotal" + groups="account.group_show_line_subtotals_tax_excluded" + /> + <t + t-set="current_subtotal" + t-value="current_subtotal + line.price_total" + groups="account.group_show_line_subtotals_tax_included" + /> - <tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''"> - <t t-if="not line.display_type" name="account_invoice_line_accountable"> - <td name="account_invoice_line_name"><span t-field="line.name" t-options="{'widget': 'text'}"/></td> + <tr + t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''" + > + <t + t-if="not line.display_type" + name="account_invoice_line_accountable" + > + <td name="account_invoice_line_name"><span + t-field="line.name" + t-options="{'widget': 'text'}" + /></td> <td class="text-right"> - <span t-field="line.quantity"/> - <span t-field="line.product_uom_id" groups="uom.group_uom"/> + <span t-field="line.quantity" /> + <span + t-field="line.product_uom_id" + groups="uom.group_uom" + /> </td> - <td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"> - <span class="text-nowrap" t-field="line.price_unit"/> + <td + t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" + > + <span + class="text-nowrap" + t-field="line.price_unit" + /> </td> - <td t-if="display_discount" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"> - <span class="text-nowrap" t-field="line.discount"/> + <td + t-if="display_discount" + t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" + > + <span class="text-nowrap" t-field="line.discount" /> </td> - <td t-if="o.company_id.vat" t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"> - <span t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_ids))" id="line_tax_ids"/> + <td + t-if="o.company_id.vat" + t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" + > + <span + t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_ids))" + id="line_tax_ids" + /> </td> <td class="text-right o_price_total"> - <span class="text-nowrap" t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/> - <span class="text-nowrap" t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/> + <span + class="text-nowrap" + t-field="line.price_subtotal" + groups="account.group_show_line_subtotals_tax_excluded" + /> + <span + class="text-nowrap" + t-field="line.price_total" + groups="account.group_show_line_subtotals_tax_included" + /> </td> </t> <t t-if="line.display_type == 'line_section'"> <td colspan="99"> - <span t-field="line.name" t-options="{'widget': 'text'}"/> + <span + t-field="line.name" + t-options="{'widget': 'text'}" + /> </td> - <t t-set="current_section" t-value="line"/> - <t t-set="current_subtotal" t-value="0"/> + <t t-set="current_section" t-value="line" /> + <t t-set="current_subtotal" t-value="0" /> </t> <t t-if="line.display_type == 'line_note'"> <td colspan="99"> - <span t-field="line.name" t-options="{'widget': 'text'}"/> + <span + t-field="line.name" + t-options="{'widget': 'text'}" + /> </td> </t> </tr> - <t t-if="current_section and (line_last or lines[line_index+1].display_type == 'line_section')"> + <t + t-if="current_section and (line_last or lines[line_index+1].display_type == 'line_section')" + > <tr class="is-subtotal text-right"> <td colspan="99"> - <t t-if="o.company_id.vat"><strong class="mr16">Sous-total HT</strong></t> - <t t-else=""><strong class="mr16">Sous-total</strong></t> + <t t-if="o.company_id.vat"><strong + class="mr16" + >Sous-total HT</strong></t> + <t t-else=""><strong + class="mr16" + >Sous-total</strong></t> <span t-esc="current_subtotal" t-options='{"widget": "monetary", "display_currency": o.currency_id}' @@ -132,33 +242,52 @@ <div id="total" position="replace"> <div id="total" class="row"> - <div t-attf-class="#{'col-6' if report_type != 'html' else 'col-sm-7 col-md-6'} ml-auto"> + <div + t-attf-class="#{'col-6' if report_type != 'html' else 'col-sm-7 col-md-6'} ml-auto" + > <table class="table table-sm" style="page-break-inside: avoid;"> - <tr t-if="o.company_id.vat" class="border-black o_subtotal" style=""> - <td t-if="o.company_id.vat"><strong>Sous-total HT</strong></td> - <td t-if="not o.company_id.vat"><strong>Sous-total</strong></td> + <tr + t-if="o.company_id.vat" + class="border-black o_subtotal" + style="" + > + <td t-if="o.company_id.vat"><strong + >Sous-total HT</strong></td> + <td t-if="not o.company_id.vat"><strong + >Sous-total</strong></td> <td class="text-right"> - <span t-field="o.amount_untaxed"/> + <span t-field="o.amount_untaxed" /> </td> </tr> <t t-if="o.company_id.vat"> <t t-foreach="o.amount_by_group" t-as="amount_by_group"> <tr style=""> - <t t-if="len(o.line_ids.filtered(lambda line: line.tax_line_id)) in [0, 1] and o.amount_untaxed == amount_by_group[2]"> - <td><span class="text-nowrap" t-esc="amount_by_group[0]"/></td> + <t + t-if="len(o.line_ids.filtered(lambda line: line.tax_line_id)) in [0, 1] and o.amount_untaxed == amount_by_group[2]" + > + <td><span + class="text-nowrap" + t-esc="amount_by_group[0]" + /></td> <td class="text-right o_price_total"> - <span class="text-nowrap" t-esc="amount_by_group[3]" /> + <span + class="text-nowrap" + t-esc="amount_by_group[3]" + /> </td> </t> <t t-else=""> <td> - <span t-esc="amount_by_group[0]"/> + <span t-esc="amount_by_group[0]" /> <span class="text-nowrap"> on - <t t-esc="amount_by_group[4]"/> + <t t-esc="amount_by_group[4]" /> </span> </td> <td class="text-right o_price_total"> - <span class="text-nowrap" t-esc="amount_by_group[3]"/> + <span + class="text-nowrap" + t-esc="amount_by_group[3]" + /> </td> </t> </tr> @@ -168,19 +297,30 @@ <td t-if="o.company_id.vat"><strong>Total TTC</strong></td> <td t-if="not o.company_id.vat"><strong>Total</strong></td> <td class="text-right"> - <span class="text-nowrap" t-field="o.amount_total"/> + <span class="text-nowrap" t-field="o.amount_total" /> </td> </tr> <t t-if="print_with_payments"> <t t-if="o.payment_state != 'invoicing_legacy'"> - <t t-set="payments_vals" t-value="o.sudo()._get_reconciled_info_JSON_values()"/> + <t + t-set="payments_vals" + t-value="o.sudo()._get_reconciled_info_JSON_values()" + /> <t t-foreach="payments_vals" t-as="payment_vals"> <tr> <td> - <i class="oe_form_field text-right oe_payment_label">Payé le <t t-esc="payment_vals['date']" t-options='{"widget": "date"}'/></i> + <i + class="oe_form_field text-right oe_payment_label" + >Payé le <t + t-esc="payment_vals['date']" + t-options='{"widget": "date"}' + /></i> </td> <td class="text-right"> - <span t-esc="payment_vals['amount']" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + <span + t-esc="payment_vals['amount']" + t-options='{"widget": "monetary", "display_currency": o.currency_id}' + /> </td> </tr> </t> @@ -188,7 +328,7 @@ <tr class="border-black"> <td><strong>Montant dû</strong></td> <td class="text-right"> - <span t-field="o.amount_residual"/> + <span t-field="o.amount_residual" /> </td> </tr> </t> @@ -200,4 +340,4 @@ </div> </template> -</odoo> \ No newline at end of file +</odoo> diff --git a/views/report_composition_templates.xml b/views/report_composition_templates.xml index a32df4ff07de7857e34f18cf628c6d16d7fc1877..7c7b4796f3f4d8c940b2f9486cc4bbe5cc882392 100644 --- a/views/report_composition_templates.xml +++ b/views/report_composition_templates.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <data> @@ -10,79 +10,155 @@ <div class="row"> <div class="col-6" name="div_outgoing_address"> <h2> - <t t-if="not (env.context.get('proforma', False) or is_pro_forma)"> - <span t-if="doc.state not in ['draft','sent']">Commande n° </span> - <span t-if="doc.state in ['draft','sent']">Devis N° </span> + <t + t-if="not (env.context.get('proforma', False) or is_pro_forma)" + > + <span + t-if="doc.state not in ['draft','sent']" + >Commande n° </span> + <span + t-if="doc.state in ['draft','sent']" + >Devis N° </span> </t> - <t t-if="env.context.get('proforma', False) or is_pro_forma"> + <t + t-if="env.context.get('proforma', False) or is_pro_forma" + > <span>Facture pro-forma n° </span> </t> - <span t-field="doc.name"/> + <span t-field="doc.name" /> </h2> <div class="mw-100 mb-3"> - <p class="m-0">Du <span t-field="doc.date_order" t-options='{"widget": "date"}'/></p> - <p class="m-0">Référent projet: <span t-field="doc.user_id"/></p> + <p class="m-0">Du <span + t-field="doc.date_order" + t-options='{"widget": "date"}' + /></p> + <p class="m-0">Référent projet: <span + t-field="doc.user_id" + /></p> </div> </div> <div class="col-6" name="div_outgoing_address"> <div> - <div t-field="doc.partner_id" - t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/> + <div + t-field="doc.partner_id" + t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}' + /> </div> </div> </div> - <br/> + <br /> <t t-foreach="doc.sale_project_ids" t-as="project"> <!-- <div class="col-12">--> <div style="page-break-after: always;"> <div class="row mt32 mb32" name="projets"> <div class="col-12"> - <h3>Projet N° <span t-field="project.name"/></h3> + <h3>Projet N° <span + t-field="project.name" + /></h3> </div> </div> <div class="row mt32 mb32" name="projets"> - <t t-foreach="project.intervention_ids" t-as="intervention"> + <t + t-foreach="project.intervention_ids" + t-as="intervention" + > <div class="col-4"> - <h4 class="text-center">Intervention n° <span t-field="intervention.name"/></h4> - <t t-if="intervention.sequence_type == 'sequence'"> + <h4 class="text-center">Intervention n° <span + t-field="intervention.name" + /></h4> + <t + t-if="intervention.sequence_type == 'sequence'" + > <div class="row"> <div class="col-6"> - <p class="m-0"><span t-field="intervention.full_seq_qty"/> séquences entières</p> - <p class="m-0"><span t-field="intervention.plant_qty_per_seq"/> plants par séquence</p> - <p class="m-0"><span t-field="intervention.extra_plants_qty"/> plants supplémentaires</p> + <p class="m-0"><span + t-field="intervention.full_seq_qty" + /> séquences entières</p> + <p class="m-0"><span + t-field="intervention.plant_qty_per_seq" + /> plants par séquence</p> + <p class="m-0"><span + t-field="intervention.extra_plants_qty" + /> plants supplémentaires</p> </div> <div class="col-6"> - <p class="m-0">Longueur: <span t-field="intervention.intervention_length"/></p> - <p class="m-0">Intervalle entre plants: <span t-field="intervention.plant_interval"/></p> + <p class="m-0">Longueur: <span + t-field="intervention.intervention_length" + /></p> + <p + class="m-0" + >Intervalle entre plants: <span + t-field="intervention.plant_interval" + /></p> </div> </div> </t> - <t t-else="intervention.sequence_type == 'list'"> - <p class="m-0">Longueur: <span t-field="intervention.intervention_length"/></p> - <p class="m-0">Intervalle entre plants: <span t-field="intervention.plant_interval"/></p> - <p class="m-0">Nombre de plants: <span t-field="intervention.plants_qty"/></p> + <t + t-else="intervention.sequence_type == 'list'" + > + <p class="m-0">Longueur: <span + t-field="intervention.intervention_length" + /></p> + <p + class="m-0" + >Intervalle entre plants: <span + t-field="intervention.plant_interval" + /></p> + <p class="m-0">Nombre de plants: <span + t-field="intervention.plants_qty" + /></p> </t> <table class="table table-sm table-compo"> <tbody class="compo_tbody"> - <t t-if="intervention.sequence_type == 'sequence'"> - <t t-foreach="intervention.plant_sequence_ids" t-as="compo"> + <t + t-if="intervention.sequence_type == 'sequence'" + > + <t + t-foreach="intervention.plant_sequence_ids" + t-as="compo" + > <tr> - <td class="text-center"><t t-if="compo.product_id.categ_id.symbol"><i t-attf-class="fa {{compo.product_id.categ_id.symbol}}"></i></t></td> - <td><span t-field="compo.product_id.name"/></td> - <td><t t-if="compo.product_alternance_id">OU</t></td> - <td><t t-if="compo.product_alternance_id"><span t-field="compo.product_alternance_id.name"/></t></td> + <td class="text-center"><t + t-if="compo.product_id.categ_id.symbol" + ><i + t-attf-class="fa {{compo.product_id.categ_id.symbol}}" + /></t></td> + <td><span + t-field="compo.product_id.name" + /></td> + <td><t + t-if="compo.product_alternance_id" + >OU</t></td> + <td><t + t-if="compo.product_alternance_id" + ><span + t-field="compo.product_alternance_id.name" + /></t></td> </tr> </t> </t> - <t t-else="intervention.sequence_type == 'list'"> - <t t-foreach="intervention.plant_sequence_ids" t-as="compo"> + <t + t-else="intervention.sequence_type == 'list'" + > + <t + t-foreach="intervention.plant_sequence_ids" + t-as="compo" + > <tr> - <td class="text-center"><t t-if="compo.product_id.categ_id.symbol"><i t-attf-class="fa {{compo.product_id.categ_id.symbol}}"></i></t></td> - <td><span t-field="compo.product_id.name"/></td> - <td><span t-field="compo.qty"/></td> + <td class="text-center"><t + t-if="compo.product_id.categ_id.symbol" + ><i + t-attf-class="fa {{compo.product_id.categ_id.symbol}}" + /></t></td> + <td><span + t-field="compo.product_id.name" + /></td> + <td><span + t-field="compo.qty" + /></td> </tr> </t> </t> @@ -104,10 +180,13 @@ <template id="report_composition"> <t t-call="web.html_container"> <t t-foreach="docs" t-as="doc"> - <t t-call="ap_report.report_composition_document" t-lang="doc.partner_id.lang"/> + <t + t-call="ap_report.report_composition_document" + t-lang="doc.partner_id.lang" + /> </t> </t> </template> </data> -</odoo> \ No newline at end of file +</odoo> diff --git a/views/report_compositions.xml b/views/report_compositions.xml index 2efdb5d97da1052db2a30703c589fd98ba00b902..d4f357d1e6a65d47f2b94c60a49a654d281d1171 100644 --- a/views/report_compositions.xml +++ b/views/report_compositions.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <data> <!-- QWeb Reports --> @@ -10,8 +10,8 @@ <field name="report_name">ap_report.report_composition</field> <field name="report_file">ap_report.report_composition</field> <field name="print_report_name">'Composition - %s' % (object.name)</field> - <field name="binding_model_id" ref="sale.model_sale_order"/> - <field name="paperformat_id" ref="ap_report.paperformat_landscape"/> + <field name="binding_model_id" ref="sale.model_sale_order" /> + <field name="paperformat_id" ref="ap_report.paperformat_landscape" /> </record> </data> diff --git a/views/report_delivery_ap_template.xml b/views/report_delivery_ap_template.xml index 7f152e102f49b606a801a374fc81b909dc4cf598..75544b10d7d4a573a57eaed712cd78ae13edd81b 100644 --- a/views/report_delivery_ap_template.xml +++ b/views/report_delivery_ap_template.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <data> @@ -9,24 +9,29 @@ <div class="row"> <div class="col-8" name="div_outgoing_address"> <h2> - <span>Devis N° </span><span t-field="o.origin"/> + <span>Devis N° </span><span t-field="o.origin" /> </h2> <div class="mw-100 mb-3"> - <p class="m-0">Du <span t-field="o.scheduled_date" t-options='{"widget": "date"}'/></p> + <p class="m-0">Du <span + t-field="o.scheduled_date" + t-options='{"widget": "date"}' + /></p> </div> </div> <div class="col-4" name="div_outgoing_address"> <div> - <div t-field="o.partner_id" - t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/> + <div + t-field="o.partner_id" + t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}' + /> </div> </div> </div> - <br/> + <br /> <table class="table table-sm" t-if="o.move_ids_without_package"> <thead> <tr> - <th></th> + <th /> <th name="th_product"> <strong>Produit</strong> </th> @@ -37,17 +42,33 @@ </thead> <tbody> <t t-foreach="o.move_ids_without_package" t-as="move"> - <t t-foreach="move.move_line_ids.sorted(key=lambda ml: ml.location_id.id)" t-as="ml"> + <t + t-foreach="move.move_line_ids.sorted(key=lambda ml: ml.location_id.id)" + t-as="ml" + > <tr> - <td></td> + <td /> <td> - <span t-field="ml.product_id.display_name"/><br/> - <span t-field="ml.product_id.description_picking"/> + <span + t-field="ml.product_id.display_name" + /><br /> + <span + t-field="ml.product_id.description_picking" + /> </td> <td> - <span t-if="o.state != 'done'" t-field="ml.product_uom_qty"/> - <span t-if="o.state == 'done'" t-field="ml.qty_done"/> - <span t-field="ml.product_uom_id" groups="uom.group_uom"/> + <span + t-if="o.state != 'done'" + t-field="ml.product_uom_qty" + /> + <span + t-if="o.state == 'done'" + t-field="ml.qty_done" + /> + <span + t-field="ml.product_uom_id" + groups="uom.group_uom" + /> </td> </tr> </t> @@ -59,4 +80,4 @@ </template> </data> -</odoo> \ No newline at end of file +</odoo> diff --git a/views/report_sale.xml b/views/report_sale.xml index 154a1300a49ea28bd6f934065ffeff3da4bd4f24..31b63bd3743fb857648a9a5b52f0bd62c3c1b48b 100644 --- a/views/report_sale.xml +++ b/views/report_sale.xml @@ -1,24 +1,36 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> - <template id="ap_report_saleorder_document" inherit_id="sale.report_saleorder_document"> - <xpath expr="//h2[@class='mt16']" position="replace"/> + <template + id="ap_report_saleorder_document" + inherit_id="sale.report_saleorder_document" + > + <xpath expr="//h2[@class='mt16']" position="replace" /> - <t t-if="doc.partner_shipping_id == doc.partner_invoice_id + <t + t-if="doc.partner_shipping_id == doc.partner_invoice_id and doc.partner_invoice_id != doc.partner_id - or doc.partner_shipping_id != doc.partner_invoice_id" position="replace"> - <t t-if="doc.partner_invoice_id != doc.partner_id - or doc.partner_shipping_id != doc.partner_id"> + or doc.partner_shipping_id != doc.partner_invoice_id" + position="replace" + > + <t + t-if="doc.partner_invoice_id != doc.partner_id + or doc.partner_shipping_id != doc.partner_id" + > <t t-set="information_block"> <t t-if="doc.partner_invoice_id != doc.partner_id"> - <strong >Adresse de facturation:</strong> - <div t-field="doc.partner_invoice_id" - t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/> + <strong>Adresse de facturation:</strong> + <div + t-field="doc.partner_invoice_id" + t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}' + /> </t> <t t-if="doc.partner_shipping_id != doc.partner_id"> <strong>Adresse de livraison:</strong> - <div t-field="doc.partner_shipping_id" - t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/> + <div + t-field="doc.partner_shipping_id" + t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}' + /> </t> </t> </t> @@ -33,14 +45,16 @@ <t t-if="env.context.get('proforma', False) or is_pro_forma"> <span>Facture pro-forma n° </span> </t> - <span t-field="doc.name"/> + <span t-field="doc.name" /> </h2> </xpath> <div t-if="doc.user_id.name" position="replace"> <div t-if="doc.user_id.name" class="col-auto col-3 mw-100 mb-2"> <strong>Référent:</strong> - <p class="m-0"><span t-field="doc.user_id"/><t t-if="doc.user_id.phone">, <t t-esc="doc.user_id.phone"/></t></p> + <p class="m-0"><span t-field="doc.user_id" /><t + t-if="doc.user_id.phone" + >, <t t-esc="doc.user_id.phone" /></t></p> </div> </div> <xpath expr="//div[@class='page']" position="inside"> @@ -48,8 +62,12 @@ </xpath> <xpath expr="//div[@name='signature']" position="before"> - <p t-if="doc.company_id.text_report" name="text_tva" class="mt-2 text-right"> - <t t-esc="doc.company_id.text_report"/> + <p + t-if="doc.company_id.text_report" + name="text_tva" + class="mt-2 text-right" + > + <t t-esc="doc.company_id.text_report" /> </p> </xpath> @@ -61,66 +79,113 @@ <th name="th_description" class="text-left">Description</th> <th name="th_quantity" class="text-right">Quantité</th> <th name="th_priceunit" class="text-right">Prix unitaire</th> - <th name="th_discount" t-if="display_discount" class="text-right" groups="product.group_discount_per_so_line"> + <th + name="th_discount" + t-if="display_discount" + class="text-right" + groups="product.group_discount_per_so_line" + > <span>Rem.%</span> </th> - <th t-if="doc.company_id.vat" name="th_taxes" class="text-right">Taxes</th> + <th + t-if="doc.company_id.vat" + name="th_taxes" + class="text-right" + >Taxes</th> <th name="th_subtotal" class="text-right"> - <t t-if="doc.company_id.vat"><span groups="account.group_show_line_subtotals_tax_excluded">Montant HT</span></t> - <t t-else=""><span groups="account.group_show_line_subtotals_tax_excluded">Montant</span></t> - <span groups="account.group_show_line_subtotals_tax_included">Prix total</span> + <t t-if="doc.company_id.vat"><span + groups="account.group_show_line_subtotals_tax_excluded" + >Montant HT</span></t> + <t t-else=""><span + groups="account.group_show_line_subtotals_tax_excluded" + >Montant</span></t> + <span + groups="account.group_show_line_subtotals_tax_included" + >Prix total</span> </th> </tr> </thead> <tbody class="sale_tbody"> - <t t-set="current_subtotal" t-value="0"/> + <t t-set="current_subtotal" t-value="0" /> <t t-foreach="doc.order_line" t-as="line"> - <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/> - <t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/> + <t + t-set="current_subtotal" + t-value="current_subtotal + line.price_subtotal" + groups="account.group_show_line_subtotals_tax_excluded" + /> + <t + t-set="current_subtotal" + t-value="current_subtotal + line.price_total" + groups="account.group_show_line_subtotals_tax_included" + /> - <tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''"> + <tr + t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''" + > <t t-if="not line.display_type"> - <td name="td_name"><span t-field="line.name"/></td> + <td name="td_name"><span t-field="line.name" /></td> <td name="td_quantity" class="text-right"> - <span t-field="line.product_uom_qty"/> - <span t-field="line.product_uom"/> + <span t-field="line.product_uom_qty" /> + <span t-field="line.product_uom" /> </td> <td name="td_priceunit" class="text-right"> - <span t-field="line.price_unit"/> + <span t-field="line.price_unit" /> </td> - <td t-if="display_discount" class="text-right" groups="product.group_discount_per_so_line"> - <span t-field="line.discount"/> + <td + t-if="display_discount" + class="text-right" + groups="product.group_discount_per_so_line" + > + <span t-field="line.discount" /> </td> - <td t-if="doc.company_id.vat" name="td_taxes" class="text-right"> - <span t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_id))"/> + <td + t-if="doc.company_id.vat" + name="td_taxes" + class="text-right" + > + <span + t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_id))" + /> </td> <td name="td_subtotal" class="text-right o_price_total"> - <span t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/> - <span t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/> + <span + t-field="line.price_subtotal" + groups="account.group_show_line_subtotals_tax_excluded" + /> + <span + t-field="line.price_total" + groups="account.group_show_line_subtotals_tax_included" + /> </td> </t> <t t-if="line.display_type == 'line_section'"> <td name="td_section_line" colspan="99"> - <span t-field="line.name"/> + <span t-field="line.name" /> </td> - <t t-set="current_section" t-value="line"/> - <t t-set="current_subtotal" t-value="0"/> + <t t-set="current_section" t-value="line" /> + <t t-set="current_subtotal" t-value="0" /> </t> <t t-if="line.display_type == 'line_note'"> <td name="td_note_line" colspan="99"> - <span t-field="line.name"/> + <span t-field="line.name" /> </td> </t> </tr> - <t t-if="current_section and (line_last or doc.order_line[line_index+1].display_type == 'line_section')"> + <t + t-if="current_section and (line_last or doc.order_line[line_index+1].display_type == 'line_section')" + > <tr class="is-subtotal text-right"> <td name="td_section_subtotal" colspan="99"> - <t t-if="doc.company_id.vat"><strong class="mr16">Sous-total HT</strong></t> - <t t-else=""><strong class="mr16">Sous-total</strong></t> + <t t-if="doc.company_id.vat"><strong + class="mr16" + >Sous-total HT</strong></t> + <t t-else=""><strong + class="mr16" + >Sous-total</strong></t> <span t-esc="current_subtotal" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' @@ -135,45 +200,78 @@ <div id="total" position="replace"> <div id="total" class="row" name="total"> - <div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto"> + <div + t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto" + > <table class="table table-sm"> - <tr t-if="doc.company_id.vat" class="border-black o_subtotal" style=""> - <td t-if="doc.company_id.vat" name="td_amount_untaxed_label"><strong>Sous-total HT</strong></td> - <td t-if="not doc.company_id.vat" name="td_amount_untaxed_label"><strong>Sous-total</strong></td> + <tr + t-if="doc.company_id.vat" + class="border-black o_subtotal" + style="" + > + <td + t-if="doc.company_id.vat" + name="td_amount_untaxed_label" + ><strong>Sous-total HT</strong></td> + <td + t-if="not doc.company_id.vat" + name="td_amount_untaxed_label" + ><strong>Sous-total</strong></td> <td name="td_amount_untaxed" class="text-right"> - <span t-field="doc.amount_untaxed"/> + <span t-field="doc.amount_untaxed" /> </td> </tr> <t t-if="doc.company_id.vat"> <t t-foreach="doc.amount_by_group" t-as="amount_by_group"> <tr style=""> - <t t-if="amount_by_group[5] == 1 and doc.amount_untaxed == amount_by_group[2]"> + <t + t-if="amount_by_group[5] == 1 and doc.amount_untaxed == amount_by_group[2]" + > <td name="td_amount_by_group_label_3"> - <span t-esc="amount_by_group[0]"/> - <span>&nbsp;<span>on</span>&nbsp;<t t-esc="amount_by_group[2]" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/></span> + <span t-esc="amount_by_group[0]" /> + <span>&nbsp;<span>on</span>&nbsp;<t + t-esc="amount_by_group[2]" + t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' + /></span> </td> - <td name="td_amount_by_group_3" class="text-right o_price_total"> - <span t-esc="amount_by_group[1]" - t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> + <td + name="td_amount_by_group_3" + class="text-right o_price_total" + > + <span + t-esc="amount_by_group[1]" + t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' + /> </td> </t> - <t t-else =""> + <t t-else=""> <td name="td_amount_by_group_label"> - <span t-esc="amount_by_group[0]"/> + <span t-esc="amount_by_group[0]" /> </td> - <td name="td_amount_by_group" class="text-right o_price_total"> - <span t-esc="amount_by_group[1]" - t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> + <td + name="td_amount_by_group" + class="text-right o_price_total" + > + <span + t-esc="amount_by_group[1]" + t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' + /> </td> </t> </tr> </t> </t> <tr class="border-black o_total"> - <td t-if="doc.company_id.vat" name="td_amount_total_label"><strong>Total TTC</strong></td> - <td t-if="not doc.company_id.vat" name="td_amount_total_label"><strong>Total</strong></td> + <td + t-if="doc.company_id.vat" + name="td_amount_total_label" + ><strong>Total TTC</strong></td> + <td + t-if="not doc.company_id.vat" + name="td_amount_total_label" + ><strong>Total</strong></td> <td name="td_amount_total" class="text-right"> - <span t-field="doc.amount_total"/> + <span t-field="doc.amount_total" /> </td> </tr> </table> diff --git a/views/report_templates.xml b/views/report_templates.xml index 16c1159affe793549dbcf306e5a55377a632f723..b576f63b755647f17659e2eca0d63ddfac034179 100644 --- a/views/report_templates.xml +++ b/views/report_templates.xml @@ -1,21 +1,34 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <!-- Assets for reports --> <template id="report_assets_common" inherit_id="web.report_assets_common"> <xpath expr="." position="inside">--> - <link rel="stylesheet" type="text/scss" href="/ap_report/static/src/scss/layout_generic.scss"/> + <link + rel="stylesheet" + type="text/scss" + href="/ap_report/static/src/scss/layout_generic.scss" + /> </xpath> </template> <template id="ap_external_layout_generic"> - <div t-attf-class="header o_company_#{company.id}_layout" t-att-style="report_header_style"> + <div + t-attf-class="header o_company_#{company.id}_layout" + t-att-style="report_header_style" + > <div class="o_boxed_header"> <div class="row"> <div class="col-2 mb4"> - <img t-if="company.logo" t-att-src="image_data_uri(company.logo)" style="max-height: 100px;" alt="Logo"/> + <img + t-if="company.logo" + t-att-src="image_data_uri(company.logo)" + style="max-height: 100px;" + alt="Logo" + /> </div> <div class="col-3" name="company_address"> - <div t-field="company.partner_id" + <div + t-field="company.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' /> </div> @@ -25,100 +38,148 @@ </div> </div> - <div t-attf-class="article o_report_layout_boxed o_company_#{company.id}_layout" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')"> + <div + t-attf-class="article o_report_layout_boxed o_company_#{company.id}_layout" + t-att-data-oe-model="o and o._name" + t-att-data-oe-id="o and o.id" + t-att-data-oe-lang="o and o.env.context.get('lang')" + > <div class="pt-1"> <!-- This div ensures that the address is not cropped by the header. --> - <t t-call="web.address_layout"/> + <t t-call="web.address_layout" /> </div> - <t t-raw="0"/> + <t t-raw="0" /> </div> <div t-attf-class="footer o_standard_footer o_company_#{company.id}_layout"> <div class="text-center" style="border-top: 1px solid black;"> <ul class="list-inline mb4"> <li class="list-inline-item"> - <t t-if="company.phone"><span class="o_force_ltr" t-field="company.phone"/></t> - <t t-if="company.email"> - <span t-field="company.email"/></t> - <t t-if="company.website"> - <span t-field="company.website"/></t> - <t t-if="company.vat"> - <t t-esc="company.country_id.vat_label or 'Tax ID'"/>: <span t-field="company.vat"/></t> + <t t-if="company.phone"><span + class="o_force_ltr" + t-field="company.phone" + /></t> + <t t-if="company.email"> - <span t-field="company.email" /></t> + <t t-if="company.website"> - <span + t-field="company.website" + /></t> + <t t-if="company.vat"> - <t + t-esc="company.country_id.vat_label or 'Tax ID'" + />: <span t-field="company.vat" /></t> </li> <li class="list-inline-item"> - <t t-if="company.company_type"><span t-field="company.company_type"/></t> - <t t-if="company.siret" > - SIRET: <span t-field="company.siret"/></t> - <t t-if="company.ape"> - Code NAF: <span t-field="company.ape"/></t> + <t t-if="company.company_type"><span + t-field="company.company_type" + /></t> + <t t-if="company.siret"> - SIRET: <span + t-field="company.siret" + /></t> + <t t-if="company.ape"> - Code NAF: <span + t-field="company.ape" + /></t> </li> <li class="list-inline-item"> - <t t-if="company.formation">N°déclaration activité de prestataire de formation: <span t-field="company.formation"/></t> + <t + t-if="company.formation" + >N°déclaration activité de prestataire de formation: <span + t-field="company.formation" + /></t> </li> </ul> <div name="financial_infos"> - <span t-field="company.report_footer"/> + <span t-field="company.report_footer" /> </div> <div t-if="report_type == 'pdf'" class="text-muted"> - Page: <span class="page"/> / <span class="topage"/> + Page: <span class="page" /> / <span class="topage" /> </div> </div> </div> </template> <template id="ap_external_layout_generic_compo"> - <div t-attf-class="header o_company_#{company.id}_layout" t-att-style="report_header_style"> + <div + t-attf-class="header o_company_#{company.id}_layout" + t-att-style="report_header_style" + > <div class="row"> <div class="col-12 mb4 text-right"> - <img t-if="company.logo" t-att-src="image_data_uri(company.logo)" style="max-height: 45px;" alt="Logo"/> + <img + t-if="company.logo" + t-att-src="image_data_uri(company.logo)" + style="max-height: 45px;" + alt="Logo" + /> </div> <!-- <div class="col-9 text-right" style="margin-top:22px;" t-field="company.report_header" name="moto"/>--> </div> </div> - <div t-attf-class="article o_report_layout_boxed o_company_#{company.id}_layout" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')"> + <div + t-attf-class="article o_report_layout_boxed o_company_#{company.id}_layout" + t-att-data-oe-model="o and o._name" + t-att-data-oe-id="o and o.id" + t-att-data-oe-lang="o and o.env.context.get('lang')" + > <div class="pt-1"> <!-- This div ensures that the address is not cropped by the header. --> - <t t-call="web.address_layout"/> + <t t-call="web.address_layout" /> </div> - <t t-raw="0"/> + <t t-raw="0" /> </div> <div t-attf-class="footer o_boxed_footer o_company_#{company.id}_layout"> <div class="text-center"> <ul class="list-inline"> <li class="list-inline-item"> - <t t-if="company.phone"><span class="o_force_ltr" t-field="company.phone"/></t> - <t t-if="company.email"> - <span t-field="company.email"/></t> - <t t-if="company.website"> - <span t-field="company.website"/></t> - <t t-if="company.vat"> - <t t-esc="company.country_id.vat_label or 'Tax ID'"/>: <span t-field="company.vat"/></t> - <t t-if="company.company_type"><span t-field="company.company_type"/></t> - <t t-if="company.siret" > - SIRET: <span t-field="company.siret"/></t> - <t t-if="company.ape"> - Code NAF: <span t-field="company.ape"/></t> + <t t-if="company.phone"><span + class="o_force_ltr" + t-field="company.phone" + /></t> + <t t-if="company.email"> - <span t-field="company.email" /></t> + <t t-if="company.website"> - <span + t-field="company.website" + /></t> + <t t-if="company.vat"> - <t + t-esc="company.country_id.vat_label or 'Tax ID'" + />: <span t-field="company.vat" /></t> + <t t-if="company.company_type"><span + t-field="company.company_type" + /></t> + <t t-if="company.siret"> - SIRET: <span + t-field="company.siret" + /></t> + <t t-if="company.ape"> - Code NAF: <span + t-field="company.ape" + /></t> </li> </ul> - <div t-field="company.report_footer"/> + <div t-field="company.report_footer" /> <div t-if="report_type == 'pdf'"> - Page: <span class="page"/> / <span class="topage"/> + Page: <span class="page" /> / <span class="topage" /> </div> </div> </div> </template> <template id="external_layout_spe"> - <t t-if="not o" t-set="o" t-value="doc"/> + <t t-if="not o" t-set="o" t-value="doc" /> <t t-if="not company"> <!-- Multicompany --> <t t-if="company_id"> - <t t-set="company" t-value="company_id"/> + <t t-set="company" t-value="company_id" /> </t> <t t-elif="o and 'company_id' in o and o.company_id.sudo()"> - <t t-set="company" t-value="o.company_id.sudo()"/> + <t t-set="company" t-value="o.company_id.sudo()" /> </t> <t t-else="else"> - <t t-set="company" t-value="res_company"/> + <t t-set="company" t-value="res_company" /> </t> </t> - <t t-call="ap_report.ap_external_layout_generic_compo"><t t-raw="0"/></t> + <t t-call="ap_report.ap_external_layout_generic_compo"><t t-raw="0" /></t> </template> diff --git a/views/res_company_views.xml b/views/res_company_views.xml index 619affb5e689752223385b3ef48f645a12cfc553..37aaa01f030c9ef053060e1241ef2af3bd8910e1 100644 --- a/views/res_company_views.xml +++ b/views/res_company_views.xml @@ -1,19 +1,19 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <data> <record id="fil_view_company_form" model="ir.ui.view"> <field name="name">fil.res.company.form.inherit.account</field> <field name="model">res.company</field> - <field name="inherit_id" ref="base.view_company_form"/> + <field name="inherit_id" ref="base.view_company_form" /> <field name="arch" type="xml"> <xpath expr="//field[@name='vat']" position="after"> - <field name="text_report"/> - <field name="formation"/> - <field name="company_type"/> + <field name="text_report" /> + <field name="formation" /> + <field name="company_type" /> </xpath> </field> </record> </data> -</odoo> \ No newline at end of file +</odoo>