Skip to Content
Menu
This question has been flagged
2 Replies
1662 Views

Hello guys, yesterday i've make a button in my odoo module and that button have the action created is .py file but the only code i put there was "return True;" just for me was able to see if the buttons is working or not, and until yesterday the button was working, today the button doesn't work give me the error "Non-dict expression"...




I'll post my code bellow:   


And the code in .py file is: 

def teste_butao(self):

    returnTrue;


Anyone can help me with this please? 

Appreciate your time and afford already, tks!

Avatar
Discard

Could you copy & share full error message

Author Best Answer

Remove the " attrs="required" " of "  " and solve the problem!

Avatar
Discard
Best Answer

Try to replace return True and add pass

Avatar
Discard
Author

@loay elhaj, the full error message is this(maybe the xml part will be executed but i edit my post and now i have a print of the xml part where it gives me an error):

Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 677, in _tag_root
f(rec)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 580, in _tag_record
record = model._load_records([data], self.mode == 'update')
File "/usr/lib/python3/dist-packages/odoo/models.py", line 4220, in _load_records
data['record']._load_records_write(data['values'])
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 1841, in _load_records_write
super(View, self)._load_records_write(values)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 4149, in _load_records_write
self.write(values)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 500, in write
res = super(View, self).write(self._compute_defaults(vals))
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3703, in write
fields[0].determine_inverse(real_recs)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1187, in determine_inverse
getattr(records, self.inverse)()
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 300, in _inverse_arch
view.write(data)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 500, in write
res = super(View, self).write(self._compute_defaults(vals))
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3693, in write
real_recs._validate_fields(vals, inverse_fields)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1266, in _validate_fields
check(self)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 411, in _check_xml
)).with_traceback(e.__traceback__) from None
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 391, in _check_xml
view.postprocess_and_fields(view_doc, validate=True)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 850, in postprocess_and_fields
arch, name_manager = self._postprocess_view(node, model, validate=validate)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 862, in _postprocess_view
self.postprocess(node, [], editable, name_manager)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 962, in postprocess
self.postprocess(child, current_node_path, node_info['editable'], name_manager)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 962, in postprocess
self.postprocess(child, current_node_path, node_info['editable'], name_manager)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 962, in postprocess
self.postprocess(child, current_node_path, node_info['editable'], name_manager)
[Previous line repeated 1 more time]
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 954, in postprocess
self._validate_attrs(node, name_manager, node_info)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 1301, in _validate_attrs
for key, val_ast in get_dict_asts(expr).items():
File "/usr/lib/python3/dist-packages/odoo/tools/view_validation.py", line 88, in get_dict_asts
raise ValueError("Non-dict expression")
odoo.exceptions.ValidationError: Error while validating view:

Non-dict expression

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 683, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 347, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 912, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1398, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1386, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 399, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 386, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-78>", line 2, in button_immediate_upgrade
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 654, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 593, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 89, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 457, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 349, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 69, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 733, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 799, in convert_xml_import
obj.parse(doc.getroot())
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 719, in parse
self._tag_root(de)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 685, in _tag_root
)) from e
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 639, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing /mnt/extra-addons/insurance/views/prospect_view.xml:3, near
<record id="view_prospect_form" model="ir.ui.view">
<field name="name">prospect.form</field>
<field name="model">prospect</field>
<field name="arch" type="xml">
<form create="false">
<sheet>
<h1>Prospeção nº <field name="num_prospect"/> </h1>
<group>
<group>
<!--What appears when you click for more information-->
<field name="name" attrs="required"/>
<field name="email_client"/>
<field name="tlm_client"/>

</group>
<group>
<field name="num_prospect"/>
<field name="ent_prospect"/>
<field name="situation"/>
</group>
</group>

<notebook name="notebook"> <!-- attrs="{'invisible': [('name', '=', 'null')]}" -->
<page string="Produto">
<p><h3>Dados de Risco</h3></p>
<group>
<group>
<field name="insurance_type"/>
</group>
<group>
</group>
<group>
<p attrs="{'invisible': [('insurance_type', '!=', 'option2'), ('insurance_type', '!=', 'option3'), ('insurance_type', '!=', 'option4')]}">
Página ainda em desenvolvimento...
</p>

<field name="a_id" attrs="{'invisible': [('insurance_type', '!=', 'option1')]}"/>
<field name="license" attrs="{'invisible': [('insurance_type', '!=', 'option1')]}"/>
<field name="month_year_license" attrs="{'invisible': [('insurance_type', '!=', 'option1')]}"/>
</group>
<group>
<field name="brand" attrs="{'invisible': [('insurance_type', '!=', 'option1')]}"/>
<field name="model" attrs="{'invisible': [('insurance_type', '!=', 'option1')]}"/>
<field name="version" attrs="{'invisible': [('insurance_type', '!=', 'option1')]}"/>
</group>
</group>
<group>
<field name="results" attrs="{'invisible': [('insurance_type', '!=', 'option1')]}"/>
</group>
<group>
<button name="teste_butao" string="Adicionar Simulação"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

Related Posts Replies Views Activity
0
Mar 24
245
3
Jan 24
13208
2
Mar 15
6450
2
Jul 23
784
1
Jan 24
12758