Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
727e058
[13.0][ADD] stock_request_mrp
HviorForgeFlow Mar 12, 2020
f8b3b60
[FIX+IMP] Update dotfiles + switch to GH actions
pedrobaeza May 28, 2022
cd71b16
[MIG] stock_request_mrp: Migration to 15.0
JoelZilli Sep 1, 2022
4879407
[FIX] stock_request_mrp: Avoid copying the relationship to mrp.produc…
victoralmau Jan 24, 2023
265f878
[IMP] stock_request_mrp: Refactor tests
victoralmau Oct 21, 2022
48bfa23
[IMP] stock_request: Set with cancelled state the stock moves that ar…
victoralmau Feb 22, 2023
eb036b0
[FIX] stock_request_mrp: Change .read() to _for_xml_id()
victoralmau Mar 8, 2023
209ef83
[IMP] stock_request_mrp: Change invisible attr of the action action_v…
victoralmau Aug 28, 2023
0017cce
[IMP] stock_request_mrp: Add _get_stock_requests() method to get all …
victoralmau Aug 28, 2023
6388190
[FIX] stock_request_mrp: Change to the correct icon
victoralmau Sep 8, 2023
1f3a0d5
Added translation using Weblate (Spanish)
Ivorra78 Nov 11, 2023
ec0fd4b
Added translation using Weblate (Italian)
mymage Dec 15, 2023
b5ef1f8
[IMP] stock_request_mrp: pre-commit stuff
victoralmau Mar 25, 2024
64c191c
[MIG] stock_request_mrp: Migration to 16.0
victoralmau Mar 25, 2024
b62ddff
[UPD] Update stock_request_mrp.pot
Mar 26, 2024
6fc1ccc
Update translation files
weblate Mar 26, 2024
902c940
[FIX] stock_request_mrp: Change setUp() to setUpClass()
victoralmau Mar 27, 2024
02e920d
[BOT] post-merge updates
OCA-git-bot Mar 27, 2024
346c94b
[IMP] stock_request_mrp: pre-commit auto fixes
AnaisLForgeFlow May 20, 2024
ff5e8d7
[MIG] stock_request_mrp: Migration to 17.0
AnaisLForgeFlow May 23, 2024
6f45114
[UPD] Update stock_request_mrp.pot
Jun 11, 2024
53b63c4
[BOT] post-merge updates
OCA-git-bot Jun 11, 2024
085f0e2
[UPD] stock_request_mrp: explicitly assign maintainers
LoisRForgeFlow Nov 5, 2024
f17e22b
[BOT] post-merge updates
OCA-git-bot Nov 5, 2024
817dd72
[MIG] stock_request_mrp: Migration to 18.0
lef-adhoc Nov 29, 2024
25bb817
[UPD] Update stock_request_mrp.pot
Mar 31, 2025
01d95b7
[BOT] post-merge updates
OCA-git-bot Mar 31, 2025
d530218
[FIX] stock_request_mrp: Correct default_location_id reference in con…
carlos-lopez-tecnativa Apr 8, 2025
5609fb5
[MIG] stock_request_mrp: Migration to 19.0
kirca Jan 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions stock_request_mrp/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=================
Stock Request MRP
=================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:26e2c33578f4412cdccfcb7b146db45355a59c5500002207026dc703ff12d8da
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-LGPL--3-blue.png
: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--request-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-request/tree/19.0/stock_request_mrp
: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-request-19-0/stock-logistics-request-19-0-stock_request_mrp
: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-request&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows users to be able to display Manufacturing Orders that
have been created as a consequence of Stock Requests.

**Table of contents**

.. contents::
:local:

Usage
=====

In case that the confirmation of the Stock Request results in an
immediate Manufacturing Order, the user will be able to display the MO's
from the Stock Request form view.

Navigate to Stock Requests and create a new stock request. Upon
confirmation of the stock request, the system will automatically
generate the corresponding manufacturing order. View and manage the
generated manufacturing orders directly from the stock request record or
through Manufacturing.

Known issues / Roadmap
======================



Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-request/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/stock-logistics-request/issues/new?body=module:%20stock_request_mrp%0Aversion:%2019.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
-------

* ForgeFlow

Contributors
------------

- Héctor Villarreal <hector.villarreal@forgeflow.com>.

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-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px
:target: https://github.com/LoisRForgeFlow
:alt: LoisRForgeFlow
.. |maintainer-etobella| image:: https://github.com/etobella.png?size=40px
:target: https://github.com/etobella
:alt: etobella

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-LoisRForgeFlow| |maintainer-etobella|

This module is part of the `OCA/stock-logistics-request <https://github.com/OCA/stock-logistics-request/tree/19.0/stock_request_mrp>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions stock_request_mrp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import post_init_hook
23 changes: 23 additions & 0 deletions stock_request_mrp/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2017-24 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

{
"name": "Stock Request MRP",
"summary": "Manufacturing request for stock",
"version": "19.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/OCA/stock-logistics-request",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"maintainers": ["LoisRForgeFlow", "etobella"],
"category": "Warehouse Management",
"depends": ["stock_request", "mrp"],
"data": [
"security/ir.model.access.csv",
"views/stock_request_views.xml",
"views/stock_request_order_views.xml",
"views/mrp_production_views.xml",
],
"installable": True,
"auto_install": True,
"post_init_hook": "post_init_hook",
}
73 changes: 73 additions & 0 deletions stock_request_mrp/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright 2020-24 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

import logging

from odoo import SUPERUSER_ID, api

logger = logging.getLogger(__name__)


def post_init_hook(env):
"""
The objective of this hook is to link existing MOs
coming from a Stock Request.
"""
logger.info("Linking existing MOs coming from a Stock Request")
link_existing_mos_to_stock_request(env)


def link_existing_mos_to_stock_request(env):
env = api.Environment(env.cr, SUPERUSER_ID, dict())
stock_request_obj = env["stock.request"]
stock_request_order_obj = env["stock.request.order"]
stock_request_allocation_obj = env["stock.request.allocation"]
mrp_production_obj = env["mrp.production"]
mos_with_sr = mrp_production_obj.search([("origin", "ilike", "SR/%")])
logger.info(f"Linking {len(mos_with_sr)} MOs records")
stock_requests = stock_request_obj.search(
[("name", "in", [mo.origin for mo in mos_with_sr])]
)
for mo in mos_with_sr:
stock_request = stock_requests.filtered(lambda x, mo=mo: x.name == mo.origin)
if stock_request:
# Link SR to MO
mo.stock_request_ids = [(6, 0, stock_request.ids)]
logger.info(f"MO {mo.name} linked to SR {stock_request.name}")
if (
not stock_request_allocation_obj.search(
[("stock_request_id", "=", stock_request.id)]
)
and mo.state != "cancel"
):
# Create allocation for finish move
logger.info(f"Create allocation for {stock_request.name}")
mo.move_finished_ids[0].allocation_ids = [
(
0,
0,
{
"stock_request_id": request.id,
"requested_product_uom_qty": request.product_qty,
},
)
for request in mo.stock_request_ids
]

# Update allocations
logger.info(f"Updating Allocations for SR {stock_request.name}")
for ml in mo.finished_move_line_ids.filtered(
lambda m: m.exists() and m.move_id.allocation_ids
):
quantity = ml.product_uom_id._compute_quantity(
ml.quantity, ml.product_id.uom_id
)
to_allocate_qty = ml.quantity
for allocation in ml.move_id.allocation_ids:
if allocation.open_product_qty:
allocated_qty = min(allocation.open_product_qty, quantity)
allocation.allocated_product_qty += allocated_qty
to_allocate_qty -= allocated_qty
stock_request.check_done()
# Update production_ids from SROs
stock_request_order_obj.search([])._compute_production_ids()
74 changes: 74 additions & 0 deletions stock_request_mrp/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_request_mrp
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-11 18:36+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\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: stock_request_mrp
#: model_terms:ir.ui.view,arch_db:stock_request_mrp.stock_request_order_form
#: model_terms:ir.ui.view,arch_db:stock_request_mrp.view_stock_request_form
msgid "MOs"
msgstr "MOs"

#. module: stock_request_mrp
#: model:ir.model.fields,field_description:stock_request_mrp.field_stock_request__production_ids
#: model:ir.model.fields,field_description:stock_request_mrp.field_stock_request_order__production_ids
msgid "Manufacturing Orders"
msgstr "Órdenes de Manufacturación"

#. module: stock_request_mrp
#: model:ir.model.fields,field_description:stock_request_mrp.field_stock_request__production_count
#: model:ir.model.fields,field_description:stock_request_mrp.field_stock_request_order__production_count
msgid "Manufacturing Orders count"
msgstr "Recuento de Órdenes de Fabricación"

#. module: stock_request_mrp
#: model:ir.model,name:stock_request_mrp.model_mrp_production
msgid "Production Order"
msgstr "Orden de Producción"

#. module: stock_request_mrp
#: model:ir.model,name:stock_request_mrp.model_stock_request
msgid "Stock Request"
msgstr "Solicitud de Existencias"

#. module: stock_request_mrp
#: model:ir.model.fields,field_description:stock_request_mrp.field_mrp_production__stock_request_count
msgid "Stock Request #"
msgstr "Solicitud de Existencias #"

#. module: stock_request_mrp
#: model:ir.model,name:stock_request_mrp.model_stock_request_order
msgid "Stock Request Order"
msgstr "Solicitud de Pedido de Existencias"

#. module: stock_request_mrp
#: model:ir.model.fields,field_description:stock_request_mrp.field_mrp_production__stock_request_ids
#: model_terms:ir.ui.view,arch_db:stock_request_mrp.mrp_production_form_view
msgid "Stock Requests"
msgstr "Solicitudes de Existencias"

#. module: stock_request_mrp
#: model:ir.model,name:stock_request_mrp.model_stock_rule
msgid "Stock Rule"
msgstr "Regla de Existencias"

#. module: stock_request_mrp
#. odoo-python
#: code:addons/stock_request_mrp/models/stock_request.py:0
#, python-format
msgid "You have linked to a Manufacture Order that belongs to another company."
msgstr ""
"Se ha vinculado a una orden de Fabricación que pertenece a otra empresa."
74 changes: 74 additions & 0 deletions stock_request_mrp/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_request_mrp
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-18 09:34+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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: stock_request_mrp
#: model_terms:ir.ui.view,arch_db:stock_request_mrp.stock_request_order_form
#: model_terms:ir.ui.view,arch_db:stock_request_mrp.view_stock_request_form
msgid "MOs"
msgstr "OP"

#. module: stock_request_mrp
#: model:ir.model.fields,field_description:stock_request_mrp.field_stock_request__production_ids
#: model:ir.model.fields,field_description:stock_request_mrp.field_stock_request_order__production_ids
msgid "Manufacturing Orders"
msgstr "Ordini di produzione"

#. module: stock_request_mrp
#: model:ir.model.fields,field_description:stock_request_mrp.field_stock_request__production_count
#: model:ir.model.fields,field_description:stock_request_mrp.field_stock_request_order__production_count
msgid "Manufacturing Orders count"
msgstr "Numero ordini di produzione"

#. module: stock_request_mrp
#: model:ir.model,name:stock_request_mrp.model_mrp_production
msgid "Production Order"
msgstr "Ordine di produzione"

#. module: stock_request_mrp
#: model:ir.model,name:stock_request_mrp.model_stock_request
msgid "Stock Request"
msgstr "Richiesta di magazzino"

#. module: stock_request_mrp
#: model:ir.model.fields,field_description:stock_request_mrp.field_mrp_production__stock_request_count
msgid "Stock Request #"
msgstr "N° richieste di magazzino"

#. module: stock_request_mrp
#: model:ir.model,name:stock_request_mrp.model_stock_request_order
msgid "Stock Request Order"
msgstr "Ordine richiesta di magazzino"

#. module: stock_request_mrp
#: model:ir.model.fields,field_description:stock_request_mrp.field_mrp_production__stock_request_ids
#: model_terms:ir.ui.view,arch_db:stock_request_mrp.mrp_production_form_view
msgid "Stock Requests"
msgstr "Richieste di magazzino"

#. module: stock_request_mrp
#: model:ir.model,name:stock_request_mrp.model_stock_rule
msgid "Stock Rule"
msgstr "Regola di giacenza"

#. module: stock_request_mrp
#. odoo-python
#: code:addons/stock_request_mrp/models/stock_request.py:0
#, python-format
msgid "You have linked to a Manufacture Order that belongs to another company."
msgstr ""
"È stato collegato un ordine di produzione che appartiene ad un'altra azienda."
Loading
Loading