Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Non-dict expression

Naroči se

Get notified when there's activity on this post

This question has been flagged
buttonformview
2 Odgovori
3663 Prikazi
Avatar
Guilherme

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!

0
Avatar
Opusti
loay elhaj

Could you copy & share full error message

Avatar
Guilherme
Avtor Best Answer

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

0
Avatar
Opusti
Avatar
loay elhaj
Best Answer

Try to replace return True and add pass

1
Avatar
Opusti
Guilherme
Avtor

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

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Process a file using JS on client
javascript button formview
Avatar
0
mar. 24
1926
Show a button in form view, when in view mode, and hide in edit mode Solved
hide button formview
Avatar
Avatar
Avatar
Avatar
3
jan. 24
15284
How to display form or tree view with some fields when click is made on button?
treeview button formview
Avatar
Avatar
2
mar. 15
8054
V17 Tree, Form view Solved
formview
Avatar
1
mar. 25
2794
Create new record by opening a new form on a button click Solved
form button formview odoo12
Avatar
Avatar
Avatar
2
jul. 23
784
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now