Can't create opening invoices

I’m trying to import all our outstanding invoices to ERPNext with the Opening Invoice Creation Tool but no matter the currency, I get the error

Purchase Invoice PINV-00001: 'Profit and Loss' type account 5212 - Round Off - MF not allowed in Opening Entry

How can I use the tool if it’s trying to post to the rounding account even with invoices in company currency? Is there something I am doing wrong here?

EDIT: Looking at the code, it seems to retrieve the company currency as the invoice currency - is that right? Shouldn’t it get the party currency?

EDIT2: Further testing has shown that the rounding is occurring when posting to the trade creditors account - this apparently has to be a round number, with the difference going to the round off account. Any ideas why this is happening appreciated.

Full trace:

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/handler.py", line 81, in runserverobj
    frappe.desk.form.run_method.runserverobj(method, docs=docs, dt=dt, dn=dn, arg=arg, args=args)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/run_method.py", line 36, in runserverobj
    r = doc.run_method(method)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 755, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1024, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1007, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 749, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py", line 96, in make_invoices
    doc.submit()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 831, in submit
    self._submit()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 820, in _submit
    self.save()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 256, in save
    return self._save(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 307, in _save
    self.run_post_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 890, in run_post_save_methods
    self.run_method("on_submit")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 755, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1024, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1007, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 749, 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 332, 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 88, in save_entries
    make_entry(entry, adv_adj, update_outstanding, from_repost)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py", line 99, in make_entry
    gle.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 218, in insert
    self.run_before_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 859, in run_before_save_methods
    self.run_method("validate")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 755, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1024, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1007, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 749, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/gl_entry/gl_entry.py", line 24, in validate
    self.check_pl_account()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/gl_entry/gl_entry.py", line 79, in check_pl_account
    .format(self.voucher_type, self.voucher_no, self.account))
  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: Purchase Invoice PINV-00030: 'Profit and Loss' type account Round Off - MF not allowed in Opening Entry

The Opening Invoice Creation Tool is ignoring the global default for “Disable Rounded Total” and instead choosing to leave it enabled. Therefore, by adding the following to erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py on line 157, the tool will check the global setting and apply that to the invoice posting:

"disable_rounded_total": frappe.db.get_single_value("Global Defaults", "disable_rounded_total")

Could a developer please check that they agree with this change and if so, add it to core? Thanks

Thanks for reporting this issue. @surajshetty can you please check.

EDIT: Looking at the code, it seems to retrieve the company currency as the invoice currency - is that right? Shouldn’t it get the party currency?

For that, you should create payable account in the Party Currency, and update that in the Supplier master.

EDIT2: Further testing has shown that the rounding is occurring when posting to the trade creditors account - this apparently has to be a round number, with the difference going to the round off account. Any ideas why this is happening appreciated.

How exactly are you creating opening invoice? Can you share screenshots?



Current Version

After submitting the invoices, they were posted in the correct currency according to the Supplier Master. It just wasn’t apparent within the actual tool, but as we won’t have to use it again after setup that’s not really a problem.

I have the same issue and I do need to use it as I’m trying to start using ERPNext now. I’m getting same error. I just need to post my opening customer invoices and supplier invoices using this tool. Any suggestions?

Hi All,
Any changes or updates on this issue as i have bumped to the same… when doing an Opening Invoice of 6,057,329.39 the error comes with the account Round off being a Profit and Loss not allowed … the temporary solution was to round the cents to ZERO.