mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] mrp_auto_assign: Migration to 14.0
This commit is contained in:
@@ -17,19 +17,19 @@ Mrp Auto Assign
|
||||
: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_auto_assign
|
||||
:target: https://github.com/OCA/manufacture/tree/14.0/mrp_auto_assign
|
||||
: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_auto_assign
|
||||
:target: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_auto_assign
|
||||
: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/manufacture&target_branch=12.0
|
||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=14.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
Simple module that make MO to reserve the raw material moves automatically
|
||||
at creation.
|
||||
at confirmation.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
@@ -41,19 +41,25 @@ Usage
|
||||
|
||||
To use this module, you need to:
|
||||
|
||||
#. Go to *Manufacturing* and create a Manufacturing Order.
|
||||
#. Go to *Manufacturing* and create and confirm a Manufacturing Order.
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/129/12.0
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
This module is not needed in higher versions, as in V15 Odoo introduces the
|
||||
option to decide how stock moves should be assigned based on the operation type.
|
||||
|
||||
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 to smash it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_auto_assign%0Aversion:%2012.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_auto_assign%0Aversion:%2014.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.
|
||||
|
||||
@@ -70,6 +76,7 @@ Contributors
|
||||
|
||||
* Florian da Costa <florian.dacosta@akretion.com>
|
||||
* Sudhir Arya <sudhir@erpharbor.com>
|
||||
* Jordi Masvidal <jordi.masvidal@forgeflow.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@@ -84,6 +91,6 @@ 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.
|
||||
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/12.0/mrp_auto_assign>`_ project on GitHub.
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/14.0/mrp_auto_assign>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"author": "Akretion, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/manufacture",
|
||||
"category": "Manufacturing",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "14.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"depends": ["mrp"],
|
||||
"application": False,
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
# @author Florian DA COSTA <florian.dacosta@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, models
|
||||
from odoo import models
|
||||
|
||||
|
||||
class MrpProduction(models.Model):
|
||||
_inherit = "mrp.production"
|
||||
|
||||
@api.model
|
||||
def create(self, values):
|
||||
production = super(MrpProduction, self).create(values)
|
||||
if production.availability != "none":
|
||||
production.action_assign()
|
||||
return production
|
||||
def action_confirm(self):
|
||||
res = super(MrpProduction, self).action_confirm()
|
||||
to_assign = self.filtered(lambda p: p.reservation_state)
|
||||
if to_assign:
|
||||
to_assign.action_assign()
|
||||
return res
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
* Florian da Costa <florian.dacosta@akretion.com>
|
||||
* Sudhir Arya <sudhir@erpharbor.com>
|
||||
* Jordi Masvidal <jordi.masvidal@forgeflow.com>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Simple module that make MO to reserve the raw material moves automatically
|
||||
at creation.
|
||||
at confirmation.
|
||||
|
||||
2
mrp_auto_assign/readme/ROADMAP.rst
Normal file
2
mrp_auto_assign/readme/ROADMAP.rst
Normal file
@@ -0,0 +1,2 @@
|
||||
This module is not needed in higher versions, as in V15 Odoo introduces the
|
||||
option to decide how stock moves should be assigned based on the operation type.
|
||||
@@ -1,6 +1,6 @@
|
||||
To use this module, you need to:
|
||||
|
||||
#. Go to *Manufacturing* and create a Manufacturing Order.
|
||||
#. Go to *Manufacturing* and create and confirm a Manufacturing Order.
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
@@ -369,18 +368,19 @@ ul.auto-toc {
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:276050fc7d5e77ab8d2b2d6ed43d1e3d3547da369c89f0004d8a400a56b4c4ea
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<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/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 image-reference" href="https://github.com/OCA/manufacture/tree/12.0/mrp_auto_assign"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/manufacture-12-0/manufacture-12-0-mrp_auto_assign"><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/manufacture&target_branch=12.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<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/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 image-reference" href="https://github.com/OCA/manufacture/tree/14.0/mrp_auto_assign"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_auto_assign"><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/manufacture&target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>Simple module that make MO to reserve the raw material moves automatically
|
||||
at creation.</p>
|
||||
at confirmation.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
|
||||
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-2">Known issues / Roadmap</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -389,41 +389,47 @@ at creation.</p>
|
||||
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
|
||||
<p>To use this module, you need to:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Go to <em>Manufacturing</em> and create a Manufacturing Order.</li>
|
||||
<li>Go to <em>Manufacturing</em> and create and confirm a Manufacturing Order.</li>
|
||||
</ol>
|
||||
<a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/129/12.0"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a>
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
|
||||
<p>This module is not needed in higher versions, as in V15 Odoo introduces the
|
||||
option to decide how stock moves should be assigned based on the operation type.</p>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
|
||||
<h1><a class="toc-backref" href="#toc-entry-3">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 to smash it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_auto_assign%0Aversion:%2012.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_auto_assign%0Aversion:%2014.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="#toc-entry-3">Credits</a></h1>
|
||||
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
|
||||
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Akretion</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
|
||||
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Florian da Costa <<a class="reference external" href="mailto:florian.dacosta@akretion.com">florian.dacosta@akretion.com</a>></li>
|
||||
<li>Sudhir Arya <<a class="reference external" href="mailto:sudhir@erpharbor.com">sudhir@erpharbor.com</a>></li>
|
||||
<li>Jordi Masvidal <<a class="reference external" href="mailto:jordi.masvidal@forgeflow.com">jordi.masvidal@forgeflow.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
|
||||
<h2><a class="toc-backref" href="#toc-entry-7">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
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/12.0/mrp_auto_assign">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/14.0/mrp_auto_assign">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>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# @author Florian DA COSTA <florian.dacosta@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests import Form
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
@@ -38,6 +39,7 @@ class TestMrpAutoAssign(TransactionCase):
|
||||
{
|
||||
"product_id": self.product_manuf.id,
|
||||
"product_tmpl_id": self.product_manuf.product_tmpl_id.id,
|
||||
"type": "normal",
|
||||
"bom_line_ids": (
|
||||
[
|
||||
(
|
||||
@@ -56,25 +58,21 @@ class TestMrpAutoAssign(TransactionCase):
|
||||
|
||||
def _update_product_qty(self, product, location, quantity):
|
||||
"""Update Product quantity."""
|
||||
product_qty = self.env["stock.change.product.qty"].create(
|
||||
product_qty = self.env["stock.quant"].create(
|
||||
{
|
||||
"location_id": location.id,
|
||||
"product_id": product.id,
|
||||
"new_quantity": quantity,
|
||||
"quantity": quantity,
|
||||
}
|
||||
)
|
||||
product_qty.change_product_qty()
|
||||
return product_qty
|
||||
|
||||
def test_01_manufacture_auto_assign(self):
|
||||
"""Test if Manufacturing order is auto-assigned."""
|
||||
|
||||
production = self.production_model.create(
|
||||
{
|
||||
"product_id": self.product_manuf.id,
|
||||
"product_qty": 1,
|
||||
"product_uom_id": self.uom_unit.id,
|
||||
"bom_id": self.bom.id,
|
||||
}
|
||||
)
|
||||
self.assertEqual(production.availability, "assigned")
|
||||
mo_form = Form(self.env["mrp.production"])
|
||||
mo_form.product_id = self.product_manuf
|
||||
mo_form.bom_id = self.bom
|
||||
mo_form.product_qty = 1
|
||||
production = mo_form.save()
|
||||
production.action_confirm()
|
||||
self.assertEqual(production.reservation_state, "assigned")
|
||||
|
||||
Reference in New Issue
Block a user