Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: MRP Subcontracting

Entity: stock.move

Compute Method: _compute_show_subcontracting_details_visible

View 18.0 View 20.0
Inputs Method Outputs
  • is_subcontract
  • quantity
  • product_uom
  • product_uom.rounding
  • state
  • move_line_ids
  • uom_id
""" Compute if the action button in order to see moves raw is visible """
self.show_subcontracting_details_visible = False
for move in self:
            if not move.is_subcontract:
                continue
-             if float_is_zero(move.quantity, precision_rounding=move.product_uom.rounding):
+             if not move.move_line_ids or move.uom_id.is_zero(move.quantity):
                continue
-             productions = move._get_subcontract_production()
-             if not productions or (productions[:1].consumption == 'strict' and not productions[:1]._has_tracked_component()):
+             productions = move._get_subcontract_production().filtered(lambda m: m.state != 'cancel')
+             if not productions:
                continue
-             move.show_subcontracting_details_visible = move.state == 'done' or any(prod.subcontracting_has_been_recorded and prod.state != 'done' for prod in productions)
+             move.show_subcontracting_details_visible = True
  • show_subcontracting_details_visible

Back to entity