from odoo import models, fields, api


class AccountMoveLaundryExt(models.Model):
    """Flag invoices originating from laundry orders."""
    _inherit = 'account.move'

    is_laundry_invoice = fields.Boolean(
        string='Laundry Invoice',
        compute='_compute_is_laundry_invoice',
        store=True,
    )

    @api.depends('invoice_line_ids.sale_line_ids.order_id.is_laundry_order')
    def _compute_is_laundry_invoice(self):
        for move in self:
            move.is_laundry_invoice = any(
                sol.order_id.is_laundry_order
                for line in move.invoice_line_ids
                for sol in line.sale_line_ids
            )
