diff --git a/plm/__manifest__.py b/plm/__manifest__.py index 1192758d..a4a644e5 100644 --- a/plm/__manifest__.py +++ b/plm/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################## { "name": "Product Lifecycle Management", - "version": "18.0.3.0.0", + "version": "18.0.3.0.1", "author": "OmniaSolutions", "website": "https://odooplm.omniasolutions.website", "category": "Manufacturing/Product Lifecycle Management (PLM)", diff --git a/plm/models/product_product.py b/plm/models/product_product.py index 0667abda..bdd2f74e 100755 --- a/plm/models/product_product.py +++ b/plm/models/product_product.py @@ -1936,6 +1936,7 @@ def action_open_linked_field(self, related_field): }) return { + "name": "Linked Documents", "type": "ir.actions.act_window", "view_mode": "kanban", 'domain': domain, diff --git a/plm/models/product_template.py b/plm/models/product_template.py index 02037445..9f8ac79f 100755 --- a/plm/models/product_template.py +++ b/plm/models/product_template.py @@ -73,12 +73,13 @@ class ProductTemplate(models.Model): compute=lambda self: self._compute_eng_code_editable() ) kit_bom = fields.Boolean(_('KIT Bom Type')) - + linkeddocuments = fields.Many2many(related="product_variant_id.linkeddocuments") def action_open_linked_field(self, related_field): - return self.product_variant_id.action_open_linked_field(related_field) - + product_id = self.env['product.product'].browse(self.id) + return product_id.action_open_linked_field(related_field) + def unlinkCheckBomRelations(self): def print_where_struct(self, where_struct): @@ -212,7 +213,7 @@ def init(self): """) def getSequenceFrom(self, prefix, digit, start_number= 0): - plm_prefix = f"PLM_SEQUENCE_{prefix}" + plm_prefix = f"PLM_SEQUENCE_{prefix}" sequence=None for sequence in self.env['ir.sequence'].sudo().search([('code','=', plm_prefix)]): break diff --git a/plm/static/src/js/many2one_widget/many2one_widget.js b/plm/static/src/js/many2one_widget/many2one_widget.js index 8f2523f3..f3436a90 100644 --- a/plm/static/src/js/many2one_widget/many2one_widget.js +++ b/plm/static/src/js/many2one_widget/many2one_widget.js @@ -38,7 +38,6 @@ export class PlmMany2oneWidget extends Many2OneField { }); if (this.props && this.props.record && this.props.record.data && this.props.record.data[this.props.name] && this.props.record.data[this.props.name].length != 0) { - let imageData = await this.env.model.orm.call(this.relation, "search_read", [], { domain: [["id", "=", this.props.record.data[this.props.name][0]]], fields: [this.props.options.image_field], @@ -55,12 +54,12 @@ export class PlmMany2oneWidget extends Many2OneField { } } - onImageClicked(event) { + async onImageClicked(event) { event.stopPropagation(); // It stops the event from triggering any additional event handlers let selectedProductId = this.props.record.data.product_id[0]; let relatedFieldName = this.props.options.linked_field; let model = this.props.record.model.root.model.config.fields[this.props.name].relation; - let action_open_linked_field = this.props.record.model.orm.call(model, "action_open_linked_field", [selectedProductId, relatedFieldName]); + let action_open_linked_field = await this.props.record.model.orm.call(model, "action_open_linked_field", [selectedProductId, relatedFieldName]); return this.action.doAction(action_open_linked_field); } }