GitHub code for common party accounting:
https://github.com/frappe/erpnext/blob/develop/erpnext/accounts/doctype/party_link/party_link.py
Documentation: https://docs.frappe.io/erpnext/user/manual/en/common_party_accounting
More documentation and examples with video: https://fosserp.com/blog/shorts/using-common-party-accounting-in-erpnext
Short docu on setting up common party accounting in ERPNext
In practice happens that a regular vendor might purchase your services or goods (so it is becoming a customer). And vice versa – usual customer can provide goods or services to your company. In order to offset (net, netting) the invoices and track financial balances between companies you can activate and use in ERPNext the “Common Party Accounting” functionality.
- In ERPNext navigate to app/erpnext-settings -> “Accounts Settings” and enable “Common Party Accounting” in the ‘Invoicing Features’ section.
- Two scenarios to link the customer or supplier. Depending on what is the primary role – If the party is already created as a supplier and is usually a supplier, then create it as a customer too. Go to the “Supplier”, click on “Link with Customer” from the “Actions” option to link.
Respectively if the party is already created as a customer and this is its usual role, then create a supplier. Go to the “Customer”, and click on “Link with Supplier” from the “Actions” option to link. - Now, create a sales invoice against the customer (who usually is supplier) who was assigned as the secondary party in the previous step.
- Upon submission of the sales invoice, an automatic journal entry will be made against the linked supplier, creating an advance balance. Also the invoice is marked as paid.
- You can now reconcile this journal entry advance against a Purchase Invoice.
This process allows you to adjust your purchases with the sales transactions.
MariaDB table which stores the links: tabParty Link
+-----------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+-------+
| name | varchar(140) | NO | PRI | NULL | |
| creation | datetime(6) | YES | | NULL | |
| modified | datetime(6) | YES | MUL | NULL | |
| modified_by | varchar(140) | YES | | NULL | |
| owner | varchar(140) | YES | | NULL | |
| docstatus | int(1) | NO | | 0 | |
| idx | int(8) | NO | | 0 | |
| primary_role | varchar(140) | YES | | NULL | |
| secondary_role | varchar(140) | YES | | NULL | |
| primary_party | varchar(140) | YES | | NULL | |
| secondary_party | varchar(140) | YES | | NULL | |
| _user_tags | text | YES | | NULL | |
| _comments | text | YES | | NULL | |
| _assign | text | YES | | NULL | |
| _liked_by | text | YES | | NULL | |
+-----------------+--------------+------+-----+---------+-------+
In order to get easily from within ERPNext a list of current settings, you can create a new Query report (Report List -> Add report) with the following SQL query:
select name, primary_role, secondary_role, primary_party, secondary_party, creation, docstatus, idx
FROM
`tabParty Link` AS party