diff --git a/.copier-answers.yml b/.copier-answers.yml index f96749d..f29e7dd 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,12 +1,13 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.1.4 +_commit: v1.3.6 _src_path: gh:oca/oca-addons-repo-template +ci: Travis dependency_installation_mode: PIP generate_requirements_txt: true include_wkhtmltopdf: false odoo_version: 14.0 rebel_module_groups: [] -repo_description: "TODO: add repo description." +repo_description: 'TODO: add repo description.' repo_name: stock-logistics-reporting repo_slug: stock-logistics-reporting travis_apt_packages: [] diff --git a/.eslintrc.yml b/.eslintrc.yml index 88f2881..d4cc423 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,10 +1,17 @@ env: browser: true + es6: true # See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 parserOptions: ecmaVersion: 2017 +overrides: + - files: + - "**/*.esm.js" + parserOptions: + sourceType: module + # Globals available in Odoo that shouldn't produce errorings globals: _: readonly @@ -14,7 +21,7 @@ globals: moment: readonly odoo: readonly openerp: readonly - Promise: readonly + owl: readonly # Styling is handled by Prettier, so we only need to enable AST rules; # see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 335381c..80ab1a2 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -10,4 +10,11 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 + with: + # The pylint-odoo version we use here does not support python 3.10 + # https://github.com/OCA/oca-addons-repo-template/issues/80 + # We also need to pin to an older version of python for older odoo versions + # where we are not using black > 21. Older black versions won't work with + # Python 3.9.8+, and we can't bump black without reformatting. + python-version: "3.9.7" - uses: pre-commit/action@v2.0.0 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..1693a12 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,69 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "0 12 * * 0" + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - name: Stale PRs and issues policy + uses: actions/stale@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + # General settings. + ascending: true + remove-stale-when-updated: true + # Pull Requests settings. + # 120+30 day stale policy for PRs + # * Except PRs marked as "no stale" + days-before-pr-stale: 120 + days-before-pr-close: 30 + exempt-pr-labels: "no stale" + stale-pr-label: "stale" + stale-pr-message: > + There hasn't been any activity on this pull request in the past 4 months, so + it has been marked as stale and it will be closed automatically if no + further activity occurs in the next 30 days. + + If you want this PR to never become stale, please ask a PSC member to apply + the "no stale" label. + # Issues settings. + # 180+30 day stale policy for open issues + # * Except Issues marked as "no stale" + days-before-issue-stale: 180 + days-before-issue-close: 30 + exempt-issue-labels: "no stale,needs more information" + stale-issue-label: "stale" + stale-issue-message: > + There hasn't been any activity on this issue in the past 6 months, so it has + been marked as stale and it will be closed automatically if no further + activity occurs in the next 30 days. + + If you want this issue to never become stale, please ask a PSC member to + apply the "no stale" label. + + # 15+30 day stale policy for issues pending more information + # * Issues that are pending more information + # * Except Issues marked as "no stale" + - name: Needs more information stale issues policy + uses: actions/stale@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + ascending: true + only-labels: "needs more information" + exempt-issue-labels: "no stale" + days-before-stale: 15 + days-before-close: 30 + days-before-pr-stale: -1 + days-before-pr-close: -1 + remove-stale-when-updated: true + stale-issue-label: "stale" + stale-issue-message: > + This issue needs more information and there hasn't been any activity + recently, so it has been marked as stale and it will be closed automatically + if no further activity occurs in the next 30 days. + + If you think this is a mistake, please ask a PSC member to remove the "needs + more information" label. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1839342..f395f79 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ exclude: | # Files and folders generated by bots, to avoid loops ^setup/|/static/description/index\.html$| # We don't want to mess with tool-generated files - .svg$|/tests/([^/]+/)?cassettes/| + .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| # Maybe reactivate this when all README files include prettier ignore tags? ^README\.md$| # Library files can have extraneous formatting (even minimized) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 9ac71fe..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,10 +0,0 @@ -# OCA Guidelines - -Please follow the official guide from the -[OCA Guidelines page](https://odoo-community.org/page/contributing). - -## Project Specific Guidelines - - - -This project does not have specific coding guidelines. diff --git a/README.md b/README.md index ff1b2fd..8bc0a6f 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,13 @@ TODO: add repo description. Available addons ---------------- -addon | version | summary ---- | --- | --- -[stock_card_report](stock_card_report/) | 14.0.1.0.2 | Add stock card report on Inventory Reporting. -[stock_picking_report_valued](stock_picking_report_valued/) | 14.0.1.0.0 | Adding Valued Picking on Delivery Slip report +addon | version | maintainers | summary +--- | --- | --- | --- +[delivery_line_sale_line_position](delivery_line_sale_line_position/) | 14.0.1.0.0 | | Adds the sale line position to the delivery report lines +[stock_card_report](stock_card_report/) | 14.0.1.0.2 | | Add stock card report on Inventory Reporting. +[stock_picking_group_by_partner_by_carrier_sale_line_position](stock_picking_group_by_partner_by_carrier_sale_line_position/) | 14.0.1.0.1 | | Glue module for sale position and delivery report grouped +[stock_picking_report_valued](stock_picking_report_valued/) | 14.0.1.0.0 | | Adding Valued Picking on Delivery Slip report +[stock_quantity_history_location](stock_quantity_history_location/) | 14.0.1.0.0 | | Provides stock quantity by location on past date [//]: # (end addons) diff --git a/delivery_line_sale_line_position/README.rst b/delivery_line_sale_line_position/README.rst new file mode 100644 index 0000000..6ec5890 --- /dev/null +++ b/delivery_line_sale_line_position/README.rst @@ -0,0 +1,84 @@ +================================ +Delivery Line Sale Line Position +================================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-reporting/tree/14.0/delivery_line_sale_line_position + :alt: OCA/stock-logistics-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-delivery_line_sale_line_position + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/151/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module is build on top of the module `sale_order_line_position`. + +On the delivery report it adds a column with the `Postion` from the related +sale order line. + +The `Position` can also made visible int the stock picking view. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Thierry Ducrest +* `Trobz `_: + +Other credits +~~~~~~~~~~~~~ + +The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/stock-logistics-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/delivery_line_sale_line_position/__init__.py b/delivery_line_sale_line_position/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/delivery_line_sale_line_position/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/delivery_line_sale_line_position/__manifest__.py b/delivery_line_sale_line_position/__manifest__.py new file mode 100644 index 0000000..41c9887 --- /dev/null +++ b/delivery_line_sale_line_position/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "Delivery Line Sale Line Position", + "summary": "Adds the sale line position to the delivery report lines", + "version": "14.0.1.0.0", + "category": "Delivery", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/stock-logistics-reporting", + "depends": ["stock", "sale_order_line_position"], + "data": [ + "report/report_deliveryslip.xml", + "views/stock_move.xml", + "views/stock_picking.xml", + ], + "installable": True, +} diff --git a/delivery_line_sale_line_position/i18n/delivery_line_sale_line_position.pot b/delivery_line_sale_line_position/i18n/delivery_line_sale_line_position.pot new file mode 100644 index 0000000..b9ef932 --- /dev/null +++ b/delivery_line_sale_line_position/i18n/delivery_line_sale_line_position.pot @@ -0,0 +1,53 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * delivery_line_sale_line_position +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: delivery_line_sale_line_position +#: model_terms:ir.ui.view,arch_db:delivery_line_sale_line_position.report_delivery_document +msgid "Pos" +msgstr "" + +#. module: delivery_line_sale_line_position +#: model:ir.model.fields,field_description:delivery_line_sale_line_position.field_stock_move__display_name +#: model:ir.model.fields,field_description:delivery_line_sale_line_position.field_stock_move_line__display_name +msgid "Display Name" +msgstr "" + +#. module: delivery_line_sale_line_position +#: model:ir.model.fields,field_description:delivery_line_sale_line_position.field_stock_move__id +#: model:ir.model.fields,field_description:delivery_line_sale_line_position.field_stock_move_line__id +msgid "ID" +msgstr "" + +#. module: delivery_line_sale_line_position +#: model:ir.model.fields,field_description:delivery_line_sale_line_position.field_stock_move____last_update +#: model:ir.model.fields,field_description:delivery_line_sale_line_position.field_stock_move_line____last_update +msgid "Last Modified on" +msgstr "" + +#. module: delivery_line_sale_line_position +#: model:ir.model.fields,field_description:delivery_line_sale_line_position.field_stock_move__position_sale_line +#: model:ir.model.fields,field_description:delivery_line_sale_line_position.field_stock_move_line__position_sale_line +msgid "Position" +msgstr "" + +#. module: delivery_line_sale_line_position +#: model:ir.model,name:delivery_line_sale_line_position.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "" + +#. module: delivery_line_sale_line_position +#: model:ir.model,name:delivery_line_sale_line_position.model_stock_move +msgid "Stock Move" +msgstr "" diff --git a/delivery_line_sale_line_position/models/__init__.py b/delivery_line_sale_line_position/models/__init__.py new file mode 100644 index 0000000..f800274 --- /dev/null +++ b/delivery_line_sale_line_position/models/__init__.py @@ -0,0 +1,2 @@ +from . import stock_move +from . import stock_move_line diff --git a/delivery_line_sale_line_position/models/stock_move.py b/delivery_line_sale_line_position/models/stock_move.py new file mode 100644 index 0000000..1a09cd0 --- /dev/null +++ b/delivery_line_sale_line_position/models/stock_move.py @@ -0,0 +1,12 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class StockMove(models.Model): + _inherit = "stock.move" + + position_sale_line = fields.Char( + related="sale_line_id.position_formatted", string="Position" + ) diff --git a/delivery_line_sale_line_position/models/stock_move_line.py b/delivery_line_sale_line_position/models/stock_move_line.py new file mode 100644 index 0000000..158f2f1 --- /dev/null +++ b/delivery_line_sale_line_position/models/stock_move_line.py @@ -0,0 +1,12 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class StockMoveLine(models.Model): + _inherit = "stock.move.line" + + position_sale_line = fields.Char( + related="move_id.position_sale_line", string="Position" + ) diff --git a/delivery_line_sale_line_position/readme/CONTRIBUTORS.rst b/delivery_line_sale_line_position/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..ef70cd0 --- /dev/null +++ b/delivery_line_sale_line_position/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Thierry Ducrest +* `Trobz `_: diff --git a/delivery_line_sale_line_position/readme/CREDITS.rst b/delivery_line_sale_line_position/readme/CREDITS.rst new file mode 100644 index 0000000..f37ebe7 --- /dev/null +++ b/delivery_line_sale_line_position/readme/CREDITS.rst @@ -0,0 +1 @@ +The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp diff --git a/delivery_line_sale_line_position/readme/DESCRIPTION.rst b/delivery_line_sale_line_position/readme/DESCRIPTION.rst new file mode 100644 index 0000000..7ad226d --- /dev/null +++ b/delivery_line_sale_line_position/readme/DESCRIPTION.rst @@ -0,0 +1,6 @@ +This module is build on top of the module `sale_order_line_position`. + +On the delivery report it adds a column with the `Postion` from the related +sale order line. + +The `Position` can also made visible int the stock picking view. diff --git a/delivery_line_sale_line_position/report/report_deliveryslip.xml b/delivery_line_sale_line_position/report/report_deliveryslip.xml new file mode 100644 index 0000000..b01335a --- /dev/null +++ b/delivery_line_sale_line_position/report/report_deliveryslip.xml @@ -0,0 +1,52 @@ + + + + + + diff --git a/delivery_line_sale_line_position/static/description/icon.png b/delivery_line_sale_line_position/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/delivery_line_sale_line_position/static/description/icon.png differ diff --git a/delivery_line_sale_line_position/static/description/index.html b/delivery_line_sale_line_position/static/description/index.html new file mode 100644 index 0000000..2b6dae2 --- /dev/null +++ b/delivery_line_sale_line_position/static/description/index.html @@ -0,0 +1,428 @@ + + + + + + +Delivery Line Sale Line Position + + + +
+

Delivery Line Sale Line Position

+ + +

Beta License: AGPL-3 OCA/stock-logistics-reporting Translate me on Weblate Try me on Runbot

+

This module is build on top of the module sale_order_line_position.

+

On the delivery report it adds a column with the Postion from the related +sale order line.

+

The Position can also made visible int the stock picking view.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+ +
+

Other credits

+

The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp

+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/stock-logistics-reporting project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/delivery_line_sale_line_position/views/stock_move.xml b/delivery_line_sale_line_position/views/stock_move.xml new file mode 100644 index 0000000..8a8dfd2 --- /dev/null +++ b/delivery_line_sale_line_position/views/stock_move.xml @@ -0,0 +1,17 @@ + + + + + stock.move.line.operations.tree + stock.move.line + + + + + + + + + + + diff --git a/delivery_line_sale_line_position/views/stock_picking.xml b/delivery_line_sale_line_position/views/stock_picking.xml new file mode 100644 index 0000000..5bf97e9 --- /dev/null +++ b/delivery_line_sale_line_position/views/stock_picking.xml @@ -0,0 +1,20 @@ + + + + + stock.view.picking.form + stock.picking + + + + + + + + + + + diff --git a/setup/_metapackage/VERSION.txt b/setup/_metapackage/VERSION.txt index 12db17e..dd34d45 100644 --- a/setup/_metapackage/VERSION.txt +++ b/setup/_metapackage/VERSION.txt @@ -1 +1 @@ -14.0.20210420.0 \ No newline at end of file +14.0.20211126.0 \ No newline at end of file diff --git a/setup/_metapackage/setup.py b/setup/_metapackage/setup.py index caa232f..0af6618 100644 --- a/setup/_metapackage/setup.py +++ b/setup/_metapackage/setup.py @@ -8,11 +8,15 @@ setuptools.setup( description="Meta package for oca-stock-logistics-reporting Odoo addons", version=version, install_requires=[ + 'odoo14-addon-delivery_line_sale_line_position', 'odoo14-addon-stock_card_report', + 'odoo14-addon-stock_picking_group_by_partner_by_carrier_sale_line_position', 'odoo14-addon-stock_picking_report_valued', + 'odoo14-addon-stock_quantity_history_location', ], classifiers=[ 'Programming Language :: Python', 'Framework :: Odoo', + 'Framework :: Odoo :: 14.0', ] ) diff --git a/setup/delivery_line_sale_line_position/odoo/addons/delivery_line_sale_line_position b/setup/delivery_line_sale_line_position/odoo/addons/delivery_line_sale_line_position new file mode 120000 index 0000000..d0aa2b9 --- /dev/null +++ b/setup/delivery_line_sale_line_position/odoo/addons/delivery_line_sale_line_position @@ -0,0 +1 @@ +../../../../delivery_line_sale_line_position \ No newline at end of file diff --git a/setup/delivery_line_sale_line_position/setup.py b/setup/delivery_line_sale_line_position/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/delivery_line_sale_line_position/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/stock_picking_group_by_partner_by_carrier_sale_line_position/odoo/addons/stock_picking_group_by_partner_by_carrier_sale_line_position b/setup/stock_picking_group_by_partner_by_carrier_sale_line_position/odoo/addons/stock_picking_group_by_partner_by_carrier_sale_line_position new file mode 120000 index 0000000..b45bec0 --- /dev/null +++ b/setup/stock_picking_group_by_partner_by_carrier_sale_line_position/odoo/addons/stock_picking_group_by_partner_by_carrier_sale_line_position @@ -0,0 +1 @@ +../../../../stock_picking_group_by_partner_by_carrier_sale_line_position \ No newline at end of file diff --git a/setup/stock_picking_group_by_partner_by_carrier_sale_line_position/setup.py b/setup/stock_picking_group_by_partner_by_carrier_sale_line_position/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/stock_picking_group_by_partner_by_carrier_sale_line_position/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/stock_quantity_history_location/odoo/addons/stock_quantity_history_location b/setup/stock_quantity_history_location/odoo/addons/stock_quantity_history_location new file mode 120000 index 0000000..2f1a370 --- /dev/null +++ b/setup/stock_quantity_history_location/odoo/addons/stock_quantity_history_location @@ -0,0 +1 @@ +../../../../stock_quantity_history_location \ No newline at end of file diff --git a/setup/stock_quantity_history_location/setup.py b/setup/stock_quantity_history_location/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/stock_quantity_history_location/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/README.rst b/stock_picking_group_by_partner_by_carrier_sale_line_position/README.rst new file mode 100644 index 0000000..10903f1 --- /dev/null +++ b/stock_picking_group_by_partner_by_carrier_sale_line_position/README.rst @@ -0,0 +1,85 @@ +============================================================ +Stock Picking Group By Partner By Carrier Sale Line Position +============================================================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-reporting/tree/14.0/stock_picking_group_by_partner_by_carrier_sale_line_position + :alt: OCA/stock-logistics-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_picking_group_by_partner_by_carrier_sale_line_position + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/151/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This is a glue module for the sale line position on the delivery report +and the module `stock_picking_group_by_partner_by_carrier`. + +It ensures that on the delivery report the position column is displayed +only if some positions exist. +And also adds the sale line position on the remaining to deliver list at +the bottom of the report. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Thierry Ducrest +* `Trobz `_: + +Other credits +~~~~~~~~~~~~~ + +The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/stock-logistics-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/__init__.py b/stock_picking_group_by_partner_by_carrier_sale_line_position/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/__manifest__.py b/stock_picking_group_by_partner_by_carrier_sale_line_position/__manifest__.py new file mode 100644 index 0000000..2f92c09 --- /dev/null +++ b/stock_picking_group_by_partner_by_carrier_sale_line_position/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "Stock Picking Group By Partner By Carrier Sale Line Position", + "summary": "Glue module for sale position and delivery report grouped", + "version": "14.0.1.0.1", + "category": "Delivery", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/stock-logistics-reporting", + "depends": [ + "delivery_line_sale_line_position", + "stock_picking_group_by_partner_by_carrier", + ], + "data": ["report/report_deliveryslip.xml"], + "installable": True, + "auto_install": True, +} diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/i18n/stock_picking_group_by_partner_by_carrier_sale_line_position.pot b/stock_picking_group_by_partner_by_carrier_sale_line_position/i18n/stock_picking_group_by_partner_by_carrier_sale_line_position.pot new file mode 100644 index 0000000..4d8b20f --- /dev/null +++ b/stock_picking_group_by_partner_by_carrier_sale_line_position/i18n/stock_picking_group_by_partner_by_carrier_sale_line_position.pot @@ -0,0 +1,13 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/models/__init__.py b/stock_picking_group_by_partner_by_carrier_sale_line_position/models/__init__.py new file mode 100644 index 0000000..ae4c272 --- /dev/null +++ b/stock_picking_group_by_partner_by_carrier_sale_line_position/models/__init__.py @@ -0,0 +1 @@ +from . import stock_picking diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/models/stock_picking.py b/stock_picking_group_by_partner_by_carrier_sale_line_position/models/stock_picking.py new file mode 100644 index 0000000..21cdc70 --- /dev/null +++ b/stock_picking_group_by_partner_by_carrier_sale_line_position/models/stock_picking.py @@ -0,0 +1,18 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import models + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + def _get_sorted_moves(self): + moves = super()._get_sorted_moves() + return moves.sorted( + lambda m: m.sale_line_id.order_id.id * 1000 + m.sale_line_id.position + ) + + def _get_sorted_move_lines(self): + self.ensure_one() + return self.move_line_ids.sorted(lambda l: l.move_id.sale_line_id.position) diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/readme/CONTRIBUTORS.rst b/stock_picking_group_by_partner_by_carrier_sale_line_position/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..ef70cd0 --- /dev/null +++ b/stock_picking_group_by_partner_by_carrier_sale_line_position/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Thierry Ducrest +* `Trobz `_: diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/readme/CREDITS.rst b/stock_picking_group_by_partner_by_carrier_sale_line_position/readme/CREDITS.rst new file mode 100644 index 0000000..f37ebe7 --- /dev/null +++ b/stock_picking_group_by_partner_by_carrier_sale_line_position/readme/CREDITS.rst @@ -0,0 +1 @@ +The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/readme/DESCRIPTION.rst b/stock_picking_group_by_partner_by_carrier_sale_line_position/readme/DESCRIPTION.rst new file mode 100644 index 0000000..9a65e3f --- /dev/null +++ b/stock_picking_group_by_partner_by_carrier_sale_line_position/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +This is a glue module for the sale line position on the delivery report +and the module `stock_picking_group_by_partner_by_carrier`. + +It ensures that on the delivery report the position column is displayed +only if some positions exist. +And also adds the sale line position on the remaining to deliver list at +the bottom of the report. diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/report/report_deliveryslip.xml b/stock_picking_group_by_partner_by_carrier_sale_line_position/report/report_deliveryslip.xml new file mode 100644 index 0000000..cdbaf92 --- /dev/null +++ b/stock_picking_group_by_partner_by_carrier_sale_line_position/report/report_deliveryslip.xml @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/static/description/icon.png b/stock_picking_group_by_partner_by_carrier_sale_line_position/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/stock_picking_group_by_partner_by_carrier_sale_line_position/static/description/icon.png differ diff --git a/stock_picking_group_by_partner_by_carrier_sale_line_position/static/description/index.html b/stock_picking_group_by_partner_by_carrier_sale_line_position/static/description/index.html new file mode 100644 index 0000000..2d50ef4 --- /dev/null +++ b/stock_picking_group_by_partner_by_carrier_sale_line_position/static/description/index.html @@ -0,0 +1,430 @@ + + + + + + +Stock Picking Group By Partner By Carrier Sale Line Position + + + +
+

Stock Picking Group By Partner By Carrier Sale Line Position

+ + +

Beta License: AGPL-3 OCA/stock-logistics-reporting Translate me on Weblate Try me on Runbot

+

This is a glue module for the sale line position on the delivery report +and the module stock_picking_group_by_partner_by_carrier.

+

It ensures that on the delivery report the position column is displayed +only if some positions exist. +And also adds the sale line position on the remaining to deliver list at +the bottom of the report.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+ +
+

Other credits

+

The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp

+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/stock-logistics-reporting project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/stock_quantity_history_location/README.rst b/stock_quantity_history_location/README.rst new file mode 100644 index 0000000..c2ce70d --- /dev/null +++ b/stock_quantity_history_location/README.rst @@ -0,0 +1,79 @@ +=============================== +Stock Quantity History Location +=============================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-reporting/tree/14.0/stock_quantity_history_location + :alt: OCA/stock-logistics-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_quantity_history_location + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/151/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to run an Inventory report or Inventory Valuation +report by location, for a past date or for current date. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* Go to: *Inventory / Reporting / Inventory or Inventory Valuation* +* Filter by location +* **Optionally: Mark if you want to include child location** +* Choose a moment in time: + * Current Inventory + * At a Specific Date + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ForgeFlow + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/stock-logistics-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_quantity_history_location/__init__.py b/stock_quantity_history_location/__init__.py new file mode 100644 index 0000000..5cb1c49 --- /dev/null +++ b/stock_quantity_history_location/__init__.py @@ -0,0 +1 @@ +from . import wizards diff --git a/stock_quantity_history_location/__manifest__.py b/stock_quantity_history_location/__manifest__.py new file mode 100644 index 0000000..1b51ed6 --- /dev/null +++ b/stock_quantity_history_location/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2019 ForgeFlow S.L. +# Copyright 2019 Aleph Objects, Inc. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Stock Quantity History Location", + "summary": "Provides stock quantity by location on past date", + "version": "14.0.1.0.0", + "license": "AGPL-3", + "author": "ForgeFlow," "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-reporting", + "depends": ["stock"], + "data": ["wizards/stock_quantity_history.xml"], +} diff --git a/stock_quantity_history_location/i18n/it.po b/stock_quantity_history_location/i18n/it.po new file mode 100644 index 0000000..3373291 --- /dev/null +++ b/stock_quantity_history_location/i18n/it.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_quantity_history_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-04-08 09:46+0000\n" +"Last-Translator: Alessandro Fiorino \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__display_name +msgid "Display Name" +msgstr "" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__id +msgid "ID" +msgstr "" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__include_child_locations +msgid "Include child locations" +msgstr "Includi locazioni figlie" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history____last_update +msgid "Last Modified on" +msgstr "" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__location_id +msgid "Location" +msgstr "Locazione" + +#. module: stock_quantity_history_location +#: model:ir.model,name:stock_quantity_history_location.model_stock_quantity_history +msgid "Stock Quantity History" +msgstr "Storico quantità giacenza" + +#~ msgid "Inventory at Date & Location" +#~ msgstr "Inventario alla Data e Locazione" diff --git a/stock_quantity_history_location/i18n/ro.po b/stock_quantity_history_location/i18n/ro.po new file mode 100644 index 0000000..e519392 --- /dev/null +++ b/stock_quantity_history_location/i18n/ro.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_quantity_history_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-09-29 11:00+0000\n" +"Last-Translator: erik-bzcl \n" +"Language-Team: none\n" +"Language: ro\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < " +"20)) ? 1 : 2;\n" +"X-Generator: Weblate 3.10\n" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__include_child_locations +msgid "Include child locations" +msgstr "Inclusiv sublocaţii" + +#. module: stock_quantity_history_location +#. openerp-web +#: code:addons/stock_quantity_history_location/static/src/js/inventory_report.js:0 +#, python-format +msgid "Inventory at Date & Location" +msgstr "Stoc în data & locaţia" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__location_id +msgid "Location" +msgstr "Locaţia" + +#. module: stock_quantity_history_location +#: model:ir.model,name:stock_quantity_history_location.model_stock_quantity_history +msgid "Stock Quantity History" +msgstr "Stoc cantitativ istoric" diff --git a/stock_quantity_history_location/i18n/stock_quantity_history_location.pot b/stock_quantity_history_location/i18n/stock_quantity_history_location.pot new file mode 100644 index 0000000..8d96fb7 --- /dev/null +++ b/stock_quantity_history_location/i18n/stock_quantity_history_location.pot @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_quantity_history_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__display_name +msgid "Display Name" +msgstr "" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__id +msgid "ID" +msgstr "" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__include_child_locations +msgid "Include child locations" +msgstr "" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history____last_update +msgid "Last Modified on" +msgstr "" + +#. module: stock_quantity_history_location +#: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__location_id +msgid "Location" +msgstr "" + +#. module: stock_quantity_history_location +#: model:ir.model,name:stock_quantity_history_location.model_stock_quantity_history +msgid "Stock Quantity History" +msgstr "" diff --git a/stock_quantity_history_location/readme/CONSTRIBUTORS.rst b/stock_quantity_history_location/readme/CONSTRIBUTORS.rst new file mode 100644 index 0000000..6860aff --- /dev/null +++ b/stock_quantity_history_location/readme/CONSTRIBUTORS.rst @@ -0,0 +1 @@ +* Jordi Ballester Alomar diff --git a/stock_quantity_history_location/readme/DESCRIPTION.rst b/stock_quantity_history_location/readme/DESCRIPTION.rst new file mode 100644 index 0000000..9b1d7c4 --- /dev/null +++ b/stock_quantity_history_location/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows to run an Inventory report or Inventory Valuation +report by location, for a past date or for current date. diff --git a/stock_quantity_history_location/readme/USAGE.rst b/stock_quantity_history_location/readme/USAGE.rst new file mode 100644 index 0000000..9037ce5 --- /dev/null +++ b/stock_quantity_history_location/readme/USAGE.rst @@ -0,0 +1,6 @@ +* Go to: *Inventory / Reporting / Inventory or Inventory Valuation* +* Filter by location +* **Optionally: Mark if you want to include child location** +* Choose a moment in time: + * Current Inventory + * At a Specific Date diff --git a/stock_quantity_history_location/static/description/icon.png b/stock_quantity_history_location/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/stock_quantity_history_location/static/description/icon.png differ diff --git a/stock_quantity_history_location/static/description/index.html b/stock_quantity_history_location/static/description/index.html new file mode 100644 index 0000000..44248ff --- /dev/null +++ b/stock_quantity_history_location/static/description/index.html @@ -0,0 +1,431 @@ + + + + + + +Stock Quantity History Location + + + +
+

Stock Quantity History Location

+ + +

Beta License: AGPL-3 OCA/stock-logistics-reporting Translate me on Weblate Try me on Runbot

+

This module allows to run an Inventory report or Inventory Valuation +report by location, for a past date or for current date.

+

Table of contents

+ +
+

Usage

+
    +
  • Go to: Inventory / Reporting / Inventory or Inventory Valuation
  • +
  • Filter by location
  • +
  • Optionally: Mark if you want to include child location
  • +
  • +
    Choose a moment in time:
    +
      +
    • Current Inventory
    • +
    • At a Specific Date
    • +
    +
    +
    +
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/stock-logistics-reporting project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/stock_quantity_history_location/static/src/js/inventory_report.js b/stock_quantity_history_location/static/src/js/inventory_report.js new file mode 100644 index 0000000..434ae08 --- /dev/null +++ b/stock_quantity_history_location/static/src/js/inventory_report.js @@ -0,0 +1,23 @@ +/* eslint-disable no-unused-vars */ +odoo.define("stock.InventoryReportLocationListController", function (require) { + "use strict"; + + var core = require("web.core"); + var InventoryReportListController = require("stock.InventoryReportListController"); + + var qweb = core.qweb; + var _t = core._t; + + var InventoryReportLocationListController = InventoryReportListController.include({ + renderButtons: function ($node) { + this._super.apply(this, arguments); + if (this.context.no_at_date) { + return; + } + if (this.modelName === "stock.quant" && this.$buttons.length) { + this.$buttons[0].firstElementChild.innerHTML = + "Inventory at Date & Location"; + } + }, + }); +}); diff --git a/stock_quantity_history_location/tests/__init__.py b/stock_quantity_history_location/tests/__init__.py new file mode 100644 index 0000000..6be307f --- /dev/null +++ b/stock_quantity_history_location/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_quantity_history_location diff --git a/stock_quantity_history_location/tests/common.py b/stock_quantity_history_location/tests/common.py new file mode 100644 index 0000000..b029621 --- /dev/null +++ b/stock_quantity_history_location/tests/common.py @@ -0,0 +1,28 @@ +# Copyright 2021 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + + +class TestCommon(SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + + def _create_stock_move(self, location_dest_id, qty): + move = self.env["stock.move"].create( + { + "name": "Stock move in", + "location_id": self.supplier_location.id, + "location_dest_id": location_dest_id.id, + "product_id": self.product.id, + "product_uom": self.product.uom_id.id, + "product_uom_qty": qty, + } + ) + move._action_confirm() + move._action_assign() + move_line = move.move_line_ids[0] + move_line.qty_done = qty + move._action_done() + return move diff --git a/stock_quantity_history_location/tests/test_stock_quantity_history_location.py b/stock_quantity_history_location/tests/test_stock_quantity_history_location.py new file mode 100644 index 0000000..f6038a0 --- /dev/null +++ b/stock_quantity_history_location/tests/test_stock_quantity_history_location.py @@ -0,0 +1,65 @@ +# Copyright 2019 ForgeFlow S.L. +# Copyright 2021 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields + +from .common import TestCommon + + +class TestStockQuantityHistoryLocation(TestCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.supplier_location = cls.env.ref("stock.stock_location_suppliers") + cls.main_company = cls.env.ref("base.main_company") + cls.product = cls.env.ref("product.product_product_3") + cls.test_stock_loc = cls.env["stock.location"].create( + { + "usage": "internal", + "name": "Test Stock Location", + "company_id": cls.main_company.id, + } + ) + cls.child_test_stock_loc = cls.env["stock.location"].create( + { + "usage": "internal", + "name": "Child Test Stock Location", + "location_id": cls.test_stock_loc.id, + "company_id": cls.main_company.id, + } + ) + cls._create_stock_move(cls, location_dest_id=cls.child_test_stock_loc, qty=100) + + def test_wizard_past_date(self): + wizard = self.env["stock.quantity.history"].create( + { + "location_id": self.test_stock_loc.id, + "include_child_locations": True, + "inventory_datetime": fields.Datetime.now(), + } + ) + action = wizard.with_context(company_owned=True).open_at_date() + self.assertEquals( + self.product.with_context(action["context"]).qty_available, 100.0 + ) + self.assertEquals( + self.product.with_context( + location=self.child_test_stock_loc.id, to_date="2019-08-10" + ).qty_available, + 0.0, + ) + + def test_wizard_current(self): + wizard = self.env["stock.quantity.history"].create( + {"location_id": self.test_stock_loc.id, "include_child_locations": False} + ) + action = wizard.with_context().open_at_date() + self.assertEquals(action["context"]["compute_child"], False) + self.assertEquals(action["context"]["location"], self.test_stock_loc.id) + wizard = self.env["stock.quantity.history"].create( + {"location_id": self.test_stock_loc.id, "include_child_locations": True} + ) + action = wizard.with_context().open_at_date() + self.assertEquals(action["context"]["compute_child"], True) + self.assertEquals(action["context"]["location"], self.test_stock_loc.id) diff --git a/stock_quantity_history_location/wizards/__init__.py b/stock_quantity_history_location/wizards/__init__.py new file mode 100644 index 0000000..51f2abb --- /dev/null +++ b/stock_quantity_history_location/wizards/__init__.py @@ -0,0 +1 @@ +from . import stock_quantity_history diff --git a/stock_quantity_history_location/wizards/stock_quantity_history.py b/stock_quantity_history_location/wizards/stock_quantity_history.py new file mode 100644 index 0000000..b08741d --- /dev/null +++ b/stock_quantity_history_location/wizards/stock_quantity_history.py @@ -0,0 +1,32 @@ +# Copyright 2019 ForgeFlow S.L. +# Copyright 2019 Aleph Objects, Inc. +# Copyright 2021 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import ast + +from odoo import fields, models + + +class StockQuantityHistory(models.TransientModel): + _inherit = "stock.quantity.history" + + location_id = fields.Many2one( + "stock.location", domain=[("usage", "in", ["internal", "transit"])] + ) + include_child_locations = fields.Boolean("Include child locations", default=True) + + def open_at_date(self): + action = super(StockQuantityHistory, self).open_at_date() + ctx = action["context"] + if isinstance(ctx, str): + ctx = ast.literal_eval(ctx) + if self.location_id: + ctx["location"] = self.location_id.id + ctx["compute_child"] = self.include_child_locations + if ctx.get("company_owned", False): + ctx.pop("company_owned") + action["name"] = "{} ({})".format( + action["name"], self.location_id.complete_name + ) + action["context"] = ctx + return action diff --git a/stock_quantity_history_location/wizards/stock_quantity_history.xml b/stock_quantity_history_location/wizards/stock_quantity_history.xml new file mode 100644 index 0000000..d81ccff --- /dev/null +++ b/stock_quantity_history_location/wizards/stock_quantity_history.xml @@ -0,0 +1,34 @@ + + + +