mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] mrp_bom_attribute_match: Migration to 15.0
Notes:
* `_get_product2bom` renamed to `_bom_find`
* Test case `test_manufacturing_order_2`:
* No longer check for "Add some materials to consume before marking this MO as to do.",
as it's already supported in core since https://github.com/odoo/odoo/commit/bf5e1debf
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "BOM Attribute Match",
|
||||
"version": "14.0.1.0.2",
|
||||
"version": "15.0.1.0.0",
|
||||
"category": "Manufacturing",
|
||||
"author": "Ilyas, Ooops, Odoo Community Association (OCA)",
|
||||
"summary": "Dynamic BOM component based on product attribute",
|
||||
@@ -10,7 +10,4 @@
|
||||
"data": [
|
||||
"views/mrp_bom_views.xml",
|
||||
],
|
||||
"qweb": [],
|
||||
"application": False,
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
@@ -109,9 +109,6 @@ class MrpBomLine(models.Model):
|
||||
)
|
||||
)
|
||||
|
||||
def write(self, vals):
|
||||
super(MrpBomLine, self).write(vals)
|
||||
|
||||
|
||||
class MrpBom(models.Model):
|
||||
_inherit = "mrp.bom"
|
||||
@@ -149,7 +146,7 @@ class MrpBom(models.Model):
|
||||
def update_product_boms():
|
||||
products = self.env["product.product"].browse(product_ids)
|
||||
product_boms.update(
|
||||
self._get_product2bom(
|
||||
self._bom_find(
|
||||
products,
|
||||
bom_type="phantom",
|
||||
picking_type=picking_type or self.picking_type_id,
|
||||
@@ -310,7 +307,7 @@ class MrpBom(models.Model):
|
||||
return line_product_id
|
||||
|
||||
def write(self, vals):
|
||||
res = super(MrpBom, self).write(vals)
|
||||
res = super().write(vals)
|
||||
for line in self.bom_line_ids:
|
||||
line.update_component_attributes()
|
||||
return res
|
||||
|
||||
@@ -5,15 +5,14 @@ class MrpProduction(models.Model):
|
||||
_inherit = "mrp.production"
|
||||
|
||||
def action_confirm(self):
|
||||
res = super(MrpProduction, self).action_confirm()
|
||||
if self and self.bom_id:
|
||||
for bom_line in self.bom_id.bom_line_ids:
|
||||
if bom_line.component_template_id:
|
||||
# product_id was set in mrp.bom.explode for correct flow. Need to remove it.
|
||||
bom_line.product_id = False
|
||||
res = super().action_confirm()
|
||||
for bom_line in self.bom_id.bom_line_ids:
|
||||
if bom_line.component_template_id:
|
||||
# product_id was set in mrp.bom.explode for correct flow. Need to remove it.
|
||||
bom_line.product_id = False
|
||||
return res
|
||||
|
||||
def write(self, vals):
|
||||
for bl in self.bom_id.bom_line_ids.filtered(lambda x: x.component_template_id):
|
||||
for bl in self.bom_id.bom_line_ids.filtered("component_template_id"):
|
||||
bl.check_component_attributes()
|
||||
return super(MrpProduction, self).write(vals)
|
||||
return super().write(vals)
|
||||
|
||||
@@ -6,7 +6,7 @@ class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
def write(self, vals):
|
||||
res = super(ProductTemplate, self).write(vals)
|
||||
res = super().write(vals)
|
||||
self.check_product_with_component_change_allowed()
|
||||
self.check_component_change_allowed()
|
||||
return res
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
* Ooops404 <https://ooops404.com>
|
||||
|
||||
* Ilyas
|
||||
|
||||
* `Camptocamp <https://www.camptocamp.com>`_
|
||||
|
||||
* Iván Todorovich <ivan.todorovich@camptocamp.com>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from odoo.tests import Form, common
|
||||
from odoo.tests import Form, TransactionCase
|
||||
|
||||
|
||||
class TestMrpAttachmentMgmtBase(common.SavepointCase):
|
||||
class TestMrpAttachmentMgmtBase(TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
|
||||
@@ -81,9 +81,7 @@ class TestMrpAttachmentMgmt(TestMrpAttachmentMgmtBase):
|
||||
mo_form.bom_id = self.bom_id
|
||||
mo_form.product_qty = 1
|
||||
self.mo_sword = mo_form.save()
|
||||
with self.assertRaises(UserError):
|
||||
# Add some materials to consume before marking this MO as to do.
|
||||
self.mo_sword.action_confirm()
|
||||
self.mo_sword.action_confirm()
|
||||
|
||||
def test_manufacturing_order_3(self):
|
||||
# Delete attribute from sword
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="mrp_bom_view_form_inherit_bom_match" model="ir.ui.view">
|
||||
<field name="name">mrp.bom.view.form.inherit.bom.match</field>
|
||||
<record id="mrp_bom_form_view" model="ir.ui.view">
|
||||
<field name="model">mrp.bom</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_bom_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
|
||||
Reference in New Issue
Block a user