[14.0][ADD] mrp_component_operation_scrap_reason

This commit is contained in:
DavidJForgeFlow
2022-12-30 11:14:49 +01:00
parent 04a2d6bb15
commit 0a7e0514f4
10 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import wizards

View File

@@ -0,0 +1,18 @@
# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "MRP Component Operation Scrap Reason",
"version": "14.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"summary": "Allows to pass a reason to scrap with MRP component operation",
"website": "https://github.com/OCA/manufacture",
"category": "Manufacturing/Manufacturing",
"license": "AGPL-3",
"depends": ["scrap_reason_code", "mrp_component_operation"],
"data": [
"wizards/mrp_component_operate_wizard.xml",
],
"installable": True,
"auto-install": True,
}

View File

@@ -0,0 +1 @@
* David Jiménez <david.jimenez@forgeflow.com>

View File

@@ -0,0 +1 @@
This module allows to pass a reason to scrap with MRP component operation (glue module).

View File

@@ -0,0 +1 @@
from . import mrp_component_operate

View File

@@ -0,0 +1,18 @@
# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
from odoo import fields, models
class MrpComponentOperate(models.Model):
_inherit = "mrp.component.operate"
scrap_reason_code_id = fields.Many2one(
"scrap.reason.code",
string="Scrap Reason Code",
)
def _create_scrap(self):
scrap = super()._create_scrap()
scrap.reason_code_id = self.scrap_reason_code_id
return scrap

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_mrp_component_operate_form_scrap_reason" model="ir.ui.view">
<field name="name">view_mrp_component_operate_form_scrap_reason</field>
<field name="model">mrp.component.operate</field>
<field
name="inherit_id"
ref="mrp_component_operation.view_mrp_component_operate_form"
/>
<field name="arch" type="xml">
<field name="operation_id" position="after">
<field
name="scrap_reason_code_id"
attrs="{'invisible': [('outgoing_operation', '!=', 'scrap')], 'required': [('outgoing_operation', '=', 'scrap')]}"
/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1 @@
../../../../mrp_component_operation_scrap_reason

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)