I will jump into the fray with a similar error. We are currently analyzing the data to observe what is causing this.
5. The traceback from the console shows:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 19, in savedocs
doc.submit()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 833, in submit
self._submit()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 822, in _submit
self.save()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 259, in save
return self._save(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 310, in _save
self.run_post_save_methods()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 892, in run_post_save_methods
self.run_method("on_submit")
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 757, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1026, in composer
return composed(self, method, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1009, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 751, in <lambda>
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 302, in on_submit
self.make_gl_entries()
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 341, in make_gl_entries
update_gl_entries_after(self.posting_date, self.posting_time, warehouses, items)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py", line 354, in update_gl_entries_after
voucher_obj.make_gl_entries(gl_entries=expected_gle, repost_future_gle=False, from_repost=True)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 602, in make_gl_entries
update_outstanding=update_outstanding, merge_entries=False)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py", line 19, in make_gl_entries
save_entries(gl_map, adv_adj, update_outstanding, from_repost)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py", line 85, in save_entries
round_off_debit_credit(gl_map)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py", line 133, in round_off_debit_credit
.format(gl_map[0].voucher_type, gl_map[0].voucher_no, debit_credit_diff))
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator='red')
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 309, in msgprint
_raise_exception()
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 282, in _raise_exception
raise raise_exception(encode(msg))
ValidationError: Debit and Credit not equal for Sales Invoice #B-881455. Difference is 2.347143.
06:59:13.722 desk.min.js?ver=1551130323.0:1660 Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 62, in application
response = frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
data = execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 939, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 19, in savedocs
doc.submit()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 833, in submit
self._submit()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 822, in _submit
self.save()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 259, in save
return self._save(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 310, in _save
self.run_post_save_methods()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 892, in run_post_save_methods
self.run_method("on_submit")
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 757, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1026, in composer
return composed(self, method, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1009, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 751, in <lambda>
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 302, in on_submit
self.make_gl_entries()
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 341, in make_gl_entries
update_gl_entries_after(self.posting_date, self.posting_time, warehouses, items)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py", line 354, in update_gl_entries_after
voucher_obj.make_gl_entries(gl_entries=expected_gle, repost_future_gle=False, from_repost=True)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 602, in make_gl_entries
update_outstanding=update_outstanding, merge_entries=False)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py", line 19, in make_gl_entries
save_entries(gl_map, adv_adj, update_outstanding, from_repost)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py", line 85, in save_entries
round_off_debit_credit(gl_map)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py", line 133, in round_off_debit_credit
.format(gl_map[0].voucher_type, gl_map[0].voucher_no, debit_credit_diff))
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator='red')
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 309, in msgprint
_raise_exception()
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 282, in _raise_exception
raise raise_exception(encode(msg))
ValidationError: Debit and Credit not equal for Sales Invoice #B-881455. Difference is 2.347143.
If the Purchase Invoice is created without “Update Stock” checked, then it will Submit properly.
However, you will not be able to submit a purchase receipt or even a stock entry to increase inventory for this amount.
It seems that if sales invoices have been created with “Update Stock” checked, with dates AFTER the desired purchase invoice / purchase receipt posting date, and with the same item code as the one being purchased / received, then the error occurs. Thus, it is suggested that no sales invoices, delivery notes or material issues with posting dates posterior to the inventory receipt, purchase receipt or purchase invoice are entered BEFORE creating these entries.