Hi all,
I am trying to create a customer automatically from the server and I’m getting an error message when I’m connected in French:
Translation: Type cannot be “Individual”. It should be one of “”, “Company”, “Individual”
Here is my code:
customer = frappe.get_doc({
"doctype": "Customer",
"customer_name": doc.patient_name,
"customer_type": _('Individual'),
"customer_group": _('Individual'),
"territory": _('All Territories')
}).insert(ignore_permissions=True)
And the error message
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 56, in application
response = frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 19, in handle
execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 42, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 907, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/client.py", line 124, in insert
doc = frappe.get_doc(doc).insert()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 214, in insert
self.run_method("after_insert")
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 667, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 892, in composer
return composed(self, method, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 875, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 661, in <lambda>
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/maia/maia/maia/doctype/patient/patient.py", line 59, in after_insert
create_customer_from_patient(self)
File "/home/frappe/frappe-bench/apps/maia/maia/maia/doctype/patient/patient.py", line 93, in create_customer_from_patient
}).insert(ignore_permissions=True)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 194, in insert
self._validate()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 402, in _validate
self._validate_selects()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 537, in _validate_selects
value, comma_options))
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 316, in throw
msgprint(msg, raise_exception=exc, title=title, indicator='red')
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 306, in msgprint
_raise_exception()
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 279, in _raise_exception
raise raise_exception, encode(msg)
ValidationError: Type ne peut pas être "Individuel". Il devrait être l'un des "", "Société", "Individuel"
It seems like Frappe cannot validate the matching of two translated strings, since it works fine in English.
Has anyone encountered this already ?
Thanks for any help!