# Contract Management

**URL:** https://discuss.tryton.org/t/contract-management/165
**Category:** Feature
**Tags:** purchasing, sales
**Created:** [July 18, 2016, 7:41am UTC](https://discuss.tryton.org/t/contract-management/165 "2016-07-18T07:41:55Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [July 18, 2016, 7:41am UTC](https://discuss.tryton.org/t/contract-management/165/1 "2016-07-18T07:41:55Z")

</div>

A [Contract](https://en.wikipedia.org/wiki/Contract) is a document which represents the agreement between two (or more) parties. This agreements have different clauses that are represented as contract terms.

In order to represent a contract, we must know its related party, an internal code, a external reference, the agreement date and a list of clauses which will be a text and a sequence to order them.

The contract can be in one of the following states:

- Draft
- Proposal
- Accepted
- Running
- Finished
- Canceled

Implementation:

> **[RFC: Contract module (#5760) · Issues · Tryton / Tryton · GitLab](https://foss.heptapod.net/tryton/tryton/-/issues/5760)**
>
> As discussed in https://discuss.tryton.org/t/contract-management/165 here is review32381002 with the proposed implementation.

---

<div class="post-metadata">

### Author: ![SISalp](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sisalp/32/200_2.png) [@SISalp](https://discuss.tryton.org/u/SISalp)
#### Post date: [July 18, 2016, 9:12am UTC](https://discuss.tryton.org/t/contract-management/165/2 "2016-07-18T09:12:10Z")

</div>

I need such a function.  
May I suggest also  
A contract is made from a contract template  
A contract has some particular conditions  
A contract can be modified while already Running  
A contract can be suspended and reactivated.  
A contract can be automatically renewed or in deadline alert for renewal.

doe’s it make sens ?

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [July 18, 2016, 9:32am UTC](https://discuss.tryton.org/t/contract-management/165/3 "2016-07-18T09:32:02Z")

</div>

[quote="SISalp, post:2, topic:165]  
I need such a function.  
May I suggest also  
A contract is made from a contract template  
[/quote]

I also thought about it, as you normally have some types of contracts, but this can be achieved by using a draft contract as template and duplicating it. Also it can be implemented as a separate module if you have more complex templating requirements.

> [@SISalp](#):
>
> A contract has some particular conditions

IIUC particular conditions → some extra term lines.  
[quote="SISalp, post:2, topic:165]  
A contract can be modified while already Running  
A contract can be suspended and reactivated.  
[/quote]  
Why not using a new contract? Which kinds of modifications do you need? For example, i don’t think we should allow terms modification while running.  
[quote="SISalp, post:2, topic:165]  
A contract can be automatically renewed or in deadline alert for renewal.  
[/quote]  
I thinks this can be implemented by a third party module, as we don’t talk about start/end dates of contract in base modules. BTW, normally contractas are autorenewed automatically, so I don’t know if it makes much sense to include start/end date fields

P.S: Thanks for your comments!

---

<div class="post-metadata">

### Author: ![SISalp](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sisalp/32/200_2.png) [@SISalp](https://discuss.tryton.org/u/SISalp)
#### Post date: [July 18, 2016, 10:39am UTC](https://discuss.tryton.org/t/contract-management/165/4 "2016-07-18T10:39:17Z")

</div>

may be we have two options

- start with a subset of what contract management is in a simplified design then add features as custom
- start with universal contract management concepts in a standardized design and then add specific custom behaviors.

I favour the second because first one reminds me Odoo too much, but this is an open discussion and I will listen everybody and probably the right thing to do is in-between the two options.

On the different contracts I deal with (either because I’m vendor or customer) I see many concepts that Tryton would be good at.  
Examples  
in telephony, when I agree on new pricing it becomes effective but I keep my contract and options.  
in my insurance, I can declare a new driver of my car, it is an amendment, not a new contract.  
A service provider proposed to suspend the service during my holidays  
when a customer complains, I can offer him to extend the duration of the contract for free as a compensation

If we choose option 1, then probably we will have several contract modules to cover different cases.  
If we could find a generic, basic way to implement generic case, then many kinds of contract management could be built over it.

Any opinion ?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [July 20, 2016, 10:17am UTC](https://discuss.tryton.org/t/contract-management/165/5 "2016-07-20T10:17:50Z")

</div>

For me, an important design feature is that contract lines often need to refer to other lines.  
For this, I think a good design will be that the line will be just link to template line which contain the text with a simple template language that render the other line paragraph number.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [July 20, 2016, 11:13am UTC](https://discuss.tryton.org/t/contract-management/165/6 "2016-07-20T11:13:05Z")

</div>

> [@ced](#):
>
> For me, an important design feature is that contract lines often need to refer to other lines.  
> For this, I think a good design will be that the line will be just link to template line which contain the text with a simple template language that render the other line paragraph number.

Great so we can also use the customer/copmany variable to be rendered on the clauses.

Just to clarify:

- Are you suggesting to add Contract Templates or only Lines templates?
- The link between lines and template lines **is required**. Isn’t it?
- Do you suggest to automatically numerate the paragraph (clauses) or what do you understand by paragraph number?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [July 21, 2016, 8:49am UTC](https://discuss.tryton.org/t/contract-management/165/7 "2016-07-21T08:49:31Z")

</div>

> [@pokoli](#):
>
> Great so we can also use the customer/copmany variable to be rendered on the clauses.

Yes. Indeed I think each template line should define a list of dict keys that it uses. And on the contract, we use the all list of keys to fill a Dict field. Of course some common field will be _real_ fields like `date`, `company` etc.

> [@pokoli](#):
>
> - Are you suggesting to add Contract Templates or only Lines templates?

The main addition is the line templates but adding a contract template is the natural next step.

> [@pokoli](#):
>
> - The link between lines and template lines is required. Isn’t it?

I think it should. I do not think it is a good practice to write contract clause per contract. Normally, they should be verified by lawyers.

> [@pokoli](#):
>
> - Do you suggest to automatically numerate the paragraph (clauses) or what do you understand by paragraph number?

Yes I think we could automatically enumerate paragraph. And probably it will be good to use a tree structure (with some line being titles).

---

<div class="post-metadata">

### Author: ![guillemNaN](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/guillemnan/32/69_2.png) [@guillemNaN](https://discuss.tryton.org/u/guillemNaN)
#### Post date: [July 25, 2016, 7:20am UTC](https://discuss.tryton.org/t/contract-management/165/8 "2016-07-25T07:20:26Z")

</div>

Provably you can take some ideas from NaN’s contract module: [https://bitbucket.org/nantic/trytond-contract](https://bitbucket.org/nantic/trytond-contract)

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [August 2, 2016, 7:14am UTC](https://discuss.tryton.org/t/contract-management/165/9 "2016-08-02T07:14:12Z")

</div>

Here is the proposed implementation:

[https://bugs.tryton.org/issue5760](https://bugs.tryton.org/issue5760)

---

<div class="post-metadata">

### Author: ![2cadz](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/2cadz/32/130_2.png) [@2cadz](https://discuss.tryton.org/u/2cadz)
#### Post date: [July 10, 2020, 10:51am UTC](https://discuss.tryton.org/t/contract-management/165/10 "2020-07-10T10:51:24Z")

</div>

How do you see the interaction with sales? add a new type of product : ‘contract’?  
how to materialize its delivery to the customer and therefore billing?

---

<div class="post-metadata">

### Author: ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)
#### Post date: [July 11, 2020, 3:18pm UTC](https://discuss.tryton.org/t/contract-management/165/11 "2020-07-11T15:18:26Z")

</div>

> [@pokoli](#):
>
> Why not using a new contract? Which kinds of modifications do you need? For example, i don’t think we should allow terms modification while running.

Amendments to current contracts are similar as to amendments to purchase/sales [contracts].  
BTW: in any case, there needs to be means to create new lines as new clauses can be contracted in any amendment.
