# Add contact and invoice party on orders

**URL:** https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813
**Category:** Feature
**Tags:** purchasing, sales
**Created:** [October 7, 2019, 2:21pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813 "2019-10-07T14:21:27Z")
**Posts on this page:** 20
**Page:** 1

<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: [October 7, 2019, 2:21pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/1 "2019-10-07T14:21:27Z")

</div>

## Rational

Currently on sale and purchase, we can define a party (who takes the order and is invoic ed–ing) and the shipment party.  
But the complete picture of an order may have more parties involved: who place, who take, who is invoic ed–ing and who receive/send. So we are missing some of them (or they are merged into the party).

## Proposal

We add on sale and purchase a new optional field `contact` which is a link to a contact mechanism with no restriction on the party attached to (and we change its record name to display the name or the party in addition to the value, e.g.: +1-202-555-0191, John Doe). This idea is to store who placed the order and how by email, phone etc. But for searching this contact if the party is already filled, by using the `search_order` we show first the mechanism of the party, then those with the minimal relationship distance. Also when creating a new contact mechanism from the order, it should fill the party field by default with the value of party order.

We also add on sale and purchase a new field `invoice_party` which behaves like the `shipment_party`.

For the opportunity, we add also the fields `contact` with the same behavior and it is copied onto the sales created.

## Implementation

> **[Add contact and invoice party (#8992) · Issues · Tryton / Tryton · GitLab](https://foss.heptapod.net/tryton/tryton/-/issues/8992)**
>
> Following https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813

---

<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: [October 7, 2019, 3:29pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/2 "2019-10-07T15:29:40Z")

</div>

> [@ced](#):
>
> We also add on sale and purchase a new field `invoice_party` which behaves like the `shipment_party` .

I’m not sure if this is really required. Is not the party placing the order most of the cases who is invoiced?

---

<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: [October 8, 2019, 11:05am UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/3 "2019-10-08T11:05:39Z")

</div>

> [@pokoli](#):
>
> Is not the party placing the order most of the cases who is invoiced?

Yes in most of the case but not all.

---

<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: [October 8, 2019, 1:50pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/4 "2019-10-08T13:50:53Z")

</div>

> [@ced](#):
>
> > Is not the party placing the order most of the cases who is invoiced?
> 
> Yes in most of the case but not all.

Then I’m not sure if it’s worth to add this field as part of base and have a more complex UI

---

<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: [October 8, 2019, 2:03pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/5 "2019-10-08T14:03:53Z")

</div>

I’m not sure it will make the UI more complex. Indeed I think it will bring better symmetry if we design it like:

```
Party: _______________Contact:_______________
Invoice Party: _______Invoice Address:_______
Shipment Party: ______Shipment Address:______

```

---

<div class="post-metadata">

### Author: ![yangoon](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/y/67e7ee/32.png) [@yangoon](https://discuss.tryton.org/u/yangoon)
#### Post date: [October 8, 2019, 3:44pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/6 "2019-10-08T15:44:28Z")

</div>

> [@ced](#):
>
> > Is not the party placing the order most of the cases who is invoiced?
> 
> Yes in most of the case but not all.

Do I understand correctly that in field contact there should be stored a party, that orders on behalf of the invoiced party? Besides legal questions (who is allowed to order in the name of another party?) shouldn’t the field be better named then ‘placing\_party’ and I agree with pokoli, that its usage seems to be a quite special use case and doesn’t qualify for inclusion in base.

---

<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: [October 8, 2019, 3:53pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/7 "2019-10-08T15:53:05Z")

</div>

> [@yangoon](#):
>
> there should be stored a party, that orders on behalf of the invoiced party?

Not a party but a contact mechanism.

> [@yangoon](#):
>
> who is allowed to order in the name of another party?

Common case is an employee of a company who place the order for his company.

> [@yangoon](#):
>
> shouldn’t the field be better named then ‘placing\_party’

It is not a party.

> [@yangoon](#):
>
> that its usage seems to be a quite special use case

The contact is not special that happens for most of the B2B orders.

---

<div class="post-metadata">

### Author: ![wifasoi](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/w/ed655f/32.png) [@wifasoi](https://discuss.tryton.org/u/wifasoi)
#### Post date: [October 8, 2019, 4:12pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/8 "2019-10-08T16:12:07Z")

</div>

Should `invoice_party` create a delegated invoice? ([Invoice delegation](https://discuss.tryton.org/t/invoice-delegation/1496) TL;DR:  
A invoice in the name of the sale/purchase `party`, but the payment is delegated to the `invoice_party`)

---

<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: [October 8, 2019, 4:14pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/9 "2019-10-08T16:14:58Z")

</div>

> [@wifasoi](#):
>
> Should `invoice_party` create a delegated invoice?

I do not think so. Here it is an information that we have prior to validate the order and the party want to have this information on the invoice.

---

<div class="post-metadata">

### Author: ![yangoon](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/y/67e7ee/32.png) [@yangoon](https://discuss.tryton.org/u/yangoon)
#### Post date: [October 8, 2019, 4:38pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/10 "2019-10-08T16:38:26Z")

</div>

> [@ced](#):
>
> > there should be stored a party, that orders on behalf of the invoiced party?
> 
> Not a party but a contact mechanism.
> 
> > who is allowed to order in the name of another party?
> 
> Common case is an employee of a company who place the order for his company.

This is contradictory. An employee is a party following our data model in Tryton. Otherwise you also wouldn’t have to say  
“We add on sale and purchase a new optional field contact which is a link to a contact mechanism **with no restriction on the party attached to** ”

But I see what you intend to do. I am still thinking that placing\_party would be a better match for the purpose.

---

<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: [October 8, 2019, 4:40pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/11 "2019-10-08T16:40:40Z")

</div>

> [@yangoon](#):
>
> This is contradictory. An employee is a party following our data model in Tryton.

Yes but we store his contact mechanism because the goal is to be able to contact him.

---

<div class="post-metadata">

### Author: ![udono](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/udono/32/2114_2.png) [@udono](https://discuss.tryton.org/u/udono)
#### Post date: [October 8, 2019, 7:52pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/12 "2019-10-08T19:52:10Z")

</div>

> [@ced](#):
>
> Yes but we store his contact mechanism because the goal is to be able to contact him.

But why you would like to restrict the contact possibilities to one single contact mechanism, when we could have all contact mechanisms of the order placing party?

> [@ced](#):
>
> Indeed I think it will bring better symmetry if we design it like:
> 
> ```auto
> Party: _______________Contact:_______________
> Invoice Party: _______Invoice Address:_______
> Shipment Party: ______Shipment Address:______
> 
> ```

Here it looks like the Contact is a contact mechanism of the Party of the left side. But with your conception it could be a contact mechanism of a different party. Where is the symmetry to Invoice (Shipment) Party and Address, where the Address is an address of the Invoice (Shipment) Party?

---

<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: [October 8, 2019, 9:34pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/13 "2019-10-08T21:34:39Z")

</div>

> [@udono](#):
>
> But why you would like to restrict the contact possibilities to one single contact mechanism, when we could have all contact mechanisms of the order placing party?

This is not a restriction but an information.

> [@udono](#):
>
> Where is the symmetry to Invoice (Shipment) Party and Address, where the Address is an address of the Invoice (Shipment) Party?

Nowhere.

---

<div class="post-metadata">

### Author: ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)
#### Post date: [October 8, 2019, 10:01pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/14 "2019-10-08T22:01:51Z")

</div>

> [@ced](#):
>
> But why you would like to restrict the contact possibilities to one single contact mechanism, when we could have all contact mechanisms of the order placing party?

I also don’t understand why one would want to have a single contact mechanism. If I want to contact a party, I open its form and use the contact mechanism I need at that moment.

---

<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: [October 9, 2019, 7:21am UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/15 "2019-10-09T07:21:19Z")

</div>

If you store only the party, you are losing the information about how the order was placed. By storing the contact, you have both information.

---

<div class="post-metadata">

### Author: ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)
#### Post date: [October 9, 2019, 8:03am UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/16 "2019-10-09T08:03:24Z")

</div>

I don’t see how that it is relevant. I may be interested to know if it was placed by phone, e-mail, or another means (say EDI-like interface) but not which exact phone or e-mail was used.

A party can have several phone numbers for the same contact (at least the company one and the mobile one are going to be quite frequent) and I don’t think anyone cares if the order was placed from one phone or the other.

---

<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: [October 9, 2019, 8:06am UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/17 "2019-10-09T08:06:50Z")

</div>

For me, it is more flexible to use contact mechanism there because it supports both usages: using party with party relationship and using contact mechanism to store few contact (we have name now on contact).

---

<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: [October 10, 2019, 5:02pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/18 "2019-10-10T17:02:59Z")

</div>

Ok, so for me it makes sense to store the contact mechanism but why storing the party? As the mechanism is directly related to the party I’m not sure it make sense to also store the party by default on sale. I’m wondering if it won’t be better to make it a functional field.

---

<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: [October 10, 2019, 5:04pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/19 "2019-10-10T17:04:31Z")

</div>

The party is not linked to the contact (just preferred with order and default value).  
The party represents the entity that will own the goods or services sold.

---

<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: [January 14, 2020, 4:59pm UTC](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813/20 "2020-01-14T16:59:21Z")

</div>

Here is the implementation: [Add contact and invoice party (#8992) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue8992)

[Next page](https://discuss.tryton.org/t/add-contact-and-invoice-party-on-orders/1813.md?page=2)
