
710 P.2d 707 (1985)
Gordon JULIAN and Sara Williams Julian, Plaintiffs and Appellants,
v.
George MATTSON, Defendant and Respondent.
No. 85-227.
Supreme Court of Montana.
Submitted on Briefs October 10, 1985.
Decided December 18, 1985.
*708 Larry W. Moran, Bozeman, for plaintiffs and appellants.
Gregory O. Morgan, Bozeman, for defendant and respondent.
SHEEHY, Justice.
Appellants, Gordon Julian and Sara Williams Julian, husband and wife, appeal from the order of the District Court, Eighteenth Judicial District, County of Gallatin, granting the motion for summary judgment of respondent, George Mattson.
We affirm.
The Julian's brought this action in District Court to recover damages for defects in construction alleged due under an oral contract to supervise construction. The District Court denied Mattson's motion for summary judgment based upon the statute of limitation but granted Mattson's motion for summary judgment because the activities for which recovery was sought in this case arose out of the same transaction or occurrence as that litigated in Mattson v. Julian (Mont. 1984), 678 P.2d 654, 41 St. Rep. 544.
A review of Mattson is required here. The facts of that case were as follows: On June 1, 1978, Mattson, Dick Prugh and James Lenon, doing business as Design Construction, entered into a "cost plus" contract for the construction of a house for Gordon Julian in Bear Canyon, Gallatin County, Montana. The contract provided that the contractor would be compensated for services at 15% of the cost of the work.
Pursuant to the written contract Design Construction performed services, supplied materials and submitted statements to Julian on a regular basis from July 10, 1978 to January 5, 1979. Julian made payments of $31,636.90 out of $38,519.23 due under the contract. After extensive efforts by Mattson and his associates to collect the amount due, the Julians paid $500.00 on the account on April 30, 1980, reducing the balance to $6,382.33. After receiving no further payments, Mattson and his associates filed their complaint on May 14, 1981, naming Gordon Julian as defendant. On July 15, 1981, Julian filed an answer, generally denying the claim of work and services performed pursuant to the contract. The answer contained no specific denial of conditions precedent nor any statement of counterclaim.
The case was heard by the District Court without a jury on January 6, and 17, 1983. At trial Julian presented evidence that some of the work performed by Design Construction was defective. Admission of the evidence was objected to because Julian had failed to plead defects as a defense as required by the rules of Civil Procedure. Julian never attempted to amend his pleadings or obtain a continuance. The District *709 Court ruled that failure to specifically plead defects barred evidence of defects under the Rules.
In Mattson, we said that because Julian did not plead or otherwise give notice of his defects theory prior to trial, it was not clear whether he was attempting to prove only failure of a condition precedent or was also seeking recoupment. Mattson, 678 P.2d at 657-58, 41 St.Rep. at 548. Whether Julian's evidence of alleged defective performance was intended to support a counterclaim or was merely defensive did not affect the outcome of that case, because in either case Julian failed to follow the simple pleading procedures set forth in Rule 9 and Rule 13(a), M.R.Civ.P. For these reasons we held that the District Court properly refused to admit the evidence of defective performance.
In the instant case, Julian filed a complaint naming only Mattson as defendant, averring that on July 12, 1977, the parties had entered into a prior oral agreement for the design of the residence in Bear Canyon. Pursuant to the oral agreement, Mattson worked on designs for Julian, billing him for architectural design work and the preparation of an estimate of the cost of construction. Thereafter, on June 1, 1978, Julian and Mattson, together with his partners, entered into the "cost plus" contract for the construction of the residence which was the subject of consideration in Mattson.
The District Court granted Mattson's motion for summary judgment in the instant case, stating:
The activities for which recovery is sought arose out of the same transaction or occurrence as that litigated in Mattson vs. Julian. Both parties of this suit were parties in Mattson vs. Julian, and the issues in this case arose out of the same transaction which was [the] basis of Mattson vs. Julian. Therefore, the plaintiff is precluded from litigation of those issues.
Julian raises one issue on appeal: whether the District Court erred in granting Mattson's motion for summary judgment.
The crux of Julian's contention is that the District Court improperly granted Mattson's motion for summary judgment on grounds of res judicata. We, however, do not find res judicata per se applicable to the instant case, but rather, Rule 13(a), M.R.Civ.P. It is true that in Mattson we said that it was unclear whether Julian's evidence of alleged defective performance was merely defensive or intended to support a counterclaim. Mattson, 678 P.2d at 656, 41 St.Rep. at 546. But we also said that the evidence "appeared to be an attempt to raise a counterclaim which had not been plead." Mattson, 678 P.2d at 657, 41 St.Rep. at 547. Julian has now laid his cards on the table. We find that Julian's claim in the instant case amounts to a compulsory counterclaim that should have been plead in Mattson. As discussed above, it was not plead and is therefore barred from being raised in this action. Rule 13(a), M.R.Civ.P., provides in part:
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. (Emphasis added.)
The purpose of the compulsory counterclaim rule is to insure that only one judicial proceeding be required to settle all those matters determinable by the facts or law, that is, to bring all logically related claims into a single litigation, thereby avoiding a multiplicity of suits. 20 Am.Jur.2d Counterclaim, Recoupment, Etc. § 15.
Julian contends that this action does not arise out of the same transaction or occurrence, as that involved in Mattson, because Mattson arose out of the written construction contract between Julian and Mattson, together with his associates, and the instant case arose out of the prior oral agreement between Julian and Mattson. We disagree.
*710 This Court has defined the term transaction as:
`that combination of acts and events, circumstances and defaults, which, viewed in one aspect, results in the plaintiff's right of action, and viewed in another aspect, results in the defendant's right of action' (cite omitted), and it `applies to any dealings of the parties resulting in wrong, without regard to whether the wrong be done by violence, neglect or breach of contract.' Scott v. Waggoner (1914), 48 Mont. 536, 545, 139 P. 454, 456.
We find that the transaction in the instant case was the construction of Julian's residence. Therefore, alleged defects in either the design or construction of the building should have been raised by Julian as a compulsory counterclaim in Mattson, regardless of which contract the alleged defects arose out of. In reality, the alleged defects for which Julian was prohibited from offering evidence in Mattson for his failure to plead are the same alleged defects for which he now seeks recovery. Hence, since Julian failed to plead his compulsory counterclaim in Mattson, he is barred from maintaining the present action against Mattson. We hold that the District Court properly granted Mattson's motion for summary judgment.
Julian also contends that summary judgment was improper because the parties in Mattson and the instant case were not the same. Rule 13(a), M.R.Civ.P., however, required Julian to raise any counterclaim which he had "against any opposing party." Both Julian and Mattson were parties to Mattson. We therefore find Julian's contention unavailing.
Mattson raises two issues on cross appeal which we shall not discuss, the above discussion being determinative of this appeal.
We affirm the District Court.
TURNAGE, C.J., and HARRISON, WEBER and GULBRANDSON, JJ., concur.
