In how many ways can we fill the cells of a $m\times n$ board with $+1$ and $-1$ such that the product of numbers on each line and on each column are all equal to $-1$?

1. **Consider the product of all \( mn \) numbers on the board:**
   - Each cell in the \( m \times n \) board can be either \( +1 \) or \( -1 \).
   - The product of all numbers in the board is the product of the products of each row and each column.

2. **Analyze the product of each row and column:**
   - For the product of numbers in each row to be \( -1 \), each row must contain an odd number of \( -1 \)'s.
   - Similarly, for the product of numbers in each column to be \( -1 \), each column must contain an odd number of \( -1 \)'s.

3. **Consider the overall product of the board:**
   - The product of all numbers in the board is the product of the products of each row.
   - Since each row product is \( -1 \), the product of all rows is \( (-1)^m \).
   - Similarly, the product of all columns is \( (-1)^n \).

4. **Determine the feasibility based on \( m \) and \( n \):**
   - For the product of all numbers in the board to be consistent, \( (-1)^m \) must equal \( (-1)^n \).
   - This implies that \( m \) and \( n \) must have the same parity (both even or both odd).

5. **Case when \( m \not\equiv n \pmod{2} \):**
   - If \( m \) and \( n \) have different parities, it is impossible to fill the board such that the product of each row and each column is \( -1 \).

6. **Case when \( m \equiv n \pmod{2} \):**
   - If \( m \) and \( n \) have the same parity, we can construct a valid filling.
   - Consider a bijection between the fillings of the \( m \times n \) board and the \( (m-1) \times (n-1) \) board.
   - Fix the first \( m-1 \) rows and \( n-1 \) columns. The last row and column are determined by the requirement that the product of each row and column is \( -1 \).

7. **Count the number of valid fillings:**
   - There are \( 2^{(m-1)(n-1)} \) ways to fill the \( (m-1) \times (n-1) \) board with \( +1 \) and \( -1 \).
   - Each filling of the \( (m-1) \times (n-1) \) board uniquely determines a filling of the \( m \times n \) board.

Conclusion:
\[
\boxed{2^{(m-1)(n-1)}}
\]