Skip to content

Commit

Permalink
[IMP] stock_location_flowable: hide buttons on flowable operation
Browse files Browse the repository at this point in the history
  • Loading branch information
deeniiz committed Feb 25, 2025
1 parent af8f8a1 commit dc00f54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions stock_location_flowable/models/mrp_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ class MrpProduction(models.Model):

picking_id = fields.Many2one(comodel_name="stock.picking")
production_blocked = fields.Boolean(compute="_compute_production_blocked")
production_flowable = fields.Boolean(compute="_compute_production_flowable")

def _compute_production_flowable(self):
for rec in self:
rec.production_flowable = rec.picking_type_id.flowable_operation

def _compute_production_blocked(self):
for rec in self:
Expand Down
13 changes: 13 additions & 0 deletions stock_location_flowable/views/mrp_production_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@
name="attrs"
>{'readonly': [('production_blocked', '=', True)]}</attribute>
</xpath>
<xpath expr="//button[@name='button_scrap']" position="before">
<field name="production_flowable" invisible="1" />
</xpath>
<xpath expr="//button[@name='button_scrap']" position="attributes">
<attribute
name="attrs"
>{'invisible': [('production_flowable', '=', True)]}</attribute>
</xpath>
<xpath expr="//button[@name='button_unbuild']" position="attributes">
<attribute
name="attrs"
>{'invisible': [('production_flowable', '=', True)]}</attribute>
</xpath>
</field>
</record>
</odoo>

0 comments on commit dc00f54

Please sign in to comment.