mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] mrp_subcontracting_bom_dual_use: Migration to 16.0
TT47843
This commit is contained in:
@@ -7,7 +7,7 @@ Mrp subcontracting bom dual use
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:cf72e158a61137dd42e16ae67e841c5960d7359e3cf430a6c7951e6607185476
|
||||
!! source digest: sha256:cafff56e6578794b77421691c0fa44a5f4daf8d002566a1eef763b360ec23198
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
@@ -17,13 +17,13 @@ Mrp subcontracting bom dual use
|
||||
: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/14.0/mrp_subcontracting_bom_dual_use
|
||||
:target: https://github.com/OCA/manufacture/tree/16.0/mrp_subcontracting_bom_dual_use
|
||||
:alt: OCA/manufacture
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_subcontracting_bom_dual_use
|
||||
:target: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-mrp_subcontracting_bom_dual_use
|
||||
: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=14.0
|
||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=16.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -48,7 +48,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 to smash it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_subcontracting_bom_dual_use%0Aversion:%2014.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_subcontracting_bom_dual_use%0Aversion:%2016.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.
|
||||
|
||||
@@ -89,6 +89,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-victoralmau|
|
||||
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/14.0/mrp_subcontracting_bom_dual_use>`_ project on GitHub.
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/16.0/mrp_subcontracting_bom_dual_use>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
"name": "Mrp subcontracting bom dual use",
|
||||
"version": "14.0.1.1.0",
|
||||
"version": "16.0.1.0.0",
|
||||
"category": "Manufacturing",
|
||||
"website": "https://github.com/OCA/manufacture",
|
||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2022 Tecnativa - Víctor Martínez
|
||||
# Copyright 2022-2024 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from odoo import api, fields, models
|
||||
|
||||
@@ -22,17 +22,11 @@ class MrpBom(models.Model):
|
||||
|
||||
@api.model
|
||||
def _bom_find_domain(
|
||||
self,
|
||||
product_tmpl=None,
|
||||
product=None,
|
||||
picking_type=None,
|
||||
company_id=False,
|
||||
bom_type=False,
|
||||
self, products, picking_type=None, company_id=False, bom_type=False
|
||||
):
|
||||
"""We need to overwrite the domain to get subcontract boms"""
|
||||
domain = super()._bom_find_domain(
|
||||
product_tmpl=product_tmpl,
|
||||
product=product,
|
||||
products=products,
|
||||
picking_type=picking_type,
|
||||
company_id=company_id,
|
||||
bom_type=bom_type,
|
||||
|
||||
@@ -367,9 +367,9 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:cf72e158a61137dd42e16ae67e841c5960d7359e3cf430a6c7951e6607185476
|
||||
!! source digest: sha256:cafff56e6578794b77421691c0fa44a5f4daf8d002566a1eef763b360ec23198
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<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_subcontracting_bom_dual_use"><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_subcontracting_bom_dual_use"><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><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/16.0/mrp_subcontracting_bom_dual_use"><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-16-0/manufacture-16-0-mrp_subcontracting_bom_dual_use"><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=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module allows subcontracting BOMs to be used for regular production orders as well.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
@@ -397,7 +397,7 @@ ul.auto-toc {
|
||||
<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_subcontracting_bom_dual_use%0Aversion:%2014.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_subcontracting_bom_dual_use%0Aversion:%2016.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">
|
||||
@@ -427,7 +427,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 image-reference" href="https://github.com/victoralmau"><img alt="victoralmau" src="https://github.com/victoralmau.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/14.0/mrp_subcontracting_bom_dual_use">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/16.0/mrp_subcontracting_bom_dual_use">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>
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
# Copyright 2022 Tecnativa - Víctor Martínez
|
||||
# Copyright 2022-2024 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo.tests import Form, common
|
||||
from odoo.tests import Form, new_test_user
|
||||
from odoo.tests.common import users
|
||||
|
||||
from odoo.addons.base.tests.common import BaseCommon
|
||||
|
||||
|
||||
class TestMrpSubcontractingBomDualUse(common.SavepointCase):
|
||||
class TestMrpSubcontractingBomDualUse(BaseCommon):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
@@ -19,6 +22,11 @@ class TestMrpSubcontractingBomDualUse(common.SavepointCase):
|
||||
cls.component_a = cls.env["product.product"].create({"name": "Test Comp A"})
|
||||
cls.workcenter = cls.env["mrp.workcenter"].create({"name": "Test workcenter"})
|
||||
cls.mrp_production_model = cls.env["mrp.production"]
|
||||
new_test_user(
|
||||
cls.env,
|
||||
login="test_mrp_routings_user",
|
||||
groups="mrp.group_mrp_routings,mrp.group_mrp_manager",
|
||||
)
|
||||
|
||||
def _create_bom(self, bom_type):
|
||||
mrp_bom_form = Form(self.env["mrp.bom"])
|
||||
@@ -31,9 +39,6 @@ class TestMrpSubcontractingBomDualUse(common.SavepointCase):
|
||||
with mrp_bom_form.bom_line_ids.new() as line_form:
|
||||
line_form.product_id = self.component_a
|
||||
line_form.product_qty = 1
|
||||
with mrp_bom_form.operation_ids.new() as operation_form:
|
||||
operation_form.name = "Test operation"
|
||||
operation_form.workcenter_id = self.workcenter
|
||||
return mrp_bom_form.save()
|
||||
|
||||
def test_mrp_production_misc_bom_normal(self):
|
||||
@@ -62,10 +67,17 @@ class TestMrpSubcontractingBomDualUse(common.SavepointCase):
|
||||
replenish = replenish_form.save()
|
||||
replenish.launch_replenishment()
|
||||
|
||||
@users("test_mrp_routings_user")
|
||||
def test_product_replenish(self):
|
||||
"""We create a bill of materials of subcontract type. We run replenish and
|
||||
validate that the production order has been created with the correct BOM."""
|
||||
bom = self._create_bom("subcontract")
|
||||
mrp_bom_form = Form(bom)
|
||||
with mrp_bom_form.operation_ids.new() as operation_form:
|
||||
operation_form.name = "Test operation"
|
||||
operation_form.bom_id = bom
|
||||
operation_form.workcenter_id = self.workcenter
|
||||
bom = mrp_bom_form.save()
|
||||
self._product_replenish(self.product, 1)
|
||||
item = self.mrp_production_model.search([("product_id", "=", self.product.id)])
|
||||
self.assertEqual(item.bom_id, bom)
|
||||
|
||||
Reference in New Issue
Block a user