I am working through the developer tutorial here.
I have added two action buttons to a tree view.
Everything worked fine until I restarted the server after adding the button tags to the XML view. I then received the following error:
Traceback (most recent call last):
File "/home/keith/src/odoo/odoo/service/server.py", line 1246, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "/odoo/modules/registry.py", line 87, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/odoo/modules/loading.py", line 470, in load_modules
processed_modules = load_marked_modules(cr, graph,
File "/odoo/modules/loading.py", line 363, in load_marked_modules
loaded, processed = load_module_graph(
File "/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package)
File "/odoo/modules/loading.py", line 69, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
File "/odoo/tools/convert.py", line 745, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate)
File "/odoo/tools/convert.py", line 811, in convert_xml_import
obj.parse(doc.getroot())
File "/odoo/tools/convert.py", line 731, in parse
self._tag_root(de)
File "/odoo/tools/convert.py", line 691, in _tag_root
raise ParseError(msg) from None # Restart with "--log-handler odoo.tools.convert:DEBUG" for complete traceback
odoo.tools.convert.ParseError: while parsing /custom/estate/views/estate_property_offer_views.xml:3
Invalid view estate.property.offer.tree (estate.estate_property_offer_view_tree) definition in estate/views/estate_property_offer_views.xml
View error context:
'-no context-'
If I remove the button tags, the server starts without error
(./odoo-bin --addons-path=../custom,addons -d rd-demo -u estate --dev xml).
I can then add the buttons back and they work correctly but as soon as I restart the server, I get the error again.
Here is the complete record from the view:
<record id="estate_property_offer_view_tree" model="ir.ui.view">
<field name="name">estate.property.offer.tree</field>
<field name="model">estate.property.offer</field>
<field name="arch" type="xml">
<tree string="Offers">
<field name="price"/>
<field name="partner_id"/>
<field name="validity"/>
<field name="date_deadline"/>
<field name="state"/>
<button name="action_accept" type="object" icon="fa-check" style="color:green" states="new"/>
<button name="action_refuse" type="object" icon="fa-close" style="color:red" states="new"/>
</tree>
</field>
</record>
CodePudding user response:
Remove the style from the button on tree view
<button name="action_refuse" type="object" icon="fa-close" states="new"/>
style attribute is not adapting in tree architecture for button only, you can do with class-based.
With CLass:
<button name="action_refuse" type="object" icon="fa-close" states="new" /> <!--my_class your custom class -->
CodePudding user response:
The view validation will fail when it calls the relaxng method and will raise the following error:
ERROR:RELAXNGV:RELAXNG_ERR_INVALIDATTR: Invalid attribute style for element button
It is called to validate the following views: calendar, graph, pivot, search, tree, activity. You can check the (common.rng) file in the base module, no style attribute in the button definition.
To fix that error, you must remove the style attribute
