'Writes repair order state to \'To be invoiced\' if invoice method is
After repair else state is set to \'Ready\'.
@return: True'

@api.multi
def action_repair_end(self):

    if self.filtered((lambda repair: (repair.state != 'under_repair'))):
        raise UserError(_('Repair    must    be    under    repair    in    order    to    end    reparation.'))
    for repair in self:
        repair.write({'repaired': True})
        vals = {'state': 'done'}
        vals['move_id'] = repair.action_repair_done().get(repair.id)
        if ((not repair.invoiced) and (repair.invoice_method == 'after_repair')):
            vals['state'] = '2binvoiced'
        repair.write(vals)
    return True
