Skip to content

Commit

Permalink
[MOD] add state field in mrp production form component line view
Browse files Browse the repository at this point in the history
  • Loading branch information
jayraj-omnia committed Jan 2, 2025
1 parent 9f73709 commit 05a97cc
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 31 deletions.
34 changes: 14 additions & 20 deletions plm/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OmniaSolutions, Open Source Management Solution
Expand All @@ -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)",
Expand All @@ -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",
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions plm/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@
from . import plm_client
from . import res_groups
from . import utils
from . import stock_move
20 changes: 10 additions & 10 deletions plm/models/mrp_bom_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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']))
Expand All @@ -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'),
Expand All @@ -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
Expand All @@ -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.")
Expand All @@ -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',
Expand All @@ -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):
Expand Down
14 changes: 14 additions & 0 deletions plm/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -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)
16 changes: 16 additions & 0 deletions plm/views/mrp_production.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="mrp_production_form_view_inherit_plm" model="ir.ui.view">
<field name="name">mrp.production.form.view.inherit.plm</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="arch" type="xml">
<field name="forecast_availability" position="after">
<field name="engineering_revision" optional="hide"/>
<field name="engineering_state" optional="hide"/>
</field>
</field>
</record>
</data>
</odoo>
2 changes: 1 addition & 1 deletion plm_box/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 05a97cc

Please sign in to comment.