Skip to content

Commit

Permalink
storage_media_product: gray out inactive relations
Browse files Browse the repository at this point in the history
  • Loading branch information
simahawk committed Apr 10, 2024
1 parent 1434168 commit c9409cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions storage_media_product/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class ProductMediaRelation(models.Model):

sequence = fields.Integer()
media_id = fields.Many2one("storage.media", required=True)
# Just to gray out relations in the tree view on the product
active = fields.Boolean(related="media_id.active")
attribute_value_ids = fields.Many2many(
"product.attribute.value", string="Attributes"
)
Expand Down
3 changes: 2 additions & 1 deletion storage_media_product/views/product.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
<record id="product_media_relation_tree" model="ir.ui.view">
<field name="model">product.media.relation</field>
<field name="arch" type="xml">
<tree>
<tree decoration-muted="not active">
<field name="active" invisible="1" />
<field name="media_id" />
<field name="media_type_id" readonly="True" />
</tree>
Expand Down

0 comments on commit c9409cf

Please sign in to comment.