Skip to Content
Menu
This question has been flagged

Hello Odooers,


I have one issue for deleting xml id using XML file. I know that we can delete using <delete> tag, but when that id is deleted and again when we upgrade module then it gives error that external id not found. Can anyone suggest me how to fix?

I tried with following syntax:

<delete model="ir.rule" search="[('id','=', ref('base.res_partner_rule_private_employee'))]"/>

<delete id="base.res_partner_rule_private_employee" model="ir.rule"/> 


I tried both above syntax, but every time when it's deleted first time and after that wheneve i upgrade my custom module then it give error for external id not found.


--

Regards
Haresh Kansara
Odoo Application Engineer

https://join.skype.com/invite/dl0S6rgZ7GBF  


Avatar
Discard
Best Answer
You can also try to call the method from the XML:

#XML
function name="delete_rule" model="res.partner"

#PY
@api.model
def delete_rule(self):
if self.env.ref('base.res_partner_rule_private_employee', raise_if_not_found=False):
self.env.ref('base.res_partner_rule_private_employee').unlink()
Avatar
Discard
Author

Thanks

Related Posts Replies Views Activity
1
May 24
644
2
Apr 23
1300