Skip to Content
Menu
This question has been flagged
1 Reply
788 Views

Hello,

How to mask "MARK AS DONE" button in manufacturing order if there is a backorder not done in transfert? Odoo.sh V15

Denis

Avatar
Discard
Best Answer

To mask the "Mark as Done" button in a manufacturing order if there is a backorder not done in transfer, you will need to create a new computed field in the manufacturing order model that checks for the presence of a backorder not done in transfer and then use this field to control the visibility of the button.

Here's an example of how you can do this in Odoo 15:

  1. Create a new computed field in the manufacturing order model to check for the presence of a backorder not done in transfer. For example:

    has_backorder = fields.Boolean(compute='_compute_has_backorder')
    def _compute_has_backorder(self):
    for order in self:
    order.has_backorder = any(move.state != 'done' for move in order.picking_ids.mapped('move_lines').filtered(lambda m: m.product_id.type=='product' and m.location_dest_id.usage == 'internal' and m.location_id.usage != 'internal'))

  2. In the XML view of the form, add a new attribute to the "Mark as Done" button called "attrs" and use the "has_backorder" field to control its visibility

    This way, the button will be invisible when the "has_backorder" computed field is set to True, indicating that there is a backorder not done in transfer.
Avatar
Discard