From bdd165fd74486c9094a7c971700dcade129af43b Mon Sep 17 00:00:00 2001 From: jayraj-omnia Date: Fri, 17 Jan 2025 18:43:13 +0530 Subject: [PATCH] [MOD] update changes regarding plm_pdf_workorder --- plm/models/ir_attachment_relations.py | 29 +++++++--- plm/views/ir_attachment_relations.xml | 57 ++++++++++--------- plm/views/ir_attachment_view.xml | 8 ++- .../view/ir_attachment.xml | 2 +- plm_pdf_workorder/views/ir_attachment.xml | 16 +++++- .../views/mrp_routing_workcenter.xml | 3 - .../models/mrp_workorder.py | 3 +- plm_spare/views/ir_attachment.xml | 4 +- plm_web_3d/views/ir_attachment.xml | 2 +- 9 files changed, 78 insertions(+), 46 deletions(-) diff --git a/plm/models/ir_attachment_relations.py b/plm/models/ir_attachment_relations.py index dbbe1176..367b60cb 100755 --- a/plm/models/ir_attachment_relations.py +++ b/plm/models/ir_attachment_relations.py @@ -28,7 +28,7 @@ class PlmDocumentRelations(models.Model): _name = 'ir.attachment.relation' _description = "Relation between document used for cad file structure" - + parent_preview = fields.Binary(related="parent_id.preview", string=_("Parent Preview"), store=False) @@ -82,12 +82,26 @@ class PlmDocumentRelations(models.Model): default=False, readonly=True) notes = fields.Char(string="Notes: ") - + preview_related = fields.Image( + compute="_compute_preview_related", + store=True, attachment=False, + max_height=1920, max_width=1920, + string=_("Child Parent Preview") + ) + _sql_constraints = [ - ('relation_uniq', 'unique (parent_id,child_id,link_kind)', _('The Document Relation must be unique !')), - ('parent_child_check', 'CHECK (parent_id <> child_id)', _('Parent child product must be different !')) + ('relation_uniq', 'unique (parent_id,child_id,link_kind)', _('The Document Relation must be unique !')), + ('parent_child_check', 'CHECK (parent_id <> child_id)', _('Parent child product must be different !')) ] + @api.depends('parent_id.preview', 'link_kind', 'child_id') + def _compute_preview_related(self): + for rec in self: + if not rec.child_preview and rec.child_id and rec.link_kind == 'ExtraTree' and rec.parent_id.preview: + rec.preview_related = rec.parent_id.preview + else: + rec.preview_related = False + def copy(self, default=None): if not default: default = {} @@ -188,7 +202,7 @@ def is_2d_ok(self, from_ir_attachment_id): if relation_id.child_id.document_type=='2d' and relation_id.parent_id.document_type in ['3d','pr'] : if relation_id.child_id.getLastCadSave()
@@ -69,7 +69,7 @@ invisible="parent_linked in [False, []]"/>
@@ -84,7 +84,7 @@

@@ -135,7 +135,12 @@ - + + @@ -179,7 +184,7 @@ - + @@ -189,19 +194,19 @@ ir.attachment.relation - - + + - 0 - + 0 + - 0 - + 0 + - 0 - + 0 + - 0 + 0 @@ -235,17 +240,17 @@ - - - @@ -514,7 +519,7 @@ Name: - @@ -601,11 +606,11 @@ View Document Relations ir.attachment.relation - + kanban,list,form ['|', ('child_id', 'in', context.get('active_ids', [])), ('parent_id', 'in', context.get('active_ids', []))] - + diff --git a/plm/views/ir_attachment_view.xml b/plm/views/ir_attachment_view.xml index f15e54b3..9f466f8b 100755 --- a/plm/views/ir_attachment_view.xml +++ b/plm/views/ir_attachment_view.xml @@ -461,9 +461,13 @@ + + + + + - Name: @@ -513,7 +517,7 @@ - + diff --git a/plm_automated_convertion/view/ir_attachment.xml b/plm_automated_convertion/view/ir_attachment.xml index 1fd8d027..c462560a 100644 --- a/plm_automated_convertion/view/ir_attachment.xml +++ b/plm_automated_convertion/view/ir_attachment.xml @@ -38,7 +38,7 @@ - diff --git a/plm_pdf_workorder/views/ir_attachment.xml b/plm_pdf_workorder/views/ir_attachment.xml index 46aae19c..bfaeb0a1 100644 --- a/plm_pdf_workorder/views/ir_attachment.xml +++ b/plm_pdf_workorder/views/ir_attachment.xml @@ -16,10 +16,22 @@ ir.attachment - - + + + Prod Doc: + + + + + diff --git a/plm_pdf_workorder/views/mrp_routing_workcenter.xml b/plm_pdf_workorder/views/mrp_routing_workcenter.xml index 3c225f8e..78662e63 100755 --- a/plm_pdf_workorder/views/mrp_routing_workcenter.xml +++ b/plm_pdf_workorder/views/mrp_routing_workcenter.xml @@ -8,9 +8,6 @@ - - - use_plm_docs == True diff --git a/plm_pdf_workorder_enterprise/models/mrp_workorder.py b/plm_pdf_workorder_enterprise/models/mrp_workorder.py index 2a3764a9..6e6eede9 100644 --- a/plm_pdf_workorder_enterprise/models/mrp_workorder.py +++ b/plm_pdf_workorder_enterprise/models/mrp_workorder.py @@ -36,7 +36,8 @@ def action_open_workorder_kanban(self): ctx.update({ "create": False, "delete": False, - 'default_res_ids': self.production_doc_ids.ids + 'default_res_ids': self.production_doc_ids.ids, + 'readonly': True }) return { diff --git a/plm_spare/views/ir_attachment.xml b/plm_spare/views/ir_attachment.xml index 4ea4dca6..5e90672b 100755 --- a/plm_spare/views/ir_attachment.xml +++ b/plm_spare/views/ir_attachment.xml @@ -7,8 +7,8 @@ - Spare Part: - + Spare Part: +