Skip to Content
Menu
This question has been flagged
    <group string="Filter Options">

<field name="vendor_id" options="{'no_create':True, 'no_edit':True}"
attrs="{'readonly': [('state', '=', 'done')]}"/>
<field name="date_from" options="{'no_create':True, 'no_edit':True}"
readonly="state = 'done'"/>
<field name="date_to" options="{'no_create':True, 'no_edit':True}"
attrs="{'readonly': [('state', '=', 'done')]}"/>
</group>
</group>
<footer>
<button name="action_export_excel" string="Generate Excel report" type="object"
class="btn-primary" attrs="{'invisible': [('state', '=', 'done')]}"/>
<button name="action_reset"
string="Generate New Report"
type="object"
class="btn-secondary"
attrs="{'invisible': [('state', '=', 'draft')]}"/>
<button string="Close"
class="btn-secondary"
special="cancel"/>
</footer>

These are the same files separate parts of odoo18, when i run this , there has a error like"Invalid modifier 'readonly': “state = 'done'”"

invalid syntax (<unknown>, line 1)

And also I think this attibute placing way has a issue, Can Someone help me to solve this, I am a beginner, I think this way is not supported to odoo18

Avatar
Discard
Best Answer

Hi,

In Odoo 18, the syntax of attributes has changed.


Try with the following code.


<group string="Filter Options">
<field name="vendor_id" options="{'no_create':True, 'no_edit':True}"
readonly="state == 'done'"/>
<field name="date_from" options="{'no_create':True, 'no_edit':True}"
readonly="state == 'done'"/>
<field name="date_to" options="{'no_create':True, 'no_edit':True}"
readonly="state == 'done'"/>
</group>



<footer>
<button name="action_export_excel" string="Generate Excel report" type="object"
class="btn-primary" readonly="state == 'done'"/>
<button name="action_reset"
string="Generate New Report"
type="object"
class="btn-secondary"
invisible="state == 'draft'"/>
<button string="Close"
class="btn-secondary"
special="cancel"/>
</footer>



Hope it helps.

Avatar
Discard
Related Posts Replies Views Activity
0
Feb 16
3356
1
May 15
6087
0
Jan 25
1615
0
Jun 21
4717
0
Jun 21
14