
737 P.2d 1132 (1987)
FIRST BANK, (N.A.) WESTERN MONTANA, MISSOULA, a National Banking Assoc., and Dan Simpkins, Relators,
v.
DISTRICT COURT FOR THE FOURTH JUDICIAL DISTRICT of the State of Montana, in and for the County of Missoula and the Hon. Douglas Harkin, Presiding Judge, Respondents.
No. 86-431.
Supreme Court of Montana.
Submitted March 18, 1987.
Decided May 11, 1987.
Garlington, Lohn & Robinson, George Goodrich, Missoula, argued, for relators.
Small, Hatch, Doubek & Pyfer, John Doubek, Helena, argued, for respondents.
*1133 SHEEHY, Justice.
This is an original proceeding. Applicants seek a writ of supervisory control vacating the Fourth Judicial District's denial of First Bank's motion to dismiss an action filed by Bessie, Lee and Rick Stott and All West Equipment, plaintiffs in the court below. The Stotts filed their action alleging fraud, misrepresentation and breach of the duty of good faith and fair dealing against First Bank. First Bank filed a motion to dismiss on the grounds that the Stotts' action was barred by the doctrine of res judicata, the compulsory counterclaim rule, and the statute of limitations. The District Court denied First Bank's motion to dismiss. We grant applicant's request for supervisory control, vacate the order denying the motion to dismiss and hereby enter an order granting the motion to dismiss.
In June, 1982, First Bank Western Montana, Missoula, loaned to plaintiffs All West Equipment and Lee Stott (individually) $68,732.30, due in September, 1982. On the same day, First Bank loaned $21,566.63 to All West Equipment. The second loan was due December 15, 1982. The Stotts defaulted on both of these notes. Bessie and Lee Stott were guarantors of the debts of All West Equipment. In their complaint, the Stotts claim that Rick Stott was also an owner of All West Equipment. Possession of the collateral was turned over to First Bank, by a written instrument dated October 20, 1982 and signed by Rick Stott on behalf of All West Equipment. The collateral was eventually sold by First Bank.
On January 7, 1983, First Bank filed a complaint, in the Fourth Judicial District Court, against All West Equipment and Lee and Bessie Stott, to collect deficiencies owing after sale of the collateral under the promissory notes and guaranty. The Stotts and All West, through another attorney than their present counsel, filed an answer which included the two following affirmative defenses:

First Affirmative Defense
As and for a separate and affirmative defense to Count One of Plaintiff's complaint, said defendants allege that plaintiff sold or liquidated certain property of defendants as collateral, not in accordance with the requirements of Section 30-9-504(1) and 30-9-504(3) MCA and in this respect allege that plaintiff conducted the sale not in a commercially reasonably manner considering the time and place of sale, the type of equipment being sold, the lack of preparation of the equipment before the sale, the sale of the equipment at amounts substantially below market value. That the plaintiff's agent led defendants to believe that by not opposing the sale the defendants would not be liable for any deficiency and defendants relying on that promise did not at that time oppose the manner of the sale.
Second Affirmative Defense
As and for a second and affirmative defense to Count Two of Plaintiff's complaint defendant alleges that plaintiff sold the collateral not in a commercially reasonable manner considering lack of notice of sale, time and place of sale, sale to Plaintiff at less than market value, and the promise by Plaintiff's agent that defendant would be "protected" from any deficiency.
The matters between First Bank and All West and the Stotts were settled without trial and a stipulation and order of dismissal with prejudice was filed on January 4, 1985.
Ten months later, on October 1985, the Stotts and All West Equipment, with different counsel, filed a complaint in the Fourth Judicial District against First Bank alleging fraud, misrepresentation, and breach of the duty of good faith and fair dealing on the part of First Bank in making the loans to them and in obtaining their signature for the release of collateral.
The Stotts also alleged that the collateral was sold without commercially reasonable preparation and that the bank violated the requirements set out in § 30-9-504, MCA (concerning the secured party's right to dispose of collateral after default.)
*1134 First Bank responded by filing a motion to dismiss on the grounds that the Stotts' action was barred by the doctrine of res judicata, the compulsory counterclaim rule and the statute of limitations. By order dated March 19, 1986, the District Court denied First Bank's Motion.
In doing so, the District Court hinted that it saw a possible additional unresolved issue, suggesting that the order of dismissal with prejudice might have been an intended consent judgment. The court explained:
Because of the limited scope of the court's discretion when ruling on a motion to dismiss, construing the complaint in the light most favorable to Plaintiffs would require that there was an express or implied understanding that an action such as the present action was exempt from the judgment in the prior lawsuit.
First Bank disputes this holding, raising four issues:
1. Whether res judicata bars the Stotts' claims.
2. Whether the claims the Stotts' have against First Bank were compulsory counterclaims in a prior action and are barred.
3. Whether the District Court erred in concluding that the prior action was resolved by a consent judgment.
4. Whether the statute of limitations bars the Stotts' claims.
Notably absent from discussion in the parties' briefs is the issue of this Court's jurisdiction for granting supervisory control on an interlocutory order. No Rule 54 certification has been obtained. There is simply a denial of a motion to dismiss. As such, it is not an appealable final order within the terms of Rule 1 of the Montana Rules of Appellate Procedure. This Court will nonetheless accept jurisdiction to protect First Bank from participating in needless litigation, a purpose for which a writ of supervisory control is intended: "... it is in the nature of a summary appeal  a shortcut  to control the course of litigation in the trial court ... and may be employed to prevent extended and needless litigation." State ex rel. Buttrey Foods, Inc. v. District Court (1966), 148 Mont. 350, 354, 420 P.2d 845, 847. State ex rel. Regis v. District Court (1936), 102 Mont. 74, 77, 55 P.2d 1295, 1297.
The bank's central argument in this application is that the Stotts are barred from bringing any action against it regarding the promissory notes and guaranty because the Stotts' claim is res judicata. The bank explains that all the issues raised by the Stotts in their action against the bank were raised in the Stotts' affirmative defenses in the original default action brought by the bank. The bank claims that the Stotts explicitly raised the following issues by their affirmative defenses:
1. That the sale and liquidation of collateral violated § 30-9-504, MCA, concerning the secured party's right to dispose of collateral after default.
2. That the sale and liquidation of collateral was not conducted in a commercially reasonable manner.
3. That the bank and its agent, Dan Simpkins, misrepresented facts when the Stotts gave their consent for the sale of the collateral.
4. That the Stotts relied on the alleged misrepresentations in consenting to the sale of the collateral.
5. That the bank and its agents promised the Stotts that they would be protected from any deficiency.
6. That the collateral was sold for less than market value.
The bank maintains that these are the same allegations which the Stotts' are pleading in their present action, with the exception that in the second action, the Stotts' allege that the bank persuaded them to place their business with it.
The doctrine of res judicata is firmly established to stand for the proposition that a party should not be able to relitigate a matter that that party has already had the opportunity to litigate, and the public policy that there must be some end to litigation. Wellman v. Wellman (1982), 198 Mont. 42, 643 P.2d 573.
Once there has been full opportunity to present an issue for judicial decision in a *1135 given proceeding . .. the determination of the court in that proceeding must be accorded finality as to all issues raised or which fairly could have been raised, else judgments might be attacked piecemeal and without end. (Citation omitted.)
Wellman, 198 Mont. at 45-46, 643 P.2d at 575. See Brault v. Smith (Mont. 1984), 679 P.2d 236, 41 St.Rep. 527.
The Stotts were given the opportunity to litigate the issues raised in their complaint, but agreed to stipulate for a dismissal with prejudice. The effect of a stipulation is the same as a judgment on the merits. Accordingly, a dismissal with prejudice is res judicata as to every issue raised in the pleadings. City of Havre v. District Court (1980), 187 Mont. 181, 609 P.2d 275; cert. denied Boucher v. City of Havre (1980), 449 U.S. 875, 101 S.Ct. 219, 66 L.Ed.2d 97; Schillinger v. Brewer (Mont. 1985), 697 P.2d 919, 42 St.Rep. 408.
This Court has summarized the necessary criteria for applying the doctrine of res judicata as follows:
... four criteria exist in Montana law which must be met before a plea of res judicata can be sustained. These criteria are: (1) the parties or their privies must be the same; (2) the subject matter of the action must be the same; (3) the issues must be the same, and must relate to the same subject matter; and (4) the capacities of the persons must be the same in reference to the subject matter and to the issues between them.
Smith v. County of Musselshell (1970), 155 Mont. 376, 378, 472 P.2d 878, 880. See also S.W. Company v. John Wight, Inc. (1978), 179 Mont. 392, 587 P.2d 348 and Fox v. 7L Bar Ranch Co. (1982), 198 Mont. 201, 645 P.2d 929.
Each of the four criteria is met in this case. The Stotts, of course, assert that the opposite is true, but present no argument to support the assertion other than to contend that the parties in the two actions are not the same. Neither their son Rick nor Dan Simpkins, the bank officer, were named in the first action, they assert. The bank responds, and we agree, that while Rick Stott was not named in the first action, he was in privity with the parties, as he had signed the agreement for voluntary possession of the collateral for All West Equipment. Further, Dan Simpkins was also in privity for purposes of the original action, as he was an officer and agent of the bank. As used here, privity implies a connection, mutuality of will or an interaction of the parties. State ex rel. Buttrey Foods, Inc. v. District Court (1966), 148 Mont. at 353, 420 P.2d at 847. Clearly, this is established for the purposes of meeting the first criterion.
We see no difficulty in reaching the same conclusion about the remaining three criteria. The subject matter of the answer and affirmative defenses are the same as those raised in the present action, i.e., First Bank's conduct in obtaining the release and sale of the collateral. The issues raised by the Stotts in their answer to the bank's collection suit are the same as the issues raised in the present action, although the Stotts' complaint sets forth the factual allegations in more detail. Finally, the capacities of the people and parties involved have not changed in the way they relate to the subject matter and issues between them. The criteria for application of res judicata are fully satisfied.
The next issue raised is whether the Stotts' second action is also barred by Rule 13(a) of M.R.Civ.P. concerning compulsory counterclaims. Rule 13(a) provides:
A pleading shall state as a counterclaim any claim which at the time of serving the pleading the pleader has against any opposing party, if it arises out of the transaction or occurrence that is the subject matter of the opposing party's claim and does not require for its adjudication the presence of third parties of whom the court cannot acquire jurisdiction....
The purpose of this statute is to avoid multiplicity of suits by requiring the parties to adjust in one action their various differences growing out of any given transaction. Friedrichsen v. Cobb (1929), 84 Mont. 238, 275 P. 267. This insures that only one judicial proceeding is required to settle all matters determinable by the facts or law and to bring all logically related *1136 claims into a single litigation. Julian v. Mattson (Mont. 1985), 710 P.2d 707, 42 St. Rep. 1908.
Since a claim which "arises out of the transaction or occurrence that is the subject matter of the opposing party's claim" must be pleaded or is barred, it is important to understand what the quoted phrase means. The United States Supreme Court defined "transaction" as follows:
`Transaction' is a word of flexible meaning. It may comprehend a series of many occurrence, depending not so much upon the immediateness of their connection as upon their logical relationship ... It is the one circumstance without which neither party would have found it necessary to seek relief. Essential facts alleged by appellant enter into and constitute in part the cause of action set forth in the counterclaim. That they are not precisely identical, or that the counterclaim embraces additional allegations ... does not matter. To hold otherwise would be to rob this branch of the rule of all serviceable meaning, since the facts relied upon by the plaintiff rarely, if ever, are, in all particulars, the same as those constituting the defendant's counterclaim.
Moore v. New York Cotton Exchange (1926), 270 U.S. 593, 610, 46 S.Ct. 367, 371, 70 L.Ed. 750, 757; Julian v. Mattson, supra.
Rule 13(a) was adopted in this state in 1961 on the same basis as the federal Rules of Civil Procedure (§ 13, Ch. 13, Laws of Montana (1961)). Long before, however, under statutes, we recognized that a defendant who failed to raise a counterclaim to a complaint could not thereafter maintain a second action against the plaintiff. Friedrichsen v. Cobb (1929), 84 Mont. 238, 275 P. 267.
In response to the bank's initial action, the Stotts' affirmative defenses alleged violation of § 30-9-504, MCA, misrepresentation on the part of the bank's agent that induced the Stotts to give their consent for the sale of collateral, "promise by plaintiff's [bank's] agent that defendant [Stotts] would be `protected' from any deficiency," and sale of the collateral as a result of these wrong doings for less than its market value. In their second action, the Stotts allege that the acts of First Bank were fraudulent, deceitful, wrongful, careless, reckless, wanton and malicious. They allege fraud and misrepresentation on the part of the bank in making the loans and in obtaining their signature to release the collateral for sale. They also allege violation of § 30-9-504, MCA. It is clear to this Court that the Stotts' answer and affirmative defenses cover the same ground as that addressed in their complaint. Their answer and affirmative defenses indicate that they had knowledge of all the facts necessary to raise the issues now in their complaint as compulsory counterclaims in the bank's initial action.
While it is true that the Stotts' complaint offers greater detail in allegations, the factual history of the complaint is the same as the history alluded to in the affirmative defenses. The issues raised are the same. They both arise out of the same transaction. There is a logical relationship between the bank's foreclosure complaint and the Stotts' answer, affirmative defense and complaint alleging fraud, misrepresentation, bad faith and violations of § 30-9-504, MCA. "That they are not precisely identical or that the counterclaim embraces additional allegation... does not matter," the U.S. Supreme Court held in Moore.
We can only conclude that the Stotts' complaint is barred because it arose from the same transaction alleged in the bank's complaint. The claims of creditor misconduct were compulsory counterclaims in the first action. Hence, the effect is the same as our finding that the Stotts' complaint is res judicata.
The District Court did not decide whether the Stotts' claims were compulsory counterclaims in the collection suit. Rather, the District Court concluded that the parties had resolved the dispute by a consent judgment (even though another judge called it an Order of Dismissal With Prejudice). Hence the District Court ruled that the Stotts' right to bring an action on the counterclaim *1137 was not barred because the parties reached a judgment by consent.
A consent judgment is "a judgment, the provision and terms of which are settled and agreed to by the parties to the action." Black's Law Dictionary (5th ed.) at 436. A judgment by consent or stipulation of the parties is construed as a contract between them embodying the terms of the judgment. It operates to end all controversy between the parties, within the scope of the judgment.
The Stotts cite 2 A.L.R.2d 514 for their position that the general rules of res judicata do not apply indiscriminately to consent judgments.
While we agree that this is true, we must point out that nothing in the record or in the order of dismissal with prejudice indicates that a consent judgment was intended. As we noted, a judgment by consent is contractual in nature and therefore it should be construed as a written contract. In other words, the meaning of the consent judgment is to be gathered from the terms of the contract and the judgment should not be extended beyond the clear import of the terms.
The order of dismissal with prejudice, submitted by First Bank stated:

ORDER
PURSUANT TO WRITTEN STIPULATION by and between Plaintiff, FIRST BANK (N.A.) WESTERN MONTANA MISSOULA, and Defendants ALL WEST EQUIPMENT, LEE STOTT and BESSIE STOTT, through their respective counsel, that the above entitled action has been fully and finally compromised and settled upon the merits.
IT IS HEREBY ORDERED, that the above entitled action be, and the same is, hereby dismissed, with prejudice, each party to bear its own costs.
DATED this 4th day of January, 1985.
                 /s/ James B. Wheelis
(Emphasis added.)
The Stotts assert that it was the bank's duty to specify in its stipulation the issues it believed were finally resolved, and state the specific extent it believed future relitigation was precluded. They argue that if the bank had specifically limited relitigation in the stipulation, they would not have agreed to the stipulation. Hence they charge that the bank, in order to gain the advantage, fraudulently concealed its intentions to preclude future litigation by writing the stipulation in such a way as to prevent the Stotts from recognizing they were signing away their rights to further legal action.
The Stotts cite no evidence or authority supporting their assertion. Further, the difference between an order of dismissal with prejudice, the equivalent of a final judgment on the merits, and a consent judgment is clear. It is not reasonable to assume that the District Court confused them.
Since we determine that the Stotts' cause of action is barred, there is no need to discuss the issue of the statute of limitations. As for the Stotts' argument that their allegations included negligence, bad faith, and "other torts," our ruling that these were compulsory counterclaims precludes applying the statute of limitations to them.
Accordingly, we grant a writ of supervisory control, which this Opinion shall be and constitute. The cause is remanded to the District Court with directions to dismiss the complaint.
TURNAGE, C.J., HARRISON, GULBRANDSON, WEBER and HUNT, JJ., and ROBERT M. HOLTER, District Judge,[*] concur.
NOTES
[*]  Sitting for MORRISON, Former J.
