Skip to content

Commit 214d315

Browse files
author
odoo
committed
fix: Update button visibility conditions in various views to improve user interaction
1 parent 4567438 commit 214d315

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

records_management/views/pickup_request.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
<form string="Pickup Request">
88
<header>
99
<button name="action_confirm" string="Confirm" type="object"
10-
states="draft" class="oe_highlight"/>
10+
invisible="state != 'draft'" class="oe_highlight"/>
1111
<button name="action_schedule" string="Schedule" type="object"
12-
states="confirmed" class="oe_highlight"/>
12+
invisible="state != 'confirmed'" class="oe_highlight"/>
1313
<button name="action_complete" string="Complete" type="object"
14-
states="scheduled" class="oe_highlight"/>
14+
invisible="state != 'scheduled'" class="oe_highlight"/>
1515
<button name="action_cancel" string="Cancel" type="object"
16-
states="draft,confirmed,scheduled"/>
16+
invisible="state not in ('draft','confirmed','scheduled')"/>
1717
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,scheduled,completed,cancelled"/>
1818
</header>
1919
<sheet>
@@ -26,13 +26,13 @@
2626
<group>
2727
<field name="customer_id"/>
2828
<field name="request_date"/>
29-
<field name="scheduled_date" attrs="{'required': [('state', 'in', ['scheduled','completed'])]}"/>
29+
<field name="scheduled_date" required="state in ('scheduled','completed')"/>
3030
<field name="priority" widget="priority"/>
3131
</group>
3232
<group>
3333
<field name="warehouse_id"/>
34-
<field name="driver_id" attrs="{'required': [('state', 'in', ['scheduled','completed'])]}"/>
35-
<field name="vehicle_id" attrs="{'required': [('state', 'in', ['scheduled','completed'])]}"/>
34+
<field name="driver_id" required="state in ('scheduled','completed')"/>
35+
<field name="vehicle_id" required="state in ('scheduled','completed')"/>
3636
</group>
3737
</group>
3838
<notebook>
@@ -49,7 +49,7 @@
4949
<page string="Notes">
5050
<field name="notes"/>
5151
</page>
52-
<page string="Signature" attrs="{'invisible': [('state', '!=', 'completed')]}">
52+
<page string="Signature" invisible="state != \'completed\'">
5353
<field name="signature" widget="signature"/>
5454
<field name="signed_by"/>
5555
<field name="signature_date"/>

records_management/views/records_box_views.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<form string="Box">
88
<header>
99
<button name="action_set_active" string="Set Active" type="object"
10-
class="oe_highlight" states="draft"/>
10+
class="oe_highlight" invisible="state != 'draft'"/>
1111
<button name="action_archive_box" string="Archive" type="object"
12-
states="active"/>
12+
invisible="state != 'active'"/>
1313
<button name="action_destroy_box" string="Mark Destroyed" type="object"
14-
states="archived" confirm="Are you sure you want to mark this box as destroyed?"/>
14+
invisible="state != 'archived'" confirm="Are you sure you want to mark this box as destroyed?"/>
1515
<field name="state" widget="statusbar" options="{'clickable': '1'}"/>
1616
</header>
1717
<sheet>
@@ -28,14 +28,14 @@
2828
<group>
2929
<group>
3030
<field name="product_id"/>
31-
<field name="barcode" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
31+
<field name="barcode" readonly="state != 'draft'"/>
3232
<field name="capacity"/>
3333
<field name="used_capacity" widget="progressbar"/>
3434
</group>
3535
<group>
3636
<field name="location_id"/>
3737
<field name="user_id"/>
38-
<field name="destruction_date" attrs="{'invisible': [('state', '!=', 'destroyed')]}"/>
38+
<field name="destruction_date" invisible="state != 'destroyed'"/>
3939
<field name="color" invisible="1"/>
4040
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
4141
</group>

records_management/views/records_document_views.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
<form string="Document">
88
<header>
99
<button name="action_store" string="Store" type="object"
10-
states="draft" class="oe_highlight"/>
10+
invisible="state != 'draft'" class="oe_highlight"/>
1111
<button name="action_retrieve" string="Retrieve" type="object"
12-
states="stored,returned"/>
12+
invisible="state not in ('stored','returned')"/>
1313
<button name="action_return" string="Return" type="object"
14-
states="retrieved"/>
14+
invisible="state != 'retrieved'"/>
1515
<button name="action_destroy" string="Destroy" type="object"
1616
confirm="Are you sure you want to destroy this document?"
17-
states="stored,returned"/>
17+
invisible="state not in ('stored','returned')"/>
1818
<field name="state" widget="statusbar" options="{'clickable': '1'}"/>
1919
</header>
2020
<sheet>
2121
<div class="oe_button_box" name="button_box">
22-
<button name="action_view_attachments" type="object" class="oe_stat_button" icon="fa-paperclip" attrs="{'invisible': [('attachment_count', '=', 0)]}">
22+
<button name="action_view_attachments" type="object" class="oe_stat_button" icon="fa-paperclip" invisible="attachment_count == 0">>
2323
<field name="attachment_count" string="Attachments" widget="statinfo"/>
2424
</button>
2525
</div>
@@ -38,7 +38,7 @@
3838
<group>
3939
<field name="retention_policy_id"/>
4040
<field name="retention_date"/>
41-
<field name="days_to_retention" attrs="{'invisible': [('retention_date', '=', False)]}"/>
41+
<field name="days_to_retention" invisible="not retention_date"/>
4242
<field name="partner_id"/>
4343
<field name="user_id"/>
4444
</group>

records_management/views/res_partner_views.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<field name="arch" type="xml">
88
<div name="button_box" position="inside">
99
<button name="action_view_documents" type="object" class="oe_stat_button" icon="fa-file-text-o"
10-
attrs="{'invisible': [('document_count', '=', 0)]}">
10+
invisible="document_count == 0">
1111
<field name="document_count" string="Documents" widget="statinfo"/>
1212
</button>
1313
</div>

records_management/views/shredding_views.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<form string="Shredding Service">
2626
<header>
2727
<button name="action_confirm" string="Confirm Service" type="object"
28-
class="oe_highlight" states="draft"/>
28+
class="oe_highlight" invisible="state != 'draft'"/>
2929
<button name="action_start" string="Start Service" type="object"
30-
class="oe_highlight" states="confirmed"/>
30+
class="oe_highlight" invisible="state != 'confirmed'"/>
3131
<button name="action_complete" string="Complete Service" type="object"
32-
class="oe_highlight" states="in_progress"/>
32+
class="oe_highlight" invisible="state not in ('in_progress')"/>
3333
<button name="action_cancel" string="Cancel" type="object"
34-
states="draft,confirmed"/>
34+
invisible="state not in ('draft,confirmed')"/>
3535
<field name="status" widget="statusbar" statusbar_visible="draft,confirmed,in_progress,completed"/>
3636
</header>
3737
<sheet>

0 commit comments

Comments
 (0)