diff --git a/setup/stock_move_line_move_location/odoo/addons/stock_move_line_move_location b/setup/stock_move_line_move_location/odoo/addons/stock_move_line_move_location new file mode 120000 index 00000000..6b098c36 --- /dev/null +++ b/setup/stock_move_line_move_location/odoo/addons/stock_move_line_move_location @@ -0,0 +1 @@ +../../../../stock_move_line_move_location \ No newline at end of file diff --git a/setup/stock_move_line_move_location/setup.py b/setup/stock_move_line_move_location/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/stock_move_line_move_location/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_move_line_move_location/README.rst b/stock_move_line_move_location/README.rst new file mode 100644 index 00000000..90e4f6e2 --- /dev/null +++ b/stock_move_line_move_location/README.rst @@ -0,0 +1,57 @@ +============================= +Move Stock Line Move 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-qrtl%2Faxls--custom-lightgray.png?logo=github + :target: https://github.com/qrtl/axls-custom/tree/16.0/stock_move_line_move_location + :alt: qrtl/axls-custom + +|badge1| |badge2| |badge3| + +This module extends the function of stock_move_location module to allow creation of +transfers based on stock.move.line records. + +The module was developed for a rather peculiar need of just removing the inventory +of the received products, which has been consumed in production straight away, where +the user of the manufacturing order has not been implemented. + +**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 +~~~~~~~ + +* Quartile Limited + +Maintainers +~~~~~~~~~~~ + +This module is part of the `qrtl/axls-custom `_ project on GitHub. + +You are welcome to contribute. diff --git a/stock_move_line_move_location/__init__.py b/stock_move_line_move_location/__init__.py new file mode 100644 index 00000000..40272379 --- /dev/null +++ b/stock_move_line_move_location/__init__.py @@ -0,0 +1 @@ +from . import wizard diff --git a/stock_move_line_move_location/__manifest__.py b/stock_move_line_move_location/__manifest__.py new file mode 100644 index 00000000..3d79ee68 --- /dev/null +++ b/stock_move_line_move_location/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "Move Stock Line Move Location", + "version": "16.0.1.0.0", + "author": "Quartile Limited", + "summary": "This module allows to move all stock " + "in a stock location to an other one in moves history.", + "website": "https://www.quartile.co", + "license": "AGPL-3", + "depends": ["stock_move_location"], + "category": "Stock", + "data": [ + "data/stock_move_line_view.xml", + ], +} diff --git a/stock_move_line_move_location/data/stock_move_line_view.xml b/stock_move_line_move_location/data/stock_move_line_view.xml new file mode 100644 index 00000000..e987ae35 --- /dev/null +++ b/stock_move_line_move_location/data/stock_move_line_view.xml @@ -0,0 +1,12 @@ + + + + Move to location... + wiz.stock.move.location + + form + + new + + + diff --git a/stock_move_line_move_location/i18n/ja.po b/stock_move_line_move_location/i18n/ja.po new file mode 100644 index 00000000..39c710c8 --- /dev/null +++ b/stock_move_line_move_location/i18n/ja.po @@ -0,0 +1,33 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_move_line_move_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-05-19 08:56+0000\n" +"PO-Revision-Date: 2023-05-19 08:56+0000\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_move_line_move_location +#: model:ir.actions.act_window,name:stock_move_line_move_location.wiz_stock_move_line_location_action +msgid "Move to location..." +msgstr "ロケーション移動" + +#. module: stock_move_line_move_location +#. odoo-python +#: code:addons/stock_move_line_move_location/wizard/stock_move_location.py:0 +#, python-format +msgid "There is more than one location in selected move lines." +msgstr "複数移動元ロケーションを選択することはできません。" + +#. module: stock_move_line_move_location +#: model:ir.model,name:stock_move_line_move_location.model_wiz_stock_move_location +msgid "Wizard move location" +msgstr "ロケーション移動ウィザード" diff --git a/stock_move_line_move_location/readme/DESCRIPTION.rst b/stock_move_line_move_location/readme/DESCRIPTION.rst new file mode 100644 index 00000000..93e72a40 --- /dev/null +++ b/stock_move_line_move_location/readme/DESCRIPTION.rst @@ -0,0 +1,6 @@ +This module extends the function of stock_move_location module to allow creation of +transfers based on stock.move.line records. + +The module was developed for a rather peculiar need of just removing the inventory +of the received products, which has been consumed in production straight away, where +the user of the manufacturing order has not been implemented. diff --git a/stock_move_line_move_location/static/description/icon.png b/stock_move_line_move_location/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/stock_move_line_move_location/static/description/icon.png differ diff --git a/stock_move_line_move_location/static/description/index.html b/stock_move_line_move_location/static/description/index.html new file mode 100644 index 00000000..5d2ad2a1 --- /dev/null +++ b/stock_move_line_move_location/static/description/index.html @@ -0,0 +1,411 @@ + + + + + + +Move Stock Line Move Location + + + +
+

Move Stock Line Move Location

+ + +

Beta License: AGPL-3 qrtl/axls-custom

+

This module extends the function of stock_move_location module to allow creation of +transfers based on stock.move.line records.

+

The module was developed for a rather peculiar need of just removing the inventory +of the received products, which has been consumed in production straight away, where +the user of the manufacturing order has not been implemented.

+

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

+
    +
  • Quartile Limited
  • +
+
+
+

Maintainers

+

This module is part of the qrtl/axls-custom project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/stock_move_line_move_location/wizard/__init__.py b/stock_move_line_move_location/wizard/__init__.py new file mode 100644 index 00000000..65df4417 --- /dev/null +++ b/stock_move_line_move_location/wizard/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from . import stock_move_location diff --git a/stock_move_line_move_location/wizard/stock_move_location.py b/stock_move_line_move_location/wizard/stock_move_location.py new file mode 100644 index 00000000..95b02b17 --- /dev/null +++ b/stock_move_line_move_location/wizard/stock_move_location.py @@ -0,0 +1,62 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from itertools import groupby + +from odoo import _, api, models +from odoo.exceptions import UserError +from odoo.fields import first + + +class StockMoveLocationWizard(models.TransientModel): + _inherit = "wiz.stock.move.location" + + @api.model + def default_get(self, fields): + res = super().default_get(fields) + if self.env.context.get("active_model", False) != "stock.move.line": + return res + # Load data from move lines + move_lines = self.env["stock.move.line"].browse( + self.env.context.get("active_ids", False) + ) + if len(move_lines.location_dest_id) > 1: + raise UserError( + _("There is more than one location in selected move lines.") + ) + res["stock_move_location_line_ids"] = self.with_context( + move_line_move_location=True + )._prepare_wizard_move_lines(move_lines) + res["origin_location_id"] = first(move_lines).location_dest_id.id + return res + + @api.model + def _prepare_wizard_move_lines(self, move_lines): + res = [] + if not self.env.context.get("move_line_move_location", False): + return super()._prepare_wizard_move_lines(move_lines) + # if need move only available qty per product on location + for _product, ml in groupby( + sorted(move_lines, key=lambda r: (r.product_id, r.lot_id)), + lambda r: (r.product_id, r.lot_id), + ): + quant = self.env["stock.quant"] + ml = list(ml)[0] + qty = quant._get_available_quantity( + ml.product_id, + ml.location_dest_id, + ml.lot_id, + strict=True, + ) + if qty: + vals = { + "product_id": ml.product_id.id, + "move_quantity": qty, + "max_quantity": qty, + "origin_location_id": ml.location_dest_id.id, + "lot_id": ml.lot_id.id, + "product_uom_id": ml.product_id.uom_id.id, + "custom": False, + } + res.append((0, 0, vals)) + return res