Skip to content

Commit 460566b

Browse files
[MIG] stock_request_mrp: Migration to 17.0
1 parent 6c68f1f commit 460566b

File tree

14 files changed

+73
-51
lines changed

14 files changed

+73
-51
lines changed

stock_request_mrp/README.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Stock Request MRP
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

31-
This module allows for users to be able to display manufacturing orders
32-
that have been created as a consequence of Stock Requests.
31+
This module allows users to be able to display Manufacturing Orders that
32+
have been created as a consequence of Stock Requests.
3333

3434
**Table of contents**
3535

@@ -43,6 +43,12 @@ In case that the confirmation of the Stock Request results in an
4343
immediate Manufacturing Order, the user will be able to display the MO's
4444
from the Stock Request form view.
4545

46+
Navigate to Stock Requests and create a new stock request. Upon
47+
confirmation of the stock request, the system will automatically
48+
generate the corresponding manufacturing order. View and manage the
49+
generated manufacturing orders directly from the stock request record or
50+
through Manufacturing.
51+
4652
Known issues / Roadmap
4753
======================
4854

stock_request_mrp/__manifest__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Copyright 2017-20 ForgeFlow S.L. (https://www.forgeflow.com)
1+
# Copyright 2017-24 ForgeFlow S.L. (https://www.forgeflow.com)
22
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
33

44
{
55
"name": "Stock Request MRP",
66
"summary": "Manufacturing request for stock",
7-
"version": "16.0.1.0.1",
7+
"version": "17.0.1.0.0",
88
"license": "LGPL-3",
99
"website": "https://github.com/OCA/stock-logistics-request",
1010
"author": "ForgeFlow, Odoo Community Association (OCA)",

stock_request_mrp/hooks.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
1+
# Copyright 2020-24 ForgeFlow S.L. (https://www.forgeflow.com)
22
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
33

44
import logging
@@ -8,17 +8,17 @@
88
logger = logging.getLogger(__name__)
99

1010

11-
def post_init_hook(cr, registry):
11+
def post_init_hook(env):
1212
"""
1313
The objective of this hook is to link existing MOs
1414
coming from a Stock Request.
1515
"""
1616
logger.info("Linking existing MOs coming from a Stock Request")
17-
link_existing_mos_to_stock_request(cr)
17+
link_existing_mos_to_stock_request(env)
1818

1919

20-
def link_existing_mos_to_stock_request(cr):
21-
env = api.Environment(cr, SUPERUSER_ID, dict())
20+
def link_existing_mos_to_stock_request(env):
21+
env = api.Environment(env.cr, SUPERUSER_ID, dict())
2222
stock_request_obj = env["stock.request"]
2323
stock_request_order_obj = env["stock.request.order"]
2424
stock_request_allocation_obj = env["stock.request.allocation"]
@@ -29,7 +29,7 @@ def link_existing_mos_to_stock_request(cr):
2929
[("name", "in", [mo.origin for mo in mos_with_sr])]
3030
)
3131
for mo in mos_with_sr:
32-
stock_request = stock_requests.filtered(lambda x: x.name == mo.origin)
32+
stock_request = stock_requests.filtered(lambda x, mo=mo: x.name == mo.origin)
3333
if stock_request:
3434
# Link SR to MO
3535
mo.stock_request_ids = [(6, 0, stock_request.ids)]
@@ -59,13 +59,13 @@ def link_existing_mos_to_stock_request(cr):
5959
for ml in mo.finished_move_line_ids.filtered(
6060
lambda m: m.exists() and m.move_id.allocation_ids
6161
):
62-
qty_done = ml.product_uom_id._compute_quantity(
63-
ml.qty_done, ml.product_id.uom_id
62+
quantity = ml.product_uom_id._compute_quantity(
63+
ml.quantity, ml.product_id.uom_id
6464
)
65-
to_allocate_qty = ml.qty_done
65+
to_allocate_qty = ml.quantity
6666
for allocation in ml.move_id.allocation_ids:
6767
if allocation.open_product_qty:
68-
allocated_qty = min(allocation.open_product_qty, qty_done)
68+
allocated_qty = min(allocation.open_product_qty, quantity)
6969
allocation.allocated_product_qty += allocated_qty
7070
to_allocate_qty -= allocated_qty
7171
stock_request.check_done()

stock_request_mrp/models/mrp_production.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
1+
# Copyright 2020-24 ForgeFlow S.L. (https://www.forgeflow.com)
22
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
33

44
from odoo import api, fields, models

stock_request_mrp/models/stock_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
1+
# Copyright 2020-24 ForgeFlow S.L. (https://www.forgeflow.com)
22
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
33

44
from odoo import _, api, fields, models

stock_request_mrp/models/stock_request_order.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
1+
# Copyright 2020-24 ForgeFlow S.L. (https://www.forgeflow.com)
22
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
33

44
from odoo import api, fields, models

stock_request_mrp/models/stock_rule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
1+
# Copyright 2020-24 ForgeFlow S.L. (https://www.forgeflow.com)
22
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
33
from odoo import models
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
This module allows for users to be able to display manufacturing orders
1+
This module allows users to be able to display Manufacturing Orders
22
that have been created as a consequence of Stock Requests.

stock_request_mrp/readme/USAGE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
In case that the confirmation of the Stock Request results in an
22
immediate Manufacturing Order, the user will be able to display the MO's
33
from the Stock Request form view.
4+
5+
Navigate to Stock Requests and create a new stock request.
6+
Upon confirmation of the stock request, the system will automatically generate the corresponding manufacturing order.
7+
View and manage the generated manufacturing orders directly from the stock request record or through Manufacturing.

stock_request_mrp/static/description/index.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ <h1 class="title">Stock Request MRP</h1>
369369
!! source digest: sha256:f6a1ec65a0741589dfbce1eedd9b245fcc1df92be32de0e1a87d92fe14e044d2
370370
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
371371
<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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-request/tree/17.0/stock_request_mrp"><img alt="OCA/stock-logistics-request" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--request-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-request-17-0/stock-logistics-request-17-0-stock_request_mrp"><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/stock-logistics-request&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372-
<p>This module allows for users to be able to display manufacturing orders
373-
that have been created as a consequence of Stock Requests.</p>
372+
<p>This module allows users to be able to display Manufacturing Orders that
373+
have been created as a consequence of Stock Requests.</p>
374374
<p><strong>Table of contents</strong></p>
375375
<div class="contents local topic" id="contents">
376376
<ul class="simple">
@@ -390,6 +390,11 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
390390
<p>In case that the confirmation of the Stock Request results in an
391391
immediate Manufacturing Order, the user will be able to display the MO’s
392392
from the Stock Request form view.</p>
393+
<p>Navigate to Stock Requests and create a new stock request. Upon
394+
confirmation of the stock request, the system will automatically
395+
generate the corresponding manufacturing order. View and manage the
396+
generated manufacturing orders directly from the stock request record or
397+
through Manufacturing.</p>
393398
</div>
394399
<div class="section" id="known-issues-roadmap">
395400
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>

0 commit comments

Comments
 (0)