From 0ab4b609f907d3ccd3c077a6c95133a3c31fc918 Mon Sep 17 00:00:00 2001 From: Berezi <82805447+Berezi@users.noreply.github.com> Date: Tue, 21 May 2024 13:58:57 +0200 Subject: [PATCH 01/41] [14.0][IMP] custom_mrp_line_cost: Change if condition. (#315) Co-authored-by: Tu Nombre --- custom_mrp_line_cost/models/stock_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_mrp_line_cost/models/stock_move_line.py b/custom_mrp_line_cost/models/stock_move_line.py index 7079006b9..594eed5bd 100644 --- a/custom_mrp_line_cost/models/stock_move_line.py +++ b/custom_mrp_line_cost/models/stock_move_line.py @@ -154,7 +154,7 @@ def _compute_base_price(self): lambda c: c.lot_id.name == line.lot_id.name ) ) - if not entry_same_lots and sum(entry_same_lots.mapped("qty_done")) == 0: + if not entry_same_lots or sum(entry_same_lots.mapped("qty_done")) == 0: cost = 0 else: entry_cost = sum( From e46b748e46cc4c4b6fc197804cffdc72f56e3bec Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 26 Jun 2024 11:06:40 +0200 Subject: [PATCH 02/41] [IMP] add continuous integration --- .eslintrc.yml | 1 + .github/workflows/pre-commit.yml | 46 ++++++++++++++++++ .gitignore | 1 + .pre-commit-config.yaml | 47 ++++++++++++------- .pylintrc | 33 ------------- .pylintrc-mandatory | 35 +------------- .travis.yml | 11 ++--- LICENSE | 6 +-- .../odoo/addons/custom_mrp_descarga | 1 + setup/custom_mrp_descarga/setup.py | 6 +++ .../odoo/addons/custom_mrp_line_cost | 1 + setup/custom_mrp_line_cost/setup.py | 6 +++ .../odoo/addons/mrp_bom_category | 1 + setup/mrp_bom_category/setup.py | 6 +++ .../odoo/addons/mrp_bom_import_position | 1 + setup/mrp_bom_import_position/setup.py | 6 +++ .../odoo/addons/mrp_bom_line_coef | 1 + setup/mrp_bom_line_coef/setup.py | 6 +++ .../odoo/addons/mrp_bom_line_note | 1 + setup/mrp_bom_line_note/setup.py | 6 +++ .../odoo/addons/mrp_bom_reference | 1 + setup/mrp_bom_reference/setup.py | 6 +++ .../odoo/addons/mrp_bom_report_group | 1 + setup/mrp_bom_report_group/setup.py | 6 +++ setup/mrp_cut/odoo/addons/mrp_cut | 1 + setup/mrp_cut/setup.py | 6 +++ .../odoo/addons/mrp_manual_sale_info | 1 + setup/mrp_manual_sale_info/setup.py | 6 +++ .../odoo/addons/mrp_product_template_lineal | 1 + setup/mrp_product_template_lineal/setup.py | 6 +++ .../odoo/addons/mrp_product_version_to_bom | 1 + setup/mrp_product_version_to_bom/setup.py | 6 +++ .../odoo/addons/mrp_production_cost | 1 + setup/mrp_production_cost/setup.py | 6 +++ .../odoo/addons/mrp_production_deconstruction | 1 + setup/mrp_production_deconstruction/setup.py | 6 +++ .../odoo/addons/mrp_production_extend_origin | 1 + setup/mrp_production_extend_origin/setup.py | 6 +++ .../mrp_production_show_button_unreserve | 1 + .../setup.py | 6 +++ .../addons/mrp_production_split_by_serials | 1 + .../mrp_production_split_by_serials/setup.py | 6 +++ .../addons/mrp_routing_workcenter_capacity | 1 + .../mrp_routing_workcenter_capacity/setup.py | 6 +++ .../mrp_second_uom/odoo/addons/mrp_second_uom | 1 + setup/mrp_second_uom/setup.py | 6 +++ .../addons/mrp_stock_picking_create_repair | 1 + .../mrp_stock_picking_create_repair/setup.py | 6 +++ .../addons/mrp_workcenter_productivity_loss | 1 + .../mrp_workcenter_productivity_loss/setup.py | 6 +++ .../odoo/addons/mrp_workorder_availability | 1 + setup/mrp_workorder_availability/setup.py | 6 +++ .../odoo/addons/mrp_workorder_extra_time | 1 + setup/mrp_workorder_extra_time/setup.py | 6 +++ .../odoo/addons/mrp_workorder_permission | 1 + setup/mrp_workorder_permission/setup.py | 6 +++ .../odoo/addons/mrp_workorder_product_variant | 1 + setup/mrp_workorder_product_variant/setup.py | 6 +++ .../odoo/addons/mrp_workorder_time_plate | 1 + setup/mrp_workorder_time_plate/setup.py | 6 +++ .../odoo/addons/quality_control_claim | 1 + setup/quality_control_claim/setup.py | 6 +++ .../odoo/addons/quality_control_test_method | 1 + setup/quality_control_test_method/setup.py | 6 +++ .../odoo/addons/quality_control_usability | 1 + setup/quality_control_usability/setup.py | 6 +++ .../odoo/addons/sale_line_mrp_link | 1 + setup/sale_line_mrp_link/setup.py | 6 +++ 68 files changed, 296 insertions(+), 94 deletions(-) create mode 100644 .github/workflows/pre-commit.yml create mode 120000 setup/custom_mrp_descarga/odoo/addons/custom_mrp_descarga create mode 100644 setup/custom_mrp_descarga/setup.py create mode 120000 setup/custom_mrp_line_cost/odoo/addons/custom_mrp_line_cost create mode 100644 setup/custom_mrp_line_cost/setup.py create mode 120000 setup/mrp_bom_category/odoo/addons/mrp_bom_category create mode 100644 setup/mrp_bom_category/setup.py create mode 120000 setup/mrp_bom_import_position/odoo/addons/mrp_bom_import_position create mode 100644 setup/mrp_bom_import_position/setup.py create mode 120000 setup/mrp_bom_line_coef/odoo/addons/mrp_bom_line_coef create mode 100644 setup/mrp_bom_line_coef/setup.py create mode 120000 setup/mrp_bom_line_note/odoo/addons/mrp_bom_line_note create mode 100644 setup/mrp_bom_line_note/setup.py create mode 120000 setup/mrp_bom_reference/odoo/addons/mrp_bom_reference create mode 100644 setup/mrp_bom_reference/setup.py create mode 120000 setup/mrp_bom_report_group/odoo/addons/mrp_bom_report_group create mode 100644 setup/mrp_bom_report_group/setup.py create mode 120000 setup/mrp_cut/odoo/addons/mrp_cut create mode 100644 setup/mrp_cut/setup.py create mode 120000 setup/mrp_manual_sale_info/odoo/addons/mrp_manual_sale_info create mode 100644 setup/mrp_manual_sale_info/setup.py create mode 120000 setup/mrp_product_template_lineal/odoo/addons/mrp_product_template_lineal create mode 100644 setup/mrp_product_template_lineal/setup.py create mode 120000 setup/mrp_product_version_to_bom/odoo/addons/mrp_product_version_to_bom create mode 100644 setup/mrp_product_version_to_bom/setup.py create mode 120000 setup/mrp_production_cost/odoo/addons/mrp_production_cost create mode 100644 setup/mrp_production_cost/setup.py create mode 120000 setup/mrp_production_deconstruction/odoo/addons/mrp_production_deconstruction create mode 100644 setup/mrp_production_deconstruction/setup.py create mode 120000 setup/mrp_production_extend_origin/odoo/addons/mrp_production_extend_origin create mode 100644 setup/mrp_production_extend_origin/setup.py create mode 120000 setup/mrp_production_show_button_unreserve/odoo/addons/mrp_production_show_button_unreserve create mode 100644 setup/mrp_production_show_button_unreserve/setup.py create mode 120000 setup/mrp_production_split_by_serials/odoo/addons/mrp_production_split_by_serials create mode 100644 setup/mrp_production_split_by_serials/setup.py create mode 120000 setup/mrp_routing_workcenter_capacity/odoo/addons/mrp_routing_workcenter_capacity create mode 100644 setup/mrp_routing_workcenter_capacity/setup.py create mode 120000 setup/mrp_second_uom/odoo/addons/mrp_second_uom create mode 100644 setup/mrp_second_uom/setup.py create mode 120000 setup/mrp_stock_picking_create_repair/odoo/addons/mrp_stock_picking_create_repair create mode 100644 setup/mrp_stock_picking_create_repair/setup.py create mode 120000 setup/mrp_workcenter_productivity_loss/odoo/addons/mrp_workcenter_productivity_loss create mode 100644 setup/mrp_workcenter_productivity_loss/setup.py create mode 120000 setup/mrp_workorder_availability/odoo/addons/mrp_workorder_availability create mode 100644 setup/mrp_workorder_availability/setup.py create mode 120000 setup/mrp_workorder_extra_time/odoo/addons/mrp_workorder_extra_time create mode 100644 setup/mrp_workorder_extra_time/setup.py create mode 120000 setup/mrp_workorder_permission/odoo/addons/mrp_workorder_permission create mode 100644 setup/mrp_workorder_permission/setup.py create mode 120000 setup/mrp_workorder_product_variant/odoo/addons/mrp_workorder_product_variant create mode 100644 setup/mrp_workorder_product_variant/setup.py create mode 120000 setup/mrp_workorder_time_plate/odoo/addons/mrp_workorder_time_plate create mode 100644 setup/mrp_workorder_time_plate/setup.py create mode 120000 setup/quality_control_claim/odoo/addons/quality_control_claim create mode 100644 setup/quality_control_claim/setup.py create mode 120000 setup/quality_control_test_method/odoo/addons/quality_control_test_method create mode 100644 setup/quality_control_test_method/setup.py create mode 120000 setup/quality_control_usability/odoo/addons/quality_control_usability create mode 100644 setup/quality_control_usability/setup.py create mode 120000 setup/sale_line_mrp_link/odoo/addons/sale_line_mrp_link create mode 100644 setup/sale_line_mrp_link/setup.py diff --git a/.eslintrc.yml b/.eslintrc.yml index 9429bc688..fed88d70d 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/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 000000000..602ecbca2 --- /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 9c283fd41..0090721f5 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 5d625265e..5d8e7bce7 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/mrp-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 b28107b6c..ac714a941 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 967b0ffaf..b4ce55ef6 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/.travis.yml b/.travis.yml index ec444145b..67eeaa5fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,23 @@ language: python +sudo: false +cache: pip python: - "3.6" -sudo: false -cache: pip - addons: postgresql: "9.6" apt: packages: - expect-dev # provides unbuffer utility - python-lxml # because pip installation is slow - - python-unidecode - antiword # document module - cups - libcups2-dev env: global: - - VERSION="14.0" TESTS="0" LINT_CHECK="0" + - VERSION="14.0" TESTS="0" LINT_CHECK="0" WKHTMLTOPDF_VERSION="0.12.4" matrix: - LINT_CHECK="1" - TESTS="1" ODOO_REPO="OCA/OCB" @@ -29,10 +27,11 @@ install: - git clone --depth=1 https://github.com/avanzosc/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} + - pip install unidecode - travis_install_nightly script: - - travis_wait travis_run_tests + - travis_run_tests after_success: - travis_after_tests_success diff --git a/LICENSE b/LICENSE index 3ffc56789..a930cc7e9 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. @@ -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/setup/custom_mrp_descarga/odoo/addons/custom_mrp_descarga b/setup/custom_mrp_descarga/odoo/addons/custom_mrp_descarga new file mode 120000 index 000000000..65aa516d3 --- /dev/null +++ b/setup/custom_mrp_descarga/odoo/addons/custom_mrp_descarga @@ -0,0 +1 @@ +../../../../custom_mrp_descarga \ No newline at end of file diff --git a/setup/custom_mrp_descarga/setup.py b/setup/custom_mrp_descarga/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/custom_mrp_descarga/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/custom_mrp_line_cost/odoo/addons/custom_mrp_line_cost b/setup/custom_mrp_line_cost/odoo/addons/custom_mrp_line_cost new file mode 120000 index 000000000..96acccadb --- /dev/null +++ b/setup/custom_mrp_line_cost/odoo/addons/custom_mrp_line_cost @@ -0,0 +1 @@ +../../../../custom_mrp_line_cost \ No newline at end of file diff --git a/setup/custom_mrp_line_cost/setup.py b/setup/custom_mrp_line_cost/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/custom_mrp_line_cost/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_bom_category/odoo/addons/mrp_bom_category b/setup/mrp_bom_category/odoo/addons/mrp_bom_category new file mode 120000 index 000000000..862977e0e --- /dev/null +++ b/setup/mrp_bom_category/odoo/addons/mrp_bom_category @@ -0,0 +1 @@ +../../../../mrp_bom_category \ No newline at end of file diff --git a/setup/mrp_bom_category/setup.py b/setup/mrp_bom_category/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_bom_category/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_bom_import_position/odoo/addons/mrp_bom_import_position b/setup/mrp_bom_import_position/odoo/addons/mrp_bom_import_position new file mode 120000 index 000000000..55c20247c --- /dev/null +++ b/setup/mrp_bom_import_position/odoo/addons/mrp_bom_import_position @@ -0,0 +1 @@ +../../../../mrp_bom_import_position \ No newline at end of file diff --git a/setup/mrp_bom_import_position/setup.py b/setup/mrp_bom_import_position/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_bom_import_position/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_bom_line_coef/odoo/addons/mrp_bom_line_coef b/setup/mrp_bom_line_coef/odoo/addons/mrp_bom_line_coef new file mode 120000 index 000000000..37168b735 --- /dev/null +++ b/setup/mrp_bom_line_coef/odoo/addons/mrp_bom_line_coef @@ -0,0 +1 @@ +../../../../mrp_bom_line_coef \ No newline at end of file diff --git a/setup/mrp_bom_line_coef/setup.py b/setup/mrp_bom_line_coef/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_bom_line_coef/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_bom_line_note/odoo/addons/mrp_bom_line_note b/setup/mrp_bom_line_note/odoo/addons/mrp_bom_line_note new file mode 120000 index 000000000..6ef490478 --- /dev/null +++ b/setup/mrp_bom_line_note/odoo/addons/mrp_bom_line_note @@ -0,0 +1 @@ +../../../../mrp_bom_line_note \ No newline at end of file diff --git a/setup/mrp_bom_line_note/setup.py b/setup/mrp_bom_line_note/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_bom_line_note/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_bom_reference/odoo/addons/mrp_bom_reference b/setup/mrp_bom_reference/odoo/addons/mrp_bom_reference new file mode 120000 index 000000000..449badd64 --- /dev/null +++ b/setup/mrp_bom_reference/odoo/addons/mrp_bom_reference @@ -0,0 +1 @@ +../../../../mrp_bom_reference \ No newline at end of file diff --git a/setup/mrp_bom_reference/setup.py b/setup/mrp_bom_reference/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_bom_reference/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_bom_report_group/odoo/addons/mrp_bom_report_group b/setup/mrp_bom_report_group/odoo/addons/mrp_bom_report_group new file mode 120000 index 000000000..4708f692c --- /dev/null +++ b/setup/mrp_bom_report_group/odoo/addons/mrp_bom_report_group @@ -0,0 +1 @@ +../../../../mrp_bom_report_group \ No newline at end of file diff --git a/setup/mrp_bom_report_group/setup.py b/setup/mrp_bom_report_group/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_bom_report_group/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_cut/odoo/addons/mrp_cut b/setup/mrp_cut/odoo/addons/mrp_cut new file mode 120000 index 000000000..74a7cc7fe --- /dev/null +++ b/setup/mrp_cut/odoo/addons/mrp_cut @@ -0,0 +1 @@ +../../../../mrp_cut \ No newline at end of file diff --git a/setup/mrp_cut/setup.py b/setup/mrp_cut/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_cut/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_manual_sale_info/odoo/addons/mrp_manual_sale_info b/setup/mrp_manual_sale_info/odoo/addons/mrp_manual_sale_info new file mode 120000 index 000000000..8f0d4cbae --- /dev/null +++ b/setup/mrp_manual_sale_info/odoo/addons/mrp_manual_sale_info @@ -0,0 +1 @@ +../../../../mrp_manual_sale_info \ No newline at end of file diff --git a/setup/mrp_manual_sale_info/setup.py b/setup/mrp_manual_sale_info/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_manual_sale_info/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_product_template_lineal/odoo/addons/mrp_product_template_lineal b/setup/mrp_product_template_lineal/odoo/addons/mrp_product_template_lineal new file mode 120000 index 000000000..e2781d833 --- /dev/null +++ b/setup/mrp_product_template_lineal/odoo/addons/mrp_product_template_lineal @@ -0,0 +1 @@ +../../../../mrp_product_template_lineal \ No newline at end of file diff --git a/setup/mrp_product_template_lineal/setup.py b/setup/mrp_product_template_lineal/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_product_template_lineal/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_product_version_to_bom/odoo/addons/mrp_product_version_to_bom b/setup/mrp_product_version_to_bom/odoo/addons/mrp_product_version_to_bom new file mode 120000 index 000000000..74e871d1c --- /dev/null +++ b/setup/mrp_product_version_to_bom/odoo/addons/mrp_product_version_to_bom @@ -0,0 +1 @@ +../../../../mrp_product_version_to_bom \ No newline at end of file diff --git a/setup/mrp_product_version_to_bom/setup.py b/setup/mrp_product_version_to_bom/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_product_version_to_bom/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_production_cost/odoo/addons/mrp_production_cost b/setup/mrp_production_cost/odoo/addons/mrp_production_cost new file mode 120000 index 000000000..163f7ef00 --- /dev/null +++ b/setup/mrp_production_cost/odoo/addons/mrp_production_cost @@ -0,0 +1 @@ +../../../../mrp_production_cost \ No newline at end of file diff --git a/setup/mrp_production_cost/setup.py b/setup/mrp_production_cost/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_production_cost/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_production_deconstruction/odoo/addons/mrp_production_deconstruction b/setup/mrp_production_deconstruction/odoo/addons/mrp_production_deconstruction new file mode 120000 index 000000000..fc7692cfb --- /dev/null +++ b/setup/mrp_production_deconstruction/odoo/addons/mrp_production_deconstruction @@ -0,0 +1 @@ +../../../../mrp_production_deconstruction \ No newline at end of file diff --git a/setup/mrp_production_deconstruction/setup.py b/setup/mrp_production_deconstruction/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_production_deconstruction/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_production_extend_origin/odoo/addons/mrp_production_extend_origin b/setup/mrp_production_extend_origin/odoo/addons/mrp_production_extend_origin new file mode 120000 index 000000000..643911310 --- /dev/null +++ b/setup/mrp_production_extend_origin/odoo/addons/mrp_production_extend_origin @@ -0,0 +1 @@ +../../../../mrp_production_extend_origin \ No newline at end of file diff --git a/setup/mrp_production_extend_origin/setup.py b/setup/mrp_production_extend_origin/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_production_extend_origin/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_production_show_button_unreserve/odoo/addons/mrp_production_show_button_unreserve b/setup/mrp_production_show_button_unreserve/odoo/addons/mrp_production_show_button_unreserve new file mode 120000 index 000000000..4849f38d1 --- /dev/null +++ b/setup/mrp_production_show_button_unreserve/odoo/addons/mrp_production_show_button_unreserve @@ -0,0 +1 @@ +../../../../mrp_production_show_button_unreserve \ No newline at end of file diff --git a/setup/mrp_production_show_button_unreserve/setup.py b/setup/mrp_production_show_button_unreserve/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_production_show_button_unreserve/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_production_split_by_serials/odoo/addons/mrp_production_split_by_serials b/setup/mrp_production_split_by_serials/odoo/addons/mrp_production_split_by_serials new file mode 120000 index 000000000..e668764c5 --- /dev/null +++ b/setup/mrp_production_split_by_serials/odoo/addons/mrp_production_split_by_serials @@ -0,0 +1 @@ +../../../../mrp_production_split_by_serials \ No newline at end of file diff --git a/setup/mrp_production_split_by_serials/setup.py b/setup/mrp_production_split_by_serials/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_production_split_by_serials/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_routing_workcenter_capacity/odoo/addons/mrp_routing_workcenter_capacity b/setup/mrp_routing_workcenter_capacity/odoo/addons/mrp_routing_workcenter_capacity new file mode 120000 index 000000000..6530dde83 --- /dev/null +++ b/setup/mrp_routing_workcenter_capacity/odoo/addons/mrp_routing_workcenter_capacity @@ -0,0 +1 @@ +../../../../mrp_routing_workcenter_capacity \ No newline at end of file diff --git a/setup/mrp_routing_workcenter_capacity/setup.py b/setup/mrp_routing_workcenter_capacity/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_routing_workcenter_capacity/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_second_uom/odoo/addons/mrp_second_uom b/setup/mrp_second_uom/odoo/addons/mrp_second_uom new file mode 120000 index 000000000..2a57db7c8 --- /dev/null +++ b/setup/mrp_second_uom/odoo/addons/mrp_second_uom @@ -0,0 +1 @@ +../../../../mrp_second_uom \ No newline at end of file diff --git a/setup/mrp_second_uom/setup.py b/setup/mrp_second_uom/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_second_uom/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_stock_picking_create_repair/odoo/addons/mrp_stock_picking_create_repair b/setup/mrp_stock_picking_create_repair/odoo/addons/mrp_stock_picking_create_repair new file mode 120000 index 000000000..55d020ef1 --- /dev/null +++ b/setup/mrp_stock_picking_create_repair/odoo/addons/mrp_stock_picking_create_repair @@ -0,0 +1 @@ +../../../../mrp_stock_picking_create_repair \ No newline at end of file diff --git a/setup/mrp_stock_picking_create_repair/setup.py b/setup/mrp_stock_picking_create_repair/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_stock_picking_create_repair/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_workcenter_productivity_loss/odoo/addons/mrp_workcenter_productivity_loss b/setup/mrp_workcenter_productivity_loss/odoo/addons/mrp_workcenter_productivity_loss new file mode 120000 index 000000000..640eda434 --- /dev/null +++ b/setup/mrp_workcenter_productivity_loss/odoo/addons/mrp_workcenter_productivity_loss @@ -0,0 +1 @@ +../../../../mrp_workcenter_productivity_loss \ No newline at end of file diff --git a/setup/mrp_workcenter_productivity_loss/setup.py b/setup/mrp_workcenter_productivity_loss/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_workcenter_productivity_loss/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_workorder_availability/odoo/addons/mrp_workorder_availability b/setup/mrp_workorder_availability/odoo/addons/mrp_workorder_availability new file mode 120000 index 000000000..861970b31 --- /dev/null +++ b/setup/mrp_workorder_availability/odoo/addons/mrp_workorder_availability @@ -0,0 +1 @@ +../../../../mrp_workorder_availability \ No newline at end of file diff --git a/setup/mrp_workorder_availability/setup.py b/setup/mrp_workorder_availability/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_workorder_availability/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_workorder_extra_time/odoo/addons/mrp_workorder_extra_time b/setup/mrp_workorder_extra_time/odoo/addons/mrp_workorder_extra_time new file mode 120000 index 000000000..fced47756 --- /dev/null +++ b/setup/mrp_workorder_extra_time/odoo/addons/mrp_workorder_extra_time @@ -0,0 +1 @@ +../../../../mrp_workorder_extra_time \ No newline at end of file diff --git a/setup/mrp_workorder_extra_time/setup.py b/setup/mrp_workorder_extra_time/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_workorder_extra_time/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_workorder_permission/odoo/addons/mrp_workorder_permission b/setup/mrp_workorder_permission/odoo/addons/mrp_workorder_permission new file mode 120000 index 000000000..5f94ffde6 --- /dev/null +++ b/setup/mrp_workorder_permission/odoo/addons/mrp_workorder_permission @@ -0,0 +1 @@ +../../../../mrp_workorder_permission \ No newline at end of file diff --git a/setup/mrp_workorder_permission/setup.py b/setup/mrp_workorder_permission/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_workorder_permission/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_workorder_product_variant/odoo/addons/mrp_workorder_product_variant b/setup/mrp_workorder_product_variant/odoo/addons/mrp_workorder_product_variant new file mode 120000 index 000000000..154e6f950 --- /dev/null +++ b/setup/mrp_workorder_product_variant/odoo/addons/mrp_workorder_product_variant @@ -0,0 +1 @@ +../../../../mrp_workorder_product_variant \ No newline at end of file diff --git a/setup/mrp_workorder_product_variant/setup.py b/setup/mrp_workorder_product_variant/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_workorder_product_variant/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_workorder_time_plate/odoo/addons/mrp_workorder_time_plate b/setup/mrp_workorder_time_plate/odoo/addons/mrp_workorder_time_plate new file mode 120000 index 000000000..dcd65eebd --- /dev/null +++ b/setup/mrp_workorder_time_plate/odoo/addons/mrp_workorder_time_plate @@ -0,0 +1 @@ +../../../../mrp_workorder_time_plate \ No newline at end of file diff --git a/setup/mrp_workorder_time_plate/setup.py b/setup/mrp_workorder_time_plate/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_workorder_time_plate/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/quality_control_claim/odoo/addons/quality_control_claim b/setup/quality_control_claim/odoo/addons/quality_control_claim new file mode 120000 index 000000000..f9d8077e3 --- /dev/null +++ b/setup/quality_control_claim/odoo/addons/quality_control_claim @@ -0,0 +1 @@ +../../../../quality_control_claim \ No newline at end of file diff --git a/setup/quality_control_claim/setup.py b/setup/quality_control_claim/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/quality_control_claim/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/quality_control_test_method/odoo/addons/quality_control_test_method b/setup/quality_control_test_method/odoo/addons/quality_control_test_method new file mode 120000 index 000000000..049103c33 --- /dev/null +++ b/setup/quality_control_test_method/odoo/addons/quality_control_test_method @@ -0,0 +1 @@ +../../../../quality_control_test_method \ No newline at end of file diff --git a/setup/quality_control_test_method/setup.py b/setup/quality_control_test_method/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/quality_control_test_method/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/quality_control_usability/odoo/addons/quality_control_usability b/setup/quality_control_usability/odoo/addons/quality_control_usability new file mode 120000 index 000000000..f782d3b1d --- /dev/null +++ b/setup/quality_control_usability/odoo/addons/quality_control_usability @@ -0,0 +1 @@ +../../../../quality_control_usability \ No newline at end of file diff --git a/setup/quality_control_usability/setup.py b/setup/quality_control_usability/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/quality_control_usability/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/sale_line_mrp_link/odoo/addons/sale_line_mrp_link b/setup/sale_line_mrp_link/odoo/addons/sale_line_mrp_link new file mode 120000 index 000000000..01f122909 --- /dev/null +++ b/setup/sale_line_mrp_link/odoo/addons/sale_line_mrp_link @@ -0,0 +1 @@ +../../../../sale_line_mrp_link \ No newline at end of file diff --git a/setup/sale_line_mrp_link/setup.py b/setup/sale_line_mrp_link/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/sale_line_mrp_link/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From c34341d4473fc0ea2587630eb17e7400cd2b71c1 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 26 Jun 2024 11:27:55 +0200 Subject: [PATCH 03/41] [IMP] sale_line_mrp_link: pre-commit stuff --- .pre-commit-config.yaml | 16 +++++------ sale_line_mrp_link/__manifest__.py | 4 +-- sale_line_mrp_link/models/mrp_production.py | 26 +++++++++++------ .../models/procurement_group.py | 20 ++++++++----- sale_line_mrp_link/models/sale_order_line.py | 5 +++- .../views/mrp_production_views.xml | 28 +++++++++++-------- .../views/sale_order_line_views.xml | 8 +++--- sale_line_mrp_link/views/sale_order_views.xml | 11 +++++--- 8 files changed, 72 insertions(+), 46 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d8e7bce7..a378fc062 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -76,14 +76,14 @@ 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: v7.8.1 - # 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: v3.2.0 hooks: diff --git a/sale_line_mrp_link/__manifest__.py b/sale_line_mrp_link/__manifest__.py index 615053abf..1715527cc 100644 --- a/sale_line_mrp_link/__manifest__.py +++ b/sale_line_mrp_link/__manifest__.py @@ -6,11 +6,11 @@ "category": "Sales Management", "license": "AGPL-3", "author": "AvanzOSC", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "depends": [ "sale_order_line_menu", "sale_mrp", - "stock" + "stock", ], "data": [ "views/mrp_production_views.xml", diff --git a/sale_line_mrp_link/models/mrp_production.py b/sale_line_mrp_link/models/mrp_production.py index ff5e549c3..ef9af5ad7 100644 --- a/sale_line_mrp_link/models/mrp_production.py +++ b/sale_line_mrp_link/models/mrp_production.py @@ -7,19 +7,29 @@ class MrpProduction(models.Model): _inherit = "mrp.production" sale_line_id = fields.Many2one( - string="Sale line", comodel_name="sale.order.line", - copy=False) + string="Sale line", + comodel_name="sale.order.line", + copy=False, + ) sale_id = fields.Many2one( - string="Sale order", comodel_name="sale.order", - related="sale_line_id.order_id", store=True, copy=False) + string="Sale order", + comodel_name="sale.order", + related="sale_line_id.order_id", + store=True, + copy=False, + ) sale_line_name = fields.Text( - string="Sale line description", related="sale_line_id.name", - store=True, copy=False) + string="Sale line description", + related="sale_line_id.name", + store=True, + copy=False, + ) @api.model def create(self, values): - if ("sale_line_id" in self.env.context and - self.env.context.get("sale_line_id", False)): + if "sale_line_id" in self.env.context and self.env.context.get( + "sale_line_id", False + ): values["sale_line_id"] = self.env.context.get("sale_line_id") production = super(MrpProduction, self).create(values) if production.sale_line_id: diff --git a/sale_line_mrp_link/models/procurement_group.py b/sale_line_mrp_link/models/procurement_group.py index 2b5510702..d021d4410 100644 --- a/sale_line_mrp_link/models/procurement_group.py +++ b/sale_line_mrp_link/models/procurement_group.py @@ -11,14 +11,20 @@ def run(self, procurements, raise_user_error=True): result = False if len(self) > 0 or not procurements: return super(ProcurementGroup, self).run( - procurements, raise_user_error=raise_user_error) + procurements, raise_user_error=raise_user_error + ) for procurement in procurements: - if ("sale_line_id" not in procurement.values or not - procurement.values.get("sale_line_id", False)): + if "sale_line_id" not in procurement.values or not procurement.values.get( + "sale_line_id", False + ): result = super(ProcurementGroup, self).run( - [procurement], raise_user_error=raise_user_error) + [procurement], raise_user_error=raise_user_error + ) else: - result = super(ProcurementGroup, self.with_context( - sale_line_id=procurement.values.get("sale_line_id"))).run( - [procurement], raise_user_error=raise_user_error) + result = super( + ProcurementGroup, + self.with_context( + sale_line_id=procurement.values.get("sale_line_id") + ), + ).run([procurement], raise_user_error=raise_user_error) return result diff --git a/sale_line_mrp_link/models/sale_order_line.py b/sale_line_mrp_link/models/sale_order_line.py index df3e882a7..9a15a0a07 100644 --- a/sale_line_mrp_link/models/sale_order_line.py +++ b/sale_line_mrp_link/models/sale_order_line.py @@ -7,4 +7,7 @@ class SaleOrderLine(models.Model): _inherit = "sale.order.line" mrp_production_id = fields.Many2one( - string="MRP Production", comodel_name="mrp.production", copy=False) + string="MRP Production", + comodel_name="mrp.production", + copy=False, + ) diff --git a/sale_line_mrp_link/views/mrp_production_views.xml b/sale_line_mrp_link/views/mrp_production_views.xml index e54809d41..0c67a82ca 100644 --- a/sale_line_mrp_link/views/mrp_production_views.xml +++ b/sale_line_mrp_link/views/mrp_production_views.xml @@ -1,34 +1,34 @@ - + mrp.production - + - - - + + + mrp.production - + - + - + - + @@ -37,7 +37,7 @@ mrp.production - + @@ -45,8 +45,12 @@ - + diff --git a/sale_line_mrp_link/views/sale_order_line_views.xml b/sale_line_mrp_link/views/sale_order_line_views.xml index b9e670ebb..c966a2510 100644 --- a/sale_line_mrp_link/views/sale_order_line_views.xml +++ b/sale_line_mrp_link/views/sale_order_line_views.xml @@ -1,18 +1,18 @@ - + sale.order.line - + - + sale.order.line - + diff --git a/sale_line_mrp_link/views/sale_order_views.xml b/sale_line_mrp_link/views/sale_order_views.xml index 5dea74a58..3ca911581 100644 --- a/sale_line_mrp_link/views/sale_order_views.xml +++ b/sale_line_mrp_link/views/sale_order_views.xml @@ -1,11 +1,14 @@ - + sale.order - + - - + + From 689aa572c645318f5f409be651ce2b2bba160c50 Mon Sep 17 00:00:00 2001 From: Berezi <82805447+Berezi@users.noreply.github.com> Date: Wed, 26 Jun 2024 14:05:49 +0200 Subject: [PATCH 04/41] [14.0][IMP] custom_mrp_descarga: New report. (#363) Co-authored-by: Tu Nombre --- custom_mrp_descarga/__manifest__.py | 1 + .../i18n/custom_mrp_descarga.pot | 101 ++++- custom_mrp_descarga/i18n/es.po | 101 ++++- custom_mrp_descarga/models/mrp_production.py | 9 +- custom_mrp_descarga/models/saca_line.py | 3 + .../models/stock_inventory_line.py | 4 +- custom_mrp_descarga/models/stock_move.py | 2 +- custom_mrp_descarga/models/stock_move_line.py | 2 +- custom_mrp_descarga/report/__init__.py | 1 + .../mrp_production_quartering_summary_xlsx.py | 353 ++++++++++++++++++ ...mrp_production_quartering_summary_xlsx.xml | 12 + .../report/mrp_production_summary_xlsx.py | 10 +- .../views/mrp_production_view.xml | 13 + .../views/stock_move_line_view.xml | 17 +- 14 files changed, 613 insertions(+), 16 deletions(-) create mode 100644 custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py create mode 100644 custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.xml diff --git a/custom_mrp_descarga/__manifest__.py b/custom_mrp_descarga/__manifest__.py index b04918ebc..f3dd1bc27 100644 --- a/custom_mrp_descarga/__manifest__.py +++ b/custom_mrp_descarga/__manifest__.py @@ -36,6 +36,7 @@ "views/stock_move_line_view.xml", "views/killing_cost_view.xml", "report/mrp_production_summary_xlsx.xml", + "report/mrp_production_quartering_summary_xlsx.xml", ], "installable": True, "auto_install": True, diff --git a/custom_mrp_descarga/i18n/custom_mrp_descarga.pot b/custom_mrp_descarga/i18n/custom_mrp_descarga.pot index ae0bb95a2..3f43a8d33 100644 --- a/custom_mrp_descarga/i18n/custom_mrp_descarga.pot +++ b/custom_mrp_descarga/i18n/custom_mrp_descarga.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-11 10:14+0000\n" -"PO-Revision-Date: 2024-04-11 10:14+0000\n" +"POT-Creation-Date: 2024-06-25 08:03+0000\n" +"PO-Revision-Date: 2024-06-25 08:03+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,6 +15,12 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "% rendimiento" +msgstr "" + #. module: custom_mrp_descarga #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 @@ -159,6 +165,7 @@ msgid "Cost" msgstr "" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format @@ -171,6 +178,7 @@ msgid "Count Production" msgstr "" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format @@ -222,6 +230,12 @@ msgstr "" msgid "Dest Kg" msgstr "" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Diferencia" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__birth_difference #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__qty_difference @@ -239,6 +253,7 @@ msgstr "" #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__display_name #: model:ir.model.fields,field_description:custom_mrp_descarga.field_product_template__display_name #: model:ir.model.fields,field_description:custom_mrp_descarga.field_project_task__display_name +#: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_quartering_summary_xlsx__display_name #: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_summary_xlsx__display_name #: model:ir.model.fields,field_description:custom_mrp_descarga.field_saca_line__display_name #: model:ir.model.fields,field_description:custom_mrp_descarga.field_stock_inventory_line__display_name @@ -276,6 +291,13 @@ msgid "Emtying Hatchers" msgstr "" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Entradas" +msgstr "" + +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format @@ -332,6 +354,7 @@ msgstr "" #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__id #: model:ir.model.fields,field_description:custom_mrp_descarga.field_product_template__id #: model:ir.model.fields,field_description:custom_mrp_descarga.field_project_task__id +#: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_quartering_summary_xlsx__id #: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_summary_xlsx__id #: model:ir.model.fields,field_description:custom_mrp_descarga.field_saca_line__id #: model:ir.model.fields,field_description:custom_mrp_descarga.field_stock_inventory_line__id @@ -342,6 +365,7 @@ msgid "ID" msgstr "" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format @@ -374,6 +398,30 @@ msgstr "" msgid "Inventory Line" msgstr "" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "KG bruto" +msgstr "" + +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "KG envases" +msgstr "" + +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "KG neto" +msgstr "" + +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "KG palets" +msgstr "" + #. module: custom_mrp_descarga #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 @@ -393,6 +441,7 @@ msgstr "" #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production____last_update #: model:ir.model.fields,field_description:custom_mrp_descarga.field_product_template____last_update #: model:ir.model.fields,field_description:custom_mrp_descarga.field_project_task____last_update +#: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_quartering_summary_xlsx____last_update #: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_summary_xlsx____last_update #: model:ir.model.fields,field_description:custom_mrp_descarga.field_saca_line____last_update #: model:ir.model.fields,field_description:custom_mrp_descarga.field_stock_inventory_line____last_update @@ -437,6 +486,11 @@ msgstr "" msgid "LĂ­neas de despieces" msgstr "" +#. module: custom_mrp_descarga +#: model:ir.model,name:custom_mrp_descarga.model_report_mrp_production_quartering_summary_xlsx +msgid "MRP Production Quartering Summary Report" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.model,name:custom_mrp_descarga.model_report_mrp_production_summary_xlsx msgid "MRP Production Summary Report" @@ -524,12 +578,19 @@ msgstr "" msgid "PAASA" msgstr "" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Palets" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.model.fields,field_description:custom_mrp_descarga.field_stock_move_line__performance msgid "Performance" msgstr "" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format @@ -584,6 +645,12 @@ msgstr "" msgid "Production Orders" msgstr "" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Producto" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__purchase_price msgid "Purchase Amount" @@ -637,6 +704,17 @@ msgstr "" msgid "Reproductor" msgstr "" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Resumen de despiece" +msgstr "" + +#. module: custom_mrp_descarga +#: model:ir.actions.report,name:custom_mrp_descarga.report_mrp_quartering_summary_xlsx +msgid "Resumen de despiece XLSX" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.actions.report,name:custom_mrp_descarga.report_mrp_production_summary_xlsx msgid "Resumen de mantanza XLSX" @@ -677,6 +755,12 @@ msgstr "" msgid "Saca Line" msgstr "" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Salidas" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__seized_units msgid "Seized" @@ -759,6 +843,12 @@ msgstr "" msgid "Total Done" msgstr "" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Total Entradas" +msgstr "" + #. module: custom_mrp_descarga #: model_terms:ir.ui.view,arch_db:custom_mrp_descarga.mrp_production_form_view msgid "Total Pallet" @@ -803,6 +893,12 @@ msgstr "" msgid "Total Quantity" msgstr "" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Total Salidas" +msgstr "" + #. module: custom_mrp_descarga #: model_terms:ir.ui.view,arch_db:custom_mrp_descarga.production_move_line_ids_tree_view msgid "Total Units" @@ -814,6 +910,7 @@ msgid "Total amount" msgstr "" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format diff --git a/custom_mrp_descarga/i18n/es.po b/custom_mrp_descarga/i18n/es.po index d62938802..a76946a69 100644 --- a/custom_mrp_descarga/i18n/es.po +++ b/custom_mrp_descarga/i18n/es.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-11 10:14+0000\n" -"PO-Revision-Date: 2024-04-11 10:14+0000\n" +"POT-Creation-Date: 2024-06-25 08:04+0000\n" +"PO-Revision-Date: 2024-06-25 08:04+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,6 +15,12 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "% rendimiento" +msgstr "" + #. module: custom_mrp_descarga #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 @@ -161,6 +167,7 @@ msgid "Cost" msgstr "Coste" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format @@ -173,6 +180,7 @@ msgid "Count Production" msgstr "Contador OF" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format @@ -224,6 +232,12 @@ msgstr "" msgid "Dest Kg" msgstr "Cantidad destino" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Diferencia" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__birth_difference #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__qty_difference @@ -241,6 +255,7 @@ msgstr "% diferencia" #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__display_name #: model:ir.model.fields,field_description:custom_mrp_descarga.field_product_template__display_name #: model:ir.model.fields,field_description:custom_mrp_descarga.field_project_task__display_name +#: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_quartering_summary_xlsx__display_name #: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_summary_xlsx__display_name #: model:ir.model.fields,field_description:custom_mrp_descarga.field_saca_line__display_name #: model:ir.model.fields,field_description:custom_mrp_descarga.field_stock_inventory_line__display_name @@ -278,6 +293,13 @@ msgid "Emtying Hatchers" msgstr "Vaciar nacedoras" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Entradas" +msgstr "" + +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format @@ -334,6 +356,7 @@ msgstr "Galllinas" #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__id #: model:ir.model.fields,field_description:custom_mrp_descarga.field_product_template__id #: model:ir.model.fields,field_description:custom_mrp_descarga.field_project_task__id +#: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_quartering_summary_xlsx__id #: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_summary_xlsx__id #: model:ir.model.fields,field_description:custom_mrp_descarga.field_saca_line__id #: model:ir.model.fields,field_description:custom_mrp_descarga.field_stock_inventory_line__id @@ -344,6 +367,7 @@ msgid "ID" msgstr "Identificador" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format @@ -376,6 +400,30 @@ msgstr "IntegraciĂłn" msgid "Inventory Line" msgstr "LĂ­nea inventario" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "KG bruto" +msgstr "" + +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "KG envases" +msgstr "" + +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "KG neto" +msgstr "" + +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "KG palets" +msgstr "" + #. module: custom_mrp_descarga #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 @@ -395,6 +443,7 @@ msgstr "" #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production____last_update #: model:ir.model.fields,field_description:custom_mrp_descarga.field_product_template____last_update #: model:ir.model.fields,field_description:custom_mrp_descarga.field_project_task____last_update +#: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_quartering_summary_xlsx____last_update #: model:ir.model.fields,field_description:custom_mrp_descarga.field_report_mrp_production_summary_xlsx____last_update #: model:ir.model.fields,field_description:custom_mrp_descarga.field_saca_line____last_update #: model:ir.model.fields,field_description:custom_mrp_descarga.field_stock_inventory_line____last_update @@ -439,6 +488,11 @@ msgstr "" msgid "LĂ­neas de despieces" msgstr "" +#. module: custom_mrp_descarga +#: model:ir.model,name:custom_mrp_descarga.model_report_mrp_production_quartering_summary_xlsx +msgid "MRP Production Quartering Summary Report" +msgstr "Informe de despiece" + #. module: custom_mrp_descarga #: model:ir.model,name:custom_mrp_descarga.model_report_mrp_production_summary_xlsx msgid "MRP Production Summary Report" @@ -526,12 +580,19 @@ msgstr "Salidas" msgid "PAASA" msgstr "" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Palets" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.model.fields,field_description:custom_mrp_descarga.field_stock_move_line__performance msgid "Performance" msgstr "Rendimiento" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format @@ -586,6 +647,12 @@ msgstr "Orden de producciĂłn" msgid "Production Orders" msgstr "Ă“rdenes de producciĂłn" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Producto" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__purchase_price msgid "Purchase Amount" @@ -639,6 +706,17 @@ msgstr "" msgid "Reproductor" msgstr "Reproductora" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Resumen de despiece" +msgstr "" + +#. module: custom_mrp_descarga +#: model:ir.actions.report,name:custom_mrp_descarga.report_mrp_quartering_summary_xlsx +msgid "Resumen de despiece XLSX" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.actions.report,name:custom_mrp_descarga.report_mrp_production_summary_xlsx msgid "Resumen de mantanza XLSX" @@ -679,6 +757,12 @@ msgstr "Fecha de saca" msgid "Saca Line" msgstr "LĂ­nea de saca" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Salidas" +msgstr "" + #. module: custom_mrp_descarga #: model:ir.model.fields,field_description:custom_mrp_descarga.field_mrp_production__seized_units msgid "Seized" @@ -761,6 +845,12 @@ msgstr "Total envases" msgid "Total Done" msgstr "Total hecho" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Total Entradas" +msgstr "" + #. module: custom_mrp_descarga #: model_terms:ir.ui.view,arch_db:custom_mrp_descarga.mrp_production_form_view msgid "Total Pallet" @@ -805,6 +895,12 @@ msgstr "Total disponible" msgid "Total Quantity" msgstr "Cantidad total" +#. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 +#, python-format +msgid "Total Salidas" +msgstr "" + #. module: custom_mrp_descarga #: model_terms:ir.ui.view,arch_db:custom_mrp_descarga.production_move_line_ids_tree_view msgid "Total Units" @@ -816,6 +912,7 @@ msgid "Total amount" msgstr "Importe total" #. module: custom_mrp_descarga +#: code:addons/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #: code:addons/custom_mrp_descarga/report/mrp_production_summary_xlsx.py:0 #, python-format diff --git a/custom_mrp_descarga/models/mrp_production.py b/custom_mrp_descarga/models/mrp_production.py index 9f4e8d6b4..9e7afa97e 100644 --- a/custom_mrp_descarga/models/mrp_production.py +++ b/custom_mrp_descarga/models/mrp_production.py @@ -1,15 +1,18 @@ # Copyright 2022 Berezi Amubieta - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import _, api, fields, models -from datetime import datetime +from datetime import datetime, timedelta from dateutil import rrule -from _datetime import timedelta from odoo.exceptions import ValidationError class MrpProduction(models.Model): _inherit = "mrp.production" + def _default_production_date(self): + result = fields.Datetime.now() + return result + saca_line_id = fields.Many2one( string="Saca Line", comodel_name="saca.line", @@ -49,7 +52,7 @@ class MrpProduction(models.Model): related="picking_type_id.chick_production", store=True) production_date = fields.Datetime( - default=fields.Datetime.now()) + default=_default_production_date) birth_week = fields.Integer( string="Birth Week", compute="_compute_birth_week", diff --git a/custom_mrp_descarga/models/saca_line.py b/custom_mrp_descarga/models/saca_line.py index 03c5d7e7f..bd2eb779d 100644 --- a/custom_mrp_descarga/models/saca_line.py +++ b/custom_mrp_descarga/models/saca_line.py @@ -39,6 +39,9 @@ def action_view_production(self): 'view_mode': 'tree,form', 'res_model': 'mrp.production', 'domain': [('id', 'in', self.production_ids.ids)], + 'search_view_id': self.env.ref( + 'mrp.view_mrp_production_filter' + ).id, 'type': 'ir.actions.act_window', 'context': context, } diff --git a/custom_mrp_descarga/models/stock_inventory_line.py b/custom_mrp_descarga/models/stock_inventory_line.py index 1827abdb5..42eb091b9 100644 --- a/custom_mrp_descarga/models/stock_inventory_line.py +++ b/custom_mrp_descarga/models/stock_inventory_line.py @@ -33,7 +33,7 @@ def onchange_cost(self): dev_line_qty = sum(dev_line.mapped("qty_done")) or 0 self.cost = ( sum(entry_line.mapped("amount")) - dev_line_amount - ) / (sum( entry_line.mapped("qty_done")) - dev_line_qty) + ) / (sum(entry_line.mapped("qty_done")) - dev_line_qty) elif self.product_id: entry_line = self.inventory_id.batch_id.move_line_ids.filtered( lambda c: c.product_id == self.product_id and ( @@ -50,4 +50,4 @@ def onchange_cost(self): dev_line_qty = sum(dev_line.mapped("qty_done")) or 0 self.cost = ( sum(entry_line.mapped("amount")) - dev_line_amount - ) / (sum( entry_line.mapped("qty_done")) - dev_line_qty) + ) / (sum(entry_line.mapped("qty_done")) - dev_line_qty) diff --git a/custom_mrp_descarga/models/stock_move.py b/custom_mrp_descarga/models/stock_move.py index de3badfee..1ee3bf680 100644 --- a/custom_mrp_descarga/models/stock_move.py +++ b/custom_mrp_descarga/models/stock_move.py @@ -1,6 +1,6 @@ # Copyright 2022 Berezi Amubieta - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import _, api, fields, models +from odoo import api, models class StockMove(models.Model): diff --git a/custom_mrp_descarga/models/stock_move_line.py b/custom_mrp_descarga/models/stock_move_line.py index 90ce20955..80e5309ec 100644 --- a/custom_mrp_descarga/models/stock_move_line.py +++ b/custom_mrp_descarga/models/stock_move_line.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import _, api, fields, models from odoo.exceptions import ValidationError -from _datetime import timedelta +from datetime import timedelta class StockMoveLine(models.Model): diff --git a/custom_mrp_descarga/report/__init__.py b/custom_mrp_descarga/report/__init__.py index d404147e6..ca43a7edf 100644 --- a/custom_mrp_descarga/report/__init__.py +++ b/custom_mrp_descarga/report/__init__.py @@ -1 +1,2 @@ from . import mrp_production_summary_xlsx +from . import mrp_production_quartering_summary_xlsx diff --git a/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py b/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py new file mode 100644 index 000000000..a473850b0 --- /dev/null +++ b/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py @@ -0,0 +1,353 @@ +# Copyright 2024 Berezi Amubieta - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import _, models + + +class ReportMrpProductionQuarteringSummaryXlsx(models.AbstractModel): + _name = "report.mrp_production_quartering_summary_xlsx" + _inherit = "report.report_xlsx.abstract" + _description = "MRP Production Quartering Summary Report" + + def generate_xlsx_report(self, workbook, data, objects): + table_header = workbook.add_format({ + 'bold': True, + 'align': 'center', + 'valign': 'vcenter', + 'fg_color': '#D7E4BC', + }) + summary = workbook.add_format({ + 'bold': True, + 'num_format': '#,##0.00;(#,##0.00)', + }) + int_format = workbook.add_format({ + 'num_format': '#,##0;(#,##0)', + }) + two_decimal_format = workbook.add_format({ + 'num_format': '#,##0.00;(#,##0.00)', + }) + three_decimal_format = workbook.add_format({ + 'num_format': '#,##0.000;(#,##0.000)', + }) + eight_decimal_format = workbook.add_format({ + 'num_format': '#,##0.00000000;(#,##0.00000000)', + }) + result_int_format = workbook.add_format({ + 'bold': True, + 'fg_color': '#afd095', + 'num_format': '#,##0;(#,##0)', + }) + result_two_decimal = workbook.add_format({ + 'bold': True, + 'fg_color': '#afd095', + 'num_format': '#,##0.00;(#,##0.00)', + }) + result_three_decimal = workbook.add_format({ + 'bold': True, + 'fg_color': '#afd095', + 'num_format': '#,##0.000;(#,##0.000)', + }) + result_summary = workbook.add_format({ + 'bold': True, + 'fg_color': '#afd095', + 'num_format': '#,##0.000;(#,##0.000)', + }) + table_header.set_text_wrap() + summary.set_text_wrap() + int_format.set_text_wrap() + two_decimal_format.set_text_wrap() + three_decimal_format.set_text_wrap() + eight_decimal_format.set_text_wrap() + result_three_decimal.set_text_wrap() + result_two_decimal.set_text_wrap() + result_summary.set_text_wrap() + table_detail_right_num = workbook.add_format({ + 'border': 1, + 'align': 'right', + 'valign': 'vcenter', + }) + table_detail_right_num.set_num_format('#,##0.00') + worksheet = workbook.add_worksheet("Resumen de despiece") + worksheet.write(0, 0, _("Resumen de despiece"), result_int_format) + for i in range(0, 13): + worksheet.set_column(0, i, 15) + n = 2 + m = 0 + worksheet.write(n, m, _("Entradas"), table_header) + n += 1 + worksheet.write(n, m, _("CĂłdigo"), table_header) + m += 1 + worksheet.write(n, m, _("Producto"), table_header) + m += 1 + worksheet.write(n, m, _("Palets"), table_header) + m += 1 + worksheet.write(n, m, _("Envases"), table_header) + m += 1 + worksheet.write(n, m, _("Unidades"), table_header) + m += 1 + worksheet.write(n, m, _("KG bruto"), table_header) + m += 1 + worksheet.write(n, m, _("KG palets"), table_header) + m += 1 + worksheet.write(n, m, _("KG envases"), table_header) + m += 1 + worksheet.write(n, m, _("KG neto"), table_header) + m += 1 + worksheet.write(n, m, _("Coste"), table_header) + m += 1 + worksheet.write(n, m, _("Importe"), table_header) + m += 1 + worksheet.write(n, m, _("Peso medio"), table_header) + m += 1 + worksheet.write(n, m, _("% rendimiento"), table_header) + for m in range(m + 1, 13): + worksheet.write(n, m, "", table_header) + entry_movelines = objects.mapped("move_line_ids") + categories = [] + products = [] + for line in entry_movelines: + if line.product_category_id not in categories: + categories.append(line.product_category_id) + categ_lines = entry_movelines.filtered( + lambda c: c.product_category_id == line.product_category_id + ) + categ_pallet = sum(categ_lines.mapped("pallet")) + categ_container = sum(categ_lines.mapped("container")) + categ_unit = sum(categ_lines.mapped("unit")) + categ_brut = sum(categ_lines.mapped("brut")) + categ_pallet_weight = 0 + categ_container_weight = 0 + for line in categ_lines: + if line.move_id and ( + line.move_id.raw_material_production_id + ) and line.move_id.raw_material_production_id.pallet_id: + categ_pallet_weight += line.move_id.raw_material_production_id.pallet_id.weight * line.pallet + if line.move_id and ( + line.move_id.raw_material_production_id + ) and line.move_id.raw_material_production_id.packaging_id: + categ_container_weight += line.move_id.raw_material_production_id.packaging_id.weight * line.container + categ_qty_done = sum(categ_lines.mapped("qty_done")) + categ_average_weight = categ_qty_done / sum( + categ_lines.mapped("download_unit") + ) if sum(categ_lines.mapped("download_unit")) else 0 + categ_amount = sum(categ_lines.mapped("amount")) + categt_applied_price = round(( + categ_amount / categ_qty_done + ) if categ_qty_done != 0 else 0, 3) + for product in categ_lines: + if product.product_id not in products: + n += 1 + m = 0 + products.append(product.product_id) + product_lines = categ_lines.filtered( + lambda c: c.product_id == product.product_id + ) + product_pallet = sum(product_lines.mapped("pallet")) + product_container = sum( + product_lines.mapped("container") + ) + product_unit = sum(product_lines.mapped("unit")) + product_brut = sum(product_lines.mapped("brut")) + product_pallet_weight = 0 + product_container_weight = 0 + for line in product_lines: + if line.move_id and line.move_id.raw_material_production_id and line.move_id.raw_material_production_id.pallet_id: + product_pallet_weight += line.move_id.raw_material_production_id.pallet_id.weight * line.pallet + if line.move_id and line.move_id.raw_material_production_id and line.move_id.raw_material_production_id.packaging_id: + product_container_weight += line.move_id.raw_material_production_id.packaging_id.weight * line.container + product_qty_done = sum( + product_lines.mapped("qty_done") + ) + product_average_weight = product_qty_done / sum( + product_lines.mapped("download_unit") + ) if sum(product_lines.mapped("download_unit")) else 0 + product_amount = sum(product_lines.mapped("amount")) + product_applied_price = ( + ( + product_amount / product_qty_done + ) if product_qty_done else 0 + ) + worksheet.write(n, m, product.product_id.default_code) + m += 1 + worksheet.write(n, m, product.product_id.name) + m += 1 + worksheet.write(n, m, product_pallet, int_format) + m += 1 + worksheet.write(n, m, product_container, int_format) + m += 1 + worksheet.write(n, m, product_unit, int_format) + m += 1 + worksheet.write(n, m, product_brut, two_decimal_format) + m += 1 + worksheet.write(n, m, product_pallet_weight, two_decimal_format) + m += 1 + worksheet.write(n, m, product_container_weight, two_decimal_format) + m += 1 + worksheet.write(n, m, product_qty_done, two_decimal_format) + m += 1 + worksheet.write( + n, m, product_applied_price, three_decimal_format + ) + m += 1 + worksheet.write( + n, m, round(product_amount, 2), two_decimal_format + ) + m += 1 + worksheet.write(n, m, product_average_weight, two_decimal_format) + m += 1 + worksheet.write(n, m, product_qty_done * 100 / sum(entry_movelines.mapped("qty_done")), two_decimal_format) + n += 1 + m = 0 + worksheet.write( + n, m, line.product_category_id.display_name, result_int_format + ) + m += 1 + worksheet.write( + n, m, "", result_int_format + ) + m += 1 + worksheet.write(n, m, categ_pallet, result_int_format) + m += 1 + worksheet.write(n, m, categ_container, result_int_format) + m += 1 + worksheet.write(n, m, categ_unit, result_int_format) + m += 1 + worksheet.write(n, m, categ_brut, result_two_decimal) + m += 1 + worksheet.write(n, m, categ_pallet_weight, result_two_decimal) + m += 1 + worksheet.write(n, m, categ_container_weight, result_two_decimal) + m += 1 + worksheet.write(n, m, categ_qty_done, result_two_decimal) + m += 1 + worksheet.write( + n, m, categt_applied_price, result_three_decimal + ) + m += 1 + worksheet.write(n, m, categ_amount, result_two_decimal) + m += 1 + worksheet.write(n, m, categ_average_weight, result_two_decimal) + m += 1 + worksheet.write(n, m, categ_qty_done * 100 / sum(entry_movelines.mapped("qty_done")), result_two_decimal) + n += 3 + m = 0 + worksheet.write(n, m, _("Salidas"), table_header) + categories = [] + products = [] + out_movelines = objects.mapped("finished_move_line_ids") + for line in out_movelines: + if line.product_category_id not in categories: + categories.append(line.product_category_id) + categ_lines = out_movelines.filtered( + lambda c: c.product_category_id == line.product_category_id + ) + categ_pallet = sum(categ_lines.mapped("pallet")) + categ_container = sum(categ_lines.mapped("container")) + categ_brut = sum(categ_lines.mapped("brut")) + categ_pallet_weight = 0 + categ_container_weight = 0 + for line in categ_lines: + if line.move_id and line.move_id.production_id and line.move_id.production_id.pallet_id: + categ_pallet_weight += line.move_id.production_id.pallet_id.weight * line.pallet + if line.move_id and line.move_id.production_id and line.move_id.production_id.packaging_id: + categ_container_weight += line.move_id.production_id.packaging_id.weight * line.container + categ_qty_done = sum(categ_lines.mapped("qty_done")) + categ_amount = sum(categ_lines.mapped("amount")) + categt_applied_price = round((categ_amount / categ_qty_done) if categ_qty_done != 0 else 0, 3) + for product in categ_lines: + if product.product_id not in products: + n += 1 + m = 0 + products.append(product.product_id) + product_lines = categ_lines.filtered( + lambda c: c.product_id == product.product_id + ) + product_pallet = sum(product_lines.mapped("pallet")) + product_container = sum( + product_lines.mapped("container") + ) + product_brut = sum(product_lines.mapped("brut")) + product_pallet_weight = 0 + product_container_weight = 0 + for line in product_lines: + if line.move_id and line.move_id.production_id and line.move_id.production_id.pallet_id: + product_pallet_weight += line.move_id.production_id.pallet_id.weight * line.pallet + if line.move_id and line.move_id.production_id and line.move_id.production_id.packaging_id: + product_container_weight += line.move_id.production_id.packaging_id.weight * line.container + product_qty_done = sum( + product_lines.mapped("qty_done") + ) + product_amount = sum(product_lines.mapped("amount")) + product_applied_price = ( + ( + product_amount / product_qty_done + ) if product_qty_done else 0 + ) + worksheet.write(n, m, product.product_id.default_code) + m += 1 + worksheet.write(n, m, product.product_id.name) + m += 1 + worksheet.write(n, m, product_pallet) + m += 1 + worksheet.write(n, m, product_container) + m += 2 + worksheet.write(n, m, product_brut, two_decimal_format) + m += 1 + worksheet.write(n, m, product_pallet_weight, two_decimal_format) + m += 1 + worksheet.write(n, m, product_container_weight, two_decimal_format) + m += 1 + worksheet.write(n, m, product_qty_done, two_decimal_format) + m += 1 + worksheet.write( + n, m, product_applied_price, three_decimal_format + ) + m += 1 + worksheet.write( + n, m, round(product_amount, 2), two_decimal_format + ) + m += 2 + worksheet.write(n, m, product_qty_done * 100 / sum(entry_movelines.mapped("qty_done")), two_decimal_format) + n += 1 + m = 0 + worksheet.write( + n, m, line.product_category_id.display_name, result_int_format + ) + m += 1 + worksheet.write( + n, m, "", result_int_format + ) + m += 1 + worksheet.write(n, m, categ_pallet, result_int_format) + m += 1 + worksheet.write(n, m, categ_container, result_int_format) + m += 2 + worksheet.write(n, m, categ_brut, result_two_decimal) + m += 1 + worksheet.write(n, m, categ_pallet_weight, result_two_decimal) + m += 1 + worksheet.write(n, m, categ_container_weight, result_two_decimal) + m += 1 + worksheet.write(n, m, categ_qty_done, result_two_decimal) + m += 1 + worksheet.write( + n, m, categt_applied_price, result_three_decimal + ) + m += 1 + worksheet.write(n, m, categ_amount, result_two_decimal) + m += 2 + worksheet.write(n, m, categ_qty_done * 100 / sum(entry_movelines.mapped("qty_done")), result_two_decimal) + n += 2 + m = 0 + worksheet.write(n, m, _("Total Entradas"), result_summary) + m += 1 + worksheet.write(n, m, sum(entry_movelines.mapped("qty_done")), result_two_decimal) + n += 1 + m = 0 + worksheet.write(n, m, _("Total Salidas"), result_summary) + m += 1 + worksheet.write(n, m, sum(out_movelines.mapped("qty_done")), result_two_decimal) + n += 1 + m = 0 + worksheet.write(n, m, _("Diferencia"), result_summary) + m += 1 + worksheet.write(n, m, sum(entry_movelines.mapped("qty_done")) - sum(out_movelines.mapped("qty_done")), result_two_decimal) diff --git a/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.xml b/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.xml new file mode 100644 index 000000000..df20254f3 --- /dev/null +++ b/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.xml @@ -0,0 +1,12 @@ + + + + Resumen de despiece XLSX + mrp.production + xlsx + mrp_production_quartering_summary_xlsx + mrp_production_quartering_summary_xlsx + + report + + diff --git a/custom_mrp_descarga/report/mrp_production_summary_xlsx.py b/custom_mrp_descarga/report/mrp_production_summary_xlsx.py index dc35c40a1..29a5bc1a7 100644 --- a/custom_mrp_descarga/report/mrp_production_summary_xlsx.py +++ b/custom_mrp_descarga/report/mrp_production_summary_xlsx.py @@ -114,7 +114,7 @@ def generate_xlsx_report(self, workbook, data, objects): categt_applied_price = round( ( categ_amount / categ_qty_done - ) if categ_qty_done != 0 else 0,3 + ) if categ_qty_done != 0 else 0, 3 ) for product in categ_lines: if product.product_id not in products: @@ -146,7 +146,7 @@ def generate_xlsx_report(self, workbook, data, objects): ) if product_qty_done else 0 ) worksheet.write(n, m, round( - product_percentage,2 + product_percentage, 2 ), two_decimal_format) m += 1 worksheet.write(n, m, product.product_id.default_code) @@ -168,11 +168,13 @@ def generate_xlsx_report(self, workbook, data, objects): ) m += 1 worksheet.write( - n, m, round(product_amount,2), two_decimal_format + n, m, round(product_amount, 2), two_decimal_format ) m += 1 worksheet.write( - n, m, round(product_qty_done / origin_qty * 100,2), + n, m, round( + product_qty_done / origin_qty * 100, 2 + ), two_decimal_format ) n += 1 diff --git a/custom_mrp_descarga/views/mrp_production_view.xml b/custom_mrp_descarga/views/mrp_production_view.xml index 84ad90c83..fbc5a5d27 100644 --- a/custom_mrp_descarga/views/mrp_production_view.xml +++ b/custom_mrp_descarga/views/mrp_production_view.xml @@ -38,6 +38,17 @@ + + mrp.production + + primary + + + + + + + mrp.production @@ -389,6 +400,7 @@ ir.actions.act_window tree,form + [('quartering', '=', True), ('paasa', '=', True)] {"search_default_todo": 1, 'default_quartering': True} @@ -399,6 +411,7 @@ ir.actions.act_window tree,form + [('saca_line_id', '!=', False)] {"search_default_todo": 1} diff --git a/custom_mrp_descarga/views/stock_move_line_view.xml b/custom_mrp_descarga/views/stock_move_line_view.xml index 36be96df6..7f958186e 100644 --- a/custom_mrp_descarga/views/stock_move_line_view.xml +++ b/custom_mrp_descarga/views/stock_move_line_view.xml @@ -105,12 +105,26 @@ + + stock.move.line.search.view + stock.move.line + primary + 30 + + + + + + + + Product Movements stock.move.line ir.actions.act_window tree,form - + + ['|', ('move_id.raw_material_production_id', '!=', False), ('move_id.production_id', '!=', False), '|',('move_id.raw_material_production_id.quartering', '=', False), ('move_id.production_id.quartering', '=', False), '|', ('move_id.production_id.paasa', '=', True), ('move_id.raw_material_production_id.paasa', '=', True), ('state', '=', 'done')] @@ -120,6 +134,7 @@ ir.actions.act_window tree,form + [('quartering', '=', True)] {"search_default_todo": 1, "search_default_groupby_production": 1} From 7cb67112034b37c3f87eaa14b175453f1c0fddb6 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 10:12:22 +0200 Subject: [PATCH 05/41] [IMP] quality_control_usability: pre-commit stuff --- quality_control_usability/__manifest__.py | 6 +++--- .../views/qc_inspection_views.xml | 5 ++--- quality_control_usability/views/qc_test_view.xml | 11 +++++------ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/quality_control_usability/__manifest__.py b/quality_control_usability/__manifest__.py index f86353dfa..1527d4f9e 100644 --- a/quality_control_usability/__manifest__.py +++ b/quality_control_usability/__manifest__.py @@ -2,9 +2,9 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Quality Control Usability", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "author": "Avanzosc", - "website": "https://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "category": "MRP", "depends": [ "quality_control_oca", @@ -14,5 +14,5 @@ "views/qc_test_view.xml", ], "license": "AGPL-3", - 'installable': True, + "installable": True, } diff --git a/quality_control_usability/views/qc_inspection_views.xml b/quality_control_usability/views/qc_inspection_views.xml index 25605be9a..4f76d1a29 100644 --- a/quality_control_usability/views/qc_inspection_views.xml +++ b/quality_control_usability/views/qc_inspection_views.xml @@ -1,9 +1,8 @@ - - + qc.inspection - + 0 diff --git a/quality_control_usability/views/qc_test_view.xml b/quality_control_usability/views/qc_test_view.xml index d4e31a764..b33c851ac 100644 --- a/quality_control_usability/views/qc_test_view.xml +++ b/quality_control_usability/views/qc_test_view.xml @@ -1,18 +1,18 @@ - + qc.test.form qc.test - + - - - + + + @@ -22,4 +22,3 @@ - From e42335288ec68489735a058665378e4a48a0657a Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 10:19:28 +0200 Subject: [PATCH 06/41] [IMP] quality_control_test_method: pre-commit stuff --- quality_control_test_method/README.rst | 4 ++-- quality_control_test_method/__manifest__.py | 8 +++---- .../models/qc_inspection.py | 22 ++++++++++++------- .../models/qc_inspection_line.py | 12 ++++++---- .../models/qc_test_method.py | 8 +++---- .../models/qc_test_proof.py | 16 +++++++++----- .../models/qc_test_question.py | 18 +++++++++------ .../views/qc_inspection_line_views.xml | 12 +++++----- .../views/qc_inspection_views.xml | 9 ++++---- .../views/qc_test_method_views.xml | 18 ++++++++------- .../views/qc_test_proof_views.xml | 20 +++++++++-------- .../views/qc_test_question_views.xml | 7 +++--- .../views/qc_test_views.xml | 14 +++++++----- 13 files changed, 96 insertions(+), 72 deletions(-) diff --git a/quality_control_test_method/README.rst b/quality_control_test_method/README.rst index 9b841e41c..f0e66e5a9 100644 --- a/quality_control_test_method/README.rst +++ b/quality_control_test_method/README.rst @@ -2,9 +2,9 @@ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -========================== +=========================== Quality Control Test Method -========================== +=========================== * Test method and test proof new two objects. * Method and proof fields in quality control test question and quality control inspection lines. diff --git a/quality_control_test_method/__manifest__.py b/quality_control_test_method/__manifest__.py index 2afe25838..9847d590e 100644 --- a/quality_control_test_method/__manifest__.py +++ b/quality_control_test_method/__manifest__.py @@ -2,9 +2,9 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Quality Control Test Method", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "author": "Avanzosc", - "website": "https://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "category": "MRP", "depends": [ "quality_control_oca", @@ -16,8 +16,8 @@ "views/qc_test_proof_views.xml", "views/qc_inspection_line_views.xml", "views/qc_test_question_views.xml", - "views/qc_inspection_views.xml" + "views/qc_inspection_views.xml", ], "license": "AGPL-3", - 'installable': True, + "installable": True, } diff --git a/quality_control_test_method/models/qc_inspection.py b/quality_control_test_method/models/qc_inspection.py index 9cb045421..cb448604d 100644 --- a/quality_control_test_method/models/qc_inspection.py +++ b/quality_control_test_method/models/qc_inspection.py @@ -4,16 +4,22 @@ class QcInspection(models.Model): - _inherit = 'qc.inspection' + _inherit = "qc.inspection" def _prepare_inspection_lines(self, test, force_fill=False): result = super(QcInspection, self)._prepare_inspection_lines( - test, force_fill=False) + test, force_fill=False + ) for line in result: - test_line = line[2]['test_line'] - line[2].update({ - 'test_method_id': self.env['qc.test.question'].search( - [('id', '=', test_line)], limit=1).test_method_id.id, - 'test_proof_id': self.env['qc.test.question'].search( - [('id', '=', test_line)], limit=1).test_proof_id.id}) + test_line = line[2]["test_line"] + line[2].update( + { + "test_method_id": self.env["qc.test.question"] + .search([("id", "=", test_line)], limit=1) + .test_method_id.id, + "test_proof_id": self.env["qc.test.question"] + .search([("id", "=", test_line)], limit=1) + .test_proof_id.id, + } + ) return result diff --git a/quality_control_test_method/models/qc_inspection_line.py b/quality_control_test_method/models/qc_inspection_line.py index 40ae7cd8b..5f9ef9470 100644 --- a/quality_control_test_method/models/qc_inspection_line.py +++ b/quality_control_test_method/models/qc_inspection_line.py @@ -1,12 +1,16 @@ # Copyright 2021 Berezi Amubieta - 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 QcInspectionLine(models.Model): - _inherit = 'qc.inspection.line' + _inherit = "qc.inspection.line" test_method_id = fields.Many2one( - string='Method', comodel_name='qc.test.method') + string="Method", + comodel_name="qc.test.method", + ) test_proof_id = fields.Many2one( - string='Proof', comodel_name='qc.test.proof') + string="Proof", + comodel_name="qc.test.proof", + ) diff --git a/quality_control_test_method/models/qc_test_method.py b/quality_control_test_method/models/qc_test_method.py index 8b018743f..2180ce7cf 100644 --- a/quality_control_test_method/models/qc_test_method.py +++ b/quality_control_test_method/models/qc_test_method.py @@ -1,10 +1,10 @@ # Copyright 2021 Berezi Amubieta - 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 QcTestMethod(models.Model): - _name = 'qc.test.method' - _description = 'Method used to do the test' + _name = "qc.test.method" + _description = "Method used to do the test" - name = fields.Char(string='Method Name') + name = fields.Char(string="Method Name") diff --git a/quality_control_test_method/models/qc_test_proof.py b/quality_control_test_method/models/qc_test_proof.py index c87a4b04a..52527ec8b 100644 --- a/quality_control_test_method/models/qc_test_proof.py +++ b/quality_control_test_method/models/qc_test_proof.py @@ -1,13 +1,17 @@ # Copyright 2021 Berezi Amubieta - 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 QcTestProof(models.Model): - _name = 'qc.test.proof' - _description = 'Test Proof' + _name = "qc.test.proof" + _description = "Test Proof" - name = fields.Char(string='Name') + name = fields.Char(string="Name") type = fields.Selection( - [("qualitative", "Qualitative"), ("quantitative", "Quantitative")], - string="Type") + selection=[ + ("qualitative", "Qualitative"), + ("quantitative", "Quantitative"), + ], + string="Type", + ) diff --git a/quality_control_test_method/models/qc_test_question.py b/quality_control_test_method/models/qc_test_question.py index 4ee49ba41..c8a8447a9 100644 --- a/quality_control_test_method/models/qc_test_question.py +++ b/quality_control_test_method/models/qc_test_question.py @@ -1,25 +1,29 @@ # Copyright 2021 Berezi Amubieta - 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 QcTestQuestion(models.Model): - _inherit = 'qc.test.question' + _inherit = "qc.test.question" test_method_id = fields.Many2one( - string='Method', comodel_name='qc.test.method') + string="Method", + comodel_name="qc.test.method", + ) test_proof_id = fields.Many2one( - string='Proof', comodel_name='qc.test.proof') + string="Proof", + comodel_name="qc.test.proof", + ) @api.onchange("test_proof_id") def onchange_type(self): if self.test_proof_id: self.type = self.test_proof_id.type - @api.onchange('type') + @api.onchange("type") def onchange_test_proof_id(self): self.ensure_one() domain = [] if self.type: - domain = ['|', ('type', '=', self.type), ('type', '=', False)] - return {'domain': {'test_proof_id': domain}} + domain = ["|", ("type", "=", self.type), ("type", "=", False)] + return {"domain": {"test_proof_id": domain}} diff --git a/quality_control_test_method/views/qc_inspection_line_views.xml b/quality_control_test_method/views/qc_inspection_line_views.xml index 6fae04410..d3f72ccb9 100644 --- a/quality_control_test_method/views/qc_inspection_line_views.xml +++ b/quality_control_test_method/views/qc_inspection_line_views.xml @@ -1,13 +1,15 @@ - - + qc.inspection.line - + - - + + diff --git a/quality_control_test_method/views/qc_inspection_views.xml b/quality_control_test_method/views/qc_inspection_views.xml index ee861f179..96c698cc3 100644 --- a/quality_control_test_method/views/qc_inspection_views.xml +++ b/quality_control_test_method/views/qc_inspection_views.xml @@ -1,13 +1,12 @@ - - + qc.inspection - + - - + + diff --git a/quality_control_test_method/views/qc_test_method_views.xml b/quality_control_test_method/views/qc_test_method_views.xml index 7d87c0ef0..0f6a02b0b 100644 --- a/quality_control_test_method/views/qc_test_method_views.xml +++ b/quality_control_test_method/views/qc_test_method_views.xml @@ -1,13 +1,12 @@ - - + qc.test.method.tree qc.test.method - - + + @@ -21,9 +20,12 @@ {} - + diff --git a/quality_control_test_method/views/qc_test_proof_views.xml b/quality_control_test_method/views/qc_test_proof_views.xml index 892f89f67..da48e3e46 100644 --- a/quality_control_test_method/views/qc_test_proof_views.xml +++ b/quality_control_test_method/views/qc_test_proof_views.xml @@ -1,14 +1,13 @@ - - + qc.test.proof.tree qc.test.proof - - - + + + @@ -22,9 +21,12 @@ {} - + diff --git a/quality_control_test_method/views/qc_test_question_views.xml b/quality_control_test_method/views/qc_test_question_views.xml index ff8e591fd..e9e9a3269 100644 --- a/quality_control_test_method/views/qc_test_question_views.xml +++ b/quality_control_test_method/views/qc_test_question_views.xml @@ -1,12 +1,11 @@ - - + qc.test.question - + - + diff --git a/quality_control_test_method/views/qc_test_views.xml b/quality_control_test_method/views/qc_test_views.xml index 09ef57a05..7a7df5a30 100644 --- a/quality_control_test_method/views/qc_test_views.xml +++ b/quality_control_test_method/views/qc_test_views.xml @@ -1,13 +1,15 @@ - - + qc.test - + - - - + + + From 98169da5a94a84e8f5ea586370fb91a7cf0d063f Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 10:38:54 +0200 Subject: [PATCH 07/41] [IMP] mrp_usability: pre-commit stuff --- mrp_usability/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mrp_usability/__manifest__.py b/mrp_usability/__manifest__.py index 0a98f5d8a..86db6414b 100644 --- a/mrp_usability/__manifest__.py +++ b/mrp_usability/__manifest__.py @@ -4,7 +4,7 @@ "name": "MRP Usability", "version": "14.0.2.1.0", "author": "Avanzosc", - "website": "https://github.com/OCA/l10n-spain", + "website": "https://github.com/avanzosc/mrp-addons", "category": "MRP", "depends": [ "mrp", From e157559187e63d38a6c6506850178e95308d89e3 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 11:37:33 +0200 Subject: [PATCH 08/41] [IMP] quality_control_claim: pre-commit stuff --- quality_control_claim/__init__.py | 1 - quality_control_claim/__manifest__.py | 7 +- quality_control_claim/models/__init__.py | 1 - quality_control_claim/models/qc_inspection.py | 77 +++++++++++-------- quality_control_claim/models/qc_test.py | 12 ++- .../views/qc_inspection_view.xml | 24 +++--- quality_control_claim/views/qc_test_view.xml | 7 +- 7 files changed, 75 insertions(+), 54 deletions(-) diff --git a/quality_control_claim/__init__.py b/quality_control_claim/__init__.py index a9e337226..0650744f6 100644 --- a/quality_control_claim/__init__.py +++ b/quality_control_claim/__init__.py @@ -1,2 +1 @@ - from . import models diff --git a/quality_control_claim/__manifest__.py b/quality_control_claim/__manifest__.py index 5f6b0d7fc..4d4012712 100644 --- a/quality_control_claim/__manifest__.py +++ b/quality_control_claim/__manifest__.py @@ -3,10 +3,9 @@ { "name": "Quality control claim", "version": "14.0.1.0.0", - "author": "OdooMRP team," - "AvanzOSC," - "Serv. Tecnol. Avanzados - Pedro M. Baeza", - "website": "http://www.odoomrp.com", + "author": "OdooMRP team," "AvanzOSC," "Serv. Tecnol. Avanzados - Pedro M. Baeza", + "website": "https://github.com/avanzosc/mrp-addons", + "license": "AGPL-3", "contributors": [ "Pedro M. Baeza ", diff --git a/quality_control_claim/models/__init__.py b/quality_control_claim/models/__init__.py index a26bedf90..de55d6a7e 100644 --- a/quality_control_claim/models/__init__.py +++ b/quality_control_claim/models/__init__.py @@ -1,4 +1,3 @@ - from . import crm_claim from . import qc_test from . import qc_inspection diff --git a/quality_control_claim/models/qc_inspection.py b/quality_control_claim/models/qc_inspection.py index a141ceb76..aaf359a6b 100644 --- a/quality_control_claim/models/qc_inspection.py +++ b/quality_control_claim/models/qc_inspection.py @@ -1,49 +1,60 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import api, fields, models, _ +from odoo import _, fields, models class QcInspection(models.Model): - _inherit = 'qc.inspection' + _inherit = "qc.inspection" - def _count_claims(self): - claim_obj = self.env['crm.claim'] - cond = [('model_ref_id', '=', '%s,%d' % (self._name, self.id))] + def _compute_claims(self): + claim_obj = self.env["crm.claim"] + cond = [("model_ref_id", "=", "%s,%d" % (self._name, self.id))] claims = claim_obj.search(cond) self.claims = len(claims) automatic_claims = fields.Boolean( - 'Automatic Claims', default=False, + string="Automatic Claims", + default=False, help="If you want to create one claim when the quality test status is" - " 'Quality failed'.") + " 'Quality failed'.", + ) automatic_claims_by_line = fields.Boolean( - 'Automatic Claims by line', default=False, + string="Automatic Claims by line", + default=False, help="If you want to create one claim per quality test line, when the" - " quality test line status is 'No ok'.") - claims = fields.Integer(string="Created claims", - compute='_count_claims', store=False) + " quality test line status is 'No ok'.", + ) + claims = fields.Integer( + string="Created claims", + compute="_compute_claims", + store=False, + ) def _prepare_inspection_header(self, object_ref, trigger_line): result = super(QcInspection, self)._prepare_inspection_header( - object_ref, trigger_line) - result.update({ - 'automatic_claims': trigger_line.test.automatic_claims, - 'automatic_claims_by_line': trigger_line.test.automatic_claims_by_line}) + object_ref, trigger_line + ) + result.update( + { + "automatic_claims": trigger_line.test.automatic_claims, + "automatic_claims_by_line": trigger_line.test.automatic_claims_by_line, + } + ) return result def action_approve(self): - crm_claim_obj = self.env['crm.claim'] + crm_claim_obj = self.env["crm.claim"] super(QcInspection, self).action_approve() for inspection in self: - if inspection.state == 'failed' and inspection.automatic_claims: + if inspection.state == "failed" and inspection.automatic_claims: vals = inspection.init_claim_vals() if self.object_id: - id, name = self.object_id.name_get()[0] - vals['name'] = _('Quality test %s for object %s ' - ' unsurpassed') % (self.name, name) + res_id, name = self.object_id.name_get()[0] + vals["name"] = _( + "Quality test %s for object %s " " unsurpassed" + ) % (self.name, name) else: - vals['name'] = (_('Quality test %s unsurpassed') % - (self.name)) + vals["name"] = _("Quality test %s unsurpassed") % (self.name) crm_claim_obj.create(vals) elif inspection.automatic_claims_by_line: for line in inspection.inspection_lines: @@ -51,20 +62,24 @@ def action_approve(self): inspection.create_claim_by_line(line) def init_claim_vals(self): - vals = {"date": fields.Datetime.now(), - "model_ref_id": "%s,%d" % (self._name, self.id) - } + vals = { + "date": fields.Datetime.now(), + "model_ref_id": "%s,%d" % (self._name, self.id), + } return vals def create_claim_by_line(self, line): - crm_claim_obj = self.env['crm.claim'] + crm_claim_obj = self.env["crm.claim"] vals = self.init_claim_vals() if self.object_id: - id, name = self.object_id.name_get()[0] - vals['name'] = _('Quality test %s for %s unsurpassed, in test' - ' line %s') % (self.name, name, line.name) + res_id, name = self.object_id.name_get()[0] + vals["name"] = _( + "Quality test %s for %s unsurpassed, in test" " line %s" + ) % (self.name, name, line.name) else: - vals['name'] = (_('Quality test %s unsurpassed, in test line %s') % - (self.name, line.name)) + vals["name"] = _("Quality test %s unsurpassed, in test line %s") % ( + self.name, + line.name, + ) claim = crm_claim_obj.create(vals) return claim diff --git a/quality_control_claim/models/qc_test.py b/quality_control_claim/models/qc_test.py index b5b1ade80..568c8a03a 100644 --- a/quality_control_claim/models/qc_test.py +++ b/quality_control_claim/models/qc_test.py @@ -7,10 +7,14 @@ class QcTest(models.Model): _inherit = "qc.test" automatic_claims = fields.Boolean( - string="Automatic Claims", default=False, + string="Automatic Claims", + default=False, help="If you want to create one claim when the quality test status is" - " 'Quality failed'.") + " 'Quality failed'.", + ) automatic_claims_by_line = fields.Boolean( - string="Automatic Claims by line", default=False, + string="Automatic Claims by line", + default=False, help="If you want to create one claim per quality test line, when the" - " quality test line status is 'No ok'.") + " quality test line status is 'No ok'.", + ) diff --git a/quality_control_claim/views/qc_inspection_view.xml b/quality_control_claim/views/qc_inspection_view.xml index a3f65d85d..181777fc6 100644 --- a/quality_control_claim/views/qc_inspection_view.xml +++ b/quality_control_claim/views/qc_inspection_view.xml @@ -1,17 +1,21 @@ - + Claims crm.claim tree,form - {'default_model_ref_id': 'qc.inspection,'+str(context.get('active_id', False))} - [('model_ref_id','=','qc.inspection,'+str(context.get('active_id',False)))] + {'default_model_ref_id': 'qc.inspection,'+str(context.get('active_id', False))} + [('model_ref_id','=','qc.inspection,'+str(context.get('active_id',False)))] qc.inspection.claim.tree qc.inspection - + @@ -23,20 +27,22 @@ qc.inspection.claim.form qc.inspection - +
-
- diff --git a/quality_control_claim/views/qc_test_view.xml b/quality_control_claim/views/qc_test_view.xml index f6ced278b..fe1e76ecc 100644 --- a/quality_control_claim/views/qc_test_view.xml +++ b/quality_control_claim/views/qc_test_view.xml @@ -1,9 +1,9 @@ - + qc.test.tree.view.inh.qualitycontroclaim qc.test - + @@ -14,7 +14,7 @@ qc.test.form.view.inh.qualitycontroclaim qc.test - + @@ -23,4 +23,3 @@ - From a3d64f57c945cb8202934e62db123b0db10646c5 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 11:48:43 +0200 Subject: [PATCH 09/41] [IMP] quality_control_private_test: pre-commit stuff --- quality_control_private_test/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quality_control_private_test/__manifest__.py b/quality_control_private_test/__manifest__.py index bc715b2ea..1e10788ca 100644 --- a/quality_control_private_test/__manifest__.py +++ b/quality_control_private_test/__manifest__.py @@ -12,7 +12,7 @@ "author": "AvanzOSC", "license": "AGPL-3", "summary": """Quality Control Private Test""", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "data": [ "views/quality_control_view.xml", "views/product_template_view.xml", From 25e7a45c956653d1100a77ec29789a5e21ad41c6 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 11:56:27 +0200 Subject: [PATCH 10/41] [IMP] mrp_cut: pre-commit stuff --- mrp_cut/__manifest__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mrp_cut/__manifest__.py b/mrp_cut/__manifest__.py index ff7ecc286..bffe8877c 100644 --- a/mrp_cut/__manifest__.py +++ b/mrp_cut/__manifest__.py @@ -4,10 +4,17 @@ "name": "MRP Cut", "version": "14.0.1.0.0", "author": "Avanzosc", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "category": "MRP", - "depends": ["product_second_uom", "mrp", "product_dimension"], - "data": ["views/mrp_bom_views.xml", "views/mrp_production.xml"], + "depends": [ + "product_second_uom", + "mrp", + "product_dimension", + ], + "data": [ + "views/mrp_bom_views.xml", + "views/mrp_production.xml", + ], "license": "AGPL-3", "installable": True, } From 24f9713b8a97373ebfbdfd5fbe4e5ded056795f4 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 11:57:01 +0200 Subject: [PATCH 11/41] [IMP] mrp_stock_usability: pre-commit stuff --- mrp_stock_usability/models/mrp_workorder.py | 26 ++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/mrp_stock_usability/models/mrp_workorder.py b/mrp_stock_usability/models/mrp_workorder.py index d38a31ff8..19077333b 100644 --- a/mrp_stock_usability/models/mrp_workorder.py +++ b/mrp_stock_usability/models/mrp_workorder.py @@ -33,9 +33,10 @@ def _compute_unreserve_visible(self): pending_raw_moves = order.move_raw_ids.filtered( lambda m: m.state not in ("done", "cancel") ) - order.unreserve_visible = any( - [m.mrp_unreserve_visible for m in pending_raw_moves] - ) and order.date_planned_start + order.unreserve_visible = ( + any([m.mrp_unreserve_visible for m in pending_raw_moves]) + and order.date_planned_start + ) def _compute_show_check_availability(self): """According to `workorder.show_check_availability`, the @@ -46,15 +47,18 @@ def _compute_show_check_availability(self): if workorder.state in ("done", "cancel"): workorder.show_check_availability = False continue - workorder.show_check_availability = any( - move.state in ("waiting", "confirmed", "partially_available") - and float_compare( - move.product_uom_qty, - 0, - precision_rounding=move.product_uom.rounding, + workorder.show_check_availability = ( + any( + move.state in ("waiting", "confirmed", "partially_available") + and float_compare( + move.product_uom_qty, + 0, + precision_rounding=move.product_uom.rounding, + ) + for move in workorder.move_raw_ids ) - for move in workorder.move_raw_ids - ) and workorder.date_planned_start + and workorder.date_planned_start + ) def action_assign(self): for order in self: From ceb13e7a155f6b0b48b9f4ce174f44d547437add Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 11:57:35 +0200 Subject: [PATCH 12/41] [IMP] mrp_production_date: pre-commit stuff --- mrp_production_date/__manifest__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mrp_production_date/__manifest__.py b/mrp_production_date/__manifest__.py index 896ad7ee1..fb155b900 100644 --- a/mrp_production_date/__manifest__.py +++ b/mrp_production_date/__manifest__.py @@ -4,6 +4,7 @@ "name": "MRP Production Date", "version": "14.0.1.0.0", "author": "Avanzosc", + "website": "https://github.com/avanzosc/mrp-addons", "category": "Manufacturing", "depends": [ "mrp", From b6c8d0b5414fade2ed958a49d0d947c4fbba21df Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 12:02:08 +0200 Subject: [PATCH 13/41] [IMP] mrp_second_uom: pre-commit stuff --- mrp_second_uom/__manifest__.py | 8 ++-- mrp_second_uom/models/mrp_bom.py | 43 +++++++++++-------- mrp_second_uom/models/stock_move.py | 17 +++++--- mrp_second_uom/views/mrp_bom_views.xml | 15 ++++--- mrp_second_uom/views/mrp_production_views.xml | 14 +++--- 5 files changed, 57 insertions(+), 40 deletions(-) diff --git a/mrp_second_uom/__manifest__.py b/mrp_second_uom/__manifest__.py index 64e58caa3..b9c7ce58b 100644 --- a/mrp_second_uom/__manifest__.py +++ b/mrp_second_uom/__manifest__.py @@ -2,18 +2,18 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "MRP Second UOM", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "author": "Avanzosc", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "category": "Product", "depends": [ "product_second_uom", - "mrp" + "mrp", ], "data": [ "views/mrp_bom_views.xml", "views/mrp_production_views.xml", ], "license": "AGPL-3", - 'installable': True, + "installable": True, } diff --git a/mrp_second_uom/models/mrp_bom.py b/mrp_second_uom/models/mrp_bom.py index ddc995146..394b568e3 100644 --- a/mrp_second_uom/models/mrp_bom.py +++ b/mrp_second_uom/models/mrp_bom.py @@ -1,37 +1,44 @@ # Copyright 2021 Berezi Amubieta - 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 MrpBom(models.Model): _inherit = "mrp.bom" second_uom_id = fields.Many2one( - string='Second UOM', comodel_name='uom.uom', - related='product_tmpl_id.second_uom_id', store=True) - qty_second_uom = fields.Float( - string='Quantity Second UOM') + string="Second UOM", + comodel_name="uom.uom", + related="product_tmpl_id.second_uom_id", + store=True, + ) + qty_second_uom = fields.Float(string="Quantity Second UOM") is_calculated = fields.Boolean( - string='Is calculated', default=False, store=False) + string="Is calculated", + default=False, + store=False, + ) - @api.onchange('product_qty', 'product_tmpl_id.factor', 'product_tmpl_id') + @api.onchange("product_qty", "product_tmpl_id.factor", "product_tmpl_id") def onchange_qty_second_uom(self): - if self.product_qty and ( - self.product_tmpl_id.factor) and ( - self.is_calculated is False): - self.qty_second_uom = ( - self.product_qty * self.product_tmpl_id.factor) + if ( + self.product_qty + and self.product_tmpl_id.factor + and self.is_calculated is False + ): + self.qty_second_uom = self.product_qty * self.product_tmpl_id.factor self.is_calculated = True else: self.is_calculated = False - @api.onchange('qty_second_uom', 'product_tmpl_id.factor_inverse') + @api.onchange("qty_second_uom", "product_tmpl_id.factor_inverse") def onchange_product_qty(self): - if self.qty_second_uom and ( - self.product_tmpl_id.factor_inverse) and ( - self.is_calculated is False): - self.product_qty = ( - self.qty_second_uom * self.product_tmpl_id.factor_inverse) + if ( + self.qty_second_uom + and self.product_tmpl_id.factor_inverse + and self.is_calculated is False + ): + self.product_qty = self.qty_second_uom * self.product_tmpl_id.factor_inverse self.is_calculated = True else: self.is_calculated = False diff --git a/mrp_second_uom/models/stock_move.py b/mrp_second_uom/models/stock_move.py index 71da01079..4fb38b0c6 100644 --- a/mrp_second_uom/models/stock_move.py +++ b/mrp_second_uom/models/stock_move.py @@ -1,19 +1,24 @@ # Copyright 2021 Berezi Amubieta - 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 StockMove(models.Model): _inherit = "stock.move" second_uom_id = fields.Many2one( - string='Second UOM', comodel_name='uom.uom', - related='product_id.second_uom_id', store=True) + string="Second UOM", + comodel_name="uom.uom", + related="product_id.second_uom_id", + store=True, + ) qty_second_uom = fields.Float( - string='Quantity Second UOM', compute='_compute_qty_second_uom', - store=True) + string="Quantity Second UOM", + compute="_compute_qty_second_uom", + store=True, + ) - @api.depends('product_id', 'product_id.factor', 'product_uom_qty') + @api.depends("product_id", "product_id.factor", "product_uom_qty") def _compute_qty_second_uom(self): for line in self: line.qty_second_uom = line.product_qty * line.product_id.factor diff --git a/mrp_second_uom/views/mrp_bom_views.xml b/mrp_second_uom/views/mrp_bom_views.xml index 7f09844d7..cdd46b0df 100644 --- a/mrp_second_uom/views/mrp_bom_views.xml +++ b/mrp_second_uom/views/mrp_bom_views.xml @@ -1,16 +1,19 @@ - - + mrp.bom - + - diff --git a/mrp_second_uom/views/mrp_production_views.xml b/mrp_second_uom/views/mrp_production_views.xml index a961b7228..70b1d5166 100644 --- a/mrp_second_uom/views/mrp_production_views.xml +++ b/mrp_second_uom/views/mrp_production_views.xml @@ -1,13 +1,15 @@ - - + mrp.production - + - - - + + + From fb93988e36390702101cb1d485ff5cdbb97185be Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 14:03:42 +0200 Subject: [PATCH 14/41] [IMP] mrp_workorder_product_variant: pre-commit stuff --- mrp_workorder_product_variant/__manifest__.py | 6 +-- .../i18n/mrp_workorder_product_variant.csv | 19 ---------- .../models/mrp_bom.py | 37 +++++++++++++------ .../models/mrp_production.py | 26 +++++++++---- .../models/mrp_routing_workcenter.py | 31 ++++++++++------ .../views/mrp_routing_workcenter_view.xml | 35 +++++++++++++----- 6 files changed, 92 insertions(+), 62 deletions(-) delete mode 100644 mrp_workorder_product_variant/i18n/mrp_workorder_product_variant.csv diff --git a/mrp_workorder_product_variant/__manifest__.py b/mrp_workorder_product_variant/__manifest__.py index d59d07bb2..cc4eb1554 100644 --- a/mrp_workorder_product_variant/__manifest__.py +++ b/mrp_workorder_product_variant/__manifest__.py @@ -2,10 +2,10 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "MRP Workorder Product Variant", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "author": "Avanzosc", "category": "Manufacturing", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "depends": [ "mrp", ], @@ -13,5 +13,5 @@ "views/mrp_routing_workcenter_view.xml", ], "license": "AGPL-3", - 'installable': True, + "installable": True, } diff --git a/mrp_workorder_product_variant/i18n/mrp_workorder_product_variant.csv b/mrp_workorder_product_variant/i18n/mrp_workorder_product_variant.csv deleted file mode 100644 index 3fd717fb0..000000000 --- a/mrp_workorder_product_variant/i18n/mrp_workorder_product_variant.csv +++ /dev/null @@ -1,19 +0,0 @@ -module,type,name,res_id,src,value,comments -mrp_workorder_product_variant,model,"ir.model,name",mrp_workorder_product_variant.model_mrp_bom,Bill of Material,, -mrp_workorder_product_variant,model,"ir.model,name",mrp_workorder_product_variant.model_mrp_production,Production Order,, -mrp_workorder_product_variant,model,"ir.model,name",mrp_workorder_product_variant.model_mrp_routing_workcenter,Work Center Usage,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_bom__display_name,Display Name,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_bom__id,ID,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_bom____last_update,Last Modified on,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_production__display_name,Display Name,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_production__id,ID,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_production____last_update,Last Modified on,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_routing_workcenter__bom_product_template_attribute_value_ids,Apply on Variants,, -mrp_workorder_product_variant,model,"ir.model.fields,help",mrp_workorder_product_variant.field_mrp_routing_workcenter__bom_product_template_attribute_value_ids,BOM Product Variants needed to apply this line.,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_routing_workcenter__display_name,Display Name,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_routing_workcenter__id,ID,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_routing_workcenter____last_update,Last Modified on,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_routing_workcenter__parent_product_tmpl_id,Parent Product Template,, -mrp_workorder_product_variant,model,"ir.model.fields,field_description",mrp_workorder_product_variant.field_mrp_routing_workcenter__possible_bom_product_template_attribute_value_ids,Possible BOM Product Attribute Value,, -mrp_workorder_product_variant,code,addons/mrp_workorder_product_variant/models/mrp_bom.py,24,BoM cannot concern product %s and have a line with attributes (%s) at the same time.,, -mrp_workorder_product_variant,code,addons/mrp_workorder_product_variant/models/mrp_bom.py,28,The attribute value %(attribute)s set on product %(product)s does not match the BoM product %(bom_product)s.,, diff --git a/mrp_workorder_product_variant/models/mrp_bom.py b/mrp_workorder_product_variant/models/mrp_bom.py index 09d77d492..03a09a8c9 100644 --- a/mrp_workorder_product_variant/models/mrp_bom.py +++ b/mrp_workorder_product_variant/models/mrp_bom.py @@ -1,13 +1,13 @@ # Copyright 2023 Berezi Amubieta - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import _, api, fields, models +from odoo import _, api, models from odoo.exceptions import ValidationError class MrpBom(models.Model): _inherit = "mrp.bom" - @api.onchange('product_id') + @api.onchange("product_id") def onchange_product_id(self): result = super(MrpBom, self).onchange_product_id() if self.product_id: @@ -15,20 +15,33 @@ def onchange_product_id(self): line.bom_product_template_attribute_value_ids = False return result - @api.constrains('product_id', 'product_tmpl_id', 'operation_ids') + @api.constrains("product_id", "product_tmpl_id", "operation_ids") def _check_bom_lines(self): result = super(MrpBom, self)._check_bom_lines() for bom in self: for operation in bom.operation_ids: - if bom.product_id and operation.bom_product_template_attribute_value_ids: - raise ValidationError(_("BoM cannot concern product %s and have a line with attributes (%s) at the same time.") - % (bom.product_id.display_name, ", ".join([ptav.display_name for ptav in operation.bom_product_template_attribute_value_ids]))) + attribute_values = operation.bom_product_template_attribute_value_ids + if bom.product_id and attribute_values: + raise ValidationError( + _( + "BoM cannot concern product %s and have a line with" + " attributes (%s) at the same time." + ) + % ( + bom.product_id.display_name, + ", ".join([ptav.display_name for ptav in attribute_values]), + ) + ) for ptav in operation.bom_product_template_attribute_value_ids: if ptav.product_tmpl_id != bom.product_tmpl_id: - raise ValidationError(_( - "The attribute value %(attribute)s set on product %(product)s does not match the BoM product %(bom_product)s.", - attribute=ptav.display_name, - product=ptav.product_tmpl_id.display_name, - bom_product=operation.parent_product_tmpl_id.display_name - )) + raise ValidationError( + _( + "The attribute value %(attribute)s set on product" + " %(product)s does not match the BoM product" + " %(bom_product)s.", + attribute=ptav.display_name, + product=ptav.product_tmpl_id.display_name, + bom_product=operation.parent_product_tmpl_id.display_name, + ) + ) return result diff --git a/mrp_workorder_product_variant/models/mrp_production.py b/mrp_workorder_product_variant/models/mrp_production.py index 11a7540d3..3bf7483f8 100644 --- a/mrp_workorder_product_variant/models/mrp_production.py +++ b/mrp_workorder_product_variant/models/mrp_production.py @@ -6,23 +6,35 @@ class MrpProduction(models.Model): _inherit = "mrp.production" - @api.onchange('bom_id', 'product_id') + @api.onchange("bom_id", "product_id") def _onchange_workorder_ids(self): result = super(MrpProduction, self)._onchange_workorder_ids() if self.bom_id and self.workorder_ids: for workorder in self.workorder_ids: attributes = self.product_id.product_template_attribute_value_ids - if workorder.operation_id and ( - workorder.operation_id.bom_product_template_attribute_value_ids) and ( - not any([line in attributes for line in workorder.operation_id.bom_product_template_attribute_value_ids])): + op = workorder.operation_id + if ( + op + and op.bom_product_template_attribute_value_ids + and ( + not any( + [ + line in attributes + for line in op.bom_product_template_attribute_value_ids + ] + ) + ) + ): self.workorder_ids = [(3, workorder.id)] for line in self.move_raw_ids: routing = [] for workorder in self.workorder_ids: if workorder.operation_id not in routing: routing.append(workorder.operation_id) - if line.bom_line_id and ( - line.bom_line_id.operation_id) and ( - line.bom_line_id.operation_id not in routing): + if ( + line.bom_line_id + and line.bom_line_id.operation_id + and line.bom_line_id.operation_id not in routing + ): self.move_raw_ids = [(3, line.id)] return result diff --git a/mrp_workorder_product_variant/models/mrp_routing_workcenter.py b/mrp_workorder_product_variant/models/mrp_routing_workcenter.py index bd44d9b4c..b3ca83be2 100644 --- a/mrp_workorder_product_variant/models/mrp_routing_workcenter.py +++ b/mrp_workorder_product_variant/models/mrp_routing_workcenter.py @@ -9,25 +9,34 @@ class MrpRoutingWorkcenter(models.Model): parent_product_tmpl_id = fields.Many2one( comodel_name="product.template", string="Parent Product Template", - related="bom_id.product_tmpl_id") + related="bom_id.product_tmpl_id", + ) possible_bom_product_template_attribute_value_ids = fields.Many2many( - string='Possible BOM Product Attribute Value', - relation='rel_routing_variant', - column1='routing_workcenter_id', - column2='product_template_attribute_id', - comodel_name='product.template.attribute.value', - compute='_compute_possible_bom_product_template_attribute_value_ids', - store=True) + string="Possible BOM Product Attribute Value", + relation="rel_routing_variant", + column1="routing_workcenter_id", + column2="product_template_attribute_id", + comodel_name="product.template.attribute.value", + compute="_compute_possible_bom_product_template_attribute_value_ids", + store=True, + ) bom_product_template_attribute_value_ids = fields.Many2many( comodel_name="product.template.attribute.value", string="Apply on Variants", ondelete="restrict", domain="[('id', 'in', possible_bom_product_template_attribute_value_ids)]", - help="BOM Product Variants needed to apply this line.") + help="BOM Product Variants needed to apply this line.", + ) @api.depends( "parent_product_tmpl_id", - "parent_product_tmpl_id.valid_product_template_attribute_line_ids") + "parent_product_tmpl_id.valid_product_template_attribute_line_ids", + ) def _compute_possible_bom_product_template_attribute_value_ids(self): for line in self: - line.possible_bom_product_template_attribute_value_ids = line.parent_product_tmpl_id.valid_product_template_attribute_line_ids._without_no_variant_attributes().product_template_value_ids._only_active() + parent_tmpl_id = line.parent_product_tmpl_id + attr_lines = parent_tmpl_id.valid_product_template_attribute_line_ids + no_variant_attrs = attr_lines._without_no_variant_attributes() + line.possible_bom_product_template_attribute_value_ids = ( + no_variant_attrs.product_template_value_ids._only_active() + ) diff --git a/mrp_workorder_product_variant/views/mrp_routing_workcenter_view.xml b/mrp_workorder_product_variant/views/mrp_routing_workcenter_view.xml index 6ab26afe3..b817e2279 100644 --- a/mrp_workorder_product_variant/views/mrp_routing_workcenter_view.xml +++ b/mrp_workorder_product_variant/views/mrp_routing_workcenter_view.xml @@ -1,26 +1,41 @@ - - + mrp.routing.workcenter - + - - - + + + mrp.routing.workcenter - + - - - + + + From 32c8d07e6100d319ba16aeea4d372ad900a84313 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 14:04:31 +0200 Subject: [PATCH 15/41] [IMP] custom_mrp_descarga: pre-commit stuff --- .flake8 | 3 +- custom_mrp_descarga/__manifest__.py | 2 +- custom_mrp_descarga/data/ir_sequence.xml | 25 +- custom_mrp_descarga/data/mrp_bom_category.xml | 27 +- .../data/quartering_product.xml | 11 +- .../models/account_analytic_line.py | 7 +- custom_mrp_descarga/models/mrp_bom.py | 14 +- custom_mrp_descarga/models/mrp_production.py | 489 +++++------ custom_mrp_descarga/models/project_task.py | 4 +- custom_mrp_descarga/models/saca_line.py | 130 +-- .../models/stock_inventory_line.py | 36 +- custom_mrp_descarga/models/stock_move.py | 8 +- custom_mrp_descarga/models/stock_move_line.py | 141 ++-- .../models/stock_production_lot.py | 26 +- custom_mrp_descarga/models/stock_quant.py | 20 +- .../mrp_production_quartering_summary_xlsx.py | 334 +++++--- ...mrp_production_quartering_summary_xlsx.xml | 4 +- .../report/mrp_production_summary_xlsx.py | 200 ++--- .../report/mrp_production_summary_xlsx.xml | 4 +- .../views/killing_cost_view.xml | 7 +- custom_mrp_descarga/views/mrp_bom_view.xml | 36 +- .../views/mrp_production_view.xml | 795 +++++++++++++----- .../views/product_template_view.xml | 6 +- custom_mrp_descarga/views/saca_line_view.xml | 35 +- .../views/stock_move_line_view.xml | 234 ++++-- .../views/stock_production_lot_view.xml | 12 +- .../views/stock_quant_view.xml | 2 +- 27 files changed, 1644 insertions(+), 968 deletions(-) diff --git a/.flake8 b/.flake8 index e397e8ed4..0adcf4233 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/custom_mrp_descarga/__manifest__.py b/custom_mrp_descarga/__manifest__.py index f3dd1bc27..2a1c01e94 100644 --- a/custom_mrp_descarga/__manifest__.py +++ b/custom_mrp_descarga/__manifest__.py @@ -7,7 +7,7 @@ "category": "MRP", "license": "AGPL-3", "author": "AvanzOSC", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "depends": [ "custom_mrp_line_cost", "custom_descarga", diff --git a/custom_mrp_descarga/data/ir_sequence.xml b/custom_mrp_descarga/data/ir_sequence.xml index af6aa2e2d..0092c2f4d 100644 --- a/custom_mrp_descarga/data/ir_sequence.xml +++ b/custom_mrp_descarga/data/ir_sequence.xml @@ -1,14 +1,13 @@ - - - - Secuencia para Ăłrdenes de producciĂłn de despiece - DESP/ - 5 - - - Secuencia para Ăłrdenes de producciĂłn de clasificado - CLAS/ - 5 - - + + + + Secuencia para Ăłrdenes de producciĂłn de despiece + DESP/ + 5 + + + Secuencia para Ăłrdenes de producciĂłn de clasificado + CLAS/ + 5 + diff --git a/custom_mrp_descarga/data/mrp_bom_category.xml b/custom_mrp_descarga/data/mrp_bom_category.xml index 6e36a92fc..5a23d0839 100644 --- a/custom_mrp_descarga/data/mrp_bom_category.xml +++ b/custom_mrp_descarga/data/mrp_bom_category.xml @@ -1,12 +1,17 @@ - - - - Despiece - - - - Clasificado - - - + + + + Despiece + + + + Clasificado + + diff --git a/custom_mrp_descarga/data/quartering_product.xml b/custom_mrp_descarga/data/quartering_product.xml index e96690bd0..9d3c57998 100644 --- a/custom_mrp_descarga/data/quartering_product.xml +++ b/custom_mrp_descarga/data/quartering_product.xml @@ -1,7 +1,6 @@ - - - - Despiece - - + + + + Despiece + diff --git a/custom_mrp_descarga/models/account_analytic_line.py b/custom_mrp_descarga/models/account_analytic_line.py index 4066cea73..9a1f458c1 100644 --- a/custom_mrp_descarga/models/account_analytic_line.py +++ b/custom_mrp_descarga/models/account_analytic_line.py @@ -6,10 +6,9 @@ class AccountAnalyticLine(models.Model): _inherit = "account.analytic.line" - production_id = fields.Many2one( - string="Production", - comodel_name="mrp.production") + production_id = fields.Many2one(string="Production", comodel_name="mrp.production") unload_date = fields.Datetime( string="Unload Date", related="production_id.saca_line_id.unload_date", - store=True) + store=True, + ) diff --git a/custom_mrp_descarga/models/mrp_bom.py b/custom_mrp_descarga/models/mrp_bom.py index 96a88fd1e..aeba76507 100644 --- a/custom_mrp_descarga/models/mrp_bom.py +++ b/custom_mrp_descarga/models/mrp_bom.py @@ -7,16 +7,11 @@ class MrpBom(models.Model): _inherit = "mrp.bom" quartering = fields.Boolean( - string="Quartering", - compute="_compute_quartering", - store=True + string="Quartering", compute="_compute_quartering", store=True ) - no_duplicate_lines = fields.Boolean( - string="No Duplicate Lines", - default=False) + no_duplicate_lines = fields.Boolean(string="No Duplicate Lines", default=False) no_produce_product = fields.Boolean( - string="Don't produce the header product", - default=False + string="Don't produce the header product", default=False ) @api.depends("category_id") @@ -24,8 +19,7 @@ def _compute_quartering(self): for line in self: quartering = False try: - quartering = ( - self.env.ref("custom_mrp_descarga.quartering_category")) + quartering = self.env.ref("custom_mrp_descarga.quartering_category") if line.category_id == quartering: quartering = True except Exception: diff --git a/custom_mrp_descarga/models/mrp_production.py b/custom_mrp_descarga/models/mrp_production.py index 9e7afa97e..6197ccf34 100644 --- a/custom_mrp_descarga/models/mrp_production.py +++ b/custom_mrp_descarga/models/mrp_production.py @@ -1,8 +1,10 @@ # Copyright 2022 Berezi Amubieta - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import _, api, fields, models from datetime import datetime, timedelta + from dateutil import rrule + +from odoo import _, api, fields, models from odoo.exceptions import ValidationError @@ -14,154 +16,116 @@ def _default_production_date(self): return result saca_line_id = fields.Many2one( - string="Saca Line", - comodel_name="saca.line", - copy=False) + string="Saca Line", comodel_name="saca.line", copy=False + ) saca_id = fields.Many2one( - string="Saca", - comodel_name="saca", - related="saca_line_id.saca_id", - store=True) + string="Saca", comodel_name="saca", related="saca_line_id.saca_id", store=True + ) origin_qty = fields.Float( - string="Origin Qty", - related="saca_line_id.net_origin", - store=True) - dest_qty = fields.Float( - related="saca_line_id.net_dest", - store=True) - purchase_price = fields.Float( - related="saca_line_id.purchase_price", - store=True) + string="Origin Qty", related="saca_line_id.net_origin", store=True + ) + dest_qty = fields.Float(related="saca_line_id.net_dest", store=True) + purchase_price = fields.Float(related="saca_line_id.purchase_price", store=True) purchase_unit_price = fields.Float( - related="saca_line_id.purchase_unit_price", - store=True) - saca_date = fields.Date( - string="Saca Date", - related="saca_line_id.date", - store=True) + related="saca_line_id.purchase_unit_price", store=True + ) + saca_date = fields.Date(string="Saca Date", related="saca_line_id.date", store=True) reproductor_quant_ids = fields.One2many( string="Reproductor", comodel_name="stock.quant", - compute="_compute_reproductor_quant_ids") + compute="_compute_reproductor_quant_ids", + ) batch_id = fields.Many2one( - string="Mother", - comodel_name="stock.picking.batch", - copy=False) + string="Mother", comodel_name="stock.picking.batch", copy=False + ) chick_production = fields.Boolean( string="Chick Production", related="picking_type_id.chick_production", - store=True) - production_date = fields.Datetime( - default=_default_production_date) + store=True, + ) + production_date = fields.Datetime(default=_default_production_date) birth_week = fields.Integer( - string="Birth Week", - compute="_compute_birth_week", - store=True) - paasa = fields.Boolean( - string="PAASA", - related="company_id.paasa", - store=True) - tolvasa = fields.Boolean( - string="Tolvasa", - related="company_id.tolvasa", - store=True) + string="Birth Week", compute="_compute_birth_week", store=True + ) + paasa = fields.Boolean(string="PAASA", related="company_id.paasa", store=True) + tolvasa = fields.Boolean(string="Tolvasa", related="company_id.tolvasa", store=True) guide_number = fields.Char( - string="Guide Number", - related="saca_line_id.guide_number", - store=True) + string="Guide Number", related="saca_line_id.guide_number", store=True + ) channel_temperature = fields.Float( string="Channel Temperature", related="saca_line_id.channel_temperature", - store=True) - staff = fields.Integer( - string="Staff", - related="saca_line_id.staff", - store=True) - product_qty = fields.Float( - copy=False) + store=True, + ) + staff = fields.Integer(string="Staff", related="saca_line_id.staff", store=True) + product_qty = fields.Float(copy=False) hen_unit = fields.Integer( - string="Hen Units", - related="batch_id.hen_unit", - store=True) + string="Hen Units", related="batch_id.hen_unit", store=True + ) birth_rate = fields.Float( - string="Birth %", - compute="_compute_birth_rate", - store=True) + string="Birth %", compute="_compute_birth_rate", store=True + ) expected_birth = fields.Float( - string="Expected Births", - compute="_compute_expected_birth", - store=True) + string="Expected Births", compute="_compute_expected_birth", store=True + ) expected_rate = fields.Float( - string="Expected %", - compute="_compute_expected_birth", - store=True) + string="Expected %", compute="_compute_expected_birth", store=True + ) birth_difference = fields.Float( - string="Difference", - compute="_compute_birth_difference", - store=True) + string="Difference", compute="_compute_birth_difference", store=True + ) difference_rate = fields.Float( - string="Difference %", - compute="_compute_difference_rate", - store=True) + string="Difference %", compute="_compute_difference_rate", store=True + ) batch_location_id = fields.Many2one( - string="Mother Location", - related="batch_id.location_id", - store=True) + string="Mother Location", related="batch_id.location_id", store=True + ) clasified_date = fields.Date( - string="Clasified Date", - compute="_compute_clasified_date") + string="Clasified Date", compute="_compute_clasified_date" + ) clasified_time_start = fields.Float( - string="Clasified Time Start", - compute="_compute_clasified_date") + string="Clasified Time Start", compute="_compute_clasified_date" + ) clasified_time_stop = fields.Float( - string="Clasified Time Stop", - compute="_compute_clasified_date") + string="Clasified Time Stop", compute="_compute_clasified_date" + ) real_average_weight = fields.Float( string="Real Average Weight", compute="_compute_real_average_weight", store=True, - digits="Weight Decimal Precision") + digits="Weight Decimal Precision", + ) unload_date = fields.Datetime( - string="Unload Date", - related="saca_line_id.unload_date", - store=True) + string="Unload Date", related="saca_line_id.unload_date", store=True + ) download_unit = fields.Integer( - string="Download Unit", - related="saca_line_id.download_unit", - store=True) + string="Download Unit", related="saca_line_id.download_unit", store=True + ) unit_difference = fields.Integer( - string="Unit Difference", - compute="_compute_unit_difference", - store=True) - total_unit = fields.Float( - string="Units", - compute="_compute_total_unit", - store=True) + string="Unit Difference", compute="_compute_unit_difference", store=True + ) + total_unit = fields.Float(string="Units", compute="_compute_total_unit", store=True) average_weight = fields.Float( string="Average Weight", related="saca_line_id.average_weight_origin", - store=True) + store=True, + ) gross_yield = fields.Float( - string="Gross Yield", - compute="_compute_gross_yield", - store=True) + string="Gross Yield", compute="_compute_gross_yield", store=True + ) descarga_order = fields.Char( - string="Descarga Order", - related="saca_line_id.descarga_order") + string="Descarga Order", related="saca_line_id.descarga_order" + ) produced_qty = fields.Float( - string="Produced Qty", - compute="_compute_produced_qty", - store=True) + string="Produced Qty", compute="_compute_produced_qty", store=True + ) qty_difference = fields.Float( - string="Difference", - compute="_compute_qty_difference", - store=True) - quartering = fields.Boolean( - string="Quartering") + string="Difference", compute="_compute_qty_difference", store=True + ) + quartering = fields.Boolean(string="Quartering") no_duplicate_lines = fields.Boolean( - string="No Duplicate Lines", - related="bom_id.no_duplicate_lines", - store=True) + string="No Duplicate Lines", related="bom_id.no_duplicate_lines", store=True + ) bom_id = fields.Many2one( domain="""[ '&', @@ -174,123 +138,142 @@ def _default_production_date(self): '&', ('product_tmpl_id.product_variant_ids','=',product_id), ('product_id','=',False), - ('type', '=', 'normal')]""") + ('type', '=', 'normal')]""" + ) clasification = fields.Selection( - string="Clasification", selection=[ + string="Clasification", + selection=[ ("normal", "Normal"), ("relaxed", "Relaxed"), - ("demanding", "Demanding")]) - channel_temperature = fields.Float( - string="Channel Temperature") + ("demanding", "Demanding"), + ], + ) + channel_temperature = fields.Float(string="Channel Temperature") waiting_time = fields.Float(string="Waiting Time") clasified_ids = fields.One2many( string="Classified", comodel_name="account.analytic.line", - inverse_name="production_id") + inverse_name="production_id", + ) farm_warehouse_id = fields.Many2one( string="Farm", comodel_name="stock.warehouse", related="saca_line_id.farm_warehouse_id", - store=True) + store=True, + ) farm_id = fields.Many2one( string="Farm", comodel_name="res.partner", related="saca_line_id.farm_id", - store=True) + store=True, + ) vehicle_id = fields.Many2one( string="Vehicle", comodel_name="fleet.vehicle", related="saca_line_id.vehicle_id", - store=True) + store=True, + ) remolque_id = fields.Many2one( string="Remolque", comodel_name="fleet.vehicle", related="saca_line_id.remolque_id", - store=True) + store=True, + ) breeding_id = fields.Many2one( string="Breeding", comodel_name="stock.picking.batch", related="saca_line_id.breeding_id", - store=True) + store=True, + ) asphyxiation_units = fields.Integer( - string="Asphyxiated", - compute="_compute_asphyxiation_units", - store=True) + string="Asphyxiated", compute="_compute_asphyxiation_units", store=True + ) seized_units = fields.Integer( - string="Seized", - compute="_compute_seized_units", - store=True) + string="Seized", compute="_compute_seized_units", store=True + ) rto_percentage = fields.Float( - string="Rto. %", - compute="_compute_rto_percentage", - store=True) + string="Rto. %", compute="_compute_rto_percentage", store=True + ) bom_category_id = fields.Many2one( - string="Category", - related="bom_id.category_id", - store=True) + string="Category", related="bom_id.category_id", store=True + ) no_produce_product = fields.Boolean( string="Don't produce the header product", related="bom_id.no_produce_product", - store=True) + store=True, + ) @api.depends("move_line_ids.percentage") def _compute_rto_percentage(self): for line in self: rto_percentage = 0 if line.move_line_ids: - rto_percentage = sum( - line.move_line_ids.mapped("percentage")) + rto_percentage = sum(line.move_line_ids.mapped("percentage")) line.rto_percentage = rto_percentage - @api.depends("move_line_ids.product_id", - "move_line_ids.product_id.chicken_seized", - "move_line_ids.unit", "quartering") + @api.depends( + "move_line_ids.product_id", + "move_line_ids.product_id.chicken_seized", + "move_line_ids.unit", + "quartering", + ) def _compute_seized_units(self): for line in self: seized_units = 0 - if line.move_line_ids and line.move_line_ids.filtered( - lambda c: c.product_id.chicken_seized) and not ( - line.quartering): + if ( + line.move_line_ids + and line.move_line_ids.filtered(lambda c: c.product_id.chicken_seized) + and not (line.quartering) + ): seized_units = sum( line.move_line_ids.filtered( - lambda c: c.product_id.chicken_seized).mapped("unit")) + lambda c: c.product_id.chicken_seized + ).mapped("unit") + ) line.seized_units = seized_units - @api.depends("move_line_ids.product_id", - "move_line_ids.product_id.asphyxiated", "quartering", - "move_line_ids.unit") + @api.depends( + "move_line_ids.product_id", + "move_line_ids.product_id.asphyxiated", + "quartering", + "move_line_ids.unit", + ) def _compute_asphyxiation_units(self): for line in self: asphyxiation_units = 0 - if line.move_line_ids and line.move_line_ids.filtered( - lambda c: c.product_id.asphyxiated) and not ( - line.quartering): + if ( + line.move_line_ids + and line.move_line_ids.filtered(lambda c: c.product_id.asphyxiated) + and not (line.quartering) + ): asphyxiation_units = sum( line.move_line_ids.filtered( - lambda c: c.product_id.asphyxiated).mapped("unit")) + lambda c: c.product_id.asphyxiated + ).mapped("unit") + ) line.asphyxiation_units = asphyxiation_units def _compute_classified_ids(self): for line in self: - cond = [("production_id", "=", line.id), ( - "classified", "=", True)] + cond = [("production_id", "=", line.id), ("classified", "=", True)] classified = self.env["account.analytic.line"].search(cond) line.clasified_ids = [(6, 0, classified.ids)] @api.depends("produced_qty", "consume_qty") def _compute_qty_difference(self): for production in self: - production.qty_difference = ( - production.consume_qty - production.produced_qty) + production.qty_difference = production.consume_qty - production.produced_qty @api.depends("finished_move_line_ids.qty_done") def _compute_produced_qty(self): for production in self: produced_qty = 0 if production.finished_move_line_ids: - produced_qty = sum(production.finished_move_line_ids.filtered( - lambda c: c.product_uom_id == production.product_uom_id - ).mapped("qty_done")) + produced_qty = sum( + production.finished_move_line_ids.filtered( + lambda c: c.product_uom_id == production.product_uom_id + ).mapped("qty_done") + ) production.produced_qty = produced_qty @api.depends("move_line_ids.qty_done", "origin_qty") @@ -298,8 +281,9 @@ def _compute_gross_yield(self): for line in self: gross_yield = 0 if line.origin_qty != 0: - gross_yield = sum( - line.move_line_ids.mapped("qty_done")) / line.origin_qty + gross_yield = ( + sum(line.move_line_ids.mapped("qty_done")) / line.origin_qty + ) line.gross_yield = gross_yield @api.depends("move_line_ids.unit") @@ -315,8 +299,9 @@ def _compute_unit_difference(self): for line in self: unit_difference = line.download_unit if line.move_line_ids: - unit_difference = sum( - line.move_line_ids.mapped("unit")) - line.download_unit + unit_difference = ( + sum(line.move_line_ids.mapped("unit")) - line.download_unit + ) line.unit_difference = unit_difference @api.depends("origin_qty", "move_line_ids.unit") @@ -347,8 +332,7 @@ def _compute_difference_rate(self): for line in self: difference_rate = 0 if line.product_qty != 0: - difference_rate = ( - line.birth_difference * 100 / line.product_qty) + difference_rate = line.birth_difference * 100 / line.product_qty line.difference_rate = difference_rate @api.depends("product_qty", "expected_birth") @@ -356,21 +340,20 @@ def _compute_birth_difference(self): for line in self: line.birth_difference = line.product_qty - line.expected_birth - @api.depends("batch_id.birth_rate_ids", "product_qty", - "production_date") + @api.depends("batch_id.birth_rate_ids", "product_qty", "production_date") def _compute_expected_birth(self): for line in self: expected_birth = 0 if line.production_date: rate = line.batch_id.birth_rate_ids.filtered( - lambda c: c.birth_start_date and c.birth_start_date <= ( - line.production_date.date()) and ( - c.birth_start_date + timedelta(days=7)) > ( - line.production_date.date())) + lambda c: c.birth_start_date + and c.birth_start_date <= (line.production_date.date()) + and (c.birth_start_date + timedelta(days=7)) + > (line.production_date.date()) + ) if rate: line.expected_rate = rate[0].percentage_birth - expected_birth = ( - line.product_qty * rate[0].percentage_birth) / 100 + expected_birth = (line.product_qty * rate[0].percentage_birth) / 100 line.expected_birth = expected_birth @api.depends("product_qty", "consume_qty") @@ -386,16 +369,15 @@ def _compute_birth_week(self): for line in self: week = 0 if line.production_date: - start_date = datetime( - line.production_date.year, 1, 1, 0, 0).date() + start_date = datetime(line.production_date.year, 1, 1, 0, 0).date() start_date = line.calculate_weeks_start(start_date) end_date = line.production_date.date() if end_date < start_date: start_date = datetime( - line.production_date.year - 1, 1, 1, 0, 0).date() + line.production_date.year - 1, 1, 1, 0, 0 + ).date() start_date = line.calculate_weeks_start(start_date) - end_date = datetime( - line.production_date.year, 1, 1, 0, 0).date() + end_date = datetime(line.production_date.year, 1, 1, 0, 0).date() week = line.weeks_between(start_date, end_date) if week == 53: week = 1 @@ -408,20 +390,24 @@ def weeks_between(self, start_date, end_date): def _compute_reproductor_quant_ids(self): for production in self: production.reproductor_quant_ids = ( - self.env["stock.quant"].sudo().search([])).filtered( - lambda c: c.product_id.egg is True and ( - c.location_id.is_hatchery is True)) + self.env["stock.quant"].sudo().search([]) + ).filtered( + lambda c: c.product_id.egg is True + and (c.location_id.is_hatchery is True) + ) @api.onchange("picking_type_id") def onchange_picking_type(self): result = super(MrpProduction, self).onchange_picking_type() product = self.env["product.product"].search( - [("one_day_chicken", "=", True)], limit=1) + [("one_day_chicken", "=", True)], limit=1 + ) if self.chick_production and product: self.product_id = product.id elif self.env.company.paasa: - product = self.env["product.product"].search([ - ("download_product", "=", True)]) + product = self.env["product.product"].search( + [("download_product", "=", True)] + ) if product and len(product) == 1: self.product_id = product.id else: @@ -457,43 +443,43 @@ def _onchange_product_id(self): def action_emptying_hatchers(self): for production in self: if not production.batch_id: - raise ValidationError( - _("No mother has been put on.") - ) + raise ValidationError(_("No mother has been put on.")) if not production.lot_producing_id: - raise ValidationError( - _("No lot has been put on.") - ) + raise ValidationError(_("No lot has been put on.")) production.move_line_ids.unlink() for quant in production.reproductor_quant_ids: - if ( - quant.available_quantity > 0) and ( - quant.lot_id.batch_id == production.batch_id): + if (quant.available_quantity > 0) and ( + quant.lot_id.batch_id == production.batch_id + ): line = production.move_line_ids.filtered( - lambda c: c.product_id == quant.product_id and ( - c.location_id == quant.location_id) and ( - c.lot_id == quant.lot_id)) + lambda c: c.product_id == quant.product_id + and (c.location_id == quant.location_id) + and (c.lot_id == quant.lot_id) + ) if line: line.qty_done += quant.available_quantity if not line: self.env["stock.move.line"].create( - {"product_id": quant.product_id.id, - "location_id": quant.location_id.id, - "location_dest_id": ( - production.production_location_id.id), - "product_uom_id": quant.product_id.uom_id.id, - "qty_done": quant.available_quantity, - "lot_id": quant.lot_id.id, - "batch_id": production.batch_id.id, - "standard_price": quant.product_id.standard_price, - "amount": ( - quant.available_quantity) * ( - quant.product_id.standard_price), - "company_id": production.company_id.id, - "production_id": production.id, - "move_id": production.move_raw_ids.filtered( - lambda c: c.product_id == quant.product_id - ).id}) + { + "product_id": quant.product_id.id, + "location_id": quant.location_id.id, + "location_dest_id": ( + production.production_location_id.id + ), + "product_uom_id": quant.product_id.uom_id.id, + "qty_done": quant.available_quantity, + "lot_id": quant.lot_id.id, + "batch_id": production.batch_id.id, + "standard_price": quant.product_id.standard_price, + "amount": (quant.available_quantity) + * (quant.product_id.standard_price), + "company_id": production.company_id.id, + "production_id": production.id, + "move_id": production.move_raw_ids.filtered( + lambda c: c.product_id == quant.product_id + ).id, + } + ) def action_view_reproductor_quant_ids(self): context = self.env.context.copy() @@ -504,7 +490,7 @@ def action_view_reproductor_quant_ids(self): "res_model": "stock.quant", "domain": [("id", "in", self.reproductor_quant_ids.ids)], "type": "ir.actions.act_window", - "context": context + "context": context, } def action_confirm(self): @@ -516,9 +502,12 @@ def button_mark_done(self): if self.move_finished_ids: self.move_finished_ids._do_unreserve() result = super(MrpProduction, self).button_mark_done() - if result is not True and "res_model" in result and result[ - "res_model" - ] == "mrp.consumption.warning" and self.no_duplicate_lines: + if ( + result is not True + and "res_model" in result + and result["res_model"] == "mrp.consumption.warning" + and self.no_duplicate_lines + ): entry_qty = sum(self.move_line_ids.mapped("qty_done")) out_qty = sum(self.finished_move_line_ids.mapped("qty_done")) for move in self.move_raw_ids: @@ -542,8 +531,8 @@ def action_delete_producing_line(self): for line in self: if line.no_produce_product: for move in line.move_finished_ids.filtered( - lambda c: c.product_id == ( - line.product_id)): + lambda c: c.product_id == (line.product_id) + ): move.do_cancel_done() move.state = "cancel" @@ -553,31 +542,41 @@ def action_generate_serial(self): if not self.lot_producing_id: super(MrpProduction, self).action_generate_serial() if self.batch_id: - self.lot_producing_id.name = u"{}{}{}".format( - self.batch_id.name, date.strftime("%d%m"), ( - date.strftime("%Y")[2:])) + self.lot_producing_id.name = "{}{}{}".format( + self.batch_id.name, date.strftime("%d%m"), (date.strftime("%Y")[2:]) + ) if self.batch_id and self.lot_producing_id: - self.lot_producing_id.name = u"{}{}{}".format( - self.batch_id.name, date.strftime("%d%m"), ( - date.strftime("%Y")[2:])) + self.lot_producing_id.name = "{}{}{}".format( + self.batch_id.name, date.strftime("%d%m"), (date.strftime("%Y")[2:]) + ) self.lot_producing_id.batch_id = self.batch_id.id def action_assign_serials(self): for production in self: if production.move_line_ids and production.lot_producing_id: for line in production.move_line_ids: - if line.product_id.tracking != "none" and not ( - line.lot_id): - lot = self.env["stock.production.lot"].search( - [("name", "=", production.lot_producing_id.name), - ("product_id", "=", line.product_id.id)], - limit=1).id + if line.product_id.tracking != "none" and not (line.lot_id): + lot = ( + self.env["stock.production.lot"] + .search( + [ + ("name", "=", production.lot_producing_id.name), + ("product_id", "=", line.product_id.id), + ], + limit=1, + ) + .id + ) if not lot: - lot = self.env[( - "stock.production.lot")].action_create_lot( + lot = ( + self.env[("stock.production.lot")] + .action_create_lot( line.product_id, production.lot_producing_id.name, - production.company_id).id + production.company_id, + ) + .id + ) line.lot_id = lot def action_delete_moves_with_qty_zero(self): @@ -592,23 +591,29 @@ def calculate_weeks_start(self, start_date): if weekday <= 3: return start_date - timedelta(days=weekday) else: - return start_date + timedelta(days=(7-weekday)) + return start_date + timedelta(days=(7 - weekday)) @api.model - def read_group(self, domain, fields, groupby, offset=0, limit=None, - orderby=False, lazy=True): + def read_group( + self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True + ): result = super(MrpProduction, self).read_group( - domain, fields, groupby, offset=offset, limit=limit, - orderby=orderby, lazy=lazy + domain, + fields, + groupby, + offset=offset, + limit=limit, + orderby=orderby, + lazy=lazy, ) for line in result: - if '__domain' in line: + if "__domain" in line: lines = self.search(line["__domain"]) - average_weight = sum(lines.mapped("average_weight"))/len(lines) - rto_percentage = sum(lines.mapped("rto_percentage"))/len(lines) - purchase_unit_price = sum( - lines.mapped("purchase_unit_price") - )/len(lines) + average_weight = sum(lines.mapped("average_weight")) / len(lines) + rto_percentage = sum(lines.mapped("rto_percentage")) / len(lines) + purchase_unit_price = sum(lines.mapped("purchase_unit_price")) / len( + lines + ) line["average_weight"] = average_weight line["rto_percentage"] = rto_percentage line["purchase_unit_price"] = purchase_unit_price diff --git a/custom_mrp_descarga/models/project_task.py b/custom_mrp_descarga/models/project_task.py index 88869e332..52146bcb3 100644 --- a/custom_mrp_descarga/models/project_task.py +++ b/custom_mrp_descarga/models/project_task.py @@ -6,6 +6,4 @@ class ProjectTask(models.Model): _inherit = "project.task" - production_id = fields.Many2one( - string="Production", - comodel_name="mrp.production") + production_id = fields.Many2one(string="Production", comodel_name="mrp.production") diff --git a/custom_mrp_descarga/models/saca_line.py b/custom_mrp_descarga/models/saca_line.py index bd2eb779d..3ddd26a22 100644 --- a/custom_mrp_descarga/models/saca_line.py +++ b/custom_mrp_descarga/models/saca_line.py @@ -11,10 +11,11 @@ class SacaLine(models.Model): string="Production", comodel_name="mrp.production", inverse_name="saca_line_id", - compute="_compute_production_ids") + compute="_compute_production_ids", + ) count_production = fields.Integer( - string="Count Production", - compute="_compute_count_production") + string="Count Production", compute="_compute_count_production" + ) def _compute_count_production(self): for line in self: @@ -22,28 +23,29 @@ def _compute_count_production(self): def _compute_production_ids(self): for line in self: - cond = [("saca_line_id", "=", line.id), ( - "quartering", "=", False)] + cond = [("saca_line_id", "=", line.id), ("quartering", "=", False)] production = self.env["mrp.production"].search(cond) line.production_ids = [(6, 0, production.ids)] def action_view_production(self): context = self.env.context.copy() - context.update({'default_saca_line_id': False, - "production_id": self.production_ids[0].id, - "active_model": "mrp.production", - "active_id": self.production_ids[0].id, - "active_ids": self.production_ids[0].ids}) + context.update( + { + "default_saca_line_id": False, + "production_id": self.production_ids[0].id, + "active_model": "mrp.production", + "active_id": self.production_ids[0].id, + "active_ids": self.production_ids[0].ids, + } + ) return { - 'name': _("Production"), - 'view_mode': 'tree,form', - 'res_model': 'mrp.production', - 'domain': [('id', 'in', self.production_ids.ids)], - 'search_view_id': self.env.ref( - 'mrp.view_mrp_production_filter' - ).id, - 'type': 'ir.actions.act_window', - 'context': context, + "name": _("Production"), + "view_mode": "tree,form", + "res_model": "mrp.production", + "domain": [("id", "in", self.production_ids.ids)], + "search_view_id": self.env.ref("mrp.view_mrp_production_filter").id, + "type": "ir.actions.act_window", + "context": context, } def action_next_stage(self): @@ -52,26 +54,28 @@ def action_next_stage(self): project = self.env.ref("custom_saca_timesheet.project_saca") if self.company_id != self.env.company: raise ValidationError( - _("The company of the saca and your company is not the same.")) + _("The company of the saca and your company is not the same.") + ) if self.stage_id == stage_clasificado: - for line in ( - self.move_line_ids.filtered( - lambda c: not c.move_id.sale_line_id)): + for line in self.move_line_ids.filtered( + lambda c: not c.move_id.sale_line_id + ): bom = self.env["mrp.bom"].search( - [("product_tmpl_id", "=", ( - line.product_id.product_tmpl_id.id))], limit=1) - new_production = self.env["mrp.production"].new({ - "bom_id": bom.id, - "product_id": line.product_id.id, - "product_uom_id": line.product_uom_id.id, - "product_qty": self.net_origin, - "saca_line_id": self.id, - "lot_producing_id": line.lot_id.id, - "company_id": self.company_id.id - }) - for ( - comp_onchange) in ( - new_production._onchange_methods["company_id"]): + [("product_tmpl_id", "=", (line.product_id.product_tmpl_id.id))], + limit=1, + ) + new_production = self.env["mrp.production"].new( + { + "bom_id": bom.id, + "product_id": line.product_id.id, + "product_uom_id": line.product_uom_id.id, + "product_qty": self.net_origin, + "saca_line_id": self.id, + "lot_producing_id": line.lot_id.id, + "company_id": self.company_id.id, + } + ) + for comp_onchange in new_production._onchange_methods["company_id"]: comp_onchange(new_production) vals = new_production._convert_to_write(new_production._cache) production = self.env["mrp.production"].create(vals) @@ -92,17 +96,28 @@ def action_next_stage(self): if self.production_ids: for line in self.production_ids: if not line.clasified_ids: - self.env["project.task"].create({ - "project_id": project.id, - "name": "Clasificado", - "production_id": line.id, - "timesheet_ids": [(0, 0, { - "production_id": line.id, - "date": self.unload_date.date(), - "name": u'{} {}'.format( - project.name, "Clasificado"), + self.env["project.task"].create( + { "project_id": project.id, - "classified": True})]}) + "name": "Clasificado", + "production_id": line.id, + "timesheet_ids": [ + ( + 0, + 0, + { + "production_id": line.id, + "date": self.unload_date.date(), + "name": "{} {}".format( + project.name, "Clasificado" + ), + "project_id": project.id, + "classified": True, + }, + ) + ], + } + ) for clas in line.clasified_ids: clas.employee_id = False clas.user_id = False @@ -114,19 +129,20 @@ def _compute_stage(self): matanza = self.env.ref("custom_descarga.stage_matanza") clasificado = self.env.ref("custom_descarga.stage_clasificado") if line.stage_id == clasificado and not line.production_ids: - line.write({ - "stage_id": matanza.id, - "is_presaca": False, - "is_saca": False, - "is_descarga": False, - "is_killing": True, - "is_classified": False}) + line.write( + { + "stage_id": matanza.id, + "is_presaca": False, + "is_saca": False, + "is_descarga": False, + "is_killing": True, + "is_classified": False, + } + ) def write(self, values): result = super(SacaLine, self).write(values) - if "gross_origin" in ( - values) or "tara_origin" in ( - values) and self.net_origin: + if "gross_origin" in (values) or "tara_origin" in (values) and self.net_origin: for line in self.production_ids: line.product_qty = self.net_origin return result diff --git a/custom_mrp_descarga/models/stock_inventory_line.py b/custom_mrp_descarga/models/stock_inventory_line.py index 42eb091b9..6d00867cb 100644 --- a/custom_mrp_descarga/models/stock_inventory_line.py +++ b/custom_mrp_descarga/models/stock_inventory_line.py @@ -19,35 +19,35 @@ def onchange_cost(self): if self.inventory_id and self.inventory_id.batch_id: if self.prod_lot_id: entry_line = self.inventory_id.batch_id.move_line_ids.filtered( - lambda c: c.lot_id == self.prod_lot_id and ( - c.location_dest_id == self.location_id - ) and c.picking_id + lambda c: c.lot_id == self.prod_lot_id + and (c.location_dest_id == self.location_id) + and c.picking_id ) dev_line = self.inventory_id.batch_id.move_line_ids.filtered( - lambda c: c.lot_id == self.prod_lot_id and ( - c.location_id == self.location_id - ) and c.picking_id + lambda c: c.lot_id == self.prod_lot_id + and (c.location_id == self.location_id) + and c.picking_id ) if entry_line: dev_line_amount = sum(dev_line.mapped("amount")) or 0 dev_line_qty = sum(dev_line.mapped("qty_done")) or 0 - self.cost = ( - sum(entry_line.mapped("amount")) - dev_line_amount - ) / (sum(entry_line.mapped("qty_done")) - dev_line_qty) + self.cost = (sum(entry_line.mapped("amount")) - dev_line_amount) / ( + sum(entry_line.mapped("qty_done")) - dev_line_qty + ) elif self.product_id: entry_line = self.inventory_id.batch_id.move_line_ids.filtered( - lambda c: c.product_id == self.product_id and ( - c.location_dest_id == self.location_id - ) and c.picking_id + lambda c: c.product_id == self.product_id + and (c.location_dest_id == self.location_id) + and c.picking_id ) dev_line = self.inventory_id.batch_id.move_line_ids.filtered( - lambda c: c.product_id == self.product_id and ( - c.location_id == self.location_id - ) and c.picking_id + lambda c: c.product_id == self.product_id + and (c.location_id == self.location_id) + and c.picking_id ) if entry_line: dev_line_amount = sum(dev_line.mapped("amount")) or 0 dev_line_qty = sum(dev_line.mapped("qty_done")) or 0 - self.cost = ( - sum(entry_line.mapped("amount")) - dev_line_amount - ) / (sum(entry_line.mapped("qty_done")) - dev_line_qty) + self.cost = (sum(entry_line.mapped("amount")) - dev_line_amount) / ( + sum(entry_line.mapped("qty_done")) - dev_line_qty + ) diff --git a/custom_mrp_descarga/models/stock_move.py b/custom_mrp_descarga/models/stock_move.py index 1ee3bf680..448516246 100644 --- a/custom_mrp_descarga/models/stock_move.py +++ b/custom_mrp_descarga/models/stock_move.py @@ -6,8 +6,12 @@ class StockMove(models.Model): _inherit = "stock.move" - @api.depends("purchase_line_id", "sale_line_id", - "raw_material_production_id", "production_id") + @api.depends( + "purchase_line_id", + "sale_line_id", + "raw_material_production_id", + "production_id", + ) def _compute_saca_line_id(self): super(StockMove, self)._compute_saca_line_id() for move in self: diff --git a/custom_mrp_descarga/models/stock_move_line.py b/custom_mrp_descarga/models/stock_move_line.py index 80e5309ec..9910924f6 100644 --- a/custom_mrp_descarga/models/stock_move_line.py +++ b/custom_mrp_descarga/models/stock_move_line.py @@ -1,32 +1,24 @@ # Copyright 2022 Berezi Amubieta - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from datetime import timedelta + from odoo import _, api, fields, models from odoo.exceptions import ValidationError -from datetime import timedelta class StockMoveLine(models.Model): _inherit = "stock.move.line" performance = fields.Float( - string="Performance", - compute="_compute_performance", - store=True) + string="Performance", compute="_compute_performance", store=True + ) sequence = fields.Integer( - string="Sequence", - compute="_compute_sequence", - store=True - ) - quartering = fields.Boolean( - string="Quartering", - related="production_id.quartering", - store=True + string="Sequence", compute="_compute_sequence", store=True ) - saca_date = fields.Date( - string="Saca Date", - related="saca_line_id.date", - store=True + quartering = fields.Boolean( + string="Quartering", related="production_id.quartering", store=True ) + saca_date = fields.Date(string="Saca Date", related="saca_line_id.date", store=True) @api.depends("production_id") def _compute_sequence(self): @@ -36,8 +28,8 @@ def _compute_sequence(self): ids = [] movelines = False if line in line.production_id.move_line_ids and ( - line.location_id == ( - line.production_id.location_src_id)): + line.location_id == (line.production_id.location_src_id) + ): movelines = line.production_id.move_line_ids elif line in line.production_id.finished_move_line_ids: movelines = line.production_id.finished_move_line_ids @@ -54,8 +46,7 @@ def _compute_performance(self): for line in self: performance = 0 if line.production_id and line.production_id.consume_qty != 0: - performance = ( - line.qty_done * 100) / line.production_id.consume_qty + performance = (line.qty_done * 100) / line.production_id.consume_qty line.performance = performance @api.onchange("unit") @@ -64,72 +55,100 @@ def onchange_unit(self): if self.unit: self.download_unit = self.unit - @api.onchange("product_id", "location_id", "location_dest_id", - "production_id", "production_id", - "production_id") + @api.onchange( + "product_id", + "location_id", + "location_dest_id", + "production_id", + "production_id", + "production_id", + ) def onchange_product_id(self): self.ensure_one() - if "production_id" in self.env.context or "default_production_id" in ( - self.env.context) and self.product_id and ( - self.location_id) and self.location_dest_id: + if ( + "production_id" in self.env.context + or "default_production_id" in (self.env.context) + and self.product_id + and (self.location_id) + and self.location_dest_id + ): if "production_id" in self.env.context: - production = self.env["mrp.production"].search([ - ("id", "=", self.env.context["production_id"])]) + production = self.env["mrp.production"].search( + [("id", "=", self.env.context["production_id"])] + ) if "default_production_id" in self.env.context: - production = self.env["mrp.production"].search([ - ("id", "=", self.env.context["default_production_id"])]) + production = self.env["mrp.production"].search( + [("id", "=", self.env.context["default_production_id"])] + ) moves = production.move_raw_ids + production.move_byproduct_ids move = moves.filtered( - lambda c: c.product_id == self.product_id and ( - c.location_id == self.location_id) and ( - c.location_dest_id == self.location_dest_id)) + lambda c: c.product_id == self.product_id + and (c.location_id == self.location_id) + and (c.location_dest_id == self.location_dest_id) + ) if move: self.move_id = move[:1].id @api.onchange("lot_id") def _onchange_lot_id(self): result = super(StockMoveLine, self)._onchange_lot_id() - if self.production_id and ( - self.production_id.quartering) and ( - self.lot_id): + if self.production_id and (self.production_id.quartering) and (self.lot_id): self.standard_price = self.lot_id.average_price if self.location_dest_id == self.production_id.location_src_id: lot = self.lot_id.name - if not any([line.lot_id.name == lot for line in ( - self.production_id.move_line_ids.filtered( - lambda c: c.location_id != self.location_id))]): + if not any( + [ + line.lot_id.name == lot + for line in ( + self.production_id.move_line_ids.filtered( + lambda c: c.location_id != self.location_id + ) + ) + ] + ): raise ValidationError( - _("The outgoing lot must match the incoming one.")) + _("The outgoing lot must match the incoming one.") + ) return result @api.onchange("batch_id", "location_id", "product_id") def onchange_lot_domain(self): result = super(StockMoveLine, self).onchange_lot_domain() - if self.production_id and not ( - self.production_id.quartering) and ( - self.location_id == self.production_id.location_dest_id): + if ( + self.production_id + and not (self.production_id.quartering) + and (self.location_id == self.production_id.location_dest_id) + ): lots = [] date = fields.Datetime.now() date = date - timedelta(days=5) date = date.date() - lot = self.env["stock.production.lot"].search([ - ("product_id", "=", self.product_id.id), - ("company_id", "=", self.company_id.id), - ("create_date", ">=", date)]) + lot = self.env["stock.production.lot"].search( + [ + ("product_id", "=", self.product_id.id), + ("company_id", "=", self.company_id.id), + ("create_date", ">=", date), + ] + ) for line in lot: if line.id not in lots: lots.append(line.id) - result = {"domain": {"lot_id": [('id', 'in', lots)]}} + result = {"domain": {"lot_id": [("id", "in", lots)]}} return result - @api.onchange('lot_id', 'product_id') + @api.onchange("lot_id", "product_id") def onchange_product_lot(self): - if self.product_id and ( - self.lot_id) and ( - self.product_id != self.lot_id.product_id): + if ( + self.product_id + and (self.lot_id) + and (self.product_id != self.lot_id.product_id) + ): raise ValidationError( - _("The product of the lot does not match with the " + - "product of the line.")) + _( + "The product of the lot does not match with the " + + "product of the line." + ) + ) @api.model def create(self, values): @@ -145,15 +164,15 @@ def write(self, values): result = super(StockMoveLine, self).write(values) for line in self: if not line.location_id: - values.update({ - "location_id": line.move_id.location_id.id, - "location_dest_id": line.move_id.location_dest_id.id - }) + values.update( + { + "location_id": line.move_id.location_id.id, + "location_dest_id": line.move_id.location_dest_id.id, + } + ) if "qty_done" in values: for line in self: - if line.move_id.state == "cancel" and values.get( - "qty_done" - ) != 0: + if line.move_id.state == "cancel" and values.get("qty_done") != 0: line.move_id.state = "done" line.state = "done" return result diff --git a/custom_mrp_descarga/models/stock_production_lot.py b/custom_mrp_descarga/models/stock_production_lot.py index 579ca4cef..3deacb182 100644 --- a/custom_mrp_descarga/models/stock_production_lot.py +++ b/custom_mrp_descarga/models/stock_production_lot.py @@ -10,20 +10,22 @@ class StockProductionLot(models.Model): string="Average Price", digits="MRP Price Decimal Precision", compute="_compute_average_price", - store=True) + store=True, + ) - @api.depends("move_line_ids.amount", "move_line_ids.qty_done", - "move_line_ids.state") + @api.depends( + "move_line_ids.amount", "move_line_ids.qty_done", "move_line_ids.state" + ) def _compute_average_price(self): for line in self: average_price = 0 clasified = line.move_line_ids.filtered( - lambda c: c.state == "done" and ( - c.location_dest_id.usage == "internal")) + lambda c: c.state == "done" and (c.location_dest_id.usage == "internal") + ) quartering = line.move_line_ids.filtered( - lambda c: c.production_id and c.production_id.quartering and ( - c.location_id == c.production_id.location_src_id - ) + lambda c: c.production_id + and c.production_id.quartering + and (c.location_id == c.production_id.location_src_id) ) if clasified: amount_total = sum(clasified.mapped("amount")) @@ -43,8 +45,10 @@ def action_view_move_lines(self): "name": _("Move Lines"), "view_mode": "tree,form", "res_model": "stock.move.line", - "domain": [("product_id", "=", self.product_id.id), - ("id", "in", self.move_line_ids.ids)], + "domain": [ + ("product_id", "=", self.product_id.id), + ("id", "in", self.move_line_ids.ids), + ], "type": "ir.actions.act_window", - "context": context + "context": context, } diff --git a/custom_mrp_descarga/models/stock_quant.py b/custom_mrp_descarga/models/stock_quant.py index f1211f848..22f481610 100644 --- a/custom_mrp_descarga/models/stock_quant.py +++ b/custom_mrp_descarga/models/stock_quant.py @@ -7,17 +7,17 @@ class StockQuant(models.Model): _inherit = "stock.quant" is_incubator = fields.Boolean( - string="Incubator", - related="location_id.is_incubator", store=True) + string="Incubator", related="location_id.is_incubator", store=True + ) is_integration = fields.Boolean( - string="Integration", - related="location_id.is_integration", store=True) + string="Integration", related="location_id.is_integration", store=True + ) is_reproductor = fields.Boolean( - string="Reproductor", - related="location_id.is_reproductor", store=True) + string="Reproductor", related="location_id.is_reproductor", store=True + ) is_feed_flour = fields.Boolean( - string="Feed/Flour", - related="location_id.is_feed_flour", store=True) + string="Feed/Flour", related="location_id.is_feed_flour", store=True + ) is_medicine = fields.Boolean( - string="Medicine", - related="location_id.is_medicine", store=True) + string="Medicine", related="location_id.is_medicine", store=True + ) diff --git a/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py b/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py index a473850b0..25ec5a478 100644 --- a/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py +++ b/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.py @@ -9,48 +9,68 @@ class ReportMrpProductionQuarteringSummaryXlsx(models.AbstractModel): _description = "MRP Production Quartering Summary Report" def generate_xlsx_report(self, workbook, data, objects): - table_header = workbook.add_format({ - 'bold': True, - 'align': 'center', - 'valign': 'vcenter', - 'fg_color': '#D7E4BC', - }) - summary = workbook.add_format({ - 'bold': True, - 'num_format': '#,##0.00;(#,##0.00)', - }) - int_format = workbook.add_format({ - 'num_format': '#,##0;(#,##0)', - }) - two_decimal_format = workbook.add_format({ - 'num_format': '#,##0.00;(#,##0.00)', - }) - three_decimal_format = workbook.add_format({ - 'num_format': '#,##0.000;(#,##0.000)', - }) - eight_decimal_format = workbook.add_format({ - 'num_format': '#,##0.00000000;(#,##0.00000000)', - }) - result_int_format = workbook.add_format({ - 'bold': True, - 'fg_color': '#afd095', - 'num_format': '#,##0;(#,##0)', - }) - result_two_decimal = workbook.add_format({ - 'bold': True, - 'fg_color': '#afd095', - 'num_format': '#,##0.00;(#,##0.00)', - }) - result_three_decimal = workbook.add_format({ - 'bold': True, - 'fg_color': '#afd095', - 'num_format': '#,##0.000;(#,##0.000)', - }) - result_summary = workbook.add_format({ - 'bold': True, - 'fg_color': '#afd095', - 'num_format': '#,##0.000;(#,##0.000)', - }) + table_header = workbook.add_format( + { + "bold": True, + "align": "center", + "valign": "vcenter", + "fg_color": "#D7E4BC", + } + ) + summary = workbook.add_format( + { + "bold": True, + "num_format": "#,##0.00;(#,##0.00)", + } + ) + int_format = workbook.add_format( + { + "num_format": "#,##0;(#,##0)", + } + ) + two_decimal_format = workbook.add_format( + { + "num_format": "#,##0.00;(#,##0.00)", + } + ) + three_decimal_format = workbook.add_format( + { + "num_format": "#,##0.000;(#,##0.000)", + } + ) + eight_decimal_format = workbook.add_format( + { + "num_format": "#,##0.00000000;(#,##0.00000000)", + } + ) + result_int_format = workbook.add_format( + { + "bold": True, + "fg_color": "#afd095", + "num_format": "#,##0;(#,##0)", + } + ) + result_two_decimal = workbook.add_format( + { + "bold": True, + "fg_color": "#afd095", + "num_format": "#,##0.00;(#,##0.00)", + } + ) + result_three_decimal = workbook.add_format( + { + "bold": True, + "fg_color": "#afd095", + "num_format": "#,##0.000;(#,##0.000)", + } + ) + result_summary = workbook.add_format( + { + "bold": True, + "fg_color": "#afd095", + "num_format": "#,##0.000;(#,##0.000)", + } + ) table_header.set_text_wrap() summary.set_text_wrap() int_format.set_text_wrap() @@ -60,12 +80,14 @@ def generate_xlsx_report(self, workbook, data, objects): result_three_decimal.set_text_wrap() result_two_decimal.set_text_wrap() result_summary.set_text_wrap() - table_detail_right_num = workbook.add_format({ - 'border': 1, - 'align': 'right', - 'valign': 'vcenter', - }) - table_detail_right_num.set_num_format('#,##0.00') + table_detail_right_num = workbook.add_format( + { + "border": 1, + "align": "right", + "valign": "vcenter", + } + ) + table_detail_right_num.set_num_format("#,##0.00") worksheet = workbook.add_worksheet("Resumen de despiece") worksheet.write(0, 0, _("Resumen de despiece"), result_int_format) for i in range(0, 13): @@ -117,22 +139,34 @@ def generate_xlsx_report(self, workbook, data, objects): categ_pallet_weight = 0 categ_container_weight = 0 for line in categ_lines: - if line.move_id and ( - line.move_id.raw_material_production_id - ) and line.move_id.raw_material_production_id.pallet_id: - categ_pallet_weight += line.move_id.raw_material_production_id.pallet_id.weight * line.pallet - if line.move_id and ( - line.move_id.raw_material_production_id - ) and line.move_id.raw_material_production_id.packaging_id: - categ_container_weight += line.move_id.raw_material_production_id.packaging_id.weight * line.container + if ( + line.move_id + and (line.move_id.raw_material_production_id) + and line.move_id.raw_material_production_id.pallet_id + ): + categ_pallet_weight += ( + line.move_id.raw_material_production_id.pallet_id.weight + * line.pallet + ) + if ( + line.move_id + and (line.move_id.raw_material_production_id) + and line.move_id.raw_material_production_id.packaging_id + ): + categ_container_weight += ( + line.move_id.raw_material_production_id.packaging_id.weight + * line.container + ) categ_qty_done = sum(categ_lines.mapped("qty_done")) - categ_average_weight = categ_qty_done / sum( - categ_lines.mapped("download_unit") - ) if sum(categ_lines.mapped("download_unit")) else 0 + categ_average_weight = ( + categ_qty_done / sum(categ_lines.mapped("download_unit")) + if sum(categ_lines.mapped("download_unit")) + else 0 + ) categ_amount = sum(categ_lines.mapped("amount")) - categt_applied_price = round(( - categ_amount / categ_qty_done - ) if categ_qty_done != 0 else 0, 3) + categt_applied_price = round( + (categ_amount / categ_qty_done) if categ_qty_done != 0 else 0, 3 + ) for product in categ_lines: if product.product_id not in products: n += 1 @@ -142,29 +176,42 @@ def generate_xlsx_report(self, workbook, data, objects): lambda c: c.product_id == product.product_id ) product_pallet = sum(product_lines.mapped("pallet")) - product_container = sum( - product_lines.mapped("container") - ) + product_container = sum(product_lines.mapped("container")) product_unit = sum(product_lines.mapped("unit")) product_brut = sum(product_lines.mapped("brut")) product_pallet_weight = 0 product_container_weight = 0 for line in product_lines: - if line.move_id and line.move_id.raw_material_production_id and line.move_id.raw_material_production_id.pallet_id: - product_pallet_weight += line.move_id.raw_material_production_id.pallet_id.weight * line.pallet - if line.move_id and line.move_id.raw_material_production_id and line.move_id.raw_material_production_id.packaging_id: - product_container_weight += line.move_id.raw_material_production_id.packaging_id.weight * line.container - product_qty_done = sum( - product_lines.mapped("qty_done") + if ( + line.move_id + and line.move_id.raw_material_production_id + and line.move_id.raw_material_production_id.pallet_id + ): + product_pallet_weight += ( + line.move_id.raw_material_production_id.pallet_id.weight + * line.pallet + ) + if ( + line.move_id + and line.move_id.raw_material_production_id + and line.move_id.raw_material_production_id.packaging_id + ): + product_container_weight += ( + line.move_id.raw_material_production_id.packaging_id.weight + * line.container + ) + product_qty_done = sum(product_lines.mapped("qty_done")) + product_average_weight = ( + product_qty_done + / sum(product_lines.mapped("download_unit")) + if sum(product_lines.mapped("download_unit")) + else 0 ) - product_average_weight = product_qty_done / sum( - product_lines.mapped("download_unit") - ) if sum(product_lines.mapped("download_unit")) else 0 product_amount = sum(product_lines.mapped("amount")) product_applied_price = ( - ( - product_amount / product_qty_done - ) if product_qty_done else 0 + (product_amount / product_qty_done) + if product_qty_done + else 0 ) worksheet.write(n, m, product.product_id.default_code) m += 1 @@ -180,7 +227,9 @@ def generate_xlsx_report(self, workbook, data, objects): m += 1 worksheet.write(n, m, product_pallet_weight, two_decimal_format) m += 1 - worksheet.write(n, m, product_container_weight, two_decimal_format) + worksheet.write( + n, m, product_container_weight, two_decimal_format + ) m += 1 worksheet.write(n, m, product_qty_done, two_decimal_format) m += 1 @@ -192,18 +241,25 @@ def generate_xlsx_report(self, workbook, data, objects): n, m, round(product_amount, 2), two_decimal_format ) m += 1 - worksheet.write(n, m, product_average_weight, two_decimal_format) + worksheet.write( + n, m, product_average_weight, two_decimal_format + ) m += 1 - worksheet.write(n, m, product_qty_done * 100 / sum(entry_movelines.mapped("qty_done")), two_decimal_format) + worksheet.write( + n, + m, + product_qty_done + * 100 + / sum(entry_movelines.mapped("qty_done")), + two_decimal_format, + ) n += 1 m = 0 worksheet.write( n, m, line.product_category_id.display_name, result_int_format ) m += 1 - worksheet.write( - n, m, "", result_int_format - ) + worksheet.write(n, m, "", result_int_format) m += 1 worksheet.write(n, m, categ_pallet, result_int_format) m += 1 @@ -219,15 +275,18 @@ def generate_xlsx_report(self, workbook, data, objects): m += 1 worksheet.write(n, m, categ_qty_done, result_two_decimal) m += 1 - worksheet.write( - n, m, categt_applied_price, result_three_decimal - ) + worksheet.write(n, m, categt_applied_price, result_three_decimal) m += 1 worksheet.write(n, m, categ_amount, result_two_decimal) m += 1 worksheet.write(n, m, categ_average_weight, result_two_decimal) m += 1 - worksheet.write(n, m, categ_qty_done * 100 / sum(entry_movelines.mapped("qty_done")), result_two_decimal) + worksheet.write( + n, + m, + categ_qty_done * 100 / sum(entry_movelines.mapped("qty_done")), + result_two_decimal, + ) n += 3 m = 0 worksheet.write(n, m, _("Salidas"), table_header) @@ -246,13 +305,28 @@ def generate_xlsx_report(self, workbook, data, objects): categ_pallet_weight = 0 categ_container_weight = 0 for line in categ_lines: - if line.move_id and line.move_id.production_id and line.move_id.production_id.pallet_id: - categ_pallet_weight += line.move_id.production_id.pallet_id.weight * line.pallet - if line.move_id and line.move_id.production_id and line.move_id.production_id.packaging_id: - categ_container_weight += line.move_id.production_id.packaging_id.weight * line.container + if ( + line.move_id + and line.move_id.production_id + and line.move_id.production_id.pallet_id + ): + categ_pallet_weight += ( + line.move_id.production_id.pallet_id.weight * line.pallet + ) + if ( + line.move_id + and line.move_id.production_id + and line.move_id.production_id.packaging_id + ): + categ_container_weight += ( + line.move_id.production_id.packaging_id.weight + * line.container + ) categ_qty_done = sum(categ_lines.mapped("qty_done")) categ_amount = sum(categ_lines.mapped("amount")) - categt_applied_price = round((categ_amount / categ_qty_done) if categ_qty_done != 0 else 0, 3) + categt_applied_price = round( + (categ_amount / categ_qty_done) if categ_qty_done != 0 else 0, 3 + ) for product in categ_lines: if product.product_id not in products: n += 1 @@ -262,25 +336,35 @@ def generate_xlsx_report(self, workbook, data, objects): lambda c: c.product_id == product.product_id ) product_pallet = sum(product_lines.mapped("pallet")) - product_container = sum( - product_lines.mapped("container") - ) + product_container = sum(product_lines.mapped("container")) product_brut = sum(product_lines.mapped("brut")) product_pallet_weight = 0 product_container_weight = 0 for line in product_lines: - if line.move_id and line.move_id.production_id and line.move_id.production_id.pallet_id: - product_pallet_weight += line.move_id.production_id.pallet_id.weight * line.pallet - if line.move_id and line.move_id.production_id and line.move_id.production_id.packaging_id: - product_container_weight += line.move_id.production_id.packaging_id.weight * line.container - product_qty_done = sum( - product_lines.mapped("qty_done") - ) + if ( + line.move_id + and line.move_id.production_id + and line.move_id.production_id.pallet_id + ): + product_pallet_weight += ( + line.move_id.production_id.pallet_id.weight + * line.pallet + ) + if ( + line.move_id + and line.move_id.production_id + and line.move_id.production_id.packaging_id + ): + product_container_weight += ( + line.move_id.production_id.packaging_id.weight + * line.container + ) + product_qty_done = sum(product_lines.mapped("qty_done")) product_amount = sum(product_lines.mapped("amount")) product_applied_price = ( - ( - product_amount / product_qty_done - ) if product_qty_done else 0 + (product_amount / product_qty_done) + if product_qty_done + else 0 ) worksheet.write(n, m, product.product_id.default_code) m += 1 @@ -294,7 +378,9 @@ def generate_xlsx_report(self, workbook, data, objects): m += 1 worksheet.write(n, m, product_pallet_weight, two_decimal_format) m += 1 - worksheet.write(n, m, product_container_weight, two_decimal_format) + worksheet.write( + n, m, product_container_weight, two_decimal_format + ) m += 1 worksheet.write(n, m, product_qty_done, two_decimal_format) m += 1 @@ -306,16 +392,21 @@ def generate_xlsx_report(self, workbook, data, objects): n, m, round(product_amount, 2), two_decimal_format ) m += 2 - worksheet.write(n, m, product_qty_done * 100 / sum(entry_movelines.mapped("qty_done")), two_decimal_format) + worksheet.write( + n, + m, + product_qty_done + * 100 + / sum(entry_movelines.mapped("qty_done")), + two_decimal_format, + ) n += 1 m = 0 worksheet.write( n, m, line.product_category_id.display_name, result_int_format ) m += 1 - worksheet.write( - n, m, "", result_int_format - ) + worksheet.write(n, m, "", result_int_format) m += 1 worksheet.write(n, m, categ_pallet, result_int_format) m += 1 @@ -329,18 +420,23 @@ def generate_xlsx_report(self, workbook, data, objects): m += 1 worksheet.write(n, m, categ_qty_done, result_two_decimal) m += 1 - worksheet.write( - n, m, categt_applied_price, result_three_decimal - ) + worksheet.write(n, m, categt_applied_price, result_three_decimal) m += 1 worksheet.write(n, m, categ_amount, result_two_decimal) m += 2 - worksheet.write(n, m, categ_qty_done * 100 / sum(entry_movelines.mapped("qty_done")), result_two_decimal) + worksheet.write( + n, + m, + categ_qty_done * 100 / sum(entry_movelines.mapped("qty_done")), + result_two_decimal, + ) n += 2 m = 0 worksheet.write(n, m, _("Total Entradas"), result_summary) m += 1 - worksheet.write(n, m, sum(entry_movelines.mapped("qty_done")), result_two_decimal) + worksheet.write( + n, m, sum(entry_movelines.mapped("qty_done")), result_two_decimal + ) n += 1 m = 0 worksheet.write(n, m, _("Total Salidas"), result_summary) @@ -350,4 +446,10 @@ def generate_xlsx_report(self, workbook, data, objects): m = 0 worksheet.write(n, m, _("Diferencia"), result_summary) m += 1 - worksheet.write(n, m, sum(entry_movelines.mapped("qty_done")) - sum(out_movelines.mapped("qty_done")), result_two_decimal) + worksheet.write( + n, + m, + sum(entry_movelines.mapped("qty_done")) + - sum(out_movelines.mapped("qty_done")), + result_two_decimal, + ) diff --git a/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.xml b/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.xml index df20254f3..0ae1f490f 100644 --- a/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.xml +++ b/custom_mrp_descarga/report/mrp_production_quartering_summary_xlsx.xml @@ -1,4 +1,4 @@ - + Resumen de despiece XLSX @@ -6,7 +6,7 @@ xlsx mrp_production_quartering_summary_xlsx mrp_production_quartering_summary_xlsx - + report diff --git a/custom_mrp_descarga/report/mrp_production_summary_xlsx.py b/custom_mrp_descarga/report/mrp_production_summary_xlsx.py index 29a5bc1a7..0dcebf0cd 100644 --- a/custom_mrp_descarga/report/mrp_production_summary_xlsx.py +++ b/custom_mrp_descarga/report/mrp_production_summary_xlsx.py @@ -9,48 +9,68 @@ class ReportMrpProductionsummaryXlsx(models.AbstractModel): _description = "MRP Production Summary Report" def generate_xlsx_report(self, workbook, data, objects): - table_header = workbook.add_format({ - 'bold': True, - 'align': 'center', - 'valign': 'vcenter', - 'fg_color': '#D7E4BC', - }) - summary = workbook.add_format({ - 'bold': True, - 'num_format': '#,##0.00;(#,##0.00)', - }) - int_format = workbook.add_format({ - 'num_format': '#,##0;(#,##0)', - }) - two_decimal_format = workbook.add_format({ - 'num_format': '#,##0.00;(#,##0.00)', - }) - three_decimal_format = workbook.add_format({ - 'num_format': '#,##0.000;(#,##0.000)', - }) - eight_decimal_format = workbook.add_format({ - 'num_format': '#,##0.00000000;(#,##0.00000000)', - }) - result_int_format = workbook.add_format({ - 'bold': True, - 'fg_color': '#afd095', - 'num_format': '#,##0;(#,##0)', - }) - result_two_decimal = workbook.add_format({ - 'bold': True, - 'fg_color': '#afd095', - 'num_format': '#,##0.00;(#,##0.00)', - }) - result_three_decimal = workbook.add_format({ - 'bold': True, - 'fg_color': '#afd095', - 'num_format': '#,##0.000;(#,##0.000)', - }) - result_summary = workbook.add_format({ - 'bold': True, - 'fg_color': '#afd095', - 'num_format': '#,##0.000;(#,##0.000)', - }) + table_header = workbook.add_format( + { + "bold": True, + "align": "center", + "valign": "vcenter", + "fg_color": "#D7E4BC", + } + ) + summary = workbook.add_format( + { + "bold": True, + "num_format": "#,##0.00;(#,##0.00)", + } + ) + int_format = workbook.add_format( + { + "num_format": "#,##0;(#,##0)", + } + ) + two_decimal_format = workbook.add_format( + { + "num_format": "#,##0.00;(#,##0.00)", + } + ) + three_decimal_format = workbook.add_format( + { + "num_format": "#,##0.000;(#,##0.000)", + } + ) + eight_decimal_format = workbook.add_format( + { + "num_format": "#,##0.00000000;(#,##0.00000000)", + } + ) + result_int_format = workbook.add_format( + { + "bold": True, + "fg_color": "#afd095", + "num_format": "#,##0;(#,##0)", + } + ) + result_two_decimal = workbook.add_format( + { + "bold": True, + "fg_color": "#afd095", + "num_format": "#,##0.00;(#,##0.00)", + } + ) + result_three_decimal = workbook.add_format( + { + "bold": True, + "fg_color": "#afd095", + "num_format": "#,##0.000;(#,##0.000)", + } + ) + result_summary = workbook.add_format( + { + "bold": True, + "fg_color": "#afd095", + "num_format": "#,##0.000;(#,##0.000)", + } + ) table_header.set_text_wrap() summary.set_text_wrap() int_format.set_text_wrap() @@ -60,12 +80,14 @@ def generate_xlsx_report(self, workbook, data, objects): result_three_decimal.set_text_wrap() result_two_decimal.set_text_wrap() result_summary.set_text_wrap() - table_detail_right_num = workbook.add_format({ - 'border': 1, - 'align': 'right', - 'valign': 'vcenter', - }) - table_detail_right_num.set_num_format('#,##0.00') + table_detail_right_num = workbook.add_format( + { + "border": 1, + "align": "right", + "valign": "vcenter", + } + ) + table_detail_right_num.set_num_format("#,##0.00") worksheet = workbook.add_worksheet("Resumen de matanza") worksheet.write(0, 0, _("Resumen de matanza"), table_header) for i in range(0, 10): @@ -108,13 +130,11 @@ def generate_xlsx_report(self, workbook, data, objects): categ_unit = sum(categ_lines.mapped("unit")) categ_qty_done = sum(categ_lines.mapped("qty_done")) categ_average_weight = ( - categ_qty_done / categ_unit - ) if categ_unit else 0 + (categ_qty_done / categ_unit) if categ_unit else 0 + ) categ_amount = sum(categ_lines.mapped("amount")) categt_applied_price = round( - ( - categ_amount / categ_qty_done - ) if categ_qty_done != 0 else 0, 3 + (categ_amount / categ_qty_done) if categ_qty_done != 0 else 0, 3 ) for product in categ_lines: if product.product_id not in products: @@ -124,30 +144,26 @@ def generate_xlsx_report(self, workbook, data, objects): product_lines = categ_lines.filtered( lambda c: c.product_id == product.product_id ) - product_container = sum( - product_lines.mapped("container") - ) + product_container = sum(product_lines.mapped("container")) product_unit = sum(product_lines.mapped("unit")) - product_qty_done = sum( - product_lines.mapped("qty_done") - ) + product_qty_done = sum(product_lines.mapped("qty_done")) product_percentage = ( - ( - product_qty_done * 100 / categ_qty_done - ) if categ_qty_done else 0 + (product_qty_done * 100 / categ_qty_done) + if categ_qty_done + else 0 ) product_average_weight = ( - product_qty_done / product_unit - ) if product_unit else 0 + (product_qty_done / product_unit) if product_unit else 0 + ) product_amount = sum(product_lines.mapped("amount")) product_applied_price = ( - ( - product_amount / product_qty_done - ) if product_qty_done else 0 + (product_amount / product_qty_done) + if product_qty_done + else 0 + ) + worksheet.write( + n, m, round(product_percentage, 2), two_decimal_format ) - worksheet.write(n, m, round( - product_percentage, 2 - ), two_decimal_format) m += 1 worksheet.write(n, m, product.product_id.default_code) m += 1 @@ -172,10 +188,10 @@ def generate_xlsx_report(self, workbook, data, objects): ) m += 1 worksheet.write( - n, m, round( - product_qty_done / origin_qty * 100, 2 - ), - two_decimal_format + n, + m, + round(product_qty_done / origin_qty * 100, 2), + two_decimal_format, ) n += 1 m = 0 @@ -183,9 +199,7 @@ def generate_xlsx_report(self, workbook, data, objects): m += 1 worksheet.write(n, m, "", result_int_format) m += 1 - worksheet.write( - n, m, line.product_category_id.name, result_int_format - ) + worksheet.write(n, m, line.product_category_id.name, result_int_format) m += 1 worksheet.write(n, m, categ_container, result_int_format) m += 1 @@ -193,24 +207,18 @@ def generate_xlsx_report(self, workbook, data, objects): m += 1 worksheet.write(n, m, categ_qty_done, result_two_decimal) m += 1 - worksheet.write( - n, m, categ_average_weight, result_three_decimal - ) + worksheet.write(n, m, categ_average_weight, result_three_decimal) m += 1 - worksheet.write( - n, m, categt_applied_price, result_three_decimal - ) + worksheet.write(n, m, categt_applied_price, result_three_decimal) m += 1 worksheet.write(n, m, categ_amount, result_two_decimal) m += 1 worksheet.write( n, m, categ_qty_done / origin_qty * 100, result_two_decimal ) - sum_live_percentage += (categ_qty_done / origin_qty * 100) + sum_live_percentage += categ_qty_done / origin_qty * 100 different_date_planned = objects.mapped("saca_date") - different_date_planned = list( - set([d for d in different_date_planned]) - ) + different_date_planned = list({d for d in different_date_planned}) n += 1 m = 0 worksheet.write(n, m, "Partes de matanza", result_int_format) @@ -228,9 +236,7 @@ def generate_xlsx_report(self, workbook, data, objects): total_qty_done = sum(movelines.mapped("qty_done")) worksheet.write(n, m, total_qty_done, result_two_decimal) m += 1 - worksheet.write( - n, m, total_qty_done / total_unit, result_three_decimal - ) + worksheet.write(n, m, total_qty_done / total_unit, result_three_decimal) m += 1 total_amount = sum(movelines.mapped("amount")) total_average_price = total_amount / total_qty_done @@ -238,9 +244,7 @@ def generate_xlsx_report(self, workbook, data, objects): m += 1 worksheet.write(n, m, total_amount, result_two_decimal) m += 1 - worksheet.write( - n, m, total_qty_done / origin_qty * 100, result_two_decimal - ) + worksheet.write(n, m, total_qty_done / origin_qty * 100, result_two_decimal) n += 1 m = 0 worksheet.write(n, m, "Datos de granja", result_int_format) @@ -256,9 +260,7 @@ def generate_xlsx_report(self, workbook, data, objects): m += 1 worksheet.write(n, m, origin_qty, result_two_decimal) m += 1 - real_average_weight = sum( - objects.mapped("real_average_weight") - ) / len(objects) + real_average_weight = sum(objects.mapped("real_average_weight")) / len(objects) worksheet.write(n, m, real_average_weight, result_three_decimal) m += 1 purchase_price = sum(objects.mapped("purchase_price")) @@ -293,7 +295,7 @@ def generate_xlsx_report(self, workbook, data, objects): m = 0 worksheet.write(n, m, "Media personal", result_int_format) personal = objects.saca_line_id.mapped("staff") - average_personal = sum(personal)/productions + average_personal = sum(personal) / productions m += 1 worksheet.write(n, m, average_personal, result_int_format) n += 1 @@ -310,9 +312,7 @@ def generate_xlsx_report(self, workbook, data, objects): m += 1 worksheet.write(n, m, total_qty_done / days, result_two_decimal) m += 1 - worksheet.write( - n, m, total_qty_done / total_unit / days, result_three_decimal - ) + worksheet.write(n, m, total_qty_done / total_unit / days, result_three_decimal) m += 1 worksheet.write(n, m, total_average_price / days, result_three_decimal) m += 1 diff --git a/custom_mrp_descarga/report/mrp_production_summary_xlsx.xml b/custom_mrp_descarga/report/mrp_production_summary_xlsx.xml index ccfd95a09..a0a97346f 100644 --- a/custom_mrp_descarga/report/mrp_production_summary_xlsx.xml +++ b/custom_mrp_descarga/report/mrp_production_summary_xlsx.xml @@ -1,4 +1,4 @@ - + Resumen de mantanza XLSX @@ -6,7 +6,7 @@ xlsx mrp_production_summary_xlsx mrp_production_summary_xlsx - + report diff --git a/custom_mrp_descarga/views/killing_cost_view.xml b/custom_mrp_descarga/views/killing_cost_view.xml index 272c9b6d3..36b1e0aa3 100644 --- a/custom_mrp_descarga/views/killing_cost_view.xml +++ b/custom_mrp_descarga/views/killing_cost_view.xml @@ -1,6 +1,11 @@ - + diff --git a/custom_mrp_descarga/views/mrp_bom_view.xml b/custom_mrp_descarga/views/mrp_bom_view.xml index 140271a7d..4751c2bf8 100644 --- a/custom_mrp_descarga/views/mrp_bom_view.xml +++ b/custom_mrp_descarga/views/mrp_bom_view.xml @@ -2,12 +2,12 @@ mrp.bom - + - - - + + + Inputs @@ -16,13 +16,19 @@ Outputs - {'column_invisible': [('parent.quartering', '=', True)]} + {'column_invisible': [('parent.quartering', '=', True)]} - {'column_invisible': [('parent.quartering', '=', True)]} + {'column_invisible': [('parent.quartering', '=', True)]} - {'column_invisible': [('parent.quartering', '=', True)]} + {'column_invisible': [('parent.quartering', '=', True)]} @@ -43,8 +49,20 @@ [('quartering', '=', False)] - + - + diff --git a/custom_mrp_descarga/views/mrp_production_view.xml b/custom_mrp_descarga/views/mrp_production_view.xml index fbc5a5d27..21e1f29a4 100644 --- a/custom_mrp_descarga/views/mrp_production_view.xml +++ b/custom_mrp_descarga/views/mrp_production_view.xml @@ -2,234 +2,499 @@ mrp.production - + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + mrp.production - + + primary - + mrp.production - + +
-
1 - ['&', '|', ('company_id', '=', False), ('company_id', '=', company_id), '&', '|', ('product_id','=',product_id), '&', ('product_tmpl_id.product_variant_ids','=',product_id), ('product_id','=',False), ('type', '=', 'normal'), ('quartering', '=', quartering)] + ['&', '|', ('company_id', '=', False), ('company_id', '=', company_id), '&', '|', ('product_id','=',product_id), '&', ('product_tmpl_id.product_variant_ids','=',product_id), ('product_id','=',False), ('type', '=', 'normal'), ('quartering', '=', quartering)] - + - {'readonly': [('state', 'in', ('cancel', 'done'))]} + {'readonly': [('state', 'in', ('cancel', 'done'))]} - - - + + + - {'invisible': [('saca_line_id', '!=', False)]} + {'invisible': [('saca_line_id', '!=', False)]} - {'invisible': [('saca_line_id', '!=', False)]} + {'invisible': [('saca_line_id', '!=', False)]} qty_done == 0 - {'readonly': ['|', ('saca_line_id', '!=', False), ('state', 'in', ('cancel'))]} + {'readonly': ['|', ('saca_line_id', '!=', False), ('state', 'in', ('cancel'))]} - - - - + + + + - - - - - + + + + + - {'invisible':[('tolvasa', '=', True)]} + {'invisible':[('tolvasa', '=', True)]} - {'invisible':[('saca_line_id', '=', False)]} + {'invisible':[('saca_line_id', '=', False)]} - {'invisible':[('tolvasa', '=', True)]} + {'invisible':[('tolvasa', '=', True)]} - {'invisible':[('saca_line_id', '=', False)]} + {'invisible':[('saca_line_id', '=', False)]} - {'invisible':[('saca_line_id', '=', False)]} + {'invisible':[('saca_line_id', '=', False)]} - {'invisible':[('saca_line_id', '=', False)]} + {'invisible':[('saca_line_id', '=', False)]} - {'invisible':[('saca_line_id', '=', False)]} + {'invisible':[('saca_line_id', '=', False)]} - {'invisible':[('saca_line_id', '=', False)]} + {'invisible':[('saca_line_id', '=', False)]} - {'invisible':[('saca_line_id', '=', False)]} + {'invisible':[('saca_line_id', '=', False)]} - {'invisible':[('saca_line_id', '=', False)]} + {'invisible':[('saca_line_id', '=', False)]} - + - {'readonly': [('state', 'in', ('done', 'cancel'))]} + {'readonly': [('state', 'in', ('done', 'cancel'))]}
-
- - - - - - - - - - - - + + + + + + + + + + + + -
@@ -379,17 +729,23 @@ mrp.production.tree mrp.production - - - - - - - - - - - + + + + + + + + + + +
@@ -399,10 +755,12 @@ mrp.production ir.actions.act_window tree,form - + [('quartering', '=', True), ('paasa', '=', True)] - {"search_default_todo": 1, 'default_quartering': True} + {"search_default_todo": 1, 'default_quartering': True} @@ -410,16 +768,33 @@ mrp.production ir.actions.act_window tree,form - + [('saca_line_id', '!=', False)] {"search_default_todo": 1} - + - + - +
diff --git a/custom_mrp_descarga/views/product_template_view.xml b/custom_mrp_descarga/views/product_template_view.xml index 38da68d8d..6b022aaad 100644 --- a/custom_mrp_descarga/views/product_template_view.xml +++ b/custom_mrp_descarga/views/product_template_view.xml @@ -1,12 +1,12 @@ - + product.template - + - + diff --git a/custom_mrp_descarga/views/saca_line_view.xml b/custom_mrp_descarga/views/saca_line_view.xml index ebf59a3f3..6078f1f3f 100644 --- a/custom_mrp_descarga/views/saca_line_view.xml +++ b/custom_mrp_descarga/views/saca_line_view.xml @@ -2,24 +2,39 @@ saca.line - +
-
- - - - - - - + + + + + + + diff --git a/custom_mrp_descarga/views/stock_move_line_view.xml b/custom_mrp_descarga/views/stock_move_line_view.xml index 7f958186e..ce318af88 100644 --- a/custom_mrp_descarga/views/stock_move_line_view.xml +++ b/custom_mrp_descarga/views/stock_move_line_view.xml @@ -2,60 +2,131 @@ stock.move.line - + - + - - - - + + + + stock.move.line - + - + - + stock.move.line - + sequence desc qty_done == 0 - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -64,43 +135,62 @@ stock.move.line.tree stock.move.line - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
stock.move.line - + - - + + - + - - - + + + @@ -109,11 +199,14 @@ stock.move.line.search.view stock.move.line primary - 30 - + 100 + - + @@ -123,9 +216,11 @@ stock.move.line ir.actions.act_window tree,form - + - ['|', ('move_id.raw_material_production_id', '!=', False), ('move_id.production_id', '!=', False), '|',('move_id.raw_material_production_id.quartering', '=', False), ('move_id.production_id.quartering', '=', False), '|', ('move_id.production_id.paasa', '=', True), ('move_id.raw_material_production_id.paasa', '=', True), ('state', '=', 'done')] + ['|', ('move_id.raw_material_production_id', '!=', False), ('move_id.production_id', '!=', False), '|',('move_id.raw_material_production_id.quartering', '=', False), ('move_id.production_id.quartering', '=', False), '|', ('move_id.production_id.paasa', '=', True), ('move_id.raw_material_production_id.paasa', '=', True), ('state', '=', 'done')] @@ -133,15 +228,32 @@ stock.move.line ir.actions.act_window tree,form - - + + [('quartering', '=', True)] - {"search_default_todo": 1, "search_default_groupby_production": 1} + {"search_default_todo": 1, "search_default_groupby_production": 1} - + - + tree,form,pivot diff --git a/custom_mrp_descarga/views/stock_production_lot_view.xml b/custom_mrp_descarga/views/stock_production_lot_view.xml index 79e8d7ca8..6d926771c 100644 --- a/custom_mrp_descarga/views/stock_production_lot_view.xml +++ b/custom_mrp_descarga/views/stock_production_lot_view.xml @@ -2,13 +2,19 @@ stock.production.lot - +
-
- +
diff --git a/custom_mrp_descarga/views/stock_quant_view.xml b/custom_mrp_descarga/views/stock_quant_view.xml index 518fde14f..ac98ade64 100644 --- a/custom_mrp_descarga/views/stock_quant_view.xml +++ b/custom_mrp_descarga/views/stock_quant_view.xml @@ -2,7 +2,7 @@ stock.quant - + Total Qty Available From 3e10354a8751084ae87eb43e6279b92462e9749e Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 14:06:37 +0200 Subject: [PATCH 16/41] [IMP] mrp_workorder_time_plate: pre-commit stuff --- mrp_workorder_time_plate/__init__.py | 2 +- mrp_workorder_time_plate/__manifest__.py | 4 +-- .../models/mrp_workcenter_productivity.py | 15 +++++++---- .../models/mrp_workorder.py | 6 ++--- .../views/mrp_workorder_view.xml | 27 ++++++++++++------- 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/mrp_workorder_time_plate/__init__.py b/mrp_workorder_time_plate/__init__.py index 9a7e03ede..0650744f6 100644 --- a/mrp_workorder_time_plate/__init__.py +++ b/mrp_workorder_time_plate/__init__.py @@ -1 +1 @@ -from . import models \ No newline at end of file +from . import models diff --git a/mrp_workorder_time_plate/__manifest__.py b/mrp_workorder_time_plate/__manifest__.py index 083f3d98b..eb8aa6ac3 100644 --- a/mrp_workorder_time_plate/__manifest__.py +++ b/mrp_workorder_time_plate/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "MRP Workorder Time Plate", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "category": "Contact", "license": "AGPL-3", "author": "AvanzOSC", @@ -13,5 +13,5 @@ "data": [ "views/mrp_workorder_view.xml", ], - 'installable': True, + "installable": True, } diff --git a/mrp_workorder_time_plate/models/mrp_workcenter_productivity.py b/mrp_workorder_time_plate/models/mrp_workcenter_productivity.py index 44d7e201e..9c1d409b2 100644 --- a/mrp_workorder_time_plate/models/mrp_workcenter_productivity.py +++ b/mrp_workorder_time_plate/models/mrp_workcenter_productivity.py @@ -8,17 +8,21 @@ class MrpWorkcenterProductivity(models.Model): _inherit = "mrp.workcenter.productivity" initial_plate = fields.Integer( - string="Initial Plate") + string="Initial Plate", + ) final_plate = fields.Integer( - string="Final Plate") + string="Final Plate", + ) manufactured_plate = fields.Integer( string="Manufactured Plate", compute="_compute_manufactured_plate", - store=True) + store=True, + ) speed_average = fields.Float( string="Speed Average", compute="_compute_speed_average", - store=True) + store=True, + ) @api.depends("initial_plate", "final_plate") def _compute_manufactured_plate(self): @@ -37,4 +41,5 @@ def _check_manufactured_plate(self): for line in self: if line.manufactured_plate < 0: raise ValidationError( - _("Error: Manufactured plates should be positive.")) + _("Error: Manufactured plates should be positive.") + ) diff --git a/mrp_workorder_time_plate/models/mrp_workorder.py b/mrp_workorder_time_plate/models/mrp_workorder.py index b065096bf..a6d52ee3f 100644 --- a/mrp_workorder_time_plate/models/mrp_workorder.py +++ b/mrp_workorder_time_plate/models/mrp_workorder.py @@ -9,10 +9,10 @@ class MrpWorkorder(models.Model): plates_manufactured = fields.Integer( string="Plates Manufactured", compute="_compute_plates_manufactured", - store=True) + store=True, + ) @api.depends("time_ids", "time_ids.manufactured_plate") def _compute_plates_manufactured(self): for line in self: - line.plates_manufactured = sum( - line.time_ids.mapped("manufactured_plate")) + line.plates_manufactured = sum(line.time_ids.mapped("manufactured_plate")) diff --git a/mrp_workorder_time_plate/views/mrp_workorder_view.xml b/mrp_workorder_time_plate/views/mrp_workorder_view.xml index 9019ac368..b0d155b13 100644 --- a/mrp_workorder_time_plate/views/mrp_workorder_view.xml +++ b/mrp_workorder_time_plate/views/mrp_workorder_view.xml @@ -1,24 +1,33 @@ - + mrp.workorder - + - - - - - + + + + + mrp.workorder - + - + From 587dd0c841dc5becbcc55a39919d161d587d25f9 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 14:12:21 +0200 Subject: [PATCH 17/41] [IMP] mrp_bom_category: pre-commit stuff --- mrp_bom_category/models/mrp_bom_category.py | 5 +++-- mrp_bom_category/models/mrp_production.py | 5 ++--- .../views/mrp_bom_category_views.xml | 20 ++++++++++--------- mrp_bom_category/views/mrp_bom_views.xml | 16 +++++++++++---- .../data/mrp_workorder_permission.xml | 4 +--- .../views/mrp_workorder_views.xml | 5 +---- 6 files changed, 30 insertions(+), 25 deletions(-) diff --git a/mrp_bom_category/models/mrp_bom_category.py b/mrp_bom_category/models/mrp_bom_category.py index 63a0d8f15..cd5241f40 100644 --- a/mrp_bom_category/models/mrp_bom_category.py +++ b/mrp_bom_category/models/mrp_bom_category.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import fields, models - + class MrpBomCategory(models.Model): _name = "mrp.bom.category" @@ -15,7 +15,8 @@ class MrpBomCategory(models.Model): ) sequence_id = fields.Many2one( string="Sequence", - comodel_name="ir.sequence") + comodel_name="ir.sequence", + ) _sql_constraints = [ ("name_unique", "unique(name)", "Category name already exists"), diff --git a/mrp_bom_category/models/mrp_production.py b/mrp_bom_category/models/mrp_production.py index 420c14b09..4dbcf969b 100644 --- a/mrp_bom_category/models/mrp_production.py +++ b/mrp_bom_category/models/mrp_production.py @@ -10,9 +10,8 @@ class MrpProduction(models.Model): @api.model def create(self, values): if "bom_id" in values: - bom = self.env["mrp.bom"].search( - [('id', '=', values["bom_id"])], limit=1) + bom = self.env["mrp.bom"].search([("id", "=", values["bom_id"])], limit=1) if bom and bom.category_id and bom.category_id.sequence_id: - values['name'] = bom.category_id.sequence_id.next_by_id() + values["name"] = bom.category_id.sequence_id.next_by_id() production = super(MrpProduction, self).create(values) return production diff --git a/mrp_bom_category/views/mrp_bom_category_views.xml b/mrp_bom_category/views/mrp_bom_category_views.xml index 3c3458b56..838af4694 100644 --- a/mrp_bom_category/views/mrp_bom_category_views.xml +++ b/mrp_bom_category/views/mrp_bom_category_views.xml @@ -1,11 +1,11 @@ - + mrp.bom.category - - + + @@ -16,8 +16,8 @@
- - + +
@@ -40,9 +40,11 @@ mrp.bom.category
- +
diff --git a/mrp_bom_category/views/mrp_bom_views.xml b/mrp_bom_category/views/mrp_bom_views.xml index 9fb2e76a2..f7d641596 100644 --- a/mrp_bom_category/views/mrp_bom_views.xml +++ b/mrp_bom_category/views/mrp_bom_views.xml @@ -31,10 +31,18 @@ - - + +
diff --git a/mrp_workorder_permission/data/mrp_workorder_permission.xml b/mrp_workorder_permission/data/mrp_workorder_permission.xml index e4b4f87c9..bce472038 100644 --- a/mrp_workorder_permission/data/mrp_workorder_permission.xml +++ b/mrp_workorder_permission/data/mrp_workorder_permission.xml @@ -13,9 +13,7 @@ - Workorder User: Can see only theirs work orders + Workorder User: Can see only theirs work orders diff --git a/mrp_workorder_permission/views/mrp_workorder_views.xml b/mrp_workorder_permission/views/mrp_workorder_views.xml index fae1b44ae..d3c734bdd 100644 --- a/mrp_workorder_permission/views/mrp_workorder_views.xml +++ b/mrp_workorder_permission/views/mrp_workorder_views.xml @@ -16,10 +16,7 @@ mrp.workorder - + From 6c06bc3d1fab8eeb14e97a710d0e33a79841ad15 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 14:13:42 +0200 Subject: [PATCH 18/41] [IMP] mrp_bom_import: pre-commit stuff --- mrp_bom_import/models/mrp_bom_import.py | 68 ++++++++++++------- .../views/mrp_bom_import_line_view.xml | 60 ++++++++-------- mrp_bom_import/views/mrp_bom_import_view.xml | 33 +++++---- mrp_bom_import/views/mrp_bom_line_view.xml | 10 +-- 4 files changed, 93 insertions(+), 78 deletions(-) diff --git a/mrp_bom_import/models/mrp_bom_import.py b/mrp_bom_import/models/mrp_bom_import.py index 2a19d4943..da65cf621 100644 --- a/mrp_bom_import/models/mrp_bom_import.py +++ b/mrp_bom_import/models/mrp_bom_import.py @@ -31,6 +31,7 @@ def check_number(number): except ValueError: return False + def convert2str(value): if isinstance(value, float) or isinstance(value, int): new_value = str(value).strip() @@ -98,7 +99,8 @@ class MrpBomImport(models.Model): ) product_found_by_code = fields.Boolean( string="Product Found By Code", - default=False) + default=False, + ) def _get_import_lines(self): return self.mapped("bom_line_import_ids") @@ -221,13 +223,11 @@ def _get_line_values(self, row_values): return values def action_validate_lines(self): - lines = (self._get_import_lines()).filtered( - lambda x: x.state not in ("done")) + lines = self._get_import_lines().filtered(lambda x: x.state not in ("done")) lines.action_validate_lines() def action_process_lines(self): - lines = (self._get_import_lines()).filtered( - lambda x: x.state == "pass") + lines = self._get_import_lines().filtered(lambda x: x.state == "pass") lines.action_process_lines() def button_open_bom_component_import_line(self): @@ -269,14 +269,16 @@ class MrpBomLineImport(models.Model): bom_name = fields.Char(string="BoM Name") bom_product_id = fields.Many2one( string="Parent Product", - comodel_name="product.product") + comodel_name="product.product", + ) bom_id = fields.Many2one( comodel_name="mrp.bom", string="BoM", ) bom_line_id = fields.Many2one( string="BoM Line", - comodel_name="mrp.bom.line") + comodel_name="mrp.bom.line", + ) log_info = fields.Text(string="Log Info") state = fields.Selection( selection=IMPORT_STATUS, @@ -286,7 +288,8 @@ class MrpBomLineImport(models.Model): parent_product_bom_count = fields.Integer( string="Parent Bom Qty", related="bom_product_id.bom_count", - store=True) + store=True, + ) parent_qty = fields.Float(string="Parent Quantity") def _check_product(self): @@ -360,11 +363,14 @@ def action_validate_lines(self): def _create_bom(self): self.ensure_one() - bom = self.env["mrp.bom"].create({ - "product_tmpl_id": self.bom_product_id.product_tmpl_id.id, - "code": self.bom_ref, - "product_qty": self.parent_qty, - "product_uom_id": self.bom_product_id.uom_id.id}) + bom = self.env["mrp.bom"].create( + { + "product_tmpl_id": self.bom_product_id.product_tmpl_id.id, + "code": self.bom_ref, + "product_qty": self.parent_qty, + "product_uom_id": self.bom_product_id.uom_id.id, + } + ) return bom def generate_bom_line_values(self): @@ -372,7 +378,8 @@ def generate_bom_line_values(self): bom_line = { "product_id": self.product_id.id, "product_qty": self.quantity, - "product_uom_id": self.product_id.uom_id.id} + "product_uom_id": self.product_id.uom_id.id, + } return bom_line def action_process_lines(self): @@ -380,25 +387,34 @@ def action_process_lines(self): for line in self.filtered(lambda x: x.state == "pass"): log_info = "" bom = False - if not line.bom_id and line.bom_product_id and line.bom_product_id not in bom_product: + if ( + not line.bom_id + and line.bom_product_id + and line.bom_product_id not in bom_product + ): state = "2validate" same_parent = line.bom_import_id.bom_line_import_ids.filtered( - lambda c: c.bom_product_id == line.bom_product_id) + lambda c: c.bom_product_id == line.bom_product_id + ) if any([state.state == "error" for state in same_parent]): - log_info = _("Error: There is another line with the " + - "same parent product errors.") + log_info = _( + "Error: There is another line with the same parent product" + " errors." + ) state = "error" else: bom = line._create_bom() - for l in same_parent: - bom_line_values = l.generate_bom_line_values() + for ln in same_parent: + bom_line_values = ln.generate_bom_line_values() bom_line_values.update({"bom_id": bom.id}) - bom_line = self.env["mrp.bom.line"].create( - bom_line_values) - l.write({ - "bom_id": bom.id, - "bom_line_id": bom_line.id, - "state": "done"}) + bom_line = self.env["mrp.bom.line"].create(bom_line_values) + ln.write( + { + "bom_id": bom.id, + "bom_line_id": bom_line.id, + "state": "done", + } + ) state = "done" line.write( { diff --git a/mrp_bom_import/views/mrp_bom_import_line_view.xml b/mrp_bom_import/views/mrp_bom_import_line_view.xml index 0edbab6d2..05b98f553 100644 --- a/mrp_bom_import/views/mrp_bom_import_line_view.xml +++ b/mrp_bom_import/views/mrp_bom_import_line_view.xml @@ -4,43 +4,43 @@ mrp.bom.line.import - - + + + name="pending" + string="Pending" + domain="[('state', '!=', 'done')]" + /> + name="finished" + string="Done" + domain="[('state', '=', 'done')]" + /> + name="errored" + string="Error" + domain="[('state', '=', 'error')]" + /> + string="Status" + name="state_group" + domain="[]" + context="{'group_by':'state'}" + /> - + string="Log Info" + name="log_info_group" + domain="[]" + context="{'group_by':'log_info'}" + /> + + string="BoM Product" + name="bom_product" + domain="[]" + context="{'group_by':'bom_product_id'}" + /> diff --git a/mrp_bom_import/views/mrp_bom_import_view.xml b/mrp_bom_import/views/mrp_bom_import_view.xml index 47f5a6a0a..b2b6c9010 100644 --- a/mrp_bom_import/views/mrp_bom_import_view.xml +++ b/mrp_bom_import/views/mrp_bom_import_view.xml @@ -84,12 +84,12 @@ - + - + @@ -134,7 +134,6 @@ mrp.bom.line.import - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/mrp_bom_import/views/mrp_bom_line_view.xml b/mrp_bom_import/views/mrp_bom_line_view.xml index 6748197a9..11bde0593 100644 --- a/mrp_bom_import/views/mrp_bom_line_view.xml +++ b/mrp_bom_import/views/mrp_bom_line_view.xml @@ -6,10 +6,10 @@ mrp.bom.line - - - - + + + + @@ -19,7 +19,7 @@ ir.actions.act_window mrp.bom.line tree,form - +
From 4e2f758db7c2bc42409166f391a4fb410457619c Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 14:14:32 +0200 Subject: [PATCH 19/41] [IMP] mrp_bom_import_position: pre-commit stuff --- mrp_bom_import_position/models/mrp_bom_import.py | 3 +-- mrp_bom_import_position/views/mrp_bom_import_view.xml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mrp_bom_import_position/models/mrp_bom_import.py b/mrp_bom_import_position/models/mrp_bom_import.py index 96b421566..3ae63de7f 100644 --- a/mrp_bom_import_position/models/mrp_bom_import.py +++ b/mrp_bom_import_position/models/mrp_bom_import.py @@ -14,8 +14,7 @@ def _get_line_values(self, row_values): if values: values.update( { - "line_position": convert2str( - row_values.get("Position", "")), + "line_position": convert2str(row_values.get("Position", "")), } ) return values diff --git a/mrp_bom_import_position/views/mrp_bom_import_view.xml b/mrp_bom_import_position/views/mrp_bom_import_view.xml index d0d178cd1..8e20f2953 100644 --- a/mrp_bom_import_position/views/mrp_bom_import_view.xml +++ b/mrp_bom_import_position/views/mrp_bom_import_view.xml @@ -18,7 +18,7 @@ /> - + From c2402f085437523a2808baaab3790fc33fdb2141 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 14:15:05 +0200 Subject: [PATCH 20/41] [IMP] mrp_bom_line_coef: pre-commit stuff --- mrp_bom_line_coef/__manifest__.py | 5 ++-- .../data/coef_decimal_precision.xml | 14 +++++----- mrp_bom_line_coef/models/mrp_bom_line.py | 26 ++++++++++++------- mrp_bom_line_coef/views/mrp_bom_view.xml | 22 +++++++++++----- 4 files changed, 40 insertions(+), 27 deletions(-) diff --git a/mrp_bom_line_coef/__manifest__.py b/mrp_bom_line_coef/__manifest__.py index 25348931b..42ef2ef9d 100644 --- a/mrp_bom_line_coef/__manifest__.py +++ b/mrp_bom_line_coef/__manifest__.py @@ -2,8 +2,9 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "MRP BOM Line Coef", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "author": "Avanzosc", + "website": "https://github.com/avanzosc/mrp-addons", "category": "MRP", "depends": [ "mrp", @@ -13,5 +14,5 @@ "views/mrp_bom_view.xml", ], "license": "AGPL-3", - 'installable': True, + "installable": True, } diff --git a/mrp_bom_line_coef/data/coef_decimal_precision.xml b/mrp_bom_line_coef/data/coef_decimal_precision.xml index cc640dc58..a1e9766eb 100644 --- a/mrp_bom_line_coef/data/coef_decimal_precision.xml +++ b/mrp_bom_line_coef/data/coef_decimal_precision.xml @@ -1,9 +1,7 @@ - - - - Coef Decimal Precision - 4 - - + + + + Coef Decimal Precision + 4 + - diff --git a/mrp_bom_line_coef/models/mrp_bom_line.py b/mrp_bom_line_coef/models/mrp_bom_line.py index 48cd4f2ff..aa101b081 100644 --- a/mrp_bom_line_coef/models/mrp_bom_line.py +++ b/mrp_bom_line_coef/models/mrp_bom_line.py @@ -1,22 +1,28 @@ # Copyright 2022 Berezi Amubieta - 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 MrpBomLine(models.Model): - _inherit = 'mrp.bom.line' + _inherit = "mrp.bom.line" coefficient = fields.Float( - string='Coefficient', - digits="Coef Decimal Precision") - expense_kg = fields.Boolean(string='Production Cost', default=False) + string="Coefficient", + digits="Coef Decimal Precision", + ) + expense_kg = fields.Boolean( + string="Production Cost", + default=False, + ) cost = fields.Float( - string='Fixed Cost', - digits="Coef Decimal Precision") + string="Fixed Cost", + digits="Coef Decimal Precision", + ) currency_id = fields.Many2one( - string='Currency', - comodel_name='res.currency', - default=lambda self: self.env.company.currency_id.id) + string="Currency", + comodel_name="res.currency", + default=lambda self: self.env.company.currency_id.id, + ) @api.onchange("product_id") def onchange_cost(self): diff --git a/mrp_bom_line_coef/views/mrp_bom_view.xml b/mrp_bom_line_coef/views/mrp_bom_view.xml index 6a45d3c53..cf2b435e5 100644 --- a/mrp_bom_line_coef/views/mrp_bom_view.xml +++ b/mrp_bom_line_coef/views/mrp_bom_view.xml @@ -1,15 +1,23 @@ - + mrp.bom - + - - - - - + + + + + From f82fb567ac0dcd4d7069b9cf8db07c702404e5db Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 14:16:34 +0200 Subject: [PATCH 21/41] [IMP] mrp_bom_line_note: pre-commit stuff --- mrp_bom_line_note/__manifest__.py | 8 ++++---- mrp_bom_line_note/models/mrp_bom_line.py | 4 ++-- mrp_bom_line_note/views/mrp_bom_views.xml | 12 +++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/mrp_bom_line_note/__manifest__.py b/mrp_bom_line_note/__manifest__.py index 8765b52dd..328bb1fad 100644 --- a/mrp_bom_line_note/__manifest__.py +++ b/mrp_bom_line_note/__manifest__.py @@ -2,16 +2,16 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "MRP BOM Line Note", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "author": "Avanzosc", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "category": "Product", "depends": [ - "mrp" + "mrp", ], "data": [ "views/mrp_bom_views.xml", ], "license": "AGPL-3", - 'installable': True, + "installable": True, } diff --git a/mrp_bom_line_note/models/mrp_bom_line.py b/mrp_bom_line_note/models/mrp_bom_line.py index 9a61d1489..100c36f68 100644 --- a/mrp_bom_line_note/models/mrp_bom_line.py +++ b/mrp_bom_line_note/models/mrp_bom_line.py @@ -1,9 +1,9 @@ # Copyright 2021 Berezi Amubieta - 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 MrpBomLine(models.Model): _inherit = "mrp.bom.line" - note = fields.Text(string='Note') + note = fields.Text(string="Note") diff --git a/mrp_bom_line_note/views/mrp_bom_views.xml b/mrp_bom_line_note/views/mrp_bom_views.xml index f91d803ac..9e1392808 100644 --- a/mrp_bom_line_note/views/mrp_bom_views.xml +++ b/mrp_bom_line_note/views/mrp_bom_views.xml @@ -1,12 +1,14 @@ - - + mrp.bom - + - - + + From 185e23a39424c5b4a10441089794f567d2411fc5 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 14:17:20 +0200 Subject: [PATCH 22/41] [IMP] mrp_bom_reference: pre-commit stuff --- mrp_bom_reference/__manifest__.py | 9 ++++----- mrp_bom_reference/models/mrp_bom.py | 16 +++++++++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/mrp_bom_reference/__manifest__.py b/mrp_bom_reference/__manifest__.py index dc6fabf6a..6d569cb58 100644 --- a/mrp_bom_reference/__manifest__.py +++ b/mrp_bom_reference/__manifest__.py @@ -2,15 +2,14 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "MRP BOM Reference", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "author": "Avanzosc", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "category": "MRP", "depends": [ "product_bom_revision", ], - "data": [ - ], + "data": [], "license": "AGPL-3", - 'installable': True, + "installable": True, } diff --git a/mrp_bom_reference/models/mrp_bom.py b/mrp_bom_reference/models/mrp_bom.py index 6749348f9..eb8f27a96 100644 --- a/mrp_bom_reference/models/mrp_bom.py +++ b/mrp_bom_reference/models/mrp_bom.py @@ -1,15 +1,17 @@ # Copyright 2021 Berezi Amubieta - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import models, api +from odoo import api, models class MrpBom(models.Model): _inherit = "mrp.bom" - @api.onchange('bom_revision', 'product_tmpl_id', 'product_id') + @api.onchange("bom_revision", "product_tmpl_id", "product_id") def onchange_reference(self): - tmpl = self.product_tmpl_id.default_code if ( - self.product_tmpl_id.default_code) else '' - va = self.product_id.default_code if ( - self.product_id.default_code) else '' - self.code = u'{} {} {}'.format(va, tmpl, self.bom_revision) + tmpl = ( + self.product_tmpl_id.default_code + if self.product_tmpl_id.default_code + else "" + ) + va = self.product_id.default_code if (self.product_id.default_code) else "" + self.code = "{} {} {}".format(va, tmpl, self.bom_revision) From 7c34a4afb8448a9a1258ffe352608e9c267ec293 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 14:17:39 +0200 Subject: [PATCH 23/41] [IMP] mrp_bom_report_group: pre-commit stuff --- mrp_bom_report_group/__manifest__.py | 6 +- .../data/mrp_bom_report_group.xml | 17 +++--- .../report/mrp_bom_report.xml | 58 ++++++++++++++----- mrp_bom_report_group/views/mrp_bom_views.xml | 4 +- 4 files changed, 57 insertions(+), 28 deletions(-) diff --git a/mrp_bom_report_group/__manifest__.py b/mrp_bom_report_group/__manifest__.py index d699bc60d..6680210b8 100644 --- a/mrp_bom_report_group/__manifest__.py +++ b/mrp_bom_report_group/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "MRP BoM Report Group", - 'version': '14.0.1.0.0', + "version": "14.0.1.0.0", "category": "Manufacturing", "license": "AGPL-3", "author": "AvanzOSC", @@ -13,7 +13,7 @@ "data": [ "data/mrp_bom_report_group.xml", "report/mrp_bom_report.xml", - "views/mrp_bom_views.xml" + "views/mrp_bom_views.xml", ], - 'installable': True, + "installable": True, } diff --git a/mrp_bom_report_group/data/mrp_bom_report_group.xml b/mrp_bom_report_group/data/mrp_bom_report_group.xml index 457856bfb..b1a82a64a 100644 --- a/mrp_bom_report_group/data/mrp_bom_report_group.xml +++ b/mrp_bom_report_group/data/mrp_bom_report_group.xml @@ -1,9 +1,10 @@ - - - - - See costs in BoM - - - + + + + See costs in BoM + + diff --git a/mrp_bom_report_group/report/mrp_bom_report.xml b/mrp_bom_report_group/report/mrp_bom_report.xml index 767c745dd..dacfbbf2d 100644 --- a/mrp_bom_report_group/report/mrp_bom_report.xml +++ b/mrp_bom_report_group/report/mrp_bom_report.xml @@ -1,45 +1,73 @@ - + -