Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4aa6d78
[13.0][ADD] stock_request_mrp
HviorForgeFlow Mar 12, 2020
10c41f2
[FIX+IMP] Update dotfiles + switch to GH actions
pedrobaeza May 28, 2022
4fe3b22
[MIG] stock_request_mrp: Migration to 15.0
JoelZilli Sep 1, 2022
51b04b4
[FIX] stock_request_mrp: Avoid copying the relationship to mrp.produc…
victoralmau Jan 24, 2023
42c0b7c
[IMP] stock_request_mrp: Refactor tests
victoralmau Oct 21, 2022
e13def3
[IMP] stock_request: Set with cancelled state the stock moves that ar…
victoralmau Feb 22, 2023
0dc6285
[FIX] stock_request_mrp: Change .read() to _for_xml_id()
victoralmau Mar 8, 2023
6af6c45
[IMP] stock_request_mrp: Change invisible attr of the action action_v…
victoralmau Aug 28, 2023
b3a0beb
[IMP] stock_request_mrp: Add _get_stock_requests() method to get all …
victoralmau Aug 28, 2023
58c4165
[FIX] stock_request_mrp: Change to the correct icon
victoralmau Sep 8, 2023
4abe80e
Added translation using Weblate (Spanish)
Ivorra78 Nov 11, 2023
3108a4d
Added translation using Weblate (Italian)
mymage Dec 15, 2023
776195e
[IMP] stock_request_mrp: pre-commit stuff
victoralmau Mar 25, 2024
1f3ea69
[MIG] stock_request_mrp: Migration to 16.0
victoralmau Mar 25, 2024
0b60620
[UPD] Update stock_request_mrp.pot
Mar 26, 2024
5b644cf
Update translation files
weblate Mar 26, 2024
edf6fe9
[FIX] stock_request_mrp: Change setUp() to setUpClass()
victoralmau Mar 27, 2024
6df98c1
[BOT] post-merge updates
OCA-git-bot Mar 27, 2024
2ab6c8b
[IMP] stock_request_mrp: pre-commit auto fixes
AnaisLForgeFlow May 20, 2024
949a7e1
[MIG] stock_request_mrp: Migration to 17.0
AnaisLForgeFlow May 23, 2024
170dbd3
[UPD] Update stock_request_mrp.pot
Jun 11, 2024
98ee15c
[BOT] post-merge updates
OCA-git-bot Jun 11, 2024
8d131ed
[UPD] stock_request_mrp: explicitly assign maintainers
LoisRForgeFlow Nov 5, 2024
c43309e
[BOT] post-merge updates
OCA-git-bot Nov 5, 2024
0ecce99
[MIG] stock_request_mrp: Migration to 18.0
lef-adhoc Nov 29, 2024
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
106 changes: 106 additions & 0 deletions stock_request_mrp/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
=================
Stock Request MRP
=================

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

.. |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-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/18.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-18-0/stock-logistics-request-18-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=18.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:%2018.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 <[email protected]>.

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/18.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": "18.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)

Check warning on line 32 in stock_request_mrp/hooks.py

View check run for this annotation

Codecov / codecov/patch

stock_request_mrp/hooks.py#L32

Added line #L32 was not covered by tests
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}")

Check warning on line 36 in stock_request_mrp/hooks.py

View check run for this annotation

Codecov / codecov/patch

stock_request_mrp/hooks.py#L35-L36

Added lines #L35 - L36 were not covered by tests
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 = [

Check warning on line 45 in stock_request_mrp/hooks.py

View check run for this annotation

Codecov / codecov/patch

stock_request_mrp/hooks.py#L44-L45

Added lines #L44 - L45 were not covered by tests
(
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}")

Check warning on line 58 in stock_request_mrp/hooks.py

View check run for this annotation

Codecov / codecov/patch

stock_request_mrp/hooks.py#L58

Added line #L58 was not covered by tests
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(

Check warning on line 62 in stock_request_mrp/hooks.py

View check run for this annotation

Codecov / codecov/patch

stock_request_mrp/hooks.py#L62

Added line #L62 was not covered by tests
ml.quantity, ml.product_id.uom_id
)
to_allocate_qty = ml.quantity

Check warning on line 65 in stock_request_mrp/hooks.py

View check run for this annotation

Codecov / codecov/patch

stock_request_mrp/hooks.py#L65

Added line #L65 was not covered by tests
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()

Check warning on line 71 in stock_request_mrp/hooks.py

View check run for this annotation

Codecov / codecov/patch

stock_request_mrp/hooks.py#L68-L71

Added lines #L68 - L71 were not covered by tests
# 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 <[email protected]>\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 <[email protected]>\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