Is $P$ defined for TM which decide or accept a language?
Both definitions are the same. They just use a different wording. The difference between "decide" and "accept" is commonplace in computability theory, but in complexity theory different terminology is typically used, since we usually deal with machines that always halt.

The class $\mathsf{P}$ consists of all languages $L$ for which there exists a Turing machine $T$ such that:


$T$ runs in polynomial time. This means that there is a polynomial $p(n)$ such that $T(x)$ stops within $p(|x|)$ steps, where $|x|$ is the length of $x$.
If $x \in L$, then $T$ accepts $x$.
If $x \notin L$, then $T$ rejects $x$.




Suppose we have a machine $T$ with a different guarantee:


If $x \in L$, then $T$ halts after $p(|x|)$ steps.
If $x \notin L$, then $T$ never halts.


The language $L$ is in $\mathsf{P}$, since we can construct a different machine $T'$ which simulates $T$ for $p(|x|)$ steps, accepts the input if $T$ halts, and rejects the input if $T$ doesn't halt. Perhaps that answers your question.