Traceback: frappe.exceptions.InvalidNameError: - Can't Submit Purchase Order

Hi,

I’m trying do follow the normal purchase workflow (MREQ,RFQ,SQTN,PO), but I can’t do it…

Somebody can gimme a hint?

Somebody can gimme a tip of how to debug this error?

I’ve searched on logs, and find this traceback:

Can somebody help me?

What version are you running InvalidNameError is gone?

Now, this exception explains what characters are valid

Hi clarkej,

Thanks for your help. I’m using v13.0.0-beta.2 (version-13-beta).

I haven’t changed any name of any DocType. I just created a Audit one, name Audit. Is this a bug?

Thanks!

Is that the name of the Item a possible problem?

Thanks,

Yes, a comma is not a valid character

frappe@ubuntu1804lts:~/frappe-bench$ bench console
In [1]: import re
In [2]: name = ‘Ola muchacho’
In [3]: isValidName = re.match(r"^[\w][\w'-]([ \w][\w'-]+)$“, name)
In [4]: bool(isValidName)
Out[4]: True
In [5]: name = ‘Ola, muchacho’
In [6]: isValidName = re.match(r”^[\w][\w'-]([ \w][\w'-]+)$", name)
In [7]: bool(isValidName)
Out[7]: False

https://github.com/frappe/frappe/blob/develop/frappe/utils/\_\_init\_\_.py#L101

Hi Clarkej,

I’m really sorry about my persistend doubt, but I had a lot of Items Names with commas and other characters, like “/”, or “%”, for example “Alcohol 70%”.

And, If I observe my own history, I can find some past purchases that these names worked fine.

and

So, I believe maybe something has changed from v12 to v13…

It could be a bug?

Yes this PR in April feat: Add name validation to data fieldtype by Thunderbottom · Pull Request #10030 · frappe/frappe · GitHub
added validate_name that now raises this InvalidNameError exception.

So starting with v13, such characters will be reserved as ‘special’ or ‘meta’ ones that are no longer valid and accepted.

The problem is they can collide with say name lookup and filter expressions when they appear in url arguments in api calls.

Here’s such a report
https://github.com/frappe/erpnext/issues/22144

Probably report this also here Issues · frappe/frappe · GitHub

And I imagine expect a patch that will strip those characters from existing data frappe/frappe/patches/v13_0 at develop · frappe/frappe · GitHub
erpnext/erpnext/patches/v13_0 at develop · frappe/erpnext · GitHub

1 Like

Now I understood! Thanks!!!

Did it:

https://github.com/frappe/erpnext/issues/22395