75. Name Get Function In Odoo || Odoo Name Get Method || Odoo 15 Tutorials || Odoo ORM Method
ฝัง
- เผยแพร่เมื่อ 11 ก.พ. 2025
- Name get function in Odoo. Odoo name get method. Show multiple field values in many2one field using name get method. How to define name get method for the model in Odoo. How to override name get function in Odoo. Odoo 15 ORM methods. How to create module in Odoo 15. Odoo 15 tutorials. Odoo 15 development tutorials. Odoo 15 tutorial.
Odoo 15 Playlist: • How To Configure Odoo1...
Website: www.odoomates....
Instgram: / odoomates
Github: github.com/odo...
Email : odoomates@gmail.com
Facebook: / odoomate
Twitter: / odoomates
Support Us in Ko Fi : ko-fi.com/odoo...
Excellent! Does it work if I put this method on a custom model (not an inherited one)? Or should I do something else?
Thank you so much
You're most welcome
While creating odoo database this error comes:
Database creation error: relation "ir_model" does not exist LINE 1: SELECT * FROM ir_model WHERE state='manual' ^
Any solution?
Can you try to create db by removing the custom addons path from the conf file and see
how to fix it :
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 638, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 314, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: Invalid field 'hs_code' on model 'product.product'
the four line code is giving me this error: "TypeError: unsupported operand type(s) for +: 'bool' and 'str'" although ref and name are both Char data type. the second one is working fine!
one of the field value is empty, so you have to add if condition to resolve this
I solved the problem like this name = str(record.ref) + ' ' + str(record.name)
Hi master. Is there any tips to get the service restart quickly?
restarting odoo service is taking long time ?
@@OdooMates yes Sir
@@OdooMates however I have a very robust computer. But restarting odoo service takes a while
@@OdooMates and when I see yours. It goes very fast
@@karim.mekhneche may be due to system specs. If you have a robust system, you can try some light weight IDE's
I cant directly create a record when a model has name_get function (In many2one relations). So how we can solve that?
What is the issue when you directly create a record
@@OdooMates it doesn't render an error. When I'm in form view a model (many) and try to create a new record in model (one) - the model use def name_get. Fill information and it will be disappeared. But when I commented the function and only use _rec_name, it can be created
@@nederakun9798 can i see your name_get and rec_name
_rec_name = 'emp_name'
emp_name = fields.Char('Name employee', required=True, tracking = True)
def name_get(self):
result = []
for record in self:
name = "[%s] %s" % (record.id, record.emp_name)
result.append((record.id, name))
return result
@@OdooMates you can try it in your module. when you have the function, go to the appointment (form view) and create a new patient (in my case, I can't). I only can create a new employee (patient in your module) when I comment the function and just use _rec_name = 'emp_name'
I HAVE PROBLRM:
ValueError: Invalid field 'hs_code' on model 'product.template'
CAN YOU HELP ME
@@abdikarimosman2511 is it a required field and value not entered in it ?
return [(rec_id,"[%s] %s" %(rec_ref, rec.name_id.name)) for rec in self]
I have fields many2one to res_partner and this way i tried and its working well but
is that right way ?
code seems fine, there is no error in ui or in log right ?
th-cam.com/video/S5FWeUTtmmE/w-d-xo.html
@@OdooMates yes there is no error
@@عبدالرحمنزويل-ي4و
Thank you so much
Glad it helped ❤️ feel free to support us by subscribing the channel