diff --git a/sale_stock_product_recommendation/README.rst b/sale_stock_product_recommendation/README.rst new file mode 100644 index 00000000000..3c4fb8e4e4b --- /dev/null +++ b/sale_stock_product_recommendation/README.rst @@ -0,0 +1,119 @@ +======================================= +Sale Order Product Recommendation Stock +======================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:c6544c813ca2f7f80f0a21fbc87c305cd86395d8843d5e71b8c8d7377c54bcf0 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |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%2Fsale--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/sale-workflow/tree/18.0/sale_stock_product_recommendation + :alt: OCA/sale-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_stock_product_recommendation + :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/sale-workflow&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of the sale order product +recommendator to display stock info. + +This way, you know if you can or not accept the recommendations. + +|List view| |Mobile kanban view| |Mobile form view| + +.. |List view| image:: https://github.com/OCA/sale-workflow/assets/973709/899cdced-2f9f-4248-96c7-c5ebc2ee8527 +.. |Mobile kanban view| image:: https://github.com/OCA/sale-workflow/assets/973709/83ccca33-902f-4fce-b70b-5d8480135113 +.. |Mobile form view| image:: https://github.com/OCA/sale-workflow/assets/973709/3ba17613-d6b6-4d44-8546-1399459a331a + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +1. Go to a draft sale order. +2. Click on *Recommended products*. +3. Configure what you want and click on *Get recommendations*. +4. If applicable, you will see the product stock forecast. + +Known issues / Roadmap +====================== + +- When clicking on *View Forecast* from the wizard, viewing the forecast + and then going back, you go back to the sale order, and not to the + wizard. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Moduon + +Contributors +------------ + +- Jairo Llopis (`Moduon `__) +- David Vidal (`Moduon `__) + +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. + +.. |maintainer-yajo| image:: https://github.com/yajo.png?size=40px + :target: https://github.com/yajo + :alt: yajo +.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px + :target: https://github.com/rafaelbn + :alt: rafaelbn + +Current `maintainers `__: + +|maintainer-yajo| |maintainer-rafaelbn| + +This module is part of the `OCA/sale-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_stock_product_recommendation/__init__.py b/sale_stock_product_recommendation/__init__.py new file mode 100644 index 00000000000..5cb1c49143f --- /dev/null +++ b/sale_stock_product_recommendation/__init__.py @@ -0,0 +1 @@ +from . import wizards diff --git a/sale_stock_product_recommendation/__manifest__.py b/sale_stock_product_recommendation/__manifest__.py new file mode 100644 index 00000000000..b99c8f88964 --- /dev/null +++ b/sale_stock_product_recommendation/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2024 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +{ + "name": "Sale Order Product Recommendation Stock", + "summary": "Display stock info when recommending products to sell", + "version": "18.0.1.0.0", + "development_status": "Alpha", + "category": "Sales/Sales", + "website": "https://github.com/OCA/sale-workflow", + "author": "Moduon, Odoo Community Association (OCA)", + "maintainers": ["yajo", "rafaelbn"], + "license": "AGPL-3", + "auto_install": True, + "depends": ["sale_stock", "sale_order_product_recommendation"], + "data": [ + "wizards/sale_order_recommendation_view.xml", + ], +} diff --git a/sale_stock_product_recommendation/i18n/es.po b/sale_stock_product_recommendation/i18n/es.po new file mode 100644 index 00000000000..199df784e6d --- /dev/null +++ b/sale_stock_product_recommendation/i18n/es.po @@ -0,0 +1,83 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_stock_product_recommendation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-01-23 12:58+0000\n" +"PO-Revision-Date: 2024-01-23 12:59+0000\n" +"Last-Translator: Jairo Llopis \n" +"Language-Team: \n" +"Language: es_ES\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4\n" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__display_qty_widget +msgid "Display Qty Widget" +msgstr "Mostrar widget de cantidad" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__forecast_expected_date +msgid "Forecast Expected Date" +msgstr "Pronóstico de la fecha prevista" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__free_qty_today +msgid "Free Qty Today" +msgstr "Cant. Libre Hoy" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__is_mto +msgid "Is Mto" +msgstr "Es MTO" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__qty_available_today +msgid "Qty Available Today" +msgstr "Cant. Disponible Hoy" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__qty_to_deliver +msgid "Qty To Deliver" +msgstr "Cant. Por Entregar" + +#. module: sale_stock_product_recommendation +#: model:ir.model,name:sale_stock_product_recommendation.model_sale_order_recommendation_line +msgid "Recommended product for current sale order" +msgstr "Producto recomendado para el pedido de ventas actual" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__scheduled_date +msgid "Scheduled Date" +msgstr "Fecha prevista" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__state +msgid "Status" +msgstr "Estado" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__move_ids +msgid "Stock Moves" +msgstr "Movimientos de stock" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__product_uom +msgid "Unit of Measure" +msgstr "Unidad de medida" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__virtual_available_at_date +msgid "Virtual Available At Date" +msgstr "Virtual disponible en la fecha" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__warehouse_id +msgid "Warehouse" +msgstr "Almacén" diff --git a/sale_stock_product_recommendation/i18n/it.po b/sale_stock_product_recommendation/i18n/it.po new file mode 100644 index 00000000000..28f5329540d --- /dev/null +++ b/sale_stock_product_recommendation/i18n/it.po @@ -0,0 +1,82 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_stock_product_recommendation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-25 15:34+0000\n" +"Last-Translator: mymage \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.17\n" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__display_qty_widget +msgid "Display Qty Widget" +msgstr "Mostra procedura guidata q.tà" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__forecast_expected_date +msgid "Forecast Expected Date" +msgstr "Data stimata previsionale" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__free_qty_today +msgid "Free Qty Today" +msgstr "Q.tà libera oggi" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__is_mto +msgid "Is Mto" +msgstr "È MTO" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__qty_available_today +msgid "Qty Available Today" +msgstr "Q.tà disponibile oggi" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__qty_to_deliver +msgid "Qty To Deliver" +msgstr "Q.tà da consegnare" + +#. module: sale_stock_product_recommendation +#: model:ir.model,name:sale_stock_product_recommendation.model_sale_order_recommendation_line +msgid "Recommended product for current sale order" +msgstr "Prodotto consigliato per questo ordine di vendita" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__scheduled_date +msgid "Scheduled Date" +msgstr "Data schedulata" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__state +msgid "Status" +msgstr "Stato" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__move_ids +msgid "Stock Moves" +msgstr "Movimenti di magazzino" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__product_uom +msgid "UoM" +msgstr "UdM" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__virtual_available_at_date +msgid "Virtual Available At Date" +msgstr "Teoricamente disponibile alla data" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__warehouse_id +msgid "Warehouse" +msgstr "Magazzino" diff --git a/sale_stock_product_recommendation/i18n/sale_stock_product_recommendation.pot b/sale_stock_product_recommendation/i18n/sale_stock_product_recommendation.pot new file mode 100644 index 00000000000..27f9771b34f --- /dev/null +++ b/sale_stock_product_recommendation/i18n/sale_stock_product_recommendation.pot @@ -0,0 +1,79 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_stock_product_recommendation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__display_qty_widget +msgid "Display Qty Widget" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__forecast_expected_date +msgid "Forecast Expected Date" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__free_qty_today +msgid "Free Qty Today" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__is_mto +msgid "Is Mto" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__qty_available_today +msgid "Qty Available Today" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__qty_to_deliver +msgid "Qty To Deliver" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model,name:sale_stock_product_recommendation.model_sale_order_recommendation_line +msgid "Recommended product for current sale order" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__scheduled_date +msgid "Scheduled Date" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__state +msgid "Status" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__move_ids +msgid "Stock Moves" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__product_uom +msgid "UoM" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__virtual_available_at_date +msgid "Virtual Available At Date" +msgstr "" + +#. module: sale_stock_product_recommendation +#: model:ir.model.fields,field_description:sale_stock_product_recommendation.field_sale_order_recommendation_line__warehouse_id +msgid "Warehouse" +msgstr "" diff --git a/sale_stock_product_recommendation/pyproject.toml b/sale_stock_product_recommendation/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/sale_stock_product_recommendation/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sale_stock_product_recommendation/readme/CONTRIBUTORS.md b/sale_stock_product_recommendation/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..dd452c4b621 --- /dev/null +++ b/sale_stock_product_recommendation/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Jairo Llopis ([Moduon](https://www.moduon.team/)) +- David Vidal ([Moduon](https://www.moduon.team/)) diff --git a/sale_stock_product_recommendation/readme/DESCRIPTION.md b/sale_stock_product_recommendation/readme/DESCRIPTION.md new file mode 100644 index 00000000000..de269dd7bdd --- /dev/null +++ b/sale_stock_product_recommendation/readme/DESCRIPTION.md @@ -0,0 +1,9 @@ +This module extends the functionality of the sale order product recommendator to display +stock info. + +This way, you know if you can or not accept the recommendations. + + +![List view](https://github.com/OCA/sale-workflow/assets/973709/899cdced-2f9f-4248-96c7-c5ebc2ee8527) +![Mobile kanban view](https://github.com/OCA/sale-workflow/assets/973709/83ccca33-902f-4fce-b70b-5d8480135113) +![Mobile form view](https://github.com/OCA/sale-workflow/assets/973709/3ba17613-d6b6-4d44-8546-1399459a331a) diff --git a/sale_stock_product_recommendation/readme/ROADMAP.md b/sale_stock_product_recommendation/readme/ROADMAP.md new file mode 100644 index 00000000000..26adb1fc40b --- /dev/null +++ b/sale_stock_product_recommendation/readme/ROADMAP.md @@ -0,0 +1,2 @@ +- When clicking on _View Forecast_ from the wizard, viewing the forecast and then going + back, you go back to the sale order, and not to the wizard. diff --git a/sale_stock_product_recommendation/readme/USAGE.md b/sale_stock_product_recommendation/readme/USAGE.md new file mode 100644 index 00000000000..46e46dab3d3 --- /dev/null +++ b/sale_stock_product_recommendation/readme/USAGE.md @@ -0,0 +1,6 @@ +To use this module, you need to: + +1. Go to a draft sale order. +2. Click on *Recommended products*. +3. Configure what you want and click on *Get recommendations*. +4. If applicable, you will see the product stock forecast. diff --git a/sale_stock_product_recommendation/static/description/icon.png b/sale_stock_product_recommendation/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/sale_stock_product_recommendation/static/description/icon.png differ diff --git a/sale_stock_product_recommendation/static/description/index.html b/sale_stock_product_recommendation/static/description/index.html new file mode 100644 index 00000000000..2d127973d4c --- /dev/null +++ b/sale_stock_product_recommendation/static/description/index.html @@ -0,0 +1,455 @@ + + + + + +Sale Order Product Recommendation Stock + + + +
+

Sale Order Product Recommendation Stock

+ + +

Alpha License: AGPL-3 OCA/sale-workflow Translate me on Weblate Try me on Runboat

+

This module extends the functionality of the sale order product +recommendator to display stock info.

+

This way, you know if you can or not accept the recommendations.

+

List view Mobile kanban view Mobile form view

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to a draft sale order.
  2. +
  3. Click on Recommended products.
  4. +
  5. Configure what you want and click on Get recommendations.
  6. +
  7. If applicable, you will see the product stock forecast.
  8. +
+
+
+

Known issues / Roadmap

+
    +
  • When clicking on View Forecast from the wizard, viewing the forecast +and then going back, you go back to the sale order, and not to the +wizard.
  • +
+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Moduon
  • +
+
+
+

Contributors

+ +
+
+

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.

+

Current maintainers:

+

yajo rafaelbn

+

This module is part of the OCA/sale-workflow project on GitHub.

+

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

+
+
+
+ + diff --git a/sale_stock_product_recommendation/wizards/__init__.py b/sale_stock_product_recommendation/wizards/__init__.py new file mode 100644 index 00000000000..d20a79a8b1a --- /dev/null +++ b/sale_stock_product_recommendation/wizards/__init__.py @@ -0,0 +1 @@ +from . import sale_order_recommendation diff --git a/sale_stock_product_recommendation/wizards/sale_order_recommendation.py b/sale_stock_product_recommendation/wizards/sale_order_recommendation.py new file mode 100644 index 00000000000..1ceee84ce21 --- /dev/null +++ b/sale_stock_product_recommendation/wizards/sale_order_recommendation.py @@ -0,0 +1,84 @@ +# Copyright 2024 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) +from odoo import api, fields, models + +GHOST_LINE_DEPS = ( + "price_unit", + "product_id", + "sale_line_id", + "units_included", + "wizard_id.order_id", +) + + +class SaleOrderRecommendationLine(models.TransientModel): + _inherit = "sale.order.recommendation.line" + + # Fields required by qty_at_date_widget, with hardcoded names + display_qty_widget = fields.Boolean(compute="_compute_qty_to_deliver") + forecast_expected_date = fields.Datetime(compute="_compute_qty_at_date") + free_qty_today = fields.Float( + compute="_compute_qty_at_date", digits="Product Unit of Measure" + ) + is_mto = fields.Boolean(compute="_compute_is_mto") + move_ids = fields.One2many(related="sale_line_id.move_ids") + product_uom = fields.Many2one(related="sale_line_id.product_uom", string="UoM") + qty_available_today = fields.Float(compute="_compute_qty_at_date") + qty_to_deliver = fields.Float( + compute="_compute_qty_to_deliver", digits="Product Unit of Measure" + ) + scheduled_date = fields.Datetime(compute="_compute_qty_at_date") + state = fields.Selection(related="wizard_id.order_id.state") + virtual_available_at_date = fields.Float( + compute="_compute_qty_at_date", digits="Product Unit of Measure" + ) + warehouse_id = fields.Many2one(related="wizard_id.order_id.warehouse_id") + + def _ghost_sale_lines(self): + """In-memory sale.order.line equivalents to current recommendations.""" + result = self.env["sale.order.line"] + for line in self: + result += self.env["sale.order.line"].new( + { + "order_id": line.wizard_id.order_id.id, + "price_unit": line.price_unit, + "product_id": line.product_id.id, + "product_uom_qty": line.units_included, + }, + line.sale_line_id, + ) + return result + + @api.depends( + "sale_line_id.display_qty_widget", + "sale_line_id.qty_delivered", + *GHOST_LINE_DEPS, + ) + def _compute_qty_to_deliver(self): + """Compute the visibility of the inventory widget.""" + for line, ghost_line in zip(self, self._ghost_sale_lines(), strict=True): + line.qty_to_deliver = ghost_line.qty_to_deliver + line.display_qty_widget = ghost_line.display_qty_widget + + @api.depends( + "sale_line_id.forecast_expected_date", + "sale_line_id.free_qty_today", + "sale_line_id.qty_available_today", + "sale_line_id.scheduled_date", + "sale_line_id.virtual_available_at_date", + *GHOST_LINE_DEPS, + ) + def _compute_qty_at_date(self): + """Compute the quantity forecasted of product at delivery date.""" + for line, ghost_line in zip(self, self._ghost_sale_lines(), strict=True): + line.forecast_expected_date = ghost_line.forecast_expected_date + line.free_qty_today = ghost_line.free_qty_today + line.qty_available_today = ghost_line.qty_available_today + line.scheduled_date = ghost_line.scheduled_date + line.virtual_available_at_date = ghost_line.virtual_available_at_date + + @api.depends("sale_line_id.is_mto", *GHOST_LINE_DEPS) + def _compute_is_mto(self): + """Compute if the product is made to order.""" + for line, ghost_line in zip(self, self._ghost_sale_lines(), strict=True): + line.is_mto = ghost_line.is_mto diff --git a/sale_stock_product_recommendation/wizards/sale_order_recommendation_view.xml b/sale_stock_product_recommendation/wizards/sale_order_recommendation_view.xml new file mode 100644 index 00000000000..e54cc07c93b --- /dev/null +++ b/sale_stock_product_recommendation/wizards/sale_order_recommendation_view.xml @@ -0,0 +1,82 @@ + + + + + Stock info in recommendations + sale.order.recommendation + + + 30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + +
+
+