diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..4311af65a0 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +# eslint complains on website_bootstrap_select +website_bootstrap_select/static/src/js/*.js +website_bootstrap_select/static/src/js/*/*.js diff --git a/.eslintrc.yml b/.eslintrc.yml index 9429bc688a..fed88d70d2 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -22,6 +22,7 @@ globals: odoo: readonly openerp: readonly owl: readonly + luxon: 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/.flake8 b/.flake8 index e397e8ed4e..0adcf42331 100644 --- a/.flake8 +++ b/.flake8 @@ -7,6 +7,7 @@ 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 +# C901: Function is too complex +ignore = E203,E501,W503,C901 per-file-ignores= __init__.py:F401 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000000..602ecbca24 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,46 @@ +name: pre-commit + +on: + pull_request: + branches: + - "14.0*" + push: + branches: + - "14.0" + - "14.0-ocabot-*" + +jobs: + pre-commit: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v2 + with: + python-version: "3.11" + - name: Get python version + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v1 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: pre-commit run --all-files --show-diff-on-failure --color=always + env: + # Consider valid a PR that changes README fragments but doesn't + # change the README.rst file itself. It's not really a problem + # because the bot will update it anyway after merge. This way, we + # lower the barrier for functional contributors that want to fix the + # readme fragments, while still letting developers get README + # auto-generated (which also helps functionals when using runboat). + # DOCS https://pre-commit.com/#temporarily-disabling-hooks + SKIP: oca-gen-addon-readme + - name: Check that all files generated by pre-commit are in git + run: | + newfiles="$(git ls-files --others --exclude-from=.gitignore)" + if [ "$newfiles" != "" ] ; then + echo "Please check-in the following files:" + echo "$newfiles" + exit 1 + fi diff --git a/.gitignore b/.gitignore index 9c283fd41f..0090721f5d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ *.py[cod] /.venv /.pytest_cache +/.ruff_cache # C extensions *.so diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3f2ff354b1..17c67e2075 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,12 @@ exclude: | /static/(src/)?lib/| # Repos using Sphinx to generate docs don't need prettying ^docs/_templates/.*\.html$| + # Don't bother non-technical authors with formatting issues in docs + readme/.*\.(rst|md)$| + # Ignore build and dist directories in addons + /build/|/dist/| + # Ignore test files in addons + /tests/samples/.*| # You don't usually want a bot to modify your legal texts (LICENSE.*|COPYING.*) default_language_version: @@ -33,14 +39,19 @@ repos: language: fail files: '[a-zA-Z0-9_]*/i18n/en\.po$' - repo: https://github.com/oca/maintainer-tools - rev: 969238e47c07d0c40573acff81d170f63245d738 + rev: 9a170331575a265c092ee6b24b845ec508e8ef75 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons - id: oca-fix-manifest-website args: ["https://github.com/avanzosc/odoo-addons"] + - repo: https://github.com/OCA/odoo-pre-commit-hooks + rev: v0.0.25 + hooks: + - id: oca-checks-odoo-module + - id: oca-checks-po - repo: https://github.com/myint/autoflake - rev: v2.2.1 + rev: v1.4 hooks: - id: autoflake args: @@ -51,11 +62,11 @@ repos: - --remove-duplicate-keys - --remove-unused-variables - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 + rev: v2.1.2 hooks: - id: prettier name: prettier (with plugin-xml) @@ -65,16 +76,16 @@ repos: 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: v8.48.0 - hooks: - - id: eslint - verbose: true - args: - - --color - - --fix + # - 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: v4.4.0 + rev: v3.2.0 hooks: - id: trailing-whitespace # exclude autogenerated files @@ -96,7 +107,7 @@ repos: - id: mixed-line-ending args: ["--fix=lf"] - repo: https://github.com/asottile/pyupgrade - rev: v3.10.1 + rev: v2.7.2 hooks: - id: pyupgrade args: ["--keep-percent-format"] @@ -109,7 +120,7 @@ repos: - --settings=. exclude: /__init__\.py$ - repo: https://github.com/acsone/setuptools-odoo - rev: 3.1.12 + rev: 3.1.8 hooks: - id: setuptools-odoo-make-default - id: setuptools-odoo-get-requirements @@ -119,13 +130,13 @@ repos: - --header - "# generated from manifests external_dependencies" - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 3.8.3 hooks: - id: flake8 name: flake8 - additional_dependencies: ["flake8-bugbear==21.9.2"] + additional_dependencies: ["flake8-bugbear==20.1.4"] - repo: https://github.com/OCA/pylint-odoo - rev: v8.0.20 + rev: 7.0.2 hooks: - id: pylint_odoo name: pylint with optional checks diff --git a/.pylintrc b/.pylintrc index b28107b6c4..ac714a9411 100644 --- a/.pylintrc +++ b/.pylintrc @@ -63,39 +63,6 @@ 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, - external-request-timeout, # messages that do not cause the lint step to fail consider-merging-classes-inherited, create-user-wo-reset-password, diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index 967b0ffaf7..b4ce55ef61 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -55,40 +55,7 @@ enable=anomalous-backslash-in-string, unreachable, 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, - external-request-timeout + xml-syntax-error [REPORTS] msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} diff --git a/LICENSE b/LICENSE index 3ffc567893..be3f7b28e5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ -GNU AFFERO GENERAL PUBLIC LICENSE + GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -633,8 +633,8 @@ the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -643,7 +643,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -658,4 +658,4 @@ specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see -. \ No newline at end of file +. diff --git a/README.md b/README.md index f61340771e..9d58799e74 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,4 @@ -[![Build Status](https://travis-ci.org/avanzosc/odoo-addons.svg?branch=14.0)](https://travis-ci.org/avanzosc/odoo-addons) -[![Code Health](https://landscape.io/github/avanzosc/odoo-addons/14.0/landscape.svg?style=flat)](https://landscape.io/github/avanzosc/odoo-addons/14.0) -[![Coverage Status](https://coveralls.io/repos/avanzosc/odoo-addons/badge.svg?branch=14.0)](https://coveralls.io/r/avanzosc/odoo-addons?branch=14.0) -[![Codacy Badge](https://www.codacy.com/project/badge/5c3b8125c017437f9f208bdd6f984915)](https://www.codacy.com/public/oihanecruce/odoo-addons) -[![codecov](https://codecov.io/gh/avanzosc/odoo-addons/branch/14.0/graph/badge.svg)](https://codecov.io/gh/avanzosc/odoo-addons) +[![pre-commit](https://github.com/avanzosc/odoo-addons/actions/workflows/pre-commit.yml/badge.svg?branch=14.0)](https://github.com/avanzosc/odoo-addons/actions/workflows/pre-commit.yml) Odoo addons =========== diff --git a/account_analytic_distribution/__init__.py b/account_analytic_distribution/__init__.py index 9a7e03eded..0650744f6b 100644 --- a/account_analytic_distribution/__init__.py +++ b/account_analytic_distribution/__init__.py @@ -1 +1 @@ -from . import models \ No newline at end of file +from . import models diff --git a/account_analytic_distribution/__manifest__.py b/account_analytic_distribution/__manifest__.py index dbde4aa2f9..9b6dab7f15 100644 --- a/account_analytic_distribution/__manifest__.py +++ b/account_analytic_distribution/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Account Analytic Distribution", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "category": "Analytic", "license": "AGPL-3", "author": "AvanzOSC", @@ -21,5 +21,5 @@ "views/account_account_view.xml", "views/account_analytic_template_view.xml", ], - 'installable': True, + "installable": True, } diff --git a/account_analytic_distribution/models/account_account.py b/account_analytic_distribution/models/account_account.py index 7ccf700a97..914f87a32b 100644 --- a/account_analytic_distribution/models/account_account.py +++ b/account_analytic_distribution/models/account_account.py @@ -9,4 +9,5 @@ class AccountAccount(models.Model): analytic_template_ids = fields.One2many( string="Analytic Distribution", comodel_name="account.analytic.template", - inverse_name="account_id") + inverse_name="account_id", + ) diff --git a/account_analytic_distribution/models/account_analytic_line.py b/account_analytic_distribution/models/account_analytic_line.py index 404548b421..38b761813b 100644 --- a/account_analytic_distribution/models/account_analytic_line.py +++ b/account_analytic_distribution/models/account_analytic_line.py @@ -6,8 +6,7 @@ class AccountAnalyticLine(models.Model): _inherit = "account.analytic.line" - pre_amount = fields.Float( - string="Amount") + pre_amount = fields.Float(string="Amount") @api.onchange("pre_amount") def onchange_pre_amount(self): @@ -18,7 +17,11 @@ def onchange_pre_amount(self): @api.model def create(self, values): if "name" in values and values["name"] == "/ -- /" and "move_id" in values: - values["name"] = self.env["account.move.line"].browse(values.get("move_id")).account_id.display_name + values["name"] = ( + self.env["account.move.line"] + .browse(values.get("move_id")) + .account_id.display_name + ) if "amount" in values: values["pre_amount"] = values["amount"] - return super(AccountAnalyticLine, self).create(values) + return super().create(values) diff --git a/account_analytic_distribution/models/account_analytic_template.py b/account_analytic_distribution/models/account_analytic_template.py index 48b137739f..47b257eade 100644 --- a/account_analytic_distribution/models/account_analytic_template.py +++ b/account_analytic_distribution/models/account_analytic_template.py @@ -7,16 +7,14 @@ class AccountAnalyticTemplate(models.Model): _name = "account.analytic.template" _description = "Account Analytic Template" - account_id = fields.Many2one( - string="Account", - comodel_name="account.account") + account_id = fields.Many2one(string="Account", comodel_name="account.account") account_analytic_id = fields.Many2one( - string="Account Analytic", - comodel_name="account.analytic.account") - percentage = fields.Float( - string="%") + string="Account Analytic", comodel_name="account.analytic.account" + ) + percentage = fields.Float(string="%") company_id = fields.Many2one( string="Company", comodel_name="res.company", related="account_analytic_id.company_id", - store=True) + store=True, + ) diff --git a/account_analytic_distribution/models/account_move.py b/account_analytic_distribution/models/account_move.py index 89c41fb2b2..7f413f903a 100644 --- a/account_analytic_distribution/models/account_move.py +++ b/account_analytic_distribution/models/account_move.py @@ -10,25 +10,29 @@ class AccountMove(models.Model): string="Analytic Lines", comodel_name="account.analytic.line", inverse_name="account_move_id", - copy=False) + copy=False, + ) def action_post(self): - result = super(AccountMove, self).action_post() + result = super().action_post() for line in self.invoice_line_ids: if line.account_id and line.account_id.analytic_template_ids: for template in line.account_id.analytic_template_ids: - analytic = self.env[("account.analytic.line")].create({ - "name": line.account_id.name, - "account_id": template.account_analytic_id.id, - "move_id": line.id, - "date": line.move_id.date}) + analytic = self.env[("account.analytic.line")].create( + { + "name": line.account_id.name, + "account_id": template.account_analytic_id.id, + "move_id": line.id, + "date": line.move_id.date, + } + ) if template.percentage: if line.credit: - analytic.amount = ( - (template.percentage * line.credit) / 100) + analytic.amount = (template.percentage * line.credit) / 100 if line.debit: - analytic.amount = (( - (-1) * template.percentage * line.debit) / 100) + analytic.amount = ( + (-1) * template.percentage * line.debit + ) / 100 return result def action_view_analytics(self): @@ -38,8 +42,9 @@ def action_view_analytics(self): "res_model": "account.analytic.line", "domain": [("id", "in", self.analytic_line_ids.ids)], "type": "ir.actions.act_window", - "views": [[self.env.ref( - "analytic.view_account_analytic_line_tree").id, "tree"], - [False, "form"]], - "context": self.env.context + "views": [ + [self.env.ref("analytic.view_account_analytic_line_tree").id, "tree"], + [False, "form"], + ], + "context": self.env.context, } diff --git a/account_analytic_distribution/models/account_move_line.py b/account_analytic_distribution/models/account_move_line.py index d44766e686..c4674bcf42 100644 --- a/account_analytic_distribution/models/account_move_line.py +++ b/account_analytic_distribution/models/account_move_line.py @@ -8,45 +8,51 @@ class AccountMoveLine(models.Model): _inherit = "account.move.line" payment_reference = fields.Char( - string="Paymente Reference", - related="move_id.payment_reference") + string="Paymente Reference", related="move_id.payment_reference" + ) distribution_done = fields.Boolean( - string="Distribution Done", - compute="_compute_distribution_done", - store=True) + string="Distribution Done", compute="_compute_distribution_done", store=True + ) account_name = fields.Char( - string="Account Name", - related="account_id.name", - store=True) + string="Account Name", related="account_id.name", store=True + ) - @api.depends("credit", "debit", "analytic_line_ids", - "analytic_line_ids.amount", "move_id", "move_id.state") + @api.depends( + "credit", + "debit", + "analytic_line_ids", + "analytic_line_ids.amount", + "move_id", + "move_id.state", + ) def _compute_distribution_done(self): for line in self: line.distribution_done = True if not line.move_id.state == "draft" and ( - line.account_id.analytic_template_ids or ( - line.analytic_account_id)): + line.account_id.analytic_template_ids or (line.analytic_account_id) + ): line.distribution_done = False amount = round(sum(line.analytic_line_ids.mapped("amount")), 2) if amount != 0 and ( - line.credit == abs(amount) or ( - line.debit == abs(amount))): + line.credit == abs(amount) or (line.debit == abs(amount)) + ): line.distribution_done = True if line.distribution_done and any( - [analitic.amount != 0 for ( - analitic) in line.analytic_line_ids]): - for analitic in ( - line.analytic_line_ids.filtered( - lambda c: c.amount == 0)): + [analitic.amount != 0 for (analitic) in line.analytic_line_ids] + ): + for analitic in line.analytic_line_ids.filtered( + lambda c: c.amount == 0 + ): analitic.unlink() def action_show_distribution(self): - """ Returns an action that will open a form view (in a popup) allowing + """Returns an action that will open a form view (in a popup) allowing to work on all the analytic lines of a particular account move. """ self.ensure_one() - view = self.env.ref('account_analytic_distribution.account_move_line_distribution_form_view') + view = self.env.ref( + "account_analytic_distribution.account_move_line_distribution_form_view" + ) return { "name": _("Distribution"), "type": "ir.actions.act_window", @@ -56,7 +62,7 @@ def action_show_distribution(self): "view_id": view.id, "target": "new", "res_id": self.id, - "context": self.env.context.copy() + "context": self.env.context.copy(), } @api.constrains("analytic_line_ids", "debit", "credit") @@ -64,9 +70,10 @@ def _check_line_distribution(self): for line in self: if line.analytic_line_ids: amount = round(sum(line.analytic_line_ids.mapped("amount")), 2) - if -amount != line.debit and ( - amount != line.credit) or ( - amount == 0): + if -amount != line.debit and (amount != line.credit) or (amount == 0): raise ValidationError( - _("The total sum of amounts must be equal to the " + - "debit or credit amount of the financial movement.")) + _( + "The total sum of amounts must be equal to the " + + "debit or credit amount of the financial movement." + ) + ) diff --git a/account_analytic_distribution/views/account_account_view.xml b/account_analytic_distribution/views/account_account_view.xml index 115353b66b..41cf0e8130 100644 --- a/account_analytic_distribution/views/account_account_view.xml +++ b/account_analytic_distribution/views/account_account_view.xml @@ -1,4 +1,4 @@ - + account.account @@ -7,11 +7,14 @@ - + - - - + + + diff --git a/account_analytic_distribution/views/account_analytic_template_view.xml b/account_analytic_distribution/views/account_analytic_template_view.xml index 7bc6486dae..0631101a54 100644 --- a/account_analytic_distribution/views/account_analytic_template_view.xml +++ b/account_analytic_distribution/views/account_analytic_template_view.xml @@ -1,14 +1,14 @@ - + account.analytic.template.tree.view account.analytic.template - - - - - + + + + + @@ -18,11 +18,21 @@ account.analytic.template - - + + - - + + @@ -35,5 +45,10 @@ tree,form - + diff --git a/account_analytic_distribution/views/account_move_line_view.xml b/account_analytic_distribution/views/account_move_line_view.xml index b75b550a0b..f0cbb86755 100644 --- a/account_analytic_distribution/views/account_move_line_view.xml +++ b/account_analytic_distribution/views/account_move_line_view.xml @@ -1,4 +1,4 @@ - + account.move.line.form.view @@ -7,25 +7,33 @@
- - - - - - + + + + + + - + - - - - - - - - - - + + + + + + + + + + @@ -35,25 +43,35 @@ account.move.line - + - + - distribution_done == False + distribution_done == False account.move.line - + - - - + + + diff --git a/account_analytic_distribution/views/account_move_view.xml b/account_analytic_distribution/views/account_move_view.xml index ef14354eb0..529fe69e34 100644 --- a/account_analytic_distribution/views/account_move_view.xml +++ b/account_analytic_distribution/views/account_move_view.xml @@ -1,25 +1,52 @@ - + account.move
-
- - - + + + + + + + + + + + + + + + + + + + + + +
+

Help with Excel column names

+

You must use this column names in order to fill the table:

+
    +
  • Reference: this will fill Reference of asset
  • +
  • Name: this will fill Name of asset
  • +
  • Date Start: this will fill Date Start of asset
  • +
  • Purchase Value: this will fill Purchase Value of asset
  • +
  • Category: this will fill Category of asset
  • +
  • Date: this will fill Asset Line Date
  • +
  • Amount: this will fill Asset Line Amount
  • +
+
+
+
+
+ +
+ + + +
+ +
+
+ + + account.asset.line.import + + + + + + + + + + + + + + + Import Account Asset Lines + ir.actions.act_window + account.asset.line.import + tree,form + + + + +
diff --git a/account_bank_multiple_partner/__manifest__.py b/account_bank_multiple_partner/__manifest__.py index 6c38495ea8..81e6902255 100644 --- a/account_bank_multiple_partner/__manifest__.py +++ b/account_bank_multiple_partner/__manifest__.py @@ -7,7 +7,7 @@ "license": "AGPL-3", "author": "AvanzOSC", "summary": """Account Bank Multiple Partner""", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/odoo-addons", "depends": [ "account", ], diff --git a/account_banking_mandate_usability/__manifest__.py b/account_banking_mandate_usability/__manifest__.py index bc404d3338..fd3f6127c2 100644 --- a/account_banking_mandate_usability/__manifest__.py +++ b/account_banking_mandate_usability/__manifest__.py @@ -7,7 +7,7 @@ "category": "Banking addons", "license": "AGPL-3", "author": "AvanzOSC", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/odoo-addons", "depends": [ "account_banking_mandate", "account_banking_sepa_direct_debit", diff --git a/account_banking_mandate_usability/tests/common.py b/account_banking_mandate_usability/tests/common.py index a1ec655c0f..7cceaa41f4 100644 --- a/account_banking_mandate_usability/tests/common.py +++ b/account_banking_mandate_usability/tests/common.py @@ -7,7 +7,7 @@ class AccountBankingMandateUsabilityCommon(common.SavepointCase): @classmethod def setUpClass(cls): - super(AccountBankingMandateUsabilityCommon, cls).setUpClass() + super().setUpClass() cls.bank_model = cls.env["res.partner.bank"] cls.mandate_model = cls.env["account.banking.mandate"] cls.mandate_wiz_model = cls.env["res.partner.bank.mandate.generator"] diff --git a/account_banking_mandate_usability/views/res_partner_bank_view.xml b/account_banking_mandate_usability/views/res_partner_bank_view.xml index 872861b1e6..7e68015015 100644 --- a/account_banking_mandate_usability/views/res_partner_bank_view.xml +++ b/account_banking_mandate_usability/views/res_partner_bank_view.xml @@ -2,11 +2,18 @@ res.partner.bank - + - - diff --git a/account_banking_mandate_usability/wizards/res_partner_bank_mandate_generator.py b/account_banking_mandate_usability/wizards/res_partner_bank_mandate_generator.py index 11163ae267..61073fb86b 100644 --- a/account_banking_mandate_usability/wizards/res_partner_bank_mandate_generator.py +++ b/account_banking_mandate_usability/wizards/res_partner_bank_mandate_generator.py @@ -55,7 +55,7 @@ def _default_mandate_recurrent_sequence_type(self): @api.model def default_get(self, fields_list): - res = super(ResPartnerBankMandateGenerator, self).default_get(fields_list) + res = super().default_get(fields_list) if self.env.context.get("active_model") == "res.partner.bank": res.update({"bank_ids": [(6, 0, self.env.context.get("active_ids"))]}) return res @@ -99,8 +99,8 @@ def _onchange_validate(self): def button_generate_mandates(self): mandate_obj = self.env["account.banking.mandate"] signature_date = ( - fields.Date.context_today(self) if (self.signed or - self.validate) else False) + fields.Date.context_today(self) if (self.signed or self.validate) else False + ) for bank in self.bank_ids: if not bank._check_active_mandate(): mandate_dict = bank._get_mandate_vals() diff --git a/account_banking_mandate_usability/wizards/res_partner_bank_mandate_generator_view.xml b/account_banking_mandate_usability/wizards/res_partner_bank_mandate_generator_view.xml index 157f5f5dbb..1a82fa923f 100644 --- a/account_banking_mandate_usability/wizards/res_partner_bank_mandate_generator_view.xml +++ b/account_banking_mandate_usability/wizards/res_partner_bank_mandate_generator_view.xml @@ -8,18 +8,28 @@ - - - + + +
-
@@ -28,12 +38,18 @@
- + Create Mandates res.partner.bank.mandate.generator form - - + + list new diff --git a/account_budget_oca_usability/README.rst b/account_budget_oca_usability/README.rst index f4a27660eb..a249f3d586 100644 --- a/account_budget_oca_usability/README.rst +++ b/account_budget_oca_usability/README.rst @@ -7,7 +7,7 @@ Account budget oca usability ============================ * New menu "Budget Lines" in Invoicing-Accounting-Management. New view of type - "pivot" in this new menu. + "pivot" in this new menu. Bug Tracker =========== diff --git a/account_budget_oca_usability/__manifest__.py b/account_budget_oca_usability/__manifest__.py index 9bf9850db2..9f25a55a54 100644 --- a/account_budget_oca_usability/__manifest__.py +++ b/account_budget_oca_usability/__manifest__.py @@ -2,11 +2,11 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Account Budget Oca Usability", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "category": "Accounting", "license": "AGPL-3", "author": "AvanzOSC", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/odoo-addons", "depends": [ "account", "account_budget_oca", diff --git a/account_budget_oca_usability/models/crossovered_budget_lines.py b/account_budget_oca_usability/models/crossovered_budget_lines.py index e4dd94ac4e..5bd224a238 100644 --- a/account_budget_oca_usability/models/crossovered_budget_lines.py +++ b/account_budget_oca_usability/models/crossovered_budget_lines.py @@ -6,20 +6,27 @@ class CrossoveredBudgetLines(models.Model): _inherit = "crossovered.budget.lines" - practical_amount = fields.Float( - store=True, copy=False) + practical_amount = fields.Float(store=True, copy=False) difference = fields.Float( - string="Difference", store=True, copy=False, digits=0, - compute="_compute_difference") + string="Difference", + store=True, + copy=False, + digits=0, + compute="_compute_difference", + ) - @api.depends("general_budget_id", "general_budget_id.account_ids", - "date_from", "date_to", "analytic_account_id", - "analytic_account_id.line_ids", - "analytic_account_id.line_ids.date", - "analytic_account_id.line_ids.general_account_id") + @api.depends( + "general_budget_id", + "general_budget_id.account_ids", + "date_from", + "date_to", + "analytic_account_id", + "analytic_account_id.line_ids", + "analytic_account_id.line_ids.date", + "analytic_account_id.line_ids.general_account_id", + ) def _compute_practical_amount(self): - result = super( - CrossoveredBudgetLines, self)._compute_practical_amount() + result = super()._compute_practical_amount() return result @api.depends("planned_amount", "practical_amount") diff --git a/account_budget_oca_usability/views/crossovered_budget_line_views.xml b/account_budget_oca_usability/views/crossovered_budget_line_views.xml index f0e4b35180..905899f169 100644 --- a/account_budget_oca_usability/views/crossovered_budget_line_views.xml +++ b/account_budget_oca_usability/views/crossovered_budget_line_views.xml @@ -1,8 +1,11 @@ - + crossovered.budget.lines - + @@ -13,10 +16,18 @@ - - + + @@ -44,11 +55,11 @@ + id="menu_act_crossovered_budget_line_view" + parent="account.menu_finance_entries_management" + name="Budgets lines" + action="act_crossovered_budget_lines2_view" + sequence="70" + groups="account.group_account_user" + /> diff --git a/account_fleet_trailer/__manifest__.py b/account_fleet_trailer/__manifest__.py index 2fc6bc17b8..16ec095ee5 100644 --- a/account_fleet_trailer/__manifest__.py +++ b/account_fleet_trailer/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Account Fleet Trailer", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "author": "Avanzosc", "website": "https://github.com/avanzosc/odoo-addons", "category": "Accounting/Accounting", @@ -13,5 +13,5 @@ "views/account_move_views.xml", ], "license": "AGPL-3", - 'installable': True, + "installable": True, } diff --git a/account_fleet_trailer/views/account_move_views.xml b/account_fleet_trailer/views/account_move_views.xml index 95fa3a872b..087bffc594 100644 --- a/account_fleet_trailer/views/account_move_views.xml +++ b/account_fleet_trailer/views/account_move_views.xml @@ -1,18 +1,24 @@ - + account.move - - + + - - + + show - - + + show - + diff --git a/account_headquarter/__manifest__.py b/account_headquarter/__manifest__.py index 5b69b7fe7e..efcf5d7591 100644 --- a/account_headquarter/__manifest__.py +++ b/account_headquarter/__manifest__.py @@ -2,22 +2,18 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Account Headquarter", - 'version': '14.0.1.6.0', + "version": "14.0.1.6.0", "category": "Invoices & Payments", "license": "AGPL-3", "author": "AvanzOSC", - "website": "http://www.avanzosc.es", - "depends": [ - "sale_order_headquarter", - "purchase_order_headquarter", - "account" - ], + "website": "https://github.com/avanzosc/odoo-addons", + "depends": ["sale_order_headquarter", "purchase_order_headquarter", "account"], "data": [ "security/account_headquarter_security.xml", "views/account_move_views.xml", "views/account_move_line_views.xml", "views/account_group_views.xml", ], - 'installable': True, - 'auto_install': True, + "installable": True, + "auto_install": True, } diff --git a/account_headquarter/models/account_analytic_line.py b/account_headquarter/models/account_analytic_line.py index 8434682e06..5d360312f9 100644 --- a/account_headquarter/models/account_analytic_line.py +++ b/account_headquarter/models/account_analytic_line.py @@ -1,11 +1,13 @@ # Copyright 2021 Alfredo de la Fuente - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import models, fields +from odoo import fields, models class AccountAnalyticLine(models.Model): - _inherit = 'account.analytic.line' + _inherit = "account.analytic.line" headquarter_id = fields.Many2one( - string='Headquarter', comodel_name='res.partner', - domain="[('headquarter','=', True)]") + string="Headquarter", + comodel_name="res.partner", + domain="[('headquarter','=', True)]", + ) diff --git a/account_headquarter/models/account_group.py b/account_headquarter/models/account_group.py index 7763f1dddc..806424551e 100644 --- a/account_headquarter/models/account_group.py +++ b/account_headquarter/models/account_group.py @@ -1,19 +1,19 @@ # Copyright 2021 Alfredo de la Fuente - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import models, fields, api +from odoo import api, fields, models class AccountGroup(models.Model): - _inherit = 'account.group' + _inherit = "account.group" length_account = fields.Integer( - string='Length account', compute='_compute_length_account', - store=True) + string="Length account", compute="_compute_length_account", store=True + ) without_headquarter = fields.Boolean( - string='Without headquarter in invoices and accounting entries', - default=True) + string="Without headquarter in invoices and accounting entries", default=True + ) - @api.depends('code_prefix_start') + @api.depends("code_prefix_start") def _compute_length_account(self): for group in self: group.length_account = len(group.code_prefix_start) @@ -26,6 +26,6 @@ def _find_account_group_headquarter(self): found = True without_headquarter_control = group.without_headquarter else: - cond = [('id', '=', group.parent_id.id)] - group = self.env['account.group'].search(cond, limit=1) + cond = [("id", "=", group.parent_id.id)] + group = self.env["account.group"].search(cond, limit=1) return without_headquarter_control diff --git a/account_headquarter/models/account_move.py b/account_headquarter/models/account_move.py index 4dee91c488..aeda685146 100644 --- a/account_headquarter/models/account_move.py +++ b/account_headquarter/models/account_move.py @@ -1,43 +1,50 @@ # Copyright 2021 Alfredo de la Fuente - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import models, fields, _ +from odoo import _, fields, models from odoo.exceptions import UserError class AccountMove(models.Model): - _inherit = 'account.move' + _inherit = "account.move" headquarter_id = fields.Many2one( - string='Headquarter', comodel_name='res.partner', - domain="[('headquarter','=', True)]") + string="Headquarter", + comodel_name="res.partner", + domain="[('headquarter','=', True)]", + ) def action_post(self): - result = super(AccountMove, self).action_post() + result = super().action_post() for account_move in self: if account_move.headquarter_id: lines = account_move.invoice_line_ids.filtered( - lambda x: x.account_id and not - x.exclude_from_invoice_tab) + lambda x: x.account_id and not x.exclude_from_invoice_tab + ) for line in lines: account_group = line.account_id.group_id without_headquarter_control = ( - account_group._find_account_group_headquarter()) - if (not without_headquarter_control and not - line.headquarter_id): + account_group._find_account_group_headquarter() + ) + if not without_headquarter_control and not line.headquarter_id: raise UserError( - _('The line with accounting account: {}, need to ' - 'define their Headquarter.').format( - line.account_id.name)) + _( + "The line with accounting account: {}, need to " + "define their Headquarter." + ).format(line.account_id.name) + ) if lines: lines2 = lines.filtered( - lambda x: x.headquarter_id and not - x.analytic_account_id) + lambda x: x.headquarter_id and not x.analytic_account_id + ) for line in lines2: raise UserError( - _('The line with accounting account: {}, need to ' - 'define their analytic account.').format( - line.account_id.name)) + _( + "The line with accounting account: {}, need to " + "define their analytic account." + ).format(line.account_id.name) + ) lines = account_move.invoice_line_ids.filtered( - lambda x: x.headquarter_id) + lambda x: x.headquarter_id + ) lines.update_analytic_lines_hearquarter() return result diff --git a/account_headquarter/models/account_move_line.py b/account_headquarter/models/account_move_line.py index 1f2068c743..167c2d6fb9 100644 --- a/account_headquarter/models/account_move_line.py +++ b/account_headquarter/models/account_move_line.py @@ -1,14 +1,16 @@ # Copyright 2021 Alfredo de la Fuente - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import models, fields, api +from odoo import api, fields, models class AccountMoveLine(models.Model): - _inherit = 'account.move.line' + _inherit = "account.move.line" headquarter_id = fields.Many2one( - string='Headquarter', comodel_name='res.partner', - domain="[('headquarter','=', True)]") + string="Headquarter", + comodel_name="res.partner", + domain="[('headquarter','=', True)]", + ) @api.model_create_multi def create(self, values): @@ -17,44 +19,50 @@ def create(self, values): else: for val in values: val = self.treatment_headquarter(val) - return super(AccountMoveLine, self).create(values) + return super().create(values) def write(self, values): - result = super(AccountMoveLine, self).write(values) - if 'headquarter_id' in values: + result = super().write(values) + if "headquarter_id" in values: for line in self: line.update_analytic_lines_hearquarter() return result def treatment_headquarter(self, values): - if values.get('exclude_from_invoice_tab', False): - values['headquarter_id'] = False - if (not values.get('exclude_from_invoice_tab', False) and not - values.get('headquarter_id', False) and - values.get('move_id', False)): - move = self.env['account.move'].browse( - values.get('move_id')) + if values.get("exclude_from_invoice_tab", False): + values["headquarter_id"] = False + if ( + not values.get("exclude_from_invoice_tab", False) + and not values.get("headquarter_id", False) + and values.get("move_id", False) + ): + move = self.env["account.move"].browse(values.get("move_id")) if move.headquarter_id: - values['headquarter_id'] = move.headquarter_id.id + values["headquarter_id"] = move.headquarter_id.id return values def update_analytic_lines_hearquarter(self): for line in self: if line.analytic_line_ids: - vals = {'headquarter_id': (line.headquarter_id.id - if line.headquarter_id else False)} + vals = { + "headquarter_id": ( + line.headquarter_id.id if line.headquarter_id else False + ) + } line.analytic_line_ids.write(vals) - @api.onchange('product_id') + @api.onchange("product_id") def _onchange_product_id(self): - result = super(AccountMoveLine, self)._onchange_product_id() + result = super()._onchange_product_id() for line in self: - if ('default_headquarter_id' in self.env.context and - self.env.context.get('default_headquarter_id', False) and - line.account_id and line.product_id): + if ( + "default_headquarter_id" in self.env.context + and self.env.context.get("default_headquarter_id", False) + and line.account_id + and line.product_id + ): account_group = line.account_id.group_id - without_headquarter = ( - account_group._find_account_group_headquarter()) + without_headquarter = account_group._find_account_group_headquarter() if without_headquarter: line.headquarter_id = False return result diff --git a/account_headquarter/models/purchase_order.py b/account_headquarter/models/purchase_order.py index f401fc5de4..985d2d5a02 100644 --- a/account_headquarter/models/purchase_order.py +++ b/account_headquarter/models/purchase_order.py @@ -4,10 +4,10 @@ class PurchaseOrder(models.Model): - _inherit = 'purchase.order' + _inherit = "purchase.order" def _prepare_invoice(self): - invoice_vals = super(PurchaseOrder, self)._prepare_invoice() + invoice_vals = super()._prepare_invoice() if self.headquarter_id: - invoice_vals['headquarter_id'] = self.headquarter_id.id + invoice_vals["headquarter_id"] = self.headquarter_id.id return invoice_vals diff --git a/account_headquarter/models/sale_order.py b/account_headquarter/models/sale_order.py index ad8ccadff1..18a79db3ea 100644 --- a/account_headquarter/models/sale_order.py +++ b/account_headquarter/models/sale_order.py @@ -4,10 +4,10 @@ class SaleOrder(models.Model): - _inherit = 'sale.order' + _inherit = "sale.order" def _prepare_invoice(self): - invoice_vals = super(SaleOrder, self)._prepare_invoice() + invoice_vals = super()._prepare_invoice() if self.headquarter_id: - invoice_vals['headquarter_id'] = self.headquarter_id.id + invoice_vals["headquarter_id"] = self.headquarter_id.id return invoice_vals diff --git a/account_headquarter/models/sale_order_line.py b/account_headquarter/models/sale_order_line.py index 0cedaf8dee..c9406e928b 100644 --- a/account_headquarter/models/sale_order_line.py +++ b/account_headquarter/models/sale_order_line.py @@ -4,19 +4,18 @@ class SaleOrderLine(models.Model): - _inherit = 'sale.order.line' + _inherit = "sale.order.line" def _prepare_invoice_line(self, **optional_values): - values = super(SaleOrderLine, self)._prepare_invoice_line( - **optional_values) + values = super()._prepare_invoice_line(**optional_values) if self.order_id.headquarter_id: - values['headquarter_id'] = self.order_id.headquarter_id.id - if 'account_id' in values and values.get('account_id', False): - account = self.env['account.account'].browse( - values.get('account_id')) + values["headquarter_id"] = self.order_id.headquarter_id.id + if "account_id" in values and values.get("account_id", False): + account = self.env["account.account"].browse(values.get("account_id")) if account: without_headquarter = ( - account.group_id._find_account_group_headquarter()) + account.group_id._find_account_group_headquarter() + ) if without_headquarter: - values['headquarter_id'] = False + values["headquarter_id"] = False return values diff --git a/account_headquarter/security/account_headquarter_security.xml b/account_headquarter/security/account_headquarter_security.xml index 75a04c8207..5bd210d2ab 100644 --- a/account_headquarter/security/account_headquarter_security.xml +++ b/account_headquarter/security/account_headquarter_security.xml @@ -4,14 +4,14 @@ Invoice headquarter ['|', ('headquarter_id', '=', False), ('headquarter_id', 'in', user.headquarter_ids.ids)] + name="domain_force" + >['|', ('headquarter_id', '=', False), ('headquarter_id', 'in', user.headquarter_ids.ids)] Journal Item headquarter ['|', ('headquarter_id', '=', False), ('headquarter_id', 'in', user.headquarter_ids.ids)] + name="domain_force" + >['|', ('headquarter_id', '=', False), ('headquarter_id', 'in', user.headquarter_ids.ids)]
diff --git a/account_headquarter/tests/test_account_headquarter.py b/account_headquarter/tests/test_account_headquarter.py index 1ff06e11e5..99b5f2ca00 100644 --- a/account_headquarter/tests/test_account_headquarter.py +++ b/account_headquarter/tests/test_account_headquarter.py @@ -7,72 +7,82 @@ class TestAccountHeadquarter(common.SavepointCase): @classmethod def setUpClass(cls): - super(TestAccountHeadquarter, cls).setUpClass() - cls.sale_payment_obj = cls.env['sale.advance.payment.inv'] - cls.invoice_obj = cls.env['account.move'] - cls.product_obj = cls.env['product.product'] - cls.sale_order_line_obj = cls.env['sale.order.line'] - cls.uom_unit = cls.env.ref('uom.product_uom_unit') - cls.customer = cls.env.ref('base.res_partner_12') - cls.resource_calendar = cls.env.ref('resource.resource_calendar_std') - cls.company = cls.env['res.company']._company_default_get('sale.order') - cls.customer.write({ - 'parent_id': cls.company.partner_id.id, - 'headquarter': True}) - cls.product = cls.product_obj.create({ - 'name': 'product account headquarter', - 'default_code': 'PACCHEADQUARTER', - 'uom_id': cls.uom_unit.id, - 'uom_po_id': cls.uom_unit.id, - 'type': 'consu', - 'invoice_policy': 'order'}) - cls.product_service = cls.product_obj.create({ - 'name': 'product serviceaccount headquarter', - 'default_code': 'PSACCHEADQUARTER', - 'uom_id': cls.uom_unit.id, - 'uom_po_id': cls.uom_unit.id, - 'type': 'service', - 'invoice_policy': 'order'}) + super().setUpClass() + cls.sale_payment_obj = cls.env["sale.advance.payment.inv"] + cls.invoice_obj = cls.env["account.move"] + cls.product_obj = cls.env["product.product"] + cls.sale_order_line_obj = cls.env["sale.order.line"] + cls.uom_unit = cls.env.ref("uom.product_uom_unit") + cls.customer = cls.env.ref("base.res_partner_12") + cls.resource_calendar = cls.env.ref("resource.resource_calendar_std") + cls.company = cls.env["res.company"]._company_default_get("sale.order") + cls.customer.write( + {"parent_id": cls.company.partner_id.id, "headquarter": True} + ) + cls.product = cls.product_obj.create( + { + "name": "product account headquarter", + "default_code": "PACCHEADQUARTER", + "uom_id": cls.uom_unit.id, + "uom_po_id": cls.uom_unit.id, + "type": "consu", + "invoice_policy": "order", + } + ) + cls.product_service = cls.product_obj.create( + { + "name": "product serviceaccount headquarter", + "default_code": "PSACCHEADQUARTER", + "uom_id": cls.uom_unit.id, + "uom_po_id": cls.uom_unit.id, + "type": "service", + "invoice_policy": "order", + } + ) sale_vals = { "headquarter_id": cls.customer.id, "partner_id": cls.customer.id, "partner_invoice_id": cls.customer.id, "partner_shipping_id": cls.customer.id, - "company_id": cls.company.id} - cls.sale = cls.env['sale.order'].create(sale_vals) + "company_id": cls.company.id, + } + cls.sale = cls.env["sale.order"].create(sale_vals) sale_line_vals = { - 'order_id': cls.sale.id, - 'product_id': cls.product.id, - 'name': cls.product.name, - 'product_uom_qty': 1, - 'product_uom': cls.product.uom_id.id, - 'price_unit': 100} + "order_id": cls.sale.id, + "product_id": cls.product.id, + "name": cls.product.name, + "product_uom_qty": 1, + "product_uom": cls.product.uom_id.id, + "price_unit": 100, + } cls.sale_order_line_obj.create(sale_line_vals) sale_line_vals = { - 'order_id': cls.sale.id, - 'product_id': cls.product.id, - 'name': cls.product_service.name, - 'product_uom_qty': 1, - 'product_uom': cls.product.uom_id.id, - 'price_unit': 100} + "order_id": cls.sale.id, + "product_id": cls.product.id, + "name": cls.product_service.name, + "product_uom_qty": 1, + "product_uom": cls.product.uom_id.id, + "price_unit": 100, + } cls.sale_order_line_obj.create(sale_line_vals) - cls.analytic_account = cls.env['account.analytic.account'].search( - [], limit=1) + cls.analytic_account = cls.env["account.analytic.account"].search([], limit=1) def test_account_headquarter(self): self.sale.action_confirm() - vals = {'advance_payment_method': 'delivered'} + vals = {"advance_payment_method": "delivered"} sale_payment = self.sale_payment_obj.create(vals) sale_payment.with_context(active_ids=self.sale.ids).create_invoices() - cond = [('invoice_origin', '=', self.sale.name)] + cond = [("invoice_origin", "=", self.sale.name)] invoice = self.invoice_obj.search(cond, limit=1) self.assertEqual(invoice.headquarter_id, self.customer) invoice.invoice_line_ids.write( - {'analytic_account_id': self.analytic_account.id, - 'headquarter_id': invoice.headquarter_id.id}) + { + "analytic_account_id": self.analytic_account.id, + "headquarter_id": invoice.headquarter_id.id, + } + ) invoice.action_post() for line in invoice.invoice_line_ids: self.assertEqual(len(line.analytic_line_ids), 1) for analytic_line in line.analytic_line_ids: - self.assertEqual( - analytic_line.headquarter_id, invoice.headquarter_id) + self.assertEqual(analytic_line.headquarter_id, invoice.headquarter_id) diff --git a/account_headquarter/views/account_group_views.xml b/account_headquarter/views/account_group_views.xml index f27ff5f715..7b29db6e77 100644 --- a/account_headquarter/views/account_group_views.xml +++ b/account_headquarter/views/account_group_views.xml @@ -1,8 +1,8 @@ - + account.group - + @@ -12,7 +12,7 @@ account.group - + @@ -33,7 +33,10 @@ - + diff --git a/account_headquarter/views/account_move_line_views.xml b/account_headquarter/views/account_move_line_views.xml index e302ef80d5..af3d3b63fb 100644 --- a/account_headquarter/views/account_move_line_views.xml +++ b/account_headquarter/views/account_move_line_views.xml @@ -1,8 +1,8 @@ - + account.move.line - + @@ -11,7 +11,7 @@ account.move.line - + @@ -20,13 +20,18 @@ account.move.line - + - + diff --git a/account_headquarter/views/account_move_views.xml b/account_headquarter/views/account_move_views.xml index b12780cc40..0981cfa0da 100644 --- a/account_headquarter/views/account_move_views.xml +++ b/account_headquarter/views/account_move_views.xml @@ -1,8 +1,8 @@ - + account.move - + @@ -11,7 +11,7 @@ account.move - + @@ -20,22 +20,30 @@ account.move - + - + - + - {'default_move_type': context.get('default_move_type'), 'journal_id': journal_id, 'default_partner_id': commercial_partner_id, 'default_currency_id': currency_id or company_currency_id, 'default_headquarter_id': headquarter_id} + {'default_move_type': context.get('default_move_type'), 'journal_id': journal_id, 'default_partner_id': commercial_partner_id, 'default_currency_id': currency_id or company_currency_id, 'default_headquarter_id': headquarter_id} account.move - + @@ -44,25 +52,33 @@ account.move - + - + account.move - + - + diff --git a/account_invoice_event_report/__manifest__.py b/account_invoice_event_report/__manifest__.py index c701869e12..2f08c07882 100644 --- a/account_invoice_event_report/__manifest__.py +++ b/account_invoice_event_report/__manifest__.py @@ -4,7 +4,7 @@ "name": "Account Invoice Event Report", "version": "14.0.1.4.0", "author": "AvanzOSC", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/odoo-addons", "category": "Custom", "license": "AGPL-3", "depends": [ @@ -14,12 +14,12 @@ "sale_order_line_contract", "event_sale", "event_registration_student", - "event_registration_sale_line_contract" + "event_registration_sale_line_contract", ], "data": [ "views/account_move_views.xml", "views/sale_order_views.xml", - "report/account_invoice_report.xml" + "report/account_invoice_report.xml", ], "installable": True, } diff --git a/account_invoice_event_report/models/account_move.py b/account_invoice_event_report/models/account_move.py index 6da8acce0d..4ff66d433f 100644 --- a/account_invoice_event_report/models/account_move.py +++ b/account_invoice_event_report/models/account_move.py @@ -1,52 +1,61 @@ # Copyright 2021 Alfredo de la fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from odoo import models, fields, api +from odoo import api, fields, models class AccountMove(models.Model): - _inherit = 'account.move' + _inherit = "account.move" students_names = fields.Text( - string='Students', compute="_compute_students_names", store=True) + string="Students", compute="_compute_students_names", store=True + ) - @api.depends("invoice_line_ids", - "invoice_line_ids.sale_order_line_id", - "invoice_line_ids.contract_line_id") + @api.depends( + "invoice_line_ids", + "invoice_line_ids.sale_order_line_id", + "invoice_line_ids.contract_line_id", + ) def _compute_students_names(self): - partner_obj = self.env['res.partner'] + partner_obj = self.env["res.partner"] for invoice in self.filtered(lambda x: x.move_type == "out_invoice"): students = partner_obj students_name = "" for line in invoice.invoice_line_ids.filtered( - lambda x: x.sale_order_line_id and x.contract_line_id): - cond = [('sale_order_line_id', '=', - line.sale_order_line_id.id), - ('contract_line_id', '=', line.contract_line_id.id)] - registrations = self.env['event.registration'].search(cond) + lambda x: x.sale_order_line_id and x.contract_line_id + ): + cond = [ + ("sale_order_line_id", "=", line.sale_order_line_id.id), + ("contract_line_id", "=", line.contract_line_id.id), + ] + registrations = self.env["event.registration"].search(cond) if registrations: for registration in registrations: if registration and registration.student_id: if registration.student_id not in students: students += registration.student_id for line in invoice.invoice_line_ids.filtered( - lambda x: x.sale_order_line_id and not x.contract_line_id): + lambda x: x.sale_order_line_id and not x.contract_line_id + ): sale_line = line.sale_order_line_id - cond = [('event_id', '=', sale_line.event_id.id), - ('event_ticket_id', '=', sale_line.event_ticket_id.id), - ('sale_order_line_id', '=', sale_line.id)] - registration = self.env['event.registration'].search(cond) + cond = [ + ("event_id", "=", sale_line.event_id.id), + ("event_ticket_id", "=", sale_line.event_ticket_id.id), + ("sale_order_line_id", "=", sale_line.id), + ] + registration = self.env["event.registration"].search(cond) if not registration: sale = line.sale_order_line_id.order_id my_line = sale.order_line.filtered( - lambda x: x.event_id.id == sale_line.event_id.id and - x.event_ticket_id) + lambda x: x.event_id.id == sale_line.event_id.id + and x.event_ticket_id + ) if my_line and len(my_line) == 1: - cond = [('event_id', '=', my_line.event_id.id), - ('event_ticket_id', '=', - my_line.event_ticket_id.id), - ('sale_order_line_id', '=', my_line.id)] - registration = self.env['event.registration'].search( - cond) + cond = [ + ("event_id", "=", my_line.event_id.id), + ("event_ticket_id", "=", my_line.event_ticket_id.id), + ("sale_order_line_id", "=", my_line.id), + ] + registration = self.env["event.registration"].search(cond) if len(registration) == 1 and registration.student_id: if registration.student_id not in students: students += registration.student_id @@ -56,10 +65,11 @@ def _compute_students_names(self): students += reg.student_id if students: cond = [("id", "in", students.ids)] - final_students = partner_obj.search( - cond, order="name asc") + final_students = partner_obj.search(cond, order="name asc") for student in final_students: students_name = ( - student.name if not students_name else - "{}, {}".format(students_name, student.name)) + student.name + if not students_name + else "{}, {}".format(students_name, student.name) + ) invoice.students_names = students_name diff --git a/account_invoice_event_report/models/account_move_line.py b/account_invoice_event_report/models/account_move_line.py index fc358b12e6..f0ae3859d7 100644 --- a/account_invoice_event_report/models/account_move_line.py +++ b/account_invoice_event_report/models/account_move_line.py @@ -1,26 +1,34 @@ # Copyright 2021 Alfredo de la fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from odoo import models, fields, api +from odoo import api, fields, models class AccountMoveLline(models.Model): - _inherit = 'account.move.line' + _inherit = "account.move.line" sale_order_line_id = fields.Many2one( - string='Sale order line', store=True, comodel_name='sale.order.line', - compute='_compute_sale_order_line_id') + string="Sale order line", + store=True, + comodel_name="sale.order.line", + compute="_compute_sale_order_line_id", + ) event_id = fields.Many2one( - string='Event', store=True, comodel_name='event.event', - compute='_compute_event_id') - student_name = fields.Char( - string='Student name', compute='_compute_student_name') + string="Event", + store=True, + comodel_name="event.event", + compute="_compute_event_id", + ) + student_name = fields.Char(string="Student name", compute="_compute_student_name") def _compute_student_name(self): for line in self.filtered( - lambda x: x.sale_order_line_id and x.contract_line_id): - registration_obj = self.env['event.registration'] - cond = [('sale_order_line_id', '=', line.sale_order_line_id.id), - ('contract_line_id', '=', line.contract_line_id.id)] + lambda x: x.sale_order_line_id and x.contract_line_id + ): + registration_obj = self.env["event.registration"] + cond = [ + ("sale_order_line_id", "=", line.sale_order_line_id.id), + ("contract_line_id", "=", line.contract_line_id.id), + ] my_registrations = registration_obj registrations = registration_obj.search(cond) if registrations: @@ -31,61 +39,74 @@ def _compute_student_name(self): students_name = "" for reg in my_registrations: students_name = ( - reg.student_id.name if not students_name else - "{}, {}".format(students_name, reg.student_id.name)) + reg.student_id.name + if not students_name + else "{}, {}".format(students_name, reg.student_id.name) + ) line.student_name = students_name for line in self.filtered( - lambda x: x.sale_order_line_id and not x.contract_line_id): + lambda x: x.sale_order_line_id and not x.contract_line_id + ): sale_line = line.sale_order_line_id - cond = [('event_id', '=', sale_line.event_id.id), - ('event_ticket_id', '=', sale_line.event_ticket_id.id), - ('sale_order_line_id', '=', sale_line.id)] - registration = self.env['event.registration'].search(cond) + cond = [ + ("event_id", "=", sale_line.event_id.id), + ("event_ticket_id", "=", sale_line.event_ticket_id.id), + ("sale_order_line_id", "=", sale_line.id), + ] + registration = self.env["event.registration"].search(cond) if not registration: sale = line.sale_order_line_id.order_id my_line = sale.order_line.filtered( - lambda x: x.event_id.id == sale_line.event_id.id and - x.event_ticket_id) + lambda x: x.event_id.id == sale_line.event_id.id + and x.event_ticket_id + ) if my_line and len(my_line) == 1: - cond = [('event_id', '=', my_line.event_id.id), - ('event_ticket_id', '=', - my_line.event_ticket_id.id), - ('sale_order_line_id', '=', my_line.id)] - registration = self.env['event.registration'].search(cond) + cond = [ + ("event_id", "=", my_line.event_id.id), + ("event_ticket_id", "=", my_line.event_ticket_id.id), + ("sale_order_line_id", "=", my_line.id), + ] + registration = self.env["event.registration"].search(cond) if len(registration) == 1 and registration.student_id: line.student_name = registration.student_id.name if len(registration) > 1: students_name = "" for reg in registration.filtered(lambda x: x.student_id): students_name = ( - reg.student_id.name if not students_name else - "{}, {}".format(students_name, reg.student_id.name)) + reg.student_id.name + if not students_name + else "{}, {}".format(students_name, reg.student_id.name) + ) line.student_name = students_name if not registration: line.student_name = "" - @api.depends('contract_line_id', 'contract_line_id.sale_order_line_id', - 'sale_line_ids') + @api.depends( + "contract_line_id", "contract_line_id.sale_order_line_id", "sale_line_ids" + ) def _compute_sale_order_line_id(self): for line in self.filtered( - lambda x: x.contract_line_id and - x.contract_line_id.sale_order_line_id): + lambda x: x.contract_line_id and x.contract_line_id.sale_order_line_id + ): sale_line = line.contract_line_id.sale_order_line_id line.sale_order_line_id = sale_line.id - for line in self.filtered( - lambda x: not x.contract_line_id and x.sale_line_ids): + for line in self.filtered(lambda x: not x.contract_line_id and x.sale_line_ids): if len(line.sale_line_ids) == 1: line.sale_order_line_id = line.sale_line_ids[0].id - @api.depends('sale_order_line_id', 'sale_order_line_id.event_id', - 'sale_line_ids', 'sale_line_ids.event_id') + @api.depends( + "sale_order_line_id", + "sale_order_line_id.event_id", + "sale_line_ids", + "sale_line_ids.event_id", + ) def _compute_event_id(self): for line in self.filtered( - lambda x: x.contract_line_id and x.sale_order_line_id and - x.sale_order_line_id.event_id): + lambda x: x.contract_line_id + and x.sale_order_line_id + and x.sale_order_line_id.event_id + ): line.event_id = line.sale_order_line_id.event_id.id - for line in self.filtered( - lambda x: not x.contract_line_id and x.sale_line_ids): - if (len(line.sale_line_ids) == 1 and - line.sale_line_ids[0].event_id): + for line in self.filtered(lambda x: not x.contract_line_id and x.sale_line_ids): + if len(line.sale_line_ids) == 1 and line.sale_line_ids[0].event_id: line.event_id = line.sale_line_ids[0].event_id.id diff --git a/account_invoice_event_report/models/sale_order.py b/account_invoice_event_report/models/sale_order.py index 3479ca1b59..a133fcd96d 100644 --- a/account_invoice_event_report/models/sale_order.py +++ b/account_invoice_event_report/models/sale_order.py @@ -1,34 +1,39 @@ # Copyright 2022 Alfredo de la fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from odoo import models, fields, api +from odoo import api, fields, models class SaleOrder(models.Model): - _inherit = 'sale.order' + _inherit = "sale.order" registration_ids = fields.One2many( - string="Event registrations", comodel_name="event.registration", - inverse_name="sale_order_id") + string="Event registrations", + comodel_name="event.registration", + inverse_name="sale_order_id", + ) students_names = fields.Text( - string='Students', compute="_compute_students_names", store=True) + string="Students", compute="_compute_students_names", store=True + ) - @api.depends("registration_ids", "registration_ids.state", - "registration_ids.student_id") + @api.depends( + "registration_ids", "registration_ids.state", "registration_ids.student_id" + ) def _compute_students_names(self): - partner_obj = self.env['res.partner'] + partner_obj = self.env["res.partner"] for sale in self: students = partner_obj students_name = "" for registration in sale.registration_ids.filtered( - lambda x: x.state != "cancel"): - if (registration.student_id and - registration.student_id not in students): + lambda x: x.state != "cancel" + ): + if registration.student_id and registration.student_id not in students: students += registration.student_id if students: cond = [("id", "in", students.ids)] - final_students = partner_obj.search( - cond, order="name asc") + final_students = partner_obj.search(cond, order="name asc") for student in final_students: students_name = ( - student.name if not students_name else - "{}, {}".format(students_name, student.name)) + student.name + if not students_name + else "{}, {}".format(students_name, student.name) + ) sale.students_names = students_name diff --git a/account_invoice_event_report/report/account_invoice_report.xml b/account_invoice_event_report/report/account_invoice_report.xml index b92d674fd2..d06bd187d3 100644 --- a/account_invoice_event_report/report/account_invoice_report.xml +++ b/account_invoice_event_report/report/account_invoice_report.xml @@ -1,4 +1,4 @@ - + @@ -7,14 +7,23 @@ Invoices with event account.move qweb-pdf - account_invoice_event_report.report_invoice_event - account_invoice_event_report.report_invoice_event + account_invoice_event_report.report_invoice_event + account_invoice_event_report.report_invoice_event (object._get_report_base_filename()) - (object.state == 'posted') and ((object.name or 'INV').replace('/','_')+'.pdf') - + (object.state == 'posted') and ((object.name or 'INV').replace('/','_')+'.pdf') + report - +
@@ -24,88 +33,148 @@
-
-
- V.A.T. +
+
+ V.A.T.
-
-
- V.A.T. +
+
+ V.A.T.
-
- V.A.T. +
+ V.A.T.
-
-
-
-
- , +
+
+
+
+ ,
-
+
- - +
+ - - + - - + -
- Zenbatekoa
+ Zenbatekoa
Importe
- + +
- - Faktura
+ + Faktura
Invoice
- - Faktura borrador
+ + Faktura borrador
Draft invoice
- - Faktura cancelada
+ + Faktura cancelada
Cancelled Invoice
Refund - Faktura rectificativa
+ Faktura rectificativa
Refund invoice
- Faktura rectificativa de proveedor
+ Faktura rectificativa de proveedor
Supplier Refund
- Faktura de proveedor
+ Faktura de proveedor
Supplier Invoice
- + +
- Aroa
+ Aroa
Period
+ - @@ -116,137 +185,253 @@
-
+
- - +
+ - - - - + - - - + + + - - - - + + + + - + - - - - - - + + - - + + - - - - - + - + - + - - - @@ -258,18 +443,37 @@
- Azalpena
+ Azalpena
Concept
- Kopurua
+ Kopurua
Quantity
- Salneurri
+
+ Salneurri
Price
- BEZ
+
+ BEZ
TAXES
- Zenbatekoa
+
+ Zenbatekoa
Amount
- + - + - + + + - + + - + +
- Ikaslea(k)
+ Ikaslea(k)
Student(s)
- + -
- +
+
- + - + - + + + - + + - + +
- Ikaslea(k)
+ Ikaslea(k)
Student(s)
- + -
- +
+
- + - + - + + - + + - + +
- - - -
- BEZ xehatze
+
+ BEZ xehatze
TAX breakdown
- + + + 0% - + +
@@ -280,34 +484,78 @@ - - - - - - - - @@ -317,14 +565,27 @@
-
- BEZ xehatze
+ +
+ BEZ xehatze
TAX breakdown
- + + - + + - + + - - + + + - + + on - + - + +
+
- -
- Guztira
+
+ Guztira
Total
- + +
@@ -334,8 +595,13 @@
- @@ -344,29 +610,46 @@
-
- Hizkuntza heziketa zerbitzuak BEZ zegatik libre gelditzen dira, BEZ Legearen 20.1.9 art.ren arabera
+
+ Hizkuntza heziketa zerbitzuak BEZ zegatik libre gelditzen dira, BEZ Legearen 20.1.9 art.ren arabera
Language training services are exempt from TAX according to art. 20.1.9 of the tax law
+
- -
- Ordainketa modua
+
+ Ordainketa modua
Payment mode:
- + +
-
+
- -
- Banku-taloi edo kontu transferentzia bidez:
+
+ Banku-taloi edo kontu transferentzia bidez:
Upon receipt of the invoice, bank transfer to the account:
- + +
@@ -379,8 +662,14 @@ diff --git a/account_invoice_event_report/views/account_move_views.xml b/account_invoice_event_report/views/account_move_views.xml index 9cd7ace1fd..436ca20ddc 100644 --- a/account_invoice_event_report/views/account_move_views.xml +++ b/account_invoice_event_report/views/account_move_views.xml @@ -1,13 +1,16 @@ - + account.move - + - + - + @@ -15,17 +18,20 @@ account.move - + - - + + account.move - + diff --git a/account_invoice_event_report/views/sale_order_views.xml b/account_invoice_event_report/views/sale_order_views.xml index f729225c77..b71dd009a6 100644 --- a/account_invoice_event_report/views/sale_order_views.xml +++ b/account_invoice_event_report/views/sale_order_views.xml @@ -1,8 +1,8 @@ - + sale.order - + @@ -14,7 +14,7 @@ sale.order - + @@ -24,7 +24,7 @@ sale.order - + @@ -34,7 +34,7 @@ sale.order - + diff --git a/account_invoice_event_report_ticketbai/__manifest__.py b/account_invoice_event_report_ticketbai/__manifest__.py index 1ea71e0481..12263a820b 100644 --- a/account_invoice_event_report_ticketbai/__manifest__.py +++ b/account_invoice_event_report_ticketbai/__manifest__.py @@ -4,16 +4,14 @@ "name": "Account Invoice Event Report Ticketbai", "version": "14.0.1.0.0", "author": "AvanzOSC", - "website": "https://github.com/avanzosc/odoo-addons.git", + "website": "https://github.com/avanzosc/odoo-addons", "category": "Custom", "license": "AGPL-3", "depends": [ "account_invoice_event_report", "l10n_es_ticketbai", ], - "data": [ - "report/account_invoice_report.xml" - ], + "data": ["report/account_invoice_report.xml"], "installable": True, "auto_install": True, } diff --git a/account_invoice_event_report_ticketbai/report/account_invoice_report.xml b/account_invoice_event_report_ticketbai/report/account_invoice_report.xml index 2f135ad91b..c1df1e7f8f 100644 --- a/account_invoice_event_report_ticketbai/report/account_invoice_report.xml +++ b/account_invoice_event_report_ticketbai/report/account_invoice_report.xml @@ -1,13 +1,24 @@ - + -