Help

2

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

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: )>"

1 Comment
Avatar
Discard

Still nobody with a solution on this?

6 Answers
2
Avatar
Piyush Suva
Best Answer

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

7 Comments
Avatar
Discard

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

Avatar
Piyush Suva
-

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

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

Avatar
Piyush Suva
-

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

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

Avatar
Piyush Suva
-

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

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...

1
Avatar
Samir Hussein
Best Answer

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



2 Comments
Avatar
Discard
Avatar
wizardz
-

It worked well, thanks

Avatar
Samir Hussein
-

Hi Diezcode, sorry but what worked well?

1
Avatar
Nirav Jani
Best Answer

Hello,

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

5 Comments
Avatar
Discard

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.

Avatar
Nirav Jani
-

It is working...No Error..

Avatar
Nirav Jani
-

Hello you customize module or used core addons ??

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.

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 ""

0
Avatar
Ankit H Gandhi(AHG)
Best Answer

Hello Jorg,

I have face same issue and I solved out that.

Solutions:

You need check action of that model using below query.

select name,domain,id from ir_act_window where res_model='your.modelname';

Now update domain field value as empty list([])

update ir_act_window set domain='[]' where id=Give id;

Hope above solution will be help

Best Thanks,

Ankit H Gandhi.

Avatar
Discard
0
Best Answer

i get similar problem when i click on any leads , my domain rule is 

['|',('user_id','=',user.id),('message_partner_ids','child_of',[user.commercial_partner_id.id])]

and i get error

aise ValueError("Invalid field %r in leaf %r" % (left, str(leaf)))ValueError: Invalid field 'user_id' in leaf "<osv.ExtendedLeaf: ('user_id', '=', 8) on mail_followers (ctx: )>"


i used this domain under "personal leads" record rule and model is crm.lead

Avatar
Discard
0
Best Answer

Hello Nirav,

 

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

1 Comment
Avatar
Discard
Avatar
Nirav Jani
-

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