[ADD] stock_replenishment_mrp_bom_selection: New module

TT48984
This commit is contained in:
pilarvargas-tecnativa
2024-05-03 13:38:30 +02:00
parent 08bb448635
commit af7bd8755c
22 changed files with 1386 additions and 0 deletions

View File

@@ -0,0 +1 @@
../../../../stock_replenishment_mrp_bom_selection

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -0,0 +1,100 @@
=====================================
Stock Replenishment MRP BoM Selection
=====================================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ea77f5ab29a72f3762a1a209c394d7f956762b97b0945b4d432e6f979ac0a109
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fmanufacture-lightgray.png?logo=github
:target: https://github.com/OCA/manufacture/tree/15.0/stock_replenishment_mrp_bom_selection
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-stock_replenishment_mrp_bom_selection
: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/manufacture&target_branch=15.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module adds a wizard for replenishment cases that have the product manufacturing route
marked as a route. This wizard allows to establish which quantity to create and with which
bill of materials to manufacture it.
**Table of contents**
.. contents::
:local:
Use Cases / Context
===================
You may have several ways to manufacture a product, using different raw materials, and
for deciding which one to choose, you need to have all the information available in
the same screen (raw material availability, production times, etc).
This module eases this through a wizard displaying the information and allowing to select
discrete quantities to produce for each combination.
Usage
=====
# Go to "Inventory / Operations / Replenishment"
# Create or use a registry that has the manufacturing route defined
# Click on "Order once", the wizard should open
# Set the quantity and the list with which you want to produce this quantity of product.
# On confirmation, the relevant production orders will be created.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/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 <https://github.com/OCA/manufacture/issues/new?body=module:%20stock_replenishment_mrp_bom_selection%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Tecnativa
Contributors
~~~~~~~~~~~~
* `Tecnativa <https://www.tecnativa.com>`_:
* Pedro Baeza
* Pilar Vargas
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/manufacture <https://github.com/OCA/manufacture/tree/15.0/stock_replenishment_mrp_bom_selection>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1,2 @@
from . import models
from . import wizard

View File

@@ -0,0 +1,17 @@
# Copyright 2024 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Stock Replenishment MRP BoM Selection",
"version": "15.0.1.0.0",
"license": "AGPL-3",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"depends": ["stock", "mrp"],
"data": [
"security/ir.model.access.csv",
"wizard/material_availability_wizard_views.xml",
"wizard/stock_warehouse_orderpoint_replenish_wizard_views.xml",
],
"installable": True,
"development_status": "Beta",
}

View File

@@ -0,0 +1,209 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_replenishment_mrp_bom_selection
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-15 07:50+0000\n"
"PO-Revision-Date: 2024-05-15 09:53+0200\n"
"Last-Translator: \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.0.1\n"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__bom_id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__bom_id
msgid "Bill of Materials"
msgstr "Lista de materiales"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__bom_line_ids
msgid "Bom Line"
msgstr "Línea de lista de materiales"
#. module: stock_replenishment_mrp_bom_selection
#: model_terms:ir.ui.view,arch_db:stock_replenishment_mrp_bom_selection.material_availability_wizard_view
msgid "Close"
msgstr "Cerrar"
#. module: stock_replenishment_mrp_bom_selection
#: model_terms:ir.ui.view,arch_db:stock_replenishment_mrp_bom_selection.stock_warehouse_orderpoint_replenish_wizard_view_form
msgid "Confirm"
msgstr "Confirmar"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__create_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__create_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__create_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__create_uid
msgid "Created by"
msgstr "Creado por"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__create_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__create_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__create_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__create_date
msgid "Created on"
msgstr "Creado en"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,help:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__product_uom_id
msgid "Default unit of measure used for all stock operations."
msgstr "Unidad de medida por defecto utilizada para todas las operaciones de stock."
#. module: stock_replenishment_mrp_bom_selection
#: model_terms:ir.ui.view,arch_db:stock_replenishment_mrp_bom_selection.stock_warehouse_orderpoint_replenish_wizard_view_form
msgid "Discard"
msgstr "Descartar"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__display_name
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__display_name
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__display_name
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__display_name
msgid "Display Name"
msgstr "Nombre mostrado"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__id
msgid "ID"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard____last_update
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard____last_update
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line____last_update
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard____last_update
msgid "Last Modified on"
msgstr "Última modificación en"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__write_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__write_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__write_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__write_uid
msgid "Last Updated by"
msgstr "Última actualización por"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__write_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__write_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__write_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__write_date
msgid "Last Updated on"
msgstr "Última actualización en"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model,name:stock_replenishment_mrp_bom_selection.model_bom_line_wizard
msgid "Manufacture BOM line"
msgstr "Linea de fabricación de la lista de materiales"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model,name:stock_replenishment_mrp_bom_selection.model_material_availability_wizard
msgid "Material Availability Wizard"
msgstr "Asistente de disponibilidad de material"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model,name:stock_replenishment_mrp_bom_selection.model_material_availability_wizard_line
msgid "Material Availability Wizard Line"
msgstr "Línea del Asistente de Disponibilidad de Material"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__max_production_qty
msgid "Maximum Production Quantity"
msgstr "Máxima Cantidad de Producción"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model,name:stock_replenishment_mrp_bom_selection.model_stock_warehouse_orderpoint
msgid "Minimum Inventory Rule"
msgstr "Regla de inventario mínimo"
#. module: stock_replenishment_mrp_bom_selection
#: code:addons/stock_replenishment_mrp_bom_selection/wizard/stock_warehouse_orderpoint_replenish_wizard.py:0
#, python-format
msgid "Nothing to produce."
msgstr "Nada para producir."
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__orderpoint_id
msgid "Orderpoint"
msgstr "Punto de pedido"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__product_id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__product_id
msgid "Product"
msgstr "Producto"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__product_tmpl_id
msgid "Product Template"
msgstr "Plantilla de producto"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__production_time
#, fuzzy
#| msgid "Product Template"
msgid "Production Time"
msgstr "Plantilla de producto"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__product_ids
#, fuzzy
#| msgid "Product"
msgid "Products"
msgstr "Producto"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__product_qty_available
msgid "Quantity Available"
msgstr "Cantidad disponible"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__qty_to_produce
msgid "Quantity to produce"
msgstr "Cantidad a producir"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__replenish_wizard_id
msgid "Replenish Wizard"
msgstr "Asistente de Reposición"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model,name:stock_replenishment_mrp_bom_selection.model_stock_warehouse_orderpoint_replenish_wizard
msgid "Stock warehouse orderpoint replenish wizard"
msgstr "Asistente de reposición de pedidos de almacén"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__qty_to_order
msgid "To Order"
msgstr "A producir"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__total_qty_to_produce
#, fuzzy
#| msgid "Quantity to produce"
msgid "Total Quantity to Produce"
msgstr "Cantidad a producir"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__product_uom_id
msgid "Unit of Measure"
msgstr "Unidad de medida"
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__wizard_id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__wizard_id
msgid "Wizard"
msgstr "Asistente"

View File

@@ -0,0 +1,201 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_replenishment_mrp_bom_selection
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-15 07:50+0000\n"
"PO-Revision-Date: 2024-05-15 07:50+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_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__bom_id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__bom_id
msgid "Bill of Materials"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__bom_line_ids
msgid "Bom Line"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model_terms:ir.ui.view,arch_db:stock_replenishment_mrp_bom_selection.material_availability_wizard_view
msgid "Close"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model_terms:ir.ui.view,arch_db:stock_replenishment_mrp_bom_selection.stock_warehouse_orderpoint_replenish_wizard_view_form
msgid "Confirm"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__create_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__create_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__create_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__create_uid
msgid "Created by"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__create_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__create_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__create_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__create_date
msgid "Created on"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,help:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__product_uom_id
msgid "Default unit of measure used for all stock operations."
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model_terms:ir.ui.view,arch_db:stock_replenishment_mrp_bom_selection.stock_warehouse_orderpoint_replenish_wizard_view_form
msgid "Discard"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__display_name
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__display_name
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__display_name
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__display_name
msgid "Display Name"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__id
msgid "ID"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard____last_update
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard____last_update
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line____last_update
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard____last_update
msgid "Last Modified on"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__write_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__write_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__write_uid
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__write_uid
msgid "Last Updated by"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__write_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__write_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__write_date
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__write_date
msgid "Last Updated on"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model,name:stock_replenishment_mrp_bom_selection.model_bom_line_wizard
msgid "Manufacture BOM line"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model,name:stock_replenishment_mrp_bom_selection.model_material_availability_wizard
msgid "Material Availability Wizard"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model,name:stock_replenishment_mrp_bom_selection.model_material_availability_wizard_line
msgid "Material Availability Wizard Line"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__max_production_qty
msgid "Maximum Production Quantity"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model,name:stock_replenishment_mrp_bom_selection.model_stock_warehouse_orderpoint
msgid "Minimum Inventory Rule"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: code:addons/stock_replenishment_mrp_bom_selection/wizard/stock_warehouse_orderpoint_replenish_wizard.py:0
#, python-format
msgid "Nothing to produce."
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__orderpoint_id
msgid "Orderpoint"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__product_id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__product_id
msgid "Product"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__product_tmpl_id
msgid "Product Template"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__production_time
msgid "Production Time"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__product_ids
msgid "Products"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__product_qty_available
msgid "Quantity Available"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__qty_to_produce
msgid "Quantity to produce"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard__replenish_wizard_id
msgid "Replenish Wizard"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model,name:stock_replenishment_mrp_bom_selection.model_stock_warehouse_orderpoint_replenish_wizard
msgid "Stock warehouse orderpoint replenish wizard"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__qty_to_order
msgid "To Order"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_stock_warehouse_orderpoint_replenish_wizard__total_qty_to_produce
msgid "Total Quantity to Produce"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__product_uom_id
msgid "Unit of Measure"
msgstr ""
#. module: stock_replenishment_mrp_bom_selection
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_bom_line_wizard__wizard_id
#: model:ir.model.fields,field_description:stock_replenishment_mrp_bom_selection.field_material_availability_wizard_line__wizard_id
msgid "Wizard"
msgstr ""

View File

@@ -0,0 +1 @@
from . import stock_warehouse_orderpoint

View File

@@ -0,0 +1,31 @@
# Copyright 2024 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class StockWarehouseOrderpoint(models.Model):
_inherit = "stock.warehouse.orderpoint"
def action_replenish(self):
# The wizard is only necessary if the production route is marked and the product
# has defined BOMs.
if (
self.route_id == self.env.ref("mrp.route_warehouse0_manufacture")
and self.product_id.bom_ids
):
# In to use the info button, it is necessary to create the wizard
replenish_wizard = self.env[
"stock.warehouse.orderpoint.replenish.wizard"
].create({"orderpoint_id": self.id})
replenish_wizard_id = replenish_wizard.id
return {
"name": "Replenish",
"type": "ir.actions.act_window",
"view_mode": "form",
"res_model": "stock.warehouse.orderpoint.replenish.wizard",
"res_id": replenish_wizard_id,
"target": "new",
"context": {"default_orderpoint_id": self.id},
}
return super().action_replenish()

View File

@@ -0,0 +1,6 @@
You may have several ways to manufacture a product, using different raw materials, and
for deciding which one to choose, you need to have all the information available in
the same screen (raw material availability, production times, etc).
This module eases this through a wizard displaying the information and allowing to select
discrete quantities to produce for each combination.

View File

@@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`_:
* Pedro Baeza
* Pilar Vargas

View File

@@ -0,0 +1,3 @@
This module adds a wizard for replenishment cases that have the product manufacturing route
marked as a route. This wizard allows to establish which quantity to create and with which
bill of materials to manufacture it.

View File

@@ -0,0 +1,5 @@
# Go to "Inventory / Operations / Replenishment"
# Create or use a registry that has the manufacturing route defined
# Click on "Order once", the wizard should open
# Set the quantity and the list with which you want to produce this quantity of product.
# On confirmation, the relevant production orders will be created.

View File

@@ -0,0 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
stock_replenishment_mrp_bom_selection.access_stock_warehouse_orderpoint_replenish_wizard,access_stock_warehouse_orderpoint_replenish_wizard,stock_replenishment_mrp_bom_selection.model_stock_warehouse_orderpoint_replenish_wizard,stock.group_stock_manager,1,1,1,1
stock_replenishment_mrp_bom_selection.access_bom_line_wizard,access_bom_line_wizard,stock_replenishment_mrp_bom_selection.model_bom_line_wizard,stock.group_stock_manager,1,1,1,1
stock_replenishment_mrp_bom_selection.access_material_availability_wizard,access_material_availability_wizard,stock_replenishment_mrp_bom_selection.model_material_availability_wizard,stock.group_stock_manager,1,1,1,1
stock_replenishment_mrp_bom_selection.access_material_availability_wizard_line,access_material_availability_wizard_line,stock_replenishment_mrp_bom_selection.model_material_availability_wizard_line,stock.group_stock_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 stock_replenishment_mrp_bom_selection.access_stock_warehouse_orderpoint_replenish_wizard access_stock_warehouse_orderpoint_replenish_wizard stock_replenishment_mrp_bom_selection.model_stock_warehouse_orderpoint_replenish_wizard stock.group_stock_manager 1 1 1 1
3 stock_replenishment_mrp_bom_selection.access_bom_line_wizard access_bom_line_wizard stock_replenishment_mrp_bom_selection.model_bom_line_wizard stock.group_stock_manager 1 1 1 1
4 stock_replenishment_mrp_bom_selection.access_material_availability_wizard access_material_availability_wizard stock_replenishment_mrp_bom_selection.model_material_availability_wizard stock.group_stock_manager 1 1 1 1
5 stock_replenishment_mrp_bom_selection.access_material_availability_wizard_line access_material_availability_wizard_line stock_replenishment_mrp_bom_selection.model_material_availability_wizard_line stock.group_stock_manager 1 1 1 1

View File

@@ -0,0 +1,445 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Stock Replenishment MRP BoM Selection</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="stock-replenishment-mrp-bom-selection">
<h1 class="title">Stock Replenishment MRP BoM Selection</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ea77f5ab29a72f3762a1a209c394d7f956762b97b0945b4d432e6f979ac0a109
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/manufacture/tree/15.0/stock_replenishment_mrp_bom_selection"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-stock_replenishment_mrp_bom_selection"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/manufacture&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds a wizard for replenishment cases that have the product manufacturing route
marked as a route. This wizard allows to establish which quantity to create and with which
bill of materials to manufacture it.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#use-cases-context" id="toc-entry-1">Use Cases / Context</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="use-cases-context">
<h1><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h1>
<p>You may have several ways to manufacture a product, using different raw materials, and
for deciding which one to choose, you need to have all the information available in
the same screen (raw material availability, production times, etc).</p>
<p>This module eases this through a wizard displaying the information and allowing to select
discrete quantities to produce for each combination.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p># Go to “Inventory / Operations / Replenishment”
# Create or use a registry that has the manufacturing route defined
# Click on “Order once”, the wizard should open
# Set the quantity and the list with which you want to produce this quantity of product.
# On confirmation, the relevant production orders will be created.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/manufacture/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20stock_replenishment_mrp_bom_selection%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Pedro Baeza</li>
<li>Pilar Vargas</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/15.0/stock_replenishment_mrp_bom_selection">OCA/manufacture</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1 @@
from . import test_stock_replenishment_mrp_bom_selection

View File

@@ -0,0 +1,72 @@
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import exceptions
from odoo.tests.common import Form, TransactionCase
class TestStockReplenishmentMrpBomSelection(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
# Product with bill of materials
cls.product = cls._create_product_template(cls, "Test product")
cls.product_c1 = cls._create_product_template(cls, "Test c1")
cls.product_c2 = cls._create_product_template(cls, "Test c2")
cls.product_c3 = cls._create_product_template(cls, "Test c3")
cls.product_c4 = cls._create_product_template(cls, "Test c4")
cls.mrp_bom_1 = cls._create_mrp_bom(cls, cls.product_c1, cls.product_c2)
cls.mrp_bom_2 = cls._create_mrp_bom(cls, cls.product_c3, cls.product_c4)
cls.manufacturing_route_id = cls.env.ref("mrp.route_warehouse0_manufacture")
def _create_product_template(self, name):
product_form = Form(self.env["product.template"])
product_form.name = name
product_form.detailed_type = "product"
return product_form.save()
def _create_mrp_bom(self, component1, component2):
mrp_bom_form = Form(self.env["mrp.bom"])
mrp_bom_form.product_tmpl_id = self.product
with mrp_bom_form.bom_line_ids.new() as line_form:
line_form.product_id = component1.product_variant_ids[0]
with mrp_bom_form.bom_line_ids.new() as line_form:
line_form.product_id = component2.product_variant_ids[0]
return mrp_bom_form.save()
def test_stock_replenishment_mrp_bom_selection(self):
orderpoint_form = Form(
self.env["stock.warehouse.orderpoint"],
view="stock.view_warehouse_orderpoint_tree_editable",
)
orderpoint_form.product_id = self.product.product_variant_ids[0]
orderpoint_form.qty_to_order = 500
order = orderpoint_form.save()
# If no route is set it will not open the wizard
with self.assertRaises(exceptions.RedirectWarning):
order.action_replenish()
# If the defined route is manufacturing it will open the wizard.
order.route_id = self.manufacturing_route_id
action = order.action_replenish()
wizard = self.env[action["res_model"]].browse(action["res_id"])
self.assertEqual(wizard.orderpoint_id, order)
self.assertEqual(len(wizard.product_id.bom_ids), 2)
self.assertEqual(wizard.qty_to_order, 500)
# Have 100 produced with each production list, finally there should be 300 left
# to be produced.
wizard.bom_line_ids[0].qty_to_produce = 100
wizard.bom_line_ids[1].qty_to_produce = 100
wizard.action_confirm()
self.assertEqual(order.qty_to_order, 300)
# Check that 2 production orders have been created.
mrp_production_orders = self.env["mrp.production"].search(
[("product_id", "=", self.product.product_variant_ids[0].id)]
)
self.assertEqual(len(mrp_production_orders), 2)
# Check that all the products have been added to the production orders.
mrp_bom_1_product_ids = self.mrp_bom_1.bom_line_ids.product_id.ids
mrp_bom_2_product_ids = self.mrp_bom_2.bom_line_ids.product_id.ids
production_product_ids = mrp_production_orders.move_raw_ids.product_id.ids
for product_id in mrp_bom_1_product_ids:
self.assertIn(product_id, production_product_ids)
for product_id in mrp_bom_2_product_ids:
self.assertIn(product_id, production_product_ids)

View File

@@ -0,0 +1,2 @@
from . import material_availability_wizard
from . import stock_warehouse_orderpoint_replenish_wizard

View File

@@ -0,0 +1,59 @@
# Copyright 2024 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class MaterialAvailabilityWizard(models.TransientModel):
_name = "material.availability.wizard"
_description = "Material Availability Wizard"
replenish_wizard_id = fields.Many2one("stock.warehouse.orderpoint.replenish.wizard")
bom_id = fields.Many2one("mrp.bom", string="Bill of Materials")
product_ids = fields.One2many(
comodel_name="material.availability.wizard.line",
inverse_name="wizard_id",
string="Products",
compute="_compute_product_ids",
store=True,
readonly=False,
)
@api.depends("bom_id")
def _compute_product_ids(self):
for wizard in self:
lines_vals = []
for line in wizard.bom_id.bom_line_ids:
lines_vals.append(
(
0,
0,
{
"product_id": line.product_id.id,
"product_qty_available": line.product_id.qty_available,
},
)
)
wizard.product_ids = lines_vals
def action_close(self):
return {
"name": "Replenish",
"type": "ir.actions.act_window",
"view_mode": "form",
"res_model": "stock.warehouse.orderpoint.replenish.wizard",
"res_id": self.replenish_wizard_id.id,
"target": "new",
"context": {
"default_orderpoint_id": self.replenish_wizard_id.orderpoint_id.id
},
}
class MaterialAvailabilityWizardLine(models.TransientModel):
_name = "material.availability.wizard.line"
_description = "Material Availability Wizard Line"
wizard_id = fields.Many2one("material.availability.wizard")
product_id = fields.Many2one("product.product", string="Product")
product_qty_available = fields.Float(string="Quantity Available")

View File

@@ -0,0 +1,28 @@
<odoo>
<record id="material_availability_wizard_view" model="ir.ui.view">
<field name="name">material.availability.wizard.view</field>
<field name="model">material.availability.wizard</field>
<field name="arch" type="xml">
<form>
<group>
<field name="bom_id" invisible="1" />
<field name="replenish_wizard_id" invisible="1" />
<field name="product_ids" nolabel="1" colspan="2">
<tree create="0" delete="0">
<field name="product_id" />
<field name="product_qty_available" />
</tree>
</field>
</group>
<footer>
<button
string="Close"
class="btn-secondary"
type="object"
name="action_close"
/>
</footer>
</form>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,133 @@
# Copyright 2024 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from odoo.tools import float_is_zero
class StockWarehouseOrderpointReplenishWizard(models.TransientModel):
_name = "stock.warehouse.orderpoint.replenish.wizard"
_description = "Stock warehouse orderpoint replenish wizard"
orderpoint_id = fields.Many2one("stock.warehouse.orderpoint")
qty_to_order = fields.Float(related="orderpoint_id.qty_to_order")
product_id = fields.Many2one("product.product", related="orderpoint_id.product_id")
product_tmpl_id = fields.Many2one(
"product.template", related="product_id.product_tmpl_id"
)
total_qty_to_produce = fields.Float(
compute="_compute_total_qty_to_produce",
string="Total Quantity to Produce",
)
qty_remaining_to_produce = fields.Float(
compute="_compute_qty_remaining_to_produce",
string="Quantity Remaining to Produce",
store=True,
)
bom_line_ids = fields.One2many(
comodel_name="bom.line.wizard",
inverse_name="wizard_id",
compute="_compute_bom_line_ids",
store=True,
readonly=False,
)
@api.depends("bom_line_ids.qty_to_produce")
def _compute_total_qty_to_produce(self):
for wizard in self:
wizard.total_qty_to_produce = sum(
wizard.bom_line_ids.mapped("qty_to_produce")
)
@api.depends("total_qty_to_produce", "qty_to_order")
def _compute_qty_remaining_to_produce(self):
for wizard in self:
wizard.qty_remaining_to_produce = (
wizard.qty_to_order - wizard.total_qty_to_produce
)
@api.depends("orderpoint_id")
def _compute_bom_line_ids(self):
self.bom_line_ids = None
lines_vals = []
boms = self.product_id.bom_ids.filtered(
lambda x: not x.product_id or x.product_id == self.product_id
)
for line in boms:
lines_vals.append(
(
0,
0,
{
"wizard_id": self.id,
"bom_id": line.id,
},
)
)
self.bom_line_ids = lines_vals
def action_confirm(self):
pd = self.env["decimal.precision"].precision_get("Product Unit of Measure")
if float_is_zero(self.total_qty_to_produce, precision_digits=pd):
raise UserError(_("Nothing to produce."))
for line in self.bom_line_ids.filtered(lambda x: x.qty_to_produce > 0):
self.orderpoint_id.qty_to_order = line.qty_to_produce
self.orderpoint_id.bom_id = line.bom_id
self.orderpoint_id._procure_orderpoint_confirm(company_id=self.env.company)
self.orderpoint_id.bom_id = False
self.orderpoint_id.qty_to_order = self.qty_remaining_to_produce
return True
class BomLineWizard(models.TransientModel):
_name = "bom.line.wizard"
_description = "Manufacture BOM line"
wizard_id = fields.Many2one(
comodel_name="stock.warehouse.orderpoint.replenish.wizard"
)
bom_id = fields.Many2one("mrp.bom", string="Bill of Materials")
qty_to_produce = fields.Float(string="Quantity to produce")
max_production_qty = fields.Float(
string="Maximum Production Quantity", compute="_compute_max_production_qty"
)
product_uom_id = fields.Many2one(
comodel_name="uom.uom",
related="bom_id.product_tmpl_id.uom_id",
readonly=True,
)
production_time = fields.Float(compute="_compute_production_time")
@api.depends("bom_id")
def _compute_max_production_qty(self):
for line in self:
max_qty = float("inf")
for bom_line in line.bom_id.bom_line_ids:
available_qty = bom_line.product_id.qty_available / bom_line.product_qty
if available_qty < 0:
max_qty = 0
break
max_qty = min(max_qty, available_qty)
line.max_production_qty = max_qty
@api.depends("bom_id")
def _compute_production_time(self):
for line in self:
production_time = sum(
operation.time_cycle for operation in line.bom_id.operation_ids
)
line.production_time = production_time
def action_material_availability_popup(self):
return {
"type": "ir.actions.act_window",
"name": "Availability of raw materials",
"res_model": "material.availability.wizard",
"view_mode": "form",
"target": "new",
"context": {
"default_bom_id": self.bom_id.id,
"default_replenish_wizard_id": self.wizard_id.id,
},
}

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record
id="stock_warehouse_orderpoint_replenish_wizard_view_form"
model="ir.ui.view"
>
<field name="name">stock.warehouse.orderpoint.replenish.wizard.view.form</field>
<field name="model">stock.warehouse.orderpoint.replenish.wizard</field>
<field name="arch" type="xml">
<form>
<group>
<group>
<field name="qty_to_order" readonly="1" />
</group>
<field name="orderpoint_id" invisible="1" />
<field name="product_id" invisible="1" />
<field name="product_tmpl_id" invisible="1" />
<field name="total_qty_to_produce" invisible="1" />
<field name="bom_line_ids" nolabel="1" colspan="2">
<tree editable="bottom" create="0" delete="0">
<field name="bom_id" readonly="1" />
<field name="max_production_qty" />
<field name="product_uom_id" nolabel="1" />
<field name="production_time" widget="float_time" />
<button
name="action_material_availability_popup"
type="object"
icon="fa-info-circle"
/>
<field name="qty_to_produce" />
</tree>
</field>
<group class="oe_subtotal_footer">
<field name="qty_remaining_to_produce" />
</group>
</group>
<footer>
<button
type="object"
name="action_confirm"
string="Confirm"
class="btn btn-primary"
data-hotkey="q"
/>
<button
special="cancel"
string="Discard"
class="btn btn-secondary"
data-hotkey="z"
/>
</footer>
</form>
</field>
</record>
</odoo>