Skip to Content
Menu
This question has been flagged
1 Reply
4305 Views

states are:- 
state = fields.Selection([('Unassigned', 'Unassigned'), ('Assigned', 'Assigned'), ('Is Repair', 'Under Repair'), ('Scraped', 'Scraped')], default="Unassigned", string='States', track_visibility="onchange")

now i want to disable the edit button on the "Scraped" state. I tried all the things that are available over the internet but unfortunately, nothing works for me. Any suggestions would be appreciated.


this is the XML:- 

<odoo><data>
<recordid="asset_management_assets__form"model="ir.ui.view"><fieldname="name">asset.assets.formfield><fieldname="model">asset.assetsfield><fieldname="arch"type="xml"><formstring="Assets"><header><buttonid="button_confirm_scrap"name="scrap_action_confirm"string="Scrap"class="btn-primary"type="object"attrs="{'invisible':[['state', 'in', ['Unassigned','Scraped']]]}"/><buttonid="button_confirm_repair"name="repair_action_confirm"string="Mark Repair Done"class="btn-primary"type="object"attrs="{'invisible':[['state', 'in', ['Unassigned', 'Assigned', 'Scraped']]]}"/><fieldname="state"widget="statusbar"/>header><sheet><groupcol="1"><groupcol="4"><separatorstring="Asset"colspan="4"/><fieldname="asset_name"/><fieldname="asset_category"/><fieldname="date_of_purchase"/><fieldname="employee_id"/><fieldname="makeandmodel"/><fieldname="serial_number"/><fieldname="vendor_id"/>group><group><fieldname="comments"/>group><groupcol="4"><separatorstring="Warranty Details"colspan="4"/><fieldname="warranty_start_date"/><fieldname="warranty_end_date"/><fieldname="repair_vendor_id"/>group><groupcol="4"><fieldname="attachments"filename="attachments_name"/><fieldname="attachments_name"invisible="1"/>group>group>sheet><divclass="oe_chatter"><fieldname="message_follower_ids"widget="mail_followers"/><fieldname="activity_ids"widget="mail_activity"/><fieldname="message_ids"widget="mail_thread"/>div>form>field>record>
data>odoo>
Avatar
Discard
Best Answer

Hi ​Ashutosh,

You can make fields readonly based on state

<field name="serial_number" attrs="{'readonly': [('state', '=', 'Scraped')]}"/>

OR

try ,

https://www.odoo.com/fr_FR/forum/aide-1/how-to-hide-edit-button-on-specific-state-of-a-record-for-specific-user-groups-204118#answer-204138

Avatar
Discard
Author

Hi Kiran,
The link worked for me.
Thank you so much for the help. :)

Related Posts Replies Views Activity
2
Sep 24
3748
0
Mar 15
2787
1
Mar 15
3485
1
Apr 22
5630
0
Dec 22
1185