Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Error in Messaging App: ValueError: Invalid field 'state' in leaf "<osv.ExtendedLeaf: ('state', 'in', ['draft', 'sent', 'cancel']) on mail_message (ctx: )>"

By
Jörg Ricardo Schumacher
on 10/13/14, 8:04 AM 3,832 views

Hello, we played around a little bit on our Test Server and only one of our users has this error when trying to open up the messages application:

ValueError: Invalid field 'state' in leaf "<osv.ExtendedLeaf: ('state', 'in', ['draft', 'sent', 'cancel']) on mail_message (ctx: )>"

 

Below, you can find som more Infos on the Stack. Does anyone know what could be the reason for this?

 

File "/opt/odoo/odoo-server/openerp/models.py", line 4332, in _where_calc e = expression.expression(cr, user, domain, self, context) File "/opt/odoo/odoo-server/openerp/osv/expression.py", line 646, in __init__ self.parse(cr, uid, context=context) File "/opt/odoo/odoo-server/openerp/osv/expression.py", line 812, in parse raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf))) ValueError: Invalid field 'state' in leaf "<osv.ExtendedLeaf: ('state', 'in', ['draft', 'sent', 'cancel']) on mail_message (ctx: )>"

Still nobody with a solution on this?

Jörg Ricardo Schumacher
on 10/14/14, 7:47 AM
2
Piyush Suva
On 10/13/14, 8:54 AM

make sure you defined 'state' field in tree/form view of your object.

run the cmd through terminal

python openerp-server -u all -d <database_name>

hop it will solve your problem

Unfortunately, I do not understand what you are trying to tell me.

Jörg Ricardo Schumacher
on 10/13/14, 9:06 AM

run the cmd through terminal python openerp-server -u all -d hop it will solve your problem

Piyush Suva
on 10/13/14, 9:28 AM

Hello Piush, thank you for your effort. Unfortunately, your command didn't execute: root@v22014102320741:~# python: can't open file 'openerp-server': [Errno 2] No such file or directory > ^C root@v220141023020741:~# root@v22014102323020741:~# python odoo-server -u all -d hop root@v220141023020741:~#: command not found

Jörg Ricardo Schumacher
on 10/13/14, 9:32 AM

python odoo-server -u all -d YOUR DATABASE NAME

Piyush Suva
on 10/13/14, 9:35 AM

root@v220142323020741:~# python odoo-server -u all -d myTESTdb python: can't open file 'odoo-server': [Errno 2] No such file or directory

Jörg Ricardo Schumacher
on 10/13/14, 9:42 AM

1) go to your odoo server directory though 'cd' command . where 'odoo-server' file will be there.. 2) then run the abov command: python odoo-server -u all -d myTESTdb

Piyush Suva
on 10/13/14, 9:47 AM

Hello Piyush, I managed to execute the command now by 1. switching to the user running odoo Server: su odoo 2. Navigating to the odoo installation folder 3. Issuing your command with the Database: python openerp-server -u all -d myTESTdb . In runs a lot of things. Besides the fact that I do not know what this command does, (is it starting a second server instance?) it did not solve the problem (at least not on the first server instance that was running all the time). As the error is user- AND document-based, I would think it is enough to delete the document causing the error... but how do I find it? Thank you and brgds...

Jörg Ricardo Schumacher
on 10/13/14, 10:28 AM
1
Samir Hussein
On 6/26/15, 10:35 AM

Hello Jörg,

I had the same issue regarding only two users which had the error. I found a way to solve it, hopefuly it will work for you (if you still have it).

Here is what i did:

1. Go to the "Configuration" menu

2. Go to the "Security" in the menu on the left of the window

3. Select "Records rules"

4. Find the different records rules which use the field  'state', 'in', ['draft', 'sent', 'cancel'] (i had at least 5 of them)

5. Modify the rule by unchecking the "Activ" checkbox and save it

6. Do so for every rules that use the field 'state' (don't forget to check it before)


I hope this will help you, it worked for us



It worked well, thanks

wizardz
on 10/22/15, 6:14 AM

Hi Diezcode, sorry but what worked well?

Samir Hussein
on 10/22/15, 6:31 AM
1
Nirav Jani
On 10/13/14, 8:14 AM

Hello,

State field is not in "mail.message" object so that give error.

It appears in the messaging menu and in the Sales Menu, when I open up the Sales Order S0002 . The Sales Order was created by another user and thereafter "shared" with the user that gets the error.

Jörg Ricardo Schumacher
on 10/13/14, 8:34 AM

It is working...No Error..

Nirav Jani
on 10/13/14, 8:48 AM

Hello you customize module or used core addons ??

Nirav Jani
on 10/13/14, 9:08 AM

Hello Nirav, no I did not customize any of the modules. We are tlking about a really fresh odoo installation and just on single email was sent.

Jörg Ricardo Schumacher
on 10/13/14, 9:33 AM

Here is the full stack trace: File "/opt/odoo/odoo-server/openerp/http.py", line 500, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/opt/odoo/odoo-server/openerp/http.py", line 517, in dispatch result = self._call_function(**self.params) File "/opt/odoo/odoo-server/openerp/http.py", line 283, in _call_function return checked_call(self.db, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/service/model.py", line 113, in wrapper return f(dbname, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/http.py", line 280, in checked_call return self.endpoint(*a, **kw) File "/opt/odoo/odoo-server/openerp/http.py", line 733, in __call__ return self.method(*args, **kw) File "/opt/odoo/odoo-server/openerp/http.py", line 376, in response_wrap response = f(*args, **kw) File "/opt/odoo/odoo-server/addons/web/controllers/main.py", line 944, in call_kw return self._call_kw(model, method, args, kwargs) File "/opt/odoo/odoo-server/addons/web/controllers/main.py", line 936, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/addons/mail/mail_message.py", line 564, in message_read parent_tree[tree_parent_id].append(self._message_read_dict(cr, uid, message_tree[message_id], parent_id=tree_parent_id, context=context)) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/addons/mail/mail_message.py", line 398, in _message_read_dict 'to_read': message.to_read, File "/opt/odoo/odoo-server/openerp/fields.py", line 754, in __get__ self.determine_value(record) File "/opt/odoo/odoo-server/openerp/fields.py", line 849, in determine_value record._prefetch_field(self) File "/opt/odoo/odoo-server/openerp/api.py", line 235, in wrapper return new_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 3154, in _prefetch_field result = records.read(list(fnames), load='_classic_write') File "/opt/odoo/odoo-server/openerp/api.py", line 235, in wrapper return new_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/api.py", line 552, in new_api result = method(self._model, cr, uid, self.ids, *args, **kwargs) File "/opt/odoo/odoo-server/addons/mail/mail_message.py", line 823, in read res = super(mail_message, self).read(cr, uid, ids, fields=fields, context=context, load=load) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 3069, in read result = BaseModel.read(records, fields, load=load) File "/opt/odoo/odoo-server/openerp/api.py", line 235, in wrapper return new_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 3101, in read self._read_from_database(stored) File "/opt/odoo/odoo-server/openerp/api.py", line 235, in wrapper return new_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 3263, in _read_from_database res2 = self._columns[f].get(cr, self._model, ids, f, user, context=context, values=result) File "/opt/odoo/odoo-server/openerp/osv/fields.py", line 1312, in get result = self._fnct(obj, cr, uid, ids, name, self._arg, context) File "/opt/odoo/odoo-server/addons/mail/mail_message.py", line 89, in _get_to_read ], context=context) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 1673, in search return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 4510, in _search self._apply_ir_rules(cr, user, query, 'read', context=context) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 4387, in _apply_ir_rules rule_where_clause, rule_where_clause_params, rule_tables = rule_obj.domain_get(cr, uid, self._name, mode, context=context) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/addons/base/ir/ir_rule.py", line 156, in domain_get query = self.pool[model_name]._where_calc(cr, SUPERUSER_ID, dom, active_test=False) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 4332, in _where_calc e = expression.expression(cr, user, domain, self, context) File "/opt/odoo/odoo-server/openerp/osv/expression.py", line 646, in __init__ self.parse(cr, uid, context=context) File "/opt/odoo/odoo-server/openerp/osv/expression.py", line 847, in parse right_ids = comodel.search(cr, uid, [(path[1], operator, right)], context=context) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/addons/calendar/calendar.py", line 1705, in search return super(mail_message, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 1673, in search return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/addons/portal/mail_message.py", line 38, in _search context=context, count=count, access_rights_uid=access_rights_uid) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/addons/mail/mail_message.py", line 621, in _search context=context, count=count, access_rights_uid=access_rights_uid) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 4509, in _search query = self._where_calc(cr, user, args, context=context) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 4332, in _where_calc e = expression.expression(cr, user, domain, self, context) File "/opt/odoo/odoo-server/openerp/osv/expression.py", line 646, in __init__ self.parse(cr, uid, context=context) File "/opt/odoo/odoo-server/openerp/osv/expression.py", line 812, in parse raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf))) ValueError: Invalid field 'state' in leaf ""

Jörg Ricardo Schumacher
on 10/13/14, 11:02 AM
0

Hello Nirav,

 

can you explain further, please, and how to resolve the problem?

Yes, tell me when error come means what to do on which module (sale or purchase) ??

Nirav Jani
on 10/13/14, 8:30 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 10/13/14, 8:04 AM
Seen: 3832 times
Last updated: 6/26/15, 10:35 AM