mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[12.0][MIG] mrp_production_request
This commit is contained in:
committed by
Chandresh Thakkar
parent
a742821ba9
commit
4196d07b0e
@@ -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/11.0/mrp_production_request
|
||||
:target: https://github.com/OCA/manufacture/tree/12.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-11-0/manufacture-11-0-mrp_production_request
|
||||
:target: https://translation.odoo-community.org/projects/manufacture-12-0/manufacture-12-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/11.0
|
||||
:target: https://runbot.odoo-community.org/runbot/129/12.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -94,6 +94,11 @@ Known issues / Roadmap
|
||||
Changelog
|
||||
=========
|
||||
|
||||
12.0.1.0.0 (2019-09-13)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* [MIG] Migration to v12.
|
||||
|
||||
11.0.1.0.0 (2018-09-13)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -105,7 +110,7 @@ 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 smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_production_request%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_production_request%0Aversion:%2012.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.
|
||||
|
||||
@@ -144,6 +149,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-lreficent|
|
||||
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/11.0/mrp_production_request>`_ project on GitHub.
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/12.0/mrp_production_request>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# Copyright 2017-19 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
"name": "MRP Production Request",
|
||||
"summary": "Allows you to use Manufacturing Request as a previous "
|
||||
"step to Manufacturing Orders for better manufacture "
|
||||
"planification.",
|
||||
"version": "11.0.1.0.1",
|
||||
"version": "12.0.1.0.0",
|
||||
"development_status": "Mature",
|
||||
"maintainers": ['lreficent'],
|
||||
"category": "Manufacturing",
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
---Fields in module 'mrp_production_request'---
|
||||
mrp_production_request / mrp.production.request / picking_type_id (many2one) : NEW relation: stock.picking.type, required: required, req_default: function
|
||||
mrp_production_request / mrp.production.request / product_uom (many2one) : DEL relation: product.uom
|
||||
mrp_production_request / mrp.production.request / product_uom_id (many2one) : NEW relation: product.uom
|
||||
---XML records in module 'mrp_production_request'---
|
||||
@@ -1,9 +0,0 @@
|
||||
---Fields in module 'mrp_production_request'---
|
||||
mrp_production_request / mrp.production.request / picking_type_id (many2one) : NEW relation: stock.picking.type, required: required, req_default: function
|
||||
# NOTHING TO DO
|
||||
|
||||
mrp_production_request / mrp.production.request / product_uom (many2one) : DEL relation: product.uom
|
||||
mrp_production_request / mrp.production.request / product_uom_id (many2one) : NEW relation: product.uom
|
||||
# Done. Renamed field: pre-migration script.
|
||||
|
||||
---XML records in module 'mrp_production_request'---
|
||||
@@ -1,15 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
field_renames = [
|
||||
('mrp.production.request', 'mrp_production_request', 'product_uom',
|
||||
'product_uom_id'),
|
||||
]
|
||||
|
||||
|
||||
@openupgrade.migrate(use_env=True)
|
||||
def migrate(env, version):
|
||||
openupgrade.rename_fields(env, field_renames)
|
||||
@@ -1,15 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
field_renames = [
|
||||
('mrp.production.request', 'mrp_production_request', 'date_planned',
|
||||
'date_planned_start')
|
||||
]
|
||||
|
||||
|
||||
@openupgrade.migrate(use_env=True)
|
||||
def migrate(env, version):
|
||||
openupgrade.rename_fields(env, field_renames)
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
"""Copy `move_dest_id` from the old procurement orders to the new field
|
||||
`move_dest_ids` in the Manufacturing Request."""
|
||||
cr.execute("""
|
||||
SELECT move_dest_id, mrp_production_request_id
|
||||
FROM procurement_order
|
||||
WHERE mrp_production_request_id is not null;""")
|
||||
for move_dest, mrp_request in cr.fetchall():
|
||||
if move_dest:
|
||||
cr.execute("""
|
||||
UPDATE stock_move
|
||||
SET created_mrp_production_request_id = %s
|
||||
WHERE id = %s
|
||||
""", (mrp_request, move_dest,))
|
||||
@@ -1,6 +1,6 @@
|
||||
from . import mrp_production_request
|
||||
from . import mrp_production
|
||||
from . import procurement_rule
|
||||
from . import stock_rule
|
||||
from . import product
|
||||
from . import stock_move
|
||||
from . import stock_warehouse_orderpoint
|
||||
|
||||
@@ -18,7 +18,7 @@ class MrpProduction(models.Model):
|
||||
Storing them on the MR and writing them on the finished moves as it
|
||||
would happen if they were present in the MO, is the best workaround
|
||||
without changing the standard data model."""
|
||||
move = super(MrpProduction, self)._generate_finished_moves()
|
||||
move = super()._generate_finished_moves()
|
||||
request = self.mrp_production_request_id
|
||||
if request and request.move_dest_ids:
|
||||
move.write({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017-18 Eficent Business and IT Consulting Services S.L.
|
||||
# Copyright 2017-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, fields, models, _
|
||||
@@ -14,7 +14,7 @@ class MrpProductionRequest(models.Model):
|
||||
|
||||
@api.model
|
||||
def _company_get(self):
|
||||
company_id = self.env['res.company']._company_default_get(self._name)
|
||||
company_id = self.env['res.company']._company_default_get()
|
||||
return self.env['res.company'].browse(company_id.id)
|
||||
|
||||
@api.model
|
||||
@@ -29,7 +29,7 @@ class MrpProductionRequest(models.Model):
|
||||
readonly=True, states={'draft': [('readonly', False)]})
|
||||
requested_by = fields.Many2one(
|
||||
comodel_name='res.users', string='Requested by',
|
||||
default=_get_default_requested_by,
|
||||
default=lambda self: self._get_default_requested_by(),
|
||||
required=True, track_visibility='onchange',
|
||||
readonly=True, states={'draft': [('readonly', False)]})
|
||||
assigned_to = fields.Many2one(
|
||||
@@ -50,7 +50,7 @@ class MrpProductionRequest(models.Model):
|
||||
states={'confirmed': [('readonly', False)]})
|
||||
company_id = fields.Many2one(
|
||||
comodel_name='res.company', string='Company',
|
||||
required=True, default=_company_get)
|
||||
required=True, default=lambda self: self._company_get())
|
||||
mrp_production_ids = fields.One2many(
|
||||
comodel_name="mrp.production", string="Manufacturing Orders",
|
||||
inverse_name="mrp_production_request_id", readonly=True)
|
||||
@@ -88,7 +88,7 @@ class MrpProductionRequest(models.Model):
|
||||
digits=dp.get_precision('Product Unit of Measure'), default=1.0,
|
||||
readonly=True, states={'draft': [('readonly', False)]})
|
||||
product_uom_id = fields.Many2one(
|
||||
comodel_name='product.uom', string='Unit of Measure',
|
||||
comodel_name='uom.uom', string='Unit of Measure',
|
||||
readonly=True, states={'draft': [('readonly', False)]},
|
||||
domain="[('category_id', '=', category_uom_id)]")
|
||||
category_uom_id = fields.Many2one(related="product_uom_id.category_id")
|
||||
@@ -180,7 +180,8 @@ class MrpProductionRequest(models.Model):
|
||||
def _subscribe_assigned_user(self, vals):
|
||||
self.ensure_one()
|
||||
if vals.get('assigned_to'):
|
||||
self.message_subscribe_users(user_ids=[self.assigned_to.id])
|
||||
self.message_subscribe(
|
||||
partner_ids=self.assigned_to.mapped('partner_id').ids)
|
||||
|
||||
@api.model
|
||||
def _create_sequence(self, vals):
|
||||
@@ -194,13 +195,13 @@ class MrpProductionRequest(models.Model):
|
||||
"""Add sequence if name is not defined and subscribe to the thread
|
||||
the user assigned to the request."""
|
||||
vals = self._create_sequence(vals)
|
||||
res = super(MrpProductionRequest, self).create(vals)
|
||||
res = super().create(vals)
|
||||
res._subscribe_assigned_user(vals)
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
res = super(MrpProductionRequest, self).write(vals)
|
||||
res = super().write(vals)
|
||||
for request in self:
|
||||
request._subscribe_assigned_user(vals)
|
||||
return res
|
||||
|
||||
@@ -8,6 +8,7 @@ class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
mrp_production_request = fields.Boolean(
|
||||
string='Manufacturing Request', help="Check this box to generate "
|
||||
"manufacturing request instead of generating manufacturing orders "
|
||||
"from procurement.", default=False)
|
||||
string='Manufacturing Request',
|
||||
help="Check this box to generate manufacturing request instead of "
|
||||
"generating manufacturing orders from procurement.",
|
||||
)
|
||||
|
||||
@@ -19,4 +19,4 @@ class StockMove(models.Model):
|
||||
vals['production_id'])
|
||||
if production.mrp_production_request_id:
|
||||
vals['propagate'] = False
|
||||
return super(StockMove, self).create(vals)
|
||||
return super().create(vals)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# 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.exceptions import UserError
|
||||
|
||||
|
||||
class ProcurementOrder(models.Model):
|
||||
_inherit = "procurement.rule"
|
||||
class StockRule(models.Model):
|
||||
_inherit = "stock.rule"
|
||||
|
||||
@api.multi
|
||||
def _prepare_mrp_production_request(
|
||||
@@ -20,6 +20,9 @@ class ProcurementOrder(models.Model):
|
||||
orderpoint = values.get('orderpoint_id')
|
||||
if orderpoint:
|
||||
data['orderpoint_id'] = orderpoint.id
|
||||
procurement_group = values.get('group_id')
|
||||
if procurement_group:
|
||||
data['procurement_group_id'] = procurement_group.id
|
||||
return data
|
||||
|
||||
@api.multi
|
||||
@@ -8,7 +8,7 @@ class Orderpoint(models.Model):
|
||||
_inherit = "stock.warehouse.orderpoint"
|
||||
|
||||
def _quantity_in_progress(self):
|
||||
res = super(Orderpoint, self)._quantity_in_progress()
|
||||
res = super()._quantity_in_progress()
|
||||
mrp_requests = self.env['mrp.production.request'].search([
|
||||
('state', 'not in', ('done', 'cancel')),
|
||||
('orderpoint_id', 'in', self.ids),
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
12.0.1.0.0 (2019-09-13)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* [MIG] Migration to v12.
|
||||
|
||||
11.0.1.0.0 (2018-09-13)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<field name="name">Manager</field>
|
||||
<field name="implied_ids"
|
||||
eval="[(4, ref('mrp_production_request.group_mrp_production_request_user'))]"/>
|
||||
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
||||
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
|
||||
<field name="category_id" ref="module_category_mrp_production_request"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<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 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.15.2: http://docutils.sourceforge.net/" />
|
||||
<title>MRP Production Request</title>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/manufacture/tree/11.0/mrp_production_request"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/manufacture-11-0/manufacture-11-0-mrp_production_request"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/129/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/manufacture/tree/12.0/mrp_production_request"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/manufacture-12-0/manufacture-12-0-mrp_production_request"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/129/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module extends the functionality of Manufacturing to allow you to use
|
||||
Manufacturing Request (MR) as a previous step to Manufacturing Orders (MO).</p>
|
||||
<p>Some of the benefits you can obtain are:</p>
|
||||
@@ -381,24 +381,25 @@ can build.</li>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#configuration" id="id2">Configuration</a></li>
|
||||
<li><a class="reference internal" href="#usage" id="id3">Usage</a></li>
|
||||
<li><a class="reference internal" href="#known-issues-roadmap" id="id4">Known issues / Roadmap</a></li>
|
||||
<li><a class="reference internal" href="#changelog" id="id5">Changelog</a><ul>
|
||||
<li><a class="reference internal" href="#id1" id="id6">11.0.1.0.0 (2018-09-13)</a></li>
|
||||
<li><a class="reference internal" href="#configuration" id="id3">Configuration</a></li>
|
||||
<li><a class="reference internal" href="#usage" id="id4">Usage</a></li>
|
||||
<li><a class="reference internal" href="#known-issues-roadmap" id="id5">Known issues / Roadmap</a></li>
|
||||
<li><a class="reference internal" href="#changelog" id="id6">Changelog</a><ul>
|
||||
<li><a class="reference internal" href="#id1" id="id7">12.0.1.0.0 (2019-09-13)</a></li>
|
||||
<li><a class="reference internal" href="#id2" id="id8">11.0.1.0.0 (2018-09-13)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id7">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id8">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id9">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id10">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id11">Maintainers</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id9">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id10">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id11">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id12">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id13">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="configuration">
|
||||
<h1><a class="toc-backref" href="#id2">Configuration</a></h1>
|
||||
<h1><a class="toc-backref" href="#id3">Configuration</a></h1>
|
||||
<p>To configure a product to automatically generate Manufacturing Requests
|
||||
from procurements instead of directly create manufacturing orders you
|
||||
need to:</p>
|
||||
@@ -410,7 +411,7 @@ need to:</p>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#id3">Usage</a></h1>
|
||||
<h1><a class="toc-backref" href="#id4">Usage</a></h1>
|
||||
<p>To use this module, you need to:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Go to <em>Manufacturing > Manufacturing Requests</em>.</li>
|
||||
@@ -441,46 +442,52 @@ from a MR to MOs. It is in hands of the user to decide when a MR is ended and
|
||||
to set it to <em>Done</em> state.</p>
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h1><a class="toc-backref" href="#id4">Known issues / Roadmap</a></h1>
|
||||
<h1><a class="toc-backref" href="#id5">Known issues / Roadmap</a></h1>
|
||||
<ul class="simple">
|
||||
<li>Take into account workstations.</li>
|
||||
<li>Take into account consumable products.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="changelog">
|
||||
<h1><a class="toc-backref" href="#id5">Changelog</a></h1>
|
||||
<h1><a class="toc-backref" href="#id6">Changelog</a></h1>
|
||||
<div class="section" id="id1">
|
||||
<h2><a class="toc-backref" href="#id6">11.0.1.0.0 (2018-09-13)</a></h2>
|
||||
<h2><a class="toc-backref" href="#id7">12.0.1.0.0 (2019-09-13)</a></h2>
|
||||
<ul class="simple">
|
||||
<li>[MIG] Migration to v12.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id2">
|
||||
<h2><a class="toc-backref" href="#id8">11.0.1.0.0 (2018-09-13)</a></h2>
|
||||
<ul class="simple">
|
||||
<li>[MIG] Migration to v11. Start of the history.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#id7">Bug Tracker</a></h1>
|
||||
<h1><a class="toc-backref" href="#id9">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 smashing it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_production_request%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_production_request%0Aversion:%2012.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="#id8">Credits</a></h1>
|
||||
<h1><a class="toc-backref" href="#id10">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id9">Authors</a></h2>
|
||||
<h2><a class="toc-backref" href="#id11">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Eficent</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id10">Contributors</a></h2>
|
||||
<h2><a class="toc-backref" href="#id12">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Lois Rilo Antelo <<a class="reference external" href="mailto:lois.rilo@eficent.com">lois.rilo@eficent.com</a>></li>
|
||||
<li>Jordi Ballester <<a class="reference external" href="mailto:jordi.ballester@eficent.com">jordi.ballester@eficent.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#id11">Maintainers</a></h2>
|
||||
<h2><a class="toc-backref" href="#id13">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
|
||||
@@ -488,7 +495,7 @@ mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||
<p><a class="reference external" href="https://github.com/lreficent"><img alt="lreficent" src="https://github.com/lreficent.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/11.0/mrp_production_request">OCA/manufacture</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/12.0/mrp_production_request">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>
|
||||
|
||||
@@ -8,7 +8,7 @@ from odoo.exceptions import UserError
|
||||
|
||||
class TestMrpProductionRequest(TransactionCase):
|
||||
def setUp(self, *args, **kwargs):
|
||||
super(TestMrpProductionRequest, self).setUp(*args, **kwargs)
|
||||
super().setUp(*args, **kwargs)
|
||||
self.production_model = self.env['mrp.production']
|
||||
self.request_model = self.env['mrp.production.request']
|
||||
self.wiz_model = self.env['mrp.production.request.create.mo']
|
||||
@@ -102,7 +102,9 @@ class TestMrpProductionRequest(TransactionCase):
|
||||
request.button_to_approve()
|
||||
request.button_approved()
|
||||
self.assertEqual(request.pending_qty, 4.0)
|
||||
wiz = self.wiz_model.with_context(active_ids=request.ids).create({})
|
||||
wiz = self.wiz_model.with_context(
|
||||
active_ids=request.ids,
|
||||
active_model="mrp.production.request").create({})
|
||||
wiz.compute_product_line_ids()
|
||||
wiz.mo_qty = 4.0
|
||||
wiz.create_mo()
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<label string="Manufacturing Request"/>
|
||||
<label for="name" string="Manufacturing Request"/>
|
||||
<h1>
|
||||
<field name="name"/>
|
||||
</h1>
|
||||
@@ -62,7 +62,7 @@
|
||||
<field name="done_qty"/>
|
||||
<field name="manufactured_qty"/>
|
||||
<field name="pending_qty"/>
|
||||
<field name="product_uom_id" groups="product.group_uom"/>
|
||||
<field name="product_uom_id" groups="uom.group_uom"/>
|
||||
<field name="category_uom_id" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -73,7 +73,7 @@
|
||||
</group>
|
||||
<group name="dates">
|
||||
<field name="date_planned_start"/>
|
||||
<field name="date_planned_finished" invisible="1"/>
|
||||
<field name="date_planned_finished"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
@@ -135,7 +135,7 @@
|
||||
<field name="mrp_production_ids" string="Manufacturing Orders"/>
|
||||
<field name="bom_id"/>
|
||||
<field name="requested_by"/>
|
||||
<field name="assigned_to" />
|
||||
<field name="assigned_to"/>
|
||||
<field name="origin"/>
|
||||
<field name="state"/>
|
||||
<field name="pending_qty" invisible="1"/>
|
||||
@@ -143,16 +143,19 @@
|
||||
<filter name="unassigned" string="Unassigned"
|
||||
domain="[('assigned_to','=', False)]"
|
||||
help="Unassigned Request"/>
|
||||
<filter domain="[('assigned_to','=', uid)]"
|
||||
<filter name="assigned_to_me"
|
||||
domain="[('assigned_to','=', uid)]"
|
||||
string="Assigned to me"/>
|
||||
<filter domain="[('requested_by','=', uid)]"
|
||||
<filter name="requested_by_me"
|
||||
domain="[('requested_by','=', uid)]"
|
||||
string="My requests" help="Requested by me"/>
|
||||
<separator/>
|
||||
<filter domain="[('pending_qty','!=', 0.0)]"
|
||||
string="Pending Qty" name="pending"
|
||||
<filter name="pending"
|
||||
domain="[('pending_qty','!=', 0.0)]"
|
||||
string="Pending Qty"
|
||||
help="Request with pending quantity"/>
|
||||
<separator/>
|
||||
<filter string="To Do" name="todo"
|
||||
<filter name="todo" string="To Do"
|
||||
domain="[('state','in',('draft', 'to_approve','approved'))]"
|
||||
help="Manufacturing Requests not done or cancelled."/>
|
||||
<separator/>
|
||||
@@ -172,17 +175,21 @@
|
||||
domain="[('state','=','done')]"
|
||||
help="Request is done"/>
|
||||
<separator/>
|
||||
<filter string="Unread Messages"
|
||||
name="message_needaction"
|
||||
<filter name="message_needaction"
|
||||
string="Unread Messages"
|
||||
domain="[('message_needaction','=',True)]"/>
|
||||
<!--Group by:-->
|
||||
<filter string="Requested by" icon="terp-personal"
|
||||
<filter name="requested_by_group_by"
|
||||
string="Requested by" icon="terp-personal"
|
||||
domain="[]"
|
||||
context="{'group_by':'requested_by'}"/>
|
||||
<filter string="Assigned to" icon="terp-personal"
|
||||
<filter name="assign_to_group_by"
|
||||
string="Assigned to" icon="terp-personal"
|
||||
domain="[]"
|
||||
context="{'group_by':'assigned_to'}"/>
|
||||
<filter string="Source" icon="terp-gtk-jump-to-rtl" domain="[]"
|
||||
<filter name="origin_group_by"
|
||||
string="Source"
|
||||
domain="[]"
|
||||
context="{'group_by':'origin'}"/>
|
||||
</search>
|
||||
</field>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017-18 Eficent Business and IT Consulting Services S.L.
|
||||
# Copyright 2017-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, fields, models, _
|
||||
@@ -19,7 +19,12 @@ class MrpProductionRequestCreateMo(models.TransientModel):
|
||||
self.env['mrp.production.request.create.mo.line'].create(
|
||||
self._prepare_product_line(line))
|
||||
self._get_mo_qty()
|
||||
return {"type": "ir.actions.do_nothing"}
|
||||
# The wizard must be reloaded in order to show the new product lines
|
||||
action = self.env.ref(
|
||||
'mrp_production_request.mrp_production_request_create_mo_action')
|
||||
res = action.read()[0]
|
||||
res['res_id'] = self.id
|
||||
return res
|
||||
|
||||
def _prepare_lines(self):
|
||||
"""Get the components (product_lines) needed for manufacturing the
|
||||
@@ -58,16 +63,30 @@ class MrpProductionRequestCreateMo(models.TransientModel):
|
||||
comodel_name="mrp.production.request.create.mo.line",
|
||||
string="Products needed",
|
||||
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,
|
||||
)
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
rec = super(MrpProductionRequestCreateMo, self).default_get(fields)
|
||||
rec = super().default_get(fields)
|
||||
active_ids = self._context.get('active_ids')
|
||||
active_model = self._context.get('active_model')
|
||||
if not active_ids:
|
||||
raise UserError(_(
|
||||
"Programming error: wizard action executed without "
|
||||
"active_ids in context."))
|
||||
rec['mrp_production_request_id'] = active_ids[0]
|
||||
request = self.env[active_model].browse(active_ids)
|
||||
rec.update({
|
||||
'mrp_production_request_id': active_ids[0],
|
||||
'date_planned_start': request[0].date_planned_start,
|
||||
'date_planned_finished': request[0].date_planned_finished,
|
||||
})
|
||||
return rec
|
||||
|
||||
def _prepare_product_line(self, pl):
|
||||
@@ -94,8 +113,8 @@ class MrpProductionRequestCreateMo(models.TransientModel):
|
||||
'location_dest_id': request_id.location_dest_id.id,
|
||||
'picking_type_id': request_id.picking_type_id.id,
|
||||
'routing_id': request_id.routing_id.id,
|
||||
'date_planned_start': request_id.date_planned_start,
|
||||
'date_planned_finished': request_id.date_planned_finished,
|
||||
'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,
|
||||
'company_id': request_id.company_id.id,
|
||||
@@ -118,6 +137,7 @@ class MrpProductionRequestCreateMo(models.TransientModel):
|
||||
|
||||
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):
|
||||
@@ -142,12 +162,14 @@ class MrpProductionRequestCreateMoLine(models.TransientModel):
|
||||
string='Quantity Required', required=True,
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
product_uom_id = fields.Many2one(
|
||||
comodel_name='product.uom', string='UoM', required=True)
|
||||
comodel_name='uom.uom', string='UoM', required=True)
|
||||
mrp_production_request_create_mo_id = fields.Many2one(
|
||||
comodel_name='mrp.production.request.create.mo')
|
||||
available_qty = fields.Float(
|
||||
string='Quantity Available', compute=_compute_available_qty,
|
||||
string='Quantity Available', compute='_compute_available_qty',
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
bottle_neck_factor = fields.Float(compute=_compute_bottle_neck_factor)
|
||||
location_id = fields.Many2one(comodel_name='stock.location',
|
||||
required=True)
|
||||
bottle_neck_factor = fields.Float(
|
||||
compute='_compute_bottle_neck_factor')
|
||||
location_id = fields.Many2one(
|
||||
comodel_name='stock.location',
|
||||
required=True)
|
||||
|
||||
@@ -29,10 +29,18 @@
|
||||
</field>
|
||||
</group>
|
||||
</group>
|
||||
<group name="destination" string="Manufacturing Order:" col="4">
|
||||
<field name="mo_qty"/>
|
||||
<field name="product_uom_id" options="{'no_open': True}"
|
||||
groups="product.group_uom"/>
|
||||
<group name="destination" string="Manufacturing Order:">
|
||||
<group name="product_qty">
|
||||
<label for="mo_qty"/>
|
||||
<div>
|
||||
<field name="mo_qty" class="oe_inline"/>
|
||||
<field name="product_uom_id" class="oe_inline" options="{'no_open': True}" groups="uom.group_uom"/>
|
||||
</div>
|
||||
</group>
|
||||
<group name="date_planned">
|
||||
<field name="date_planned_start"/>
|
||||
<field name="date_planned_finished"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<footer>
|
||||
|
||||
Reference in New Issue
Block a user