diff --git a/stock_request/LICENSE b/LICENSE similarity index 100% rename from stock_request/LICENSE rename to LICENSE diff --git a/stock_request/README.md b/README.md similarity index 84% rename from stock_request/README.md rename to README.md index e09bf13f..e7e0ca6e 100644 --- a/stock_request/README.md +++ b/README.md @@ -1,4 +1,3 @@ - [![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-request&target_branch=16.0) [![Pre-commit Status](https://github.com/OCA/stock-logistics-request/actions/workflows/pre-commit.yml/badge.svg?branch=16.0)](https://github.com/OCA/stock-logistics-request/actions/workflows/pre-commit.yml?query=branch%3A16.0) [![Build Status](https://github.com/OCA/stock-logistics-request/actions/workflows/test.yml/badge.svg?branch=16.0)](https://github.com/OCA/stock-logistics-request/actions/workflows/test.yml?query=branch%3A16.0) @@ -9,7 +8,9 @@ # Stock Logistics Request -This repository contains modules to provide another way of creating stock movements. Provided as a dedicated application, users will be able to create their stock needs by product and location. +This repository contains modules to provide another way of creating stock movements. +Provided as a dedicated application, users will be able to create their stock needs by +product and location. @@ -27,11 +28,12 @@ This part will be replaced when running the oca-gen-addons-table script from OCA This repository is licensed under [AGPL-3.0](LICENSE). -However, each module can have a totally different license, as long as they adhere to Odoo Community Association (OCA) -policy. Consult each module's `__manifest__.py` file, which contains a `license` key -that explains its license. +However, each module can have a totally different license, as long as they adhere to +Odoo Community Association (OCA) policy. Consult each module's `__manifest__.py` file, +which contains a `license` key that explains its license. + +--- ----- OCA, or the [Odoo Community Association](http://odoo-community.org/), is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. diff --git a/stock_request/setup/.setuptools-odoo-make-default-ignore b/setup/.setuptools-odoo-make-default-ignore similarity index 100% rename from stock_request/setup/.setuptools-odoo-make-default-ignore rename to setup/.setuptools-odoo-make-default-ignore diff --git a/stock_request/setup/README b/setup/README similarity index 100% rename from stock_request/setup/README rename to setup/README diff --git a/setup/stock_request/odoo/addons/stock_request b/setup/stock_request/odoo/addons/stock_request new file mode 120000 index 00000000..700a8813 --- /dev/null +++ b/setup/stock_request/odoo/addons/stock_request @@ -0,0 +1 @@ +../../../../stock_request \ No newline at end of file diff --git a/setup/stock_request/setup.py b/setup/stock_request/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/stock_request/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_request/stock_request/README.rst b/stock_request/README.rst similarity index 86% rename from stock_request/stock_request/README.rst rename to stock_request/README.rst index 2637dea4..f54411c4 100644 --- a/stock_request/stock_request/README.rst +++ b/stock_request/README.rst @@ -17,13 +17,13 @@ Stock Request :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-warehouse/tree/15.0/stock_request - :alt: OCA/stock-logistics-warehouse + :target: https://github.com/OCA/stock-logistics-request/tree/15.0/stock_request + :alt: OCA/stock-logistics-request .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_request + :target: https://translation.odoo-community.org/projects/stock-logistics-request-16-0/stock-logistics-request-16-0-stock_request :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=15.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-request&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -89,10 +89,10 @@ It is also required to manage active field logically from Orders to SRs. Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -136,6 +136,6 @@ 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-warehouse `_ project on GitHub. +This module is part of the `OCA/stock-logistics-request `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_request/stock_request/__init__.py b/stock_request/__init__.py similarity index 100% rename from stock_request/stock_request/__init__.py rename to stock_request/__init__.py diff --git a/stock_request/stock_request/__manifest__.py b/stock_request/__manifest__.py similarity index 89% rename from stock_request/stock_request/__manifest__.py rename to stock_request/__manifest__.py index 2e263b63..cfa804b8 100644 --- a/stock_request/stock_request/__manifest__.py +++ b/stock_request/__manifest__.py @@ -4,9 +4,9 @@ { "name": "Stock Request", "summary": "Internal request for stock", - "version": "15.0.1.6.3", + "version": "16.0.1.0.0", "license": "LGPL-3", - "website": "https://github.com/OCA/stock-logistics-warehouse", + "website": "https://github.com/OCA/stock-logistics-request", "author": "ForgeFlow, Odoo Community Association (OCA)", "category": "Warehouse Management", "depends": ["stock"], diff --git a/stock_request/stock_request/data/stock_request_sequence_data.xml b/stock_request/data/stock_request_sequence_data.xml similarity index 100% rename from stock_request/stock_request/data/stock_request_sequence_data.xml rename to stock_request/data/stock_request_sequence_data.xml diff --git a/stock_request/stock_request/i18n/ca.po b/stock_request/i18n/ca.po similarity index 100% rename from stock_request/stock_request/i18n/ca.po rename to stock_request/i18n/ca.po diff --git a/stock_request/stock_request/i18n/de.po b/stock_request/i18n/de.po similarity index 100% rename from stock_request/stock_request/i18n/de.po rename to stock_request/i18n/de.po diff --git a/stock_request/stock_request/i18n/el_GR.po b/stock_request/i18n/el_GR.po similarity index 100% rename from stock_request/stock_request/i18n/el_GR.po rename to stock_request/i18n/el_GR.po diff --git a/stock_request/stock_request/i18n/es.po b/stock_request/i18n/es.po similarity index 100% rename from stock_request/stock_request/i18n/es.po rename to stock_request/i18n/es.po diff --git a/stock_request/stock_request/i18n/es_ES.po b/stock_request/i18n/es_ES.po similarity index 100% rename from stock_request/stock_request/i18n/es_ES.po rename to stock_request/i18n/es_ES.po diff --git a/stock_request/stock_request/i18n/eu.po b/stock_request/i18n/eu.po similarity index 100% rename from stock_request/stock_request/i18n/eu.po rename to stock_request/i18n/eu.po diff --git a/stock_request/stock_request/i18n/fi.po b/stock_request/i18n/fi.po similarity index 100% rename from stock_request/stock_request/i18n/fi.po rename to stock_request/i18n/fi.po diff --git a/stock_request/stock_request/i18n/fr.po b/stock_request/i18n/fr.po similarity index 100% rename from stock_request/stock_request/i18n/fr.po rename to stock_request/i18n/fr.po diff --git a/stock_request/stock_request/i18n/fr_CH.po b/stock_request/i18n/fr_CH.po similarity index 100% rename from stock_request/stock_request/i18n/fr_CH.po rename to stock_request/i18n/fr_CH.po diff --git a/stock_request/stock_request/i18n/fr_FR.po b/stock_request/i18n/fr_FR.po similarity index 100% rename from stock_request/stock_request/i18n/fr_FR.po rename to stock_request/i18n/fr_FR.po diff --git a/stock_request/stock_request/i18n/gl.po b/stock_request/i18n/gl.po similarity index 100% rename from stock_request/stock_request/i18n/gl.po rename to stock_request/i18n/gl.po diff --git a/stock_request/stock_request/i18n/hr.po b/stock_request/i18n/hr.po similarity index 100% rename from stock_request/stock_request/i18n/hr.po rename to stock_request/i18n/hr.po diff --git a/stock_request/stock_request/i18n/hr_HR.po b/stock_request/i18n/hr_HR.po similarity index 100% rename from stock_request/stock_request/i18n/hr_HR.po rename to stock_request/i18n/hr_HR.po diff --git a/stock_request/stock_request/i18n/it.po b/stock_request/i18n/it.po similarity index 100% rename from stock_request/stock_request/i18n/it.po rename to stock_request/i18n/it.po diff --git a/stock_request/stock_request/i18n/ja.po b/stock_request/i18n/ja.po similarity index 100% rename from stock_request/stock_request/i18n/ja.po rename to stock_request/i18n/ja.po diff --git a/stock_request/stock_request/i18n/ja_JP.po b/stock_request/i18n/ja_JP.po similarity index 100% rename from stock_request/stock_request/i18n/ja_JP.po rename to stock_request/i18n/ja_JP.po diff --git a/stock_request/stock_request/i18n/nl.po b/stock_request/i18n/nl.po similarity index 100% rename from stock_request/stock_request/i18n/nl.po rename to stock_request/i18n/nl.po diff --git a/stock_request/stock_request/i18n/nl_NL.po b/stock_request/i18n/nl_NL.po similarity index 100% rename from stock_request/stock_request/i18n/nl_NL.po rename to stock_request/i18n/nl_NL.po diff --git a/stock_request/stock_request/i18n/pt.po b/stock_request/i18n/pt.po similarity index 100% rename from stock_request/stock_request/i18n/pt.po rename to stock_request/i18n/pt.po diff --git a/stock_request/stock_request/i18n/pt_BR.po b/stock_request/i18n/pt_BR.po similarity index 100% rename from stock_request/stock_request/i18n/pt_BR.po rename to stock_request/i18n/pt_BR.po diff --git a/stock_request/stock_request/i18n/ro.po b/stock_request/i18n/ro.po similarity index 100% rename from stock_request/stock_request/i18n/ro.po rename to stock_request/i18n/ro.po diff --git a/stock_request/stock_request/i18n/ru.po b/stock_request/i18n/ru.po similarity index 100% rename from stock_request/stock_request/i18n/ru.po rename to stock_request/i18n/ru.po diff --git a/stock_request/stock_request/i18n/sl.po b/stock_request/i18n/sl.po similarity index 100% rename from stock_request/stock_request/i18n/sl.po rename to stock_request/i18n/sl.po diff --git a/stock_request/stock_request/i18n/stock_request.pot b/stock_request/i18n/stock_request.pot similarity index 100% rename from stock_request/stock_request/i18n/stock_request.pot rename to stock_request/i18n/stock_request.pot diff --git a/stock_request/stock_request/i18n/tr.po b/stock_request/i18n/tr.po similarity index 100% rename from stock_request/stock_request/i18n/tr.po rename to stock_request/i18n/tr.po diff --git a/stock_request/stock_request/i18n/tr_TR.po b/stock_request/i18n/tr_TR.po similarity index 100% rename from stock_request/stock_request/i18n/tr_TR.po rename to stock_request/i18n/tr_TR.po diff --git a/stock_request/stock_request/i18n/vi_VN.po b/stock_request/i18n/vi_VN.po similarity index 100% rename from stock_request/stock_request/i18n/vi_VN.po rename to stock_request/i18n/vi_VN.po diff --git a/stock_request/stock_request/i18n/zh_CN.po b/stock_request/i18n/zh_CN.po similarity index 100% rename from stock_request/stock_request/i18n/zh_CN.po rename to stock_request/i18n/zh_CN.po diff --git a/stock_request/stock_request/migrations/15.0.1.4.0/noupdate_changes.xml b/stock_request/migrations/15.0.1.4.0/noupdate_changes.xml similarity index 100% rename from stock_request/stock_request/migrations/15.0.1.4.0/noupdate_changes.xml rename to stock_request/migrations/15.0.1.4.0/noupdate_changes.xml diff --git a/stock_request/stock_request/migrations/15.0.1.4.0/post-migration.py b/stock_request/migrations/15.0.1.4.0/post-migration.py similarity index 100% rename from stock_request/stock_request/migrations/15.0.1.4.0/post-migration.py rename to stock_request/migrations/15.0.1.4.0/post-migration.py diff --git a/stock_request/stock_request/models/__init__.py b/stock_request/models/__init__.py similarity index 100% rename from stock_request/stock_request/models/__init__.py rename to stock_request/models/__init__.py diff --git a/stock_request/stock_request/models/procurement_group.py b/stock_request/models/procurement_group.py similarity index 100% rename from stock_request/stock_request/models/procurement_group.py rename to stock_request/models/procurement_group.py diff --git a/stock_request/stock_request/models/res_company.py b/stock_request/models/res_company.py similarity index 100% rename from stock_request/stock_request/models/res_company.py rename to stock_request/models/res_company.py diff --git a/stock_request/stock_request/models/res_config_settings.py b/stock_request/models/res_config_settings.py similarity index 100% rename from stock_request/stock_request/models/res_config_settings.py rename to stock_request/models/res_config_settings.py diff --git a/stock_request/stock_request/models/stock_location.py b/stock_request/models/stock_location.py similarity index 100% rename from stock_request/stock_request/models/stock_location.py rename to stock_request/models/stock_location.py diff --git a/stock_request/stock_request/models/stock_location_route.py b/stock_request/models/stock_location_route.py similarity index 95% rename from stock_request/stock_request/models/stock_location_route.py rename to stock_request/models/stock_location_route.py index 97063ab8..7e3d260f 100644 --- a/stock_request/stock_request/models/stock_location_route.py +++ b/stock_request/models/stock_location_route.py @@ -6,7 +6,7 @@ class StockLocationRoute(models.Model): - _inherit = "stock.location.route" + _inherit = "stock.route" @api.constrains("company_id") def _check_company_stock_request(self): diff --git a/stock_request/stock_request/models/stock_move.py b/stock_request/models/stock_move.py similarity index 100% rename from stock_request/stock_request/models/stock_move.py rename to stock_request/models/stock_move.py diff --git a/stock_request/stock_request/models/stock_move_line.py b/stock_request/models/stock_move_line.py similarity index 100% rename from stock_request/stock_request/models/stock_move_line.py rename to stock_request/models/stock_move_line.py diff --git a/stock_request/stock_request/models/stock_picking.py b/stock_request/models/stock_picking.py similarity index 91% rename from stock_request/stock_request/models/stock_picking.py rename to stock_request/models/stock_picking.py index 85ea9b09..e9f386b2 100644 --- a/stock_request/stock_request/models/stock_picking.py +++ b/stock_request/models/stock_picking.py @@ -16,10 +16,10 @@ class StockPicking(models.Model): "Stock Request #", compute="_compute_stock_request_ids" ) - @api.depends("move_lines") + @api.depends("move_ids") def _compute_stock_request_ids(self): for rec in self: - rec.stock_request_ids = rec.move_lines.mapped("stock_request_ids") + rec.stock_request_ids = rec.move_ids.mapped("stock_request_ids") rec.stock_request_count = len(rec.stock_request_ids) def action_view_stock_request(self): diff --git a/stock_request/stock_request/models/stock_request.py b/stock_request/models/stock_request.py similarity index 85% rename from stock_request/stock_request/models/stock_request.py rename to stock_request/models/stock_request.py index 87afe8ca..c1f5d5e1 100644 --- a/stock_request/stock_request/models/stock_request.py +++ b/stock_request/models/stock_request.py @@ -180,41 +180,50 @@ def _compute_qty(self): @api.constrains("order_id", "requested_by") def check_order_requested_by(self): - if self.order_id and self.order_id.requested_by != self.requested_by: - raise ValidationError(_("Requested by must be equal to the order")) + for rec in self: + if rec.order_id and rec.order_id.requested_by != rec.requested_by: + raise ValidationError(_("Requested by must be equal to the order")) @api.constrains("order_id", "warehouse_id") def check_order_warehouse_id(self): - if self.order_id and self.order_id.warehouse_id != self.warehouse_id: - raise ValidationError(_("Warehouse must be equal to the order")) + for rec in self: + if rec.order_id and rec.order_id.warehouse_id != rec.warehouse_id: + raise ValidationError(_("Warehouse must be equal to the order")) @api.constrains("order_id", "location_id") def check_order_location(self): - if self.order_id and self.order_id.location_id != self.location_id: - raise ValidationError(_("Location must be equal to the order")) + for rec in self: + if rec.order_id and rec.order_id.location_id != rec.location_id: + raise ValidationError(_("Location must be equal to the order")) @api.constrains("order_id", "procurement_group_id") def check_order_procurement_group(self): - if ( - self.order_id - and self.order_id.procurement_group_id != self.procurement_group_id - ): - raise ValidationError(_("Procurement group must be equal to the order")) + for rec in self: + if ( + rec.order_id + and rec.order_id.procurement_group_id != rec.procurement_group_id + ): + raise ValidationError(_("Procurement group must be equal to the order")) @api.constrains("order_id", "company_id") def check_order_company(self): - if self.order_id and self.order_id.company_id != self.company_id: - raise ValidationError(_("Company must be equal to the order")) + for rec in self: + if rec.order_id and rec.order_id.company_id != rec.company_id: + raise ValidationError(_("Company must be equal to the order")) @api.constrains("order_id", "expected_date") def check_order_expected_date(self): - if self.order_id and self.order_id.expected_date != self.expected_date: - raise ValidationError(_("Expected date must be equal to the order")) + for rec in self: + if rec.order_id and rec.order_id.expected_date != rec.expected_date: + raise ValidationError(_("Expected date must be equal to the order")) @api.constrains("order_id", "picking_policy") def check_order_picking_policy(self): - if self.order_id and self.order_id.picking_policy != self.picking_policy: - raise ValidationError(_("The picking policy must be equal to the order")) + for rec in self: + if rec.order_id and rec.order_id.picking_policy != rec.picking_policy: + raise ValidationError( + _("The picking policy must be equal to the order") + ) def _action_confirm(self): self._action_launch_procurement_rule() @@ -351,17 +360,20 @@ def action_view_transfer(self): action["res_id"] = pickings.id return action - @api.model - def create(self, vals): - upd_vals = vals.copy() - if upd_vals.get("name", "/") == "/": - upd_vals["name"] = self.env["ir.sequence"].next_by_code("stock.request") - if "order_id" in upd_vals: - order_id = self.env["stock.request.order"].browse(upd_vals["order_id"]) - upd_vals["expected_date"] = order_id.expected_date - else: - upd_vals["expected_date"] = self._get_expected_date() - return super().create(upd_vals) + @api.model_create_multi + def create(self, vals_list): + vals_list_upd = [] + for vals in vals_list: + upd_vals = vals.copy() + if upd_vals.get("name", "/") == "/": + upd_vals["name"] = self.env["ir.sequence"].next_by_code("stock.request") + if "order_id" in upd_vals: + order_id = self.env["stock.request.order"].browse(upd_vals["order_id"]) + upd_vals["expected_date"] = order_id.expected_date + else: + upd_vals["expected_date"] = self._get_expected_date() + vals_list_upd.append(upd_vals) + return super().create(vals_list_upd) def unlink(self): if self.filtered(lambda r: r.state != "draft"): diff --git a/stock_request/stock_request/models/stock_request_abstract.py b/stock_request/models/stock_request_abstract.py similarity index 99% rename from stock_request/stock_request/models/stock_request_abstract.py rename to stock_request/models/stock_request_abstract.py index 32ef1687..afdf7f00 100644 --- a/stock_request/stock_request/models/stock_request_abstract.py +++ b/stock_request/models/stock_request_abstract.py @@ -94,14 +94,14 @@ def _compute_product_qty(self): "res.company", "Company", required=True, default=lambda self: self.env.company ) route_id = fields.Many2one( - "stock.location.route", + "stock.route", string="Route", domain="[('id', 'in', route_ids)]", ondelete="restrict", ) route_ids = fields.Many2many( - "stock.location.route", + "stock.route", string="Routes", compute="_compute_route_ids", readonly=True, diff --git a/stock_request/stock_request/models/stock_request_allocation.py b/stock_request/models/stock_request_allocation.py similarity index 100% rename from stock_request/stock_request/models/stock_request_allocation.py rename to stock_request/models/stock_request_allocation.py diff --git a/stock_request/stock_request/models/stock_request_order.py b/stock_request/models/stock_request_order.py similarity index 100% rename from stock_request/stock_request/models/stock_request_order.py rename to stock_request/models/stock_request_order.py diff --git a/stock_request/stock_request/models/stock_rule.py b/stock_request/models/stock_rule.py similarity index 100% rename from stock_request/stock_request/models/stock_rule.py rename to stock_request/models/stock_rule.py diff --git a/stock_request/stock_request/models/stock_warehouse.py b/stock_request/models/stock_warehouse.py similarity index 100% rename from stock_request/stock_request/models/stock_warehouse.py rename to stock_request/models/stock_warehouse.py diff --git a/stock_request/stock_request/readme/CONFIGURE.rst b/stock_request/readme/CONFIGURE.rst similarity index 100% rename from stock_request/stock_request/readme/CONFIGURE.rst rename to stock_request/readme/CONFIGURE.rst diff --git a/stock_request/stock_request/readme/CONTRIBUTORS.rst b/stock_request/readme/CONTRIBUTORS.rst similarity index 100% rename from stock_request/stock_request/readme/CONTRIBUTORS.rst rename to stock_request/readme/CONTRIBUTORS.rst diff --git a/stock_request/stock_request/readme/DESCRIPTION.rst b/stock_request/readme/DESCRIPTION.rst similarity index 100% rename from stock_request/stock_request/readme/DESCRIPTION.rst rename to stock_request/readme/DESCRIPTION.rst diff --git a/stock_request/stock_request/readme/ROADMAP.rst b/stock_request/readme/ROADMAP.rst similarity index 100% rename from stock_request/stock_request/readme/ROADMAP.rst rename to stock_request/readme/ROADMAP.rst diff --git a/stock_request/stock_request/readme/USAGE.rst b/stock_request/readme/USAGE.rst similarity index 100% rename from stock_request/stock_request/readme/USAGE.rst rename to stock_request/readme/USAGE.rst diff --git a/stock_request/stock_request/security/ir.model.access.csv b/stock_request/security/ir.model.access.csv similarity index 100% rename from stock_request/stock_request/security/ir.model.access.csv rename to stock_request/security/ir.model.access.csv diff --git a/stock_request/stock_request/security/stock_request_security.xml b/stock_request/security/stock_request_security.xml similarity index 100% rename from stock_request/stock_request/security/stock_request_security.xml rename to stock_request/security/stock_request_security.xml diff --git a/stock_request/stock_request/static/description/icon.png b/stock_request/static/description/icon.png similarity index 100% rename from stock_request/stock_request/static/description/icon.png rename to stock_request/static/description/icon.png diff --git a/stock_request/stock_request/static/description/icon.svg b/stock_request/static/description/icon.svg similarity index 100% rename from stock_request/stock_request/static/description/icon.svg rename to stock_request/static/description/icon.svg diff --git a/stock_request/stock_request/static/description/index.html b/stock_request/static/description/index.html similarity index 78% rename from stock_request/stock_request/static/description/index.html rename to stock_request/static/description/index.html index 85a4d563..6060b6ca 100644 --- a/stock_request/stock_request/static/description/index.html +++ b/stock_request/static/description/index.html @@ -1,20 +1,20 @@ - + - + Stock Request