From 05a97cce9b00b60eb86fef02f383af9f26ce19ee Mon Sep 17 00:00:00 2001 From: jayraj-omnia Date: Thu, 2 Jan 2025 18:49:32 +0530 Subject: [PATCH] [MOD] add state field in mrp production form component line view --- plm/__manifest__.py | 34 ++++++++++++++-------------------- plm/models/__init__.py | 1 + plm/models/mrp_bom_line.py | 20 ++++++++++---------- plm/models/stock_move.py | 14 ++++++++++++++ plm/views/mrp_production.xml | 16 ++++++++++++++++ plm_box/__manifest__.py | 2 +- 6 files changed, 56 insertions(+), 31 deletions(-) create mode 100644 plm/models/stock_move.py create mode 100644 plm/views/mrp_production.xml diff --git a/plm/__manifest__.py b/plm/__manifest__.py index df0b314c..02a4e629 100644 --- a/plm/__manifest__.py +++ b/plm/__manifest__.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- ############################################################################## # # OmniaSolutions, Open Source Management Solution @@ -20,7 +21,7 @@ ############################################################################## { "name": "Product Lifecycle Management", - "version": "18.0.0.1", + "version": "18.0.1.0.0", "author": "OmniaSolutions", "website": "https://odooplm.omniasolutions.website", "category": "Manufacturing/Product Lifecycle Management (PLM)", @@ -31,11 +32,16 @@ "images": ["static/img/odoo_plm.png"], "depends": ["base", "board", "product", "mrp"], "data": [ - # data - "data/data.xml", - # security "security/base_plm_security.xml", - # views + "data/data.xml", + "report/bom_document.xml", + "report/bom_structure_report_template.xml", + "report/document_report_templates.xml", + "report/product_report_templates.xml", + "report/product_report_document.xml", + "report/bom_structure.xml", + "report/component_report.xml", + "report/document_report.xml", "views/product_product_first.xml", "views/ir_attachment_view.xml", "views/ir_attachment_relations.xml", @@ -59,33 +65,21 @@ "views/menu.xml", "views/product_category.xml", "views/plm_temporaty.xml", + "views/mrp_production.xml", # QwebTemplates 'views/templates.xml', - # Reports Template - "report/bom_document.xml", - "report/bom_structure_report_template.xml", - "report/document_report_templates.xml", - "report/product_report_templates.xml", - "report/product_report_document.xml", - # Report - "report/bom_structure.xml", - "report/component_report.xml", - "report/document_report.xml", ], "assets": { "web.assets_backend": [ "plm/static/src/css/component_kanban.css", "plm/static/src/css/color_fields_tree.css", - ], + ], 'web.report_assets_common': [ "plm/static/src/scss/document_bom.scss", "plm/static/src/css/component_kanban.css", "plm/static/src/css/color_fields_tree.css", ], - }, - "qweb": [], - "demo": [], - "test": [], + }, "installable": True, "application": True, "auto_install": False, diff --git a/plm/models/__init__.py b/plm/models/__init__.py index 9526b2ca..0320e393 100755 --- a/plm/models/__init__.py +++ b/plm/models/__init__.py @@ -53,3 +53,4 @@ from . import plm_client from . import res_groups from . import utils +from . import stock_move diff --git a/plm/models/mrp_bom_line.py b/plm/models/mrp_bom_line.py index e542ee8c..bad86580 100755 --- a/plm/models/mrp_bom_line.py +++ b/plm/models/mrp_bom_line.py @@ -75,7 +75,7 @@ def _get_child_bom_lines(self): else: self.child_line_ids = False - + def get_related_boms(self): for bom_line in self: if not bom_line.product_id: @@ -121,7 +121,7 @@ def _related_boms(self): else: bom_line.related_bom_ids = [(6, False, bom_objs.ids)] - + def openRelatedBoms(self): related_boms = self.get_related_boms() if not related_boms: @@ -138,7 +138,7 @@ def openRelatedBoms(self): if len(ids_to_open) == 1: out_act_dict['view_mode'] = 'form' out_act_dict['res_id'] = ids_to_open[0] - + for line_brws in self: if line_brws.type == 'normal': domain.append(('type', 'in', ['normal','subcontract', 'phantom'])) @@ -154,7 +154,7 @@ def openRelatedBoms(self): out_act_dict['domain'] = domain return out_act_dict - + def openRelatedDocuments(self): domain = [('id', 'in', self.related_document_ids.ids)] out_act_dict = {'name': _('Documents'), @@ -169,7 +169,7 @@ def openRelatedDocuments(self): 'domain': domain} return out_act_dict - + def _related_doc_ids(self): for bom_line_brws in self: bom_line_brws.related_document_ids = bom_line_brws.product_id.linkeddocuments @@ -192,7 +192,7 @@ def _related_doc_ids(self): readonly=True, index=True, help="This is the document object that declares this BoM.") - + type = fields.Selection(related="bom_id.type") itemnum = fields.Integer('CAD Item Position', help= "This is the item reference position into the CAD document that declares this BoM.") @@ -217,13 +217,13 @@ def _related_doc_ids(self): ('server', 'Server')], 'Cutted Compute Type', default='none') - + product_tag_ids = fields.Many2many(related='product_tmpl_id.product_tag_ids') product_tag_ids = fields.Many2many(related='product_tmpl_id.product_tag_ids') - + product_tumbnail = fields.Image(related="product_id.product_tmpl_id.image_1920") - + def go_to_product(self): return {'name': _('Product'), 'res_model': 'product.product', @@ -233,7 +233,7 @@ def go_to_product(self): 'type': 'ir.actions.act_window', 'domain': [('id', 'in', self.product_id.ids)], } - + def plm_sanitize(self, vals): all_keys = self._fields if isinstance(vals, dict): diff --git a/plm/models/stock_move.py b/plm/models/stock_move.py new file mode 100644 index 00000000..44ca15cb --- /dev/null +++ b/plm/models/stock_move.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +from odoo import _, fields, models + + +class StockMove(models.Model): + _inherit = "stock.move" + + engineering_revision = fields.Integer(related="product_id.engineering_revision", + string=_("Revision"), + help=_("The revision of the product.")) + engineering_state = fields.Selection(related="product_id.engineering_state", + string=_("Status"), + help=_("The status of the product in its LifeCycle."), + store=False) diff --git a/plm/views/mrp_production.xml b/plm/views/mrp_production.xml new file mode 100644 index 00000000..5af03b89 --- /dev/null +++ b/plm/views/mrp_production.xml @@ -0,0 +1,16 @@ + + + + + mrp.production.form.view.inherit.plm + mrp.production + + + + + + + + + + diff --git a/plm_box/__manifest__.py b/plm_box/__manifest__.py index 74b20964..dad4bdad 100644 --- a/plm_box/__manifest__.py +++ b/plm_box/__manifest__.py @@ -38,10 +38,10 @@ "data": [ "security/plm_security.xml", "data/plm_box_sequence_data.xml", - "views/menu.xml", "views/non_cad_doc.xml", "views/box_object_rel.xml", "views/ir_attachment.xml", + "views/menu.xml", ], "installable": True, "application": False,