Skip to content

Commit

Permalink
IMP: add tumbnail to mrp.bom.lines
Browse files Browse the repository at this point in the history
  • Loading branch information
mboscolo committed May 31, 2024
1 parent 5e8fad5 commit cd6845f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plm/models/mrp_bom_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from odoo import fields
from odoo import api
from odoo import _
import logging


class MrpBomLineExtension(models.Model):
Expand Down Expand Up @@ -193,6 +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 @@ -219,7 +219,9 @@ def _related_doc_ids(self):
default='none')

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 Down
3 changes: 3 additions & 0 deletions plm/views/mrp_extension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<field name="model">mrp.bom.line</field>
<field name="arch" type="xml">
<tree>
<field name="product_tumbnail" widget="image" options="{ 'size': [60, 60]}"/>
<field name="product_id"/>
<button name="go_to_product"
icon="fa-external-link"
Expand Down Expand Up @@ -45,6 +46,7 @@
<field name="arch" type="xml">
<field name="product_id" position="before">
<field name="itemnum"/>
<field name="product_tumbnail" widget="image" options="{ 'size': [60, 60]}"/>
</field>
<field name="product_id" position="after">
<field name="engineering_revision" readonly="True"/>
Expand Down Expand Up @@ -159,6 +161,7 @@
<xpath expr="//field[@name='bom_line_ids']/tree/field[@name='product_id']" position="before">
<field name="related_bom_ids" invisible="True"/>
<field name="hasChildBoms" invisible="True"/>
<field name="product_tumbnail" widget="image" options="{ 'size': [60, 60]}"/>
<button name="openRelatedBoms"
type="object"
icon="fa-level-down"
Expand Down

0 comments on commit cd6845f

Please sign in to comment.