# Replace party and credit invoice

**URL:** https://discuss.tryton.org/t/replace-party-and-credit-invoice/5373
**Category:** User
**Tags:** accounting
**Created:** [June 21, 2022, 2:41pm UTC](https://discuss.tryton.org/t/replace-party-and-credit-invoice/5373 "2022-06-21T14:41:02Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![acaubet](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/acaubet/32/1493_2.png) [@acaubet](https://discuss.tryton.org/u/acaubet)
#### Post date: [June 21, 2022, 2:41pm UTC](https://discuss.tryton.org/t/replace-party-and-credit-invoice/5373/1 "2022-06-21T14:41:02Z")

</div>

Hi there,  
I just faced an edge case in replacing parties and it’s not clear to me how to solve it in a clean way.

- Crea te a invoice 1 for party A
- Replace party A by party B
- Try to credit invoice 1 and it returns domains errors due to inactive party, addresses, identifiers, lines etc…

How it’s supposed to credit this invoice? My two approximation on how to solve are:

- Creating a party A.1 and generating manually a credit invoice for invoice 1? Later replace party A.1 by party B.
- Undo all the work of replace party in the database, (I need to check all the fields\_to\_replace of all my installed modules), credit the invoice, and replace party again.

Neither of those solutions are clean/simple for me. Any suggestions?

---

<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: [June 21, 2022, 3:48pm UTC](https://discuss.tryton.org/t/replace-party-and-credit-invoice/5373/2 "2022-06-21T15:48:59Z")

</div>

> [@acaubet](#):
>
> Try to credit invoice 1 and it returns domains errors due to inactive party, addresses, identifiers, lines etc…

Could you post exactly the domain errors that you have?  
It is strange to have a domain error due to inactive records as (IIRC) we do not validate that any record should be active in order to be used on invoices.

So crediting it should not raise any error.

---

<div class="post-metadata">

### Author: ![acaubet](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/acaubet/32/1493_2.png) [@acaubet](https://discuss.tryton.org/u/acaubet)
#### Post date: [June 22, 2022, 7:49am UTC](https://discuss.tryton.org/t/replace-party-and-credit-invoice/5373/3 "2022-06-22T07:49:39Z")

</div>

> The value for field “Party Tax Identifier” in “Invoice” is not valid according to its domain.

It’s not for inactive, it’s because the old identifier of A is in the invoice, but the invoice 1 have the new party B, so on credit the new invoice is for party B, but the identifier is pointing to party=A.

---

<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: [June 22, 2022, 7:51am UTC](https://discuss.tryton.org/t/replace-party-and-credit-invoice/5373/4 "2022-06-22T07:51:11Z")

</div>

I think you are hit by: [Move party\_identifier with the PartyReplace wizard (#10567) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue10567)

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [July 22, 2022, 7:51am UTC](https://discuss.tryton.org/t/replace-party-and-credit-invoice/5373/5 "2022-07-22T07:51:13Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
