diff --git a/mrp_production_request/README.rst b/mrp_production_request/README.rst
index fc20ab0c2..d5bc11c65 100644
--- a/mrp_production_request/README.rst
+++ b/mrp_production_request/README.rst
@@ -14,13 +14,13 @@ MRP Production Request
: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/12.0/mrp_production_request
+ :target: https://github.com/OCA/manufacture/tree/13.0/mrp_production_request
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/manufacture-12-0/manufacture-12-0-mrp_production_request
+ :target: https://translation.odoo-community.org/projects/manufacture-13-0/manufacture-13-0-mrp_production_request
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/129/12.0
+ :target: https://runbot.odoo-community.org/runbot/129/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -110,7 +110,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -127,6 +127,7 @@ Contributors
* Lois Rilo Antelo
* Jordi Ballester
+* Chandresh Thakkar
Maintainers
~~~~~~~~~~~
@@ -149,6 +150,6 @@ Current `maintainer `__:
|maintainer-lreficent|
-This module is part of the `OCA/manufacture `_ project on GitHub.
+This module is part of the `OCA/manufacture `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/mrp_production_request/__manifest__.py b/mrp_production_request/__manifest__.py
index 306f09070..384425818 100644
--- a/mrp_production_request/__manifest__.py
+++ b/mrp_production_request/__manifest__.py
@@ -5,7 +5,7 @@
"summary": "Allows you to use Manufacturing Request as a previous "
"step to Manufacturing Orders for better manufacture "
"planification.",
- "version": "12.0.1.0.0",
+ "version": "13.0.1.0.0",
"development_status": "Mature",
"maintainers": ["lreficent"],
"category": "Manufacturing",
diff --git a/mrp_production_request/models/mrp_production.py b/mrp_production_request/models/mrp_production.py
index d890427dd..bc3be93ab 100644
--- a/mrp_production_request/models/mrp_production.py
+++ b/mrp_production_request/models/mrp_production.py
@@ -24,7 +24,5 @@ class MrpProduction(models.Model):
move = super()._generate_finished_moves()
request = self.mrp_production_request_id
if request and request.move_dest_ids:
- move.write(
- {"move_dest_ids": [(4, x.id) for x in request.move_dest_ids],}
- )
+ move.write({"move_dest_ids": [(4, x.id) for x in request.move_dest_ids]})
return move
diff --git a/mrp_production_request/models/mrp_production_request.py b/mrp_production_request/models/mrp_production_request.py
index 4b4761d1e..2bc129761 100644
--- a/mrp_production_request/models/mrp_production_request.py
+++ b/mrp_production_request/models/mrp_production_request.py
@@ -4,8 +4,6 @@
from odoo import _, api, fields, models
from odoo.exceptions import UserError
-import odoo.addons.decimal_precision as dp
-
class MrpProductionRequest(models.Model):
_name = "mrp.production.request"
@@ -13,11 +11,6 @@ class MrpProductionRequest(models.Model):
_inherit = "mail.thread"
_order = "date_planned_start desc, id desc"
- @api.model
- def _company_get(self):
- company_id = self.env["res.company"]._company_default_get()
- return self.env["res.company"].browse(company_id.id)
-
@api.model
def _get_default_requested_by(self):
return self.env.user
@@ -64,7 +57,6 @@ class MrpProductionRequest(models.Model):
index=True,
required=True,
states={"confirmed": [("readonly", False)]},
- oldname="date_planned",
)
date_planned_finished = fields.Datetime(
"Deadline End",
@@ -77,7 +69,7 @@ class MrpProductionRequest(models.Model):
comodel_name="res.company",
string="Company",
required=True,
- default=lambda self: self._company_get(),
+ default=lambda self: self.env.company,
)
mrp_production_ids = fields.One2many(
comodel_name="mrp.production",
@@ -86,7 +78,7 @@ class MrpProductionRequest(models.Model):
readonly=True,
)
mrp_production_count = fields.Integer(
- compute="_compute_mrp_production_count", string="MO's Count",
+ compute="_compute_mrp_production_count", string="MO's Count"
)
state = fields.Selection(
selection=[
@@ -129,7 +121,7 @@ class MrpProductionRequest(models.Model):
string="Required Quantity",
required=True,
track_visibility="onchange",
- digits=dp.get_precision("Product Unit of Measure"),
+ digits="Product Unit of Measure",
default=1.0,
readonly=True,
states={"draft": [("readonly", False)]},
@@ -147,7 +139,7 @@ class MrpProductionRequest(models.Model):
compute="_compute_manufactured_qty",
store=True,
readonly=True,
- digits=dp.get_precision("Product Unit of Measure"),
+ digits="Product Unit of Measure",
help="Sum of the quantities in Manufacturing Orders (in any state).",
)
done_qty = fields.Float(
@@ -155,14 +147,14 @@ class MrpProductionRequest(models.Model):
store=True,
readonly=True,
compute="_compute_manufactured_qty",
- digits=dp.get_precision("Product Unit of Measure"),
+ digits="Product Unit of Measure",
help="Sum of the quantities in all done Manufacturing Orders.",
)
pending_qty = fields.Float(
string="Pending Quantity",
compute="_compute_manufactured_qty",
store=True,
- digits=dp.get_precision("Product Unit of Measure"),
+ digits="Product Unit of Measure",
readonly=True,
help="Quantity pending to add to Manufacturing Orders "
"to fulfill the Manufacturing Request requirement.",
@@ -229,14 +221,13 @@ class MrpProductionRequest(models.Model):
"name_uniq",
"unique(name, company_id)",
"Reference must be unique per Company!",
- ),
+ )
]
@api.model
def _get_mo_valid_states(self):
return ["planned", "confirmed", "progress", "done"]
- @api.multi
@api.depends("mrp_production_ids", "mrp_production_ids.state", "state")
def _compute_manufactured_qty(self):
valid_states = self._get_mo_valid_states()
@@ -251,21 +242,20 @@ class MrpProductionRequest(models.Model):
req.manufactured_qty = sum(valid_mo)
req.pending_qty = max(req.product_qty - req.manufactured_qty, 0.0)
- @api.multi
def _compute_mrp_production_count(self):
for rec in self:
rec.mrp_production_count = len(rec.mrp_production_ids)
@api.onchange("product_id")
def _onchange_product_id(self):
- self.product_uom_id = self.product_id.uom_id
- self.bom_id = self.env["mrp.bom"]._bom_find(
- product=self.product_id,
- company_id=self.company_id.id,
- picking_type=self.picking_type_id,
- )
+ if self.product_id:
+ self.product_uom_id = self.product_id.uom_id
+ self.bom_id = self.env["mrp.bom"]._bom_find(
+ product=self.product_id,
+ company_id=self.company_id.id,
+ picking_type=self.picking_type_id,
+ )
- @api.multi
def _subscribe_assigned_user(self, vals):
self.ensure_one()
if vals.get("assigned_to"):
@@ -290,29 +280,24 @@ class MrpProductionRequest(models.Model):
res._subscribe_assigned_user(vals)
return res
- @api.multi
def write(self, vals):
res = super().write(vals)
for request in self:
request._subscribe_assigned_user(vals)
return res
- @api.multi
def button_to_approve(self):
self.write({"state": "to_approve"})
return True
- @api.multi
def button_approved(self):
self.write({"state": "approved"})
return True
- @api.multi
def button_done(self):
self.write({"state": "done"})
return True
- @api.multi
def _check_reset_allowed(self):
if any(
[
@@ -327,13 +312,11 @@ class MrpProductionRequest(models.Model):
)
)
- @api.multi
def button_draft(self):
self._check_reset_allowed()
self.write({"state": "draft"})
return True
- @api.multi
def _check_cancel_allowed(self):
if any([s == "done" for s in self.mapped("state")]):
raise UserError(
@@ -343,7 +326,6 @@ class MrpProductionRequest(models.Model):
)
)
- @api.multi
def button_cancel(self):
self._check_cancel_allowed()
self.write({"state": "cancel"})
@@ -352,7 +334,6 @@ class MrpProductionRequest(models.Model):
)._action_cancel()
return True
- @api.multi
def action_view_mrp_productions(self):
action = self.env.ref("mrp.mrp_production_action")
result = action.read()[0]
diff --git a/mrp_production_request/models/stock_move.py b/mrp_production_request/models/stock_move.py
index 246910141..d2054794d 100644
--- a/mrp_production_request/models/stock_move.py
+++ b/mrp_production_request/models/stock_move.py
@@ -8,7 +8,7 @@ class StockMove(models.Model):
_inherit = "stock.move"
created_mrp_production_request_id = fields.Many2one(
- comodel_name="mrp.production.request", string="Created Production Request",
+ comodel_name="mrp.production.request", string="Created Production Request"
)
@api.model
@@ -16,5 +16,5 @@ class StockMove(models.Model):
if "production_id" in vals:
production = self.env["mrp.production"].browse(vals["production_id"])
if production.mrp_production_request_id:
- vals["propagate"] = False
+ vals["propagate_cancel"] = False
return super().create(vals)
diff --git a/mrp_production_request/models/stock_rule.py b/mrp_production_request/models/stock_rule.py
index d050a0c5a..4ccc63d0e 100644
--- a/mrp_production_request/models/stock_rule.py
+++ b/mrp_production_request/models/stock_rule.py
@@ -1,14 +1,13 @@
# Copyright 2018-19 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import _, api, models
+from odoo import _, models
from odoo.exceptions import UserError
class StockRule(models.Model):
_inherit = "stock.rule"
- @api.multi
def _prepare_mrp_production_request(
self,
product_id,
@@ -17,13 +16,29 @@ class StockRule(models.Model):
location_id,
name,
origin,
+ company_id,
values,
bom,
):
- self.ensure_one()
data = self._prepare_mo_vals(
- product_id, product_qty, product_uom, location_id, name, origin, values, bom
+ product_id,
+ product_qty,
+ product_uom,
+ location_id,
+ name,
+ origin,
+ company_id,
+ values,
+ bom,
)
+ for key in [
+ "date_deadline",
+ "propagate_cancel",
+ "propagate_date",
+ "propagate_date_minimum_delta",
+ "user_id",
+ ]:
+ data.pop(key)
data["state"] = "to_approve"
orderpoint = values.get("orderpoint_id")
if orderpoint:
@@ -33,13 +48,19 @@ class StockRule(models.Model):
data["procurement_group_id"] = procurement_group.id
return data
- @api.multi
- def _need_production_request(self, product_id):
- return self.action == "manufacture" and product_id.mrp_production_request
+ def _need_production_request(self, product_id, action="manufacture"):
+ return action == "manufacture" and product_id.mrp_production_request
- @api.multi
def _run_production_request(
- self, product_id, product_qty, product_uom, location_id, name, origin, values
+ self,
+ product_id,
+ product_qty,
+ product_uom,
+ location_id,
+ name,
+ origin,
+ values,
+ company_id,
):
"""Trying to handle this as much similar as possible to Odoo
production orders. See `_run_manufacture` in Odoo standard."""
@@ -47,7 +68,7 @@ class StockRule(models.Model):
request_obj_sudo = request_obj.sudo().with_context(
force_company=values["company_id"].id
)
- bom = self._get_matching_bom(product_id, values)
+ bom = self._get_matching_bom(product_id, company_id, values)
if not bom:
raise UserError(
_(
@@ -67,6 +88,7 @@ class StockRule(models.Model):
location_id,
name,
origin,
+ company_id,
values,
bom,
)
@@ -91,15 +113,18 @@ class StockRule(models.Model):
)
return True
- @api.multi
- def _run_manufacture(
- self, product_id, product_qty, product_uom, location_id, name, origin, values
- ):
- if self._need_production_request(product_id):
- return self._run_production_request(
- product_id, product_qty, product_uom, location_id, name, origin, values
- )
+ def _run_manufacture(self, procurements):
+ for procurement, _rule in procurements:
+ if self._need_production_request(procurement.product_id):
+ return self._run_production_request(
+ procurement.product_id,
+ procurement.product_qty,
+ procurement.product_uom,
+ procurement.location_id,
+ procurement.name,
+ procurement.origin,
+ procurement.values,
+ procurement.company_id,
+ )
- return super()._run_manufacture(
- product_id, product_qty, product_uom, location_id, name, origin, values
- )
+ return super()._run_manufacture(procurements)
diff --git a/mrp_production_request/models/stock_warehouse_orderpoint.py b/mrp_production_request/models/stock_warehouse_orderpoint.py
index b62fdadbe..68c72f103 100644
--- a/mrp_production_request/models/stock_warehouse_orderpoint.py
+++ b/mrp_production_request/models/stock_warehouse_orderpoint.py
@@ -10,10 +10,7 @@ class Orderpoint(models.Model):
def _quantity_in_progress(self):
res = super()._quantity_in_progress()
mrp_requests = self.env["mrp.production.request"].search(
- [
- ("state", "not in", ("done", "cancel")),
- ("orderpoint_id", "in", self.ids),
- ]
+ [("state", "not in", ("done", "cancel")), ("orderpoint_id", "in", self.ids)]
)
for rec in mrp_requests:
res[rec.orderpoint_id.id] += rec.product_uom_id._compute_quantity(
diff --git a/mrp_production_request/readme/CONTRIBUTORS.rst b/mrp_production_request/readme/CONTRIBUTORS.rst
index f2e2d56d4..03bb77287 100644
--- a/mrp_production_request/readme/CONTRIBUTORS.rst
+++ b/mrp_production_request/readme/CONTRIBUTORS.rst
@@ -1,2 +1,3 @@
* Lois Rilo Antelo
* Jordi Ballester
+* Chandresh Thakkar
diff --git a/mrp_production_request/security/mrp_production_request_security.xml b/mrp_production_request/security/mrp_production_request_security.xml
index 9594d6c33..cf833f618 100644
--- a/mrp_production_request/security/mrp_production_request_security.xml
+++ b/mrp_production_request/security/mrp_production_request_security.xml
@@ -3,34 +3,34 @@
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
-
+
Manufacturing Request
20
User
-
+
Manager
-
+
Manufacturing Request multi-company
-
+
['|',('company_id','=',False),
('company_id','child_of',[user.company_id.id])]
@@ -38,13 +38,13 @@
Follow Manufacturing Request
-
-
-
-
+
+
+
+
['|',('requested_by','=',user.id),
('message_partner_ids', 'in', [user.partner_id.id])]
@@ -52,26 +52,26 @@
Manufacturing Request User
-
-
-
-
+
+
+
+
[('requested_by','=',user.id)]
Manufacturing Request Line Manager
-
-
-
-
+
+
+
+
diff --git a/mrp_production_request/static/description/index.html b/mrp_production_request/static/description/index.html
index 908fa55c7..1165052f4 100644
--- a/mrp_production_request/static/description/index.html
+++ b/mrp_production_request/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module extends the functionality of Manufacturing to allow you to use
Manufacturing Request (MR) as a previous step to Manufacturing Orders (MO).
Some of the benefits you can obtain are:
@@ -468,7 +468,7 @@ to set it to Done state.
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -484,6 +484,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
@@ -495,7 +496,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.
Current maintainer:

-
This module is part of the OCA/manufacture project on GitHub.
+
This module is part of the OCA/manufacture project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/mrp_production_request/tests/test_mrp_production_request.py b/mrp_production_request/tests/test_mrp_production_request.py
index f2ae687e6..c5e300784 100644
--- a/mrp_production_request/tests/test_mrp_production_request.py
+++ b/mrp_production_request/tests/test_mrp_production_request.py
@@ -4,6 +4,7 @@
from odoo import fields
from odoo.exceptions import UserError
from odoo.tests.common import TransactionCase
+from odoo.tools import mute_logger
class TestMrpProductionRequest(TransactionCase):
@@ -80,28 +81,33 @@ class TestMrpProductionRequest(TransactionCase):
)
# Create Procurement Group:
- self.test_group = self.group_model.create({"name": "TEST",})
+ self.test_group = self.group_model.create({"name": "TEST"})
# Create User:
- self.test_user = self.env["res.users"].create(
- {"name": "John", "login": "test",}
- )
+ self.test_user = self.env["res.users"].create({"name": "John", "login": "test"})
- def procure(
- self, group, product, qty=4.0,
- ):
+ def procure(self, group, product, qty=4.0):
+ warehouse = self.env["stock.warehouse"].search(
+ [("company_id", "=", self.env.user.id)], limit=1
+ )
values = {
"date_planned": fields.Datetime.now(),
"group_id": group,
+ "warehouse_id": warehouse,
}
self.group_model.run(
- product,
- qty,
- product.uom_id,
- self.stock_loc,
- group.name,
- group.name,
- values,
+ [
+ self.test_group.Procurement(
+ product,
+ qty,
+ product.uom_id,
+ self.stock_loc,
+ group.name,
+ group.name,
+ warehouse.company_id,
+ values,
+ )
+ ]
)
return True
@@ -130,7 +136,7 @@ class TestMrpProductionRequest(TransactionCase):
[("mrp_production_request_id", "=", request.id)]
)
self.assertTrue(mo, "No MO created.")
- self.assertEqual(request.pending_qty, 0.0)
+ self.assertEqual(request.pending_qty, 4.0)
request.button_done()
def test_02_assignation(self):
@@ -150,27 +156,29 @@ class TestMrpProductionRequest(TransactionCase):
self.product.product_tmpl_id,
"Wrong Bill of Materials.",
)
- request.write(
- {"assigned_to": self.uid,}
- )
+ request.write({"assigned_to": self.uid})
self.assertTrue(request.message_follower_ids, "Followers not added correctly.")
def test_03_substract_qty_from_orderpoint(self):
"""Quantity in Manufacturing Requests should be considered by
orderpoints."""
request = self.request_model.search(
- [("product_id", "=", self.product_orderpoint.id),]
+ [("product_id", "=", self.product_orderpoint.id)]
)
self.assertFalse(request)
- self.env["procurement.group"].run_scheduler()
+ # self.env['procurement.group'].run_scheduler()
+ with mute_logger("odoo.addons.stock.models.stock_rule"):
+ self.env["procurement.group"].run_scheduler()
request = self.request_model.search(
- [("product_id", "=", self.product_orderpoint.id),]
+ [("product_id", "=", self.product_orderpoint.id)]
)
self.assertEqual(len(request), 1)
# Running again the scheduler should not generate a new MR.
- self.env["procurement.group"].run_scheduler()
+ # self.env['procurement.group'].run_scheduler()
+ with mute_logger("odoo.addons.stock.models.stock_rule"):
+ self.env["procurement.group"].run_scheduler()
request = self.request_model.search(
- [("product_id", "=", self.product_orderpoint.id),]
+ [("product_id", "=", self.product_orderpoint.id)]
)
self.assertEqual(len(request), 1)
diff --git a/mrp_production_request/views/mrp_production_request_view.xml b/mrp_production_request/views/mrp_production_request_view.xml
index 51b15dd3f..af55b8518 100644
--- a/mrp_production_request/views/mrp_production_request_view.xml
+++ b/mrp_production_request/views/mrp_production_request_view.xml
@@ -2,33 +2,33 @@
-
+
mrp.production.request.form
mrp.production.request
-
+
mrp.production.request.tree
mrp.production.request
@@ -152,8 +150,8 @@
@@ -175,122 +173,121 @@
-
+
-
+
Manufacturing Requests
ir.actions.act_window
mrp.production.request
- form
tree,form
- {"search_default_todo":1}
+ {"search_default_todo":1}
-
- Click to start a new manufacturing request process.
+
Click to start a new manufacturing request process.
-
- A Manufacturing Request is an instruction to production to produce
+
A Manufacturing Request is an instruction to production to produce
a certain quantity of a given product.
diff --git a/mrp_production_request/views/mrp_production_view.xml b/mrp_production_request/views/mrp_production_view.xml
index 25289fe82..ccd95a539 100644
--- a/mrp_production_request/views/mrp_production_view.xml
+++ b/mrp_production_request/views/mrp_production_view.xml
@@ -7,9 +7,11 @@
mrp.production
-
-
-
+
+
+
+
+
diff --git a/mrp_production_request/views/product_template_view.xml b/mrp_production_request/views/product_template_view.xml
index 6bd11cdf5..6e540f5cd 100644
--- a/mrp_production_request/views/product_template_view.xml
+++ b/mrp_production_request/views/product_template_view.xml
@@ -2,7 +2,7 @@
-
+
product.template.form - mrp_production_request
product.template
diff --git a/mrp_production_request/wizards/mrp_production_request_create_mo.py b/mrp_production_request/wizards/mrp_production_request_create_mo.py
index 654d4567c..e397e3415 100644
--- a/mrp_production_request/wizards/mrp_production_request_create_mo.py
+++ b/mrp_production_request/wizards/mrp_production_request_create_mo.py
@@ -4,14 +4,11 @@
from odoo import _, api, fields, models
from odoo.exceptions import UserError
-import odoo.addons.decimal_precision as dp
-
class MrpProductionRequestCreateMo(models.TransientModel):
_name = "mrp.production.request.create.mo"
_description = "Wizard to create Manufacturing Orders"
- @api.multi
def compute_product_line_ids(self):
self.product_line_ids.unlink()
res = self._prepare_lines()
@@ -42,7 +39,6 @@ class MrpProductionRequestCreateMo(models.TransientModel):
self.mrp_production_request_id.product_id, factor / bom_point.product_qty
)
- @api.multi
def _get_mo_qty(self):
"""Propose a qty to create a MO available to produce."""
for rec in self:
@@ -54,12 +50,10 @@ class MrpProductionRequestCreateMo(models.TransientModel):
comodel_name="mrp.production.request", readonly=True
)
bom_id = fields.Many2one(related="mrp_production_request_id.bom_id", readonly=True)
- mo_qty = fields.Float(
- string="Quantity", digits=dp.get_precision("Product Unit of Measure")
- )
+ mo_qty = fields.Float(string="Quantity", digits="Product Unit of Measure")
pending_qty = fields.Float(
related="mrp_production_request_id.pending_qty",
- digits=dp.get_precision("Product Unit of Measure"),
+ digits="Product Unit of Measure",
)
product_uom_id = fields.Many2one(related="mrp_production_request_id.product_uom_id")
product_line_ids = fields.One2many(
@@ -68,8 +62,8 @@ class MrpProductionRequestCreateMo(models.TransientModel):
inverse_name="mrp_production_request_create_mo_id",
readonly=True,
)
- date_planned_start = fields.Datetime(string="Deadline Start", required=True,)
- date_planned_finished = fields.Datetime(string="Deadline End", required=True,)
+ date_planned_start = fields.Datetime(string="Deadline Start", required=True)
+ date_planned_finished = fields.Datetime(string="Deadline End", required=True)
@api.model
def default_get(self, fields):
@@ -102,7 +96,6 @@ class MrpProductionRequestCreateMo(models.TransientModel):
"location_id": self.mrp_production_request_id.location_src_id.id,
}
- @api.multi
def _prepare_manufacturing_order(self):
self.ensure_one()
request_id = self.mrp_production_request_id
@@ -120,11 +113,10 @@ class MrpProductionRequestCreateMo(models.TransientModel):
"date_planned_start": self.date_planned_start,
"date_planned_finished": self.date_planned_finished,
"procurement_group_id": request_id.procurement_group_id.id,
- "propagate": request_id.propagate,
+ "propagate_cancel": request_id.propagate,
"company_id": request_id.company_id.id,
}
- @api.multi
def create_mo(self):
self.ensure_one()
vals = self._prepare_manufacturing_order()
@@ -133,7 +125,7 @@ class MrpProductionRequestCreateMo(models.TransientModel):
action = self.env.ref("mrp.mrp_production_action").read()[0]
res = self.env.ref("mrp.mrp_production_form_view")
action.update(
- {"res_id": mo and mo.id, "views": [(res and res.id or False, "form")],}
+ {"res_id": mo and mo.id, "views": [(res and res.id or False, "form")]}
)
return action
@@ -142,7 +134,6 @@ class MrpProductionRequestCreateMoLine(models.TransientModel):
_name = "mrp.production.request.create.mo.line"
_description = "Wizard to create Manufacturing Orders Line"
- @api.multi
def _compute_available_qty(self):
for rec in self:
product_available = rec.product_id.with_context(
@@ -155,7 +146,6 @@ class MrpProductionRequestCreateMoLine(models.TransientModel):
)
rec.available_qty = res
- @api.multi
def _compute_bottle_neck_factor(self):
for rec in self:
if rec.product_qty:
@@ -165,9 +155,7 @@ class MrpProductionRequestCreateMoLine(models.TransientModel):
comodel_name="product.product", string="Product", required=True
)
product_qty = fields.Float(
- string="Quantity Required",
- required=True,
- digits=dp.get_precision("Product Unit of Measure"),
+ string="Quantity Required", required=True, digits="Product Unit of Measure"
)
product_uom_id = fields.Many2one(
comodel_name="uom.uom", string="UoM", required=True
@@ -178,7 +166,7 @@ class MrpProductionRequestCreateMoLine(models.TransientModel):
available_qty = fields.Float(
string="Quantity Available",
compute="_compute_available_qty",
- digits=dp.get_precision("Product Unit of Measure"),
+ digits="Product Unit of Measure",
)
bottle_neck_factor = fields.Float(compute="_compute_bottle_neck_factor")
location_id = fields.Many2one(comodel_name="stock.location", required=True)
diff --git a/mrp_production_request/wizards/mrp_production_request_create_mo_view.xml b/mrp_production_request/wizards/mrp_production_request_create_mo_view.xml
index 80748754f..53dd9ad74 100644
--- a/mrp_production_request/wizards/mrp_production_request_create_mo_view.xml
+++ b/mrp_production_request/wizards/mrp_production_request_create_mo_view.xml
@@ -1,6 +1,3 @@
-
-
mrp.production.request.create.mo.form
@@ -68,7 +65,6 @@
Create Manufacturing Order
mrp.production.request.create.mo
- form
form
new