How it works...

You will need to use the <delete> tag. To delete a record from a model, you need to provide the name of the model in the model attribute. This is a compulsory attribute.

In the first method, you need to provide the XML ID of the records that were previously created from another module's data files. During the installation of the module, Odoo will try to find the record. If the record is found for the given XML ID, it will delete the record, otherwise it will raise an error. You can delete only the records that are created from the XML files (or records that have XML IDs).

In the second method, you need to pass the domain in the domain attribute. During the installation of the module, Odoo will search the records by this domain. If records are found, it deletes them. This option will not raise an error if no records match the given domain. Use this option with extreme caution, because it might delete your user's data since the search option deletes all the records that match the domain.

<delete> is rarely used in Odoo as it is dangerous. If you are not careful with this, you might break the system. Avoid it if possible.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset