I would like to perform a check when deleting a record (click the deleted button on the form).
Except I haven’t seen anything like onDelete or anything else, can you tell me how this is done?
Please.
PS :
I saw a canDelete but I would like to be able to make a request in db to check if there are links with other objects before authorizing the deletion
i’m thinking about it, I’m new to development, but the idea in my mind is that when a user wants to delete a record, its just make inactive. then we can check these records through the database or do a complete cleaning.
please let me know your answer so that I can improve myself if I have a mistake as an idea or if it is open to improvement.
best regards
I just need to create my own packages and extend my entity’s class repository ? The code you show is already in AOP, it’s for an object that I created that I want to overload the delete button to add controls before deletion.
Like @ple-axelor said, you can overide the remove function in the dao/repository so you can edit this to inactive rather than deleting. For this, you have to create a new class, extends from the repository and bind it in the module file.
WOW it’s starting to get tense lol the dao package is a self-generating package, I have to create my own packages in the java source directory? do you have an example please?
When I develop, I use my own package because I use custom module.
I create a module like this : https://github.com/PHPierrre/Axelor-IntelliJ-Views-Hot-Reload
and I configure it with settings.gradle and build.gradle at the root of the axelor project
So I too create my own modules under eclipse, however when you create your DOMAIN XML files it generates the repositories even if you have a custom module, that’s where I’m lost… I hope I got it right Explain.
Yeah when you create new domain, it create new repositories.
If you want to add properties to extistant domain, you have to create a domain file in your own module and set the exact name and package that the axelor domain which already exist.
Yes I know that, but we are just talking about the .xml in the « domain » package, this will generate java classes in the build/src-gen/java package like:
« com.axelor.apps.group.db .repo »
with class repositories in it.
I can’t modify these class to add my overload
@Override
public void remove(BankReconciliation entity) {
like your example above because these files are generated.
How do I do it ?
Ok the call works well, however how do I cancel the delete action, I saw that you are rolling back from an exception. I would just like to do a test and if the test is good I don’t do the deletion. How can I do this?