Surcharge vue déjà existante dans le framework

Pour les Français : Bonjour j’aimerais pouvoir utiliser un module déjà existant dans le framework la vue projet. Comment je peux faire pour surcharger la vue - modele déjà existante et y rajouter mes champs. merci pour votre aide.

For the English: Hello, I would like to be able to use an already existing module in the project view framework. How can I overload the existing view - model and add my fields to it? Thanks for your help.

Hello,

You copy the complete view in your specific module, then you add a unique id, then you make your changes in your specific view.
Example for view address-grid :
id="forum-address-grid"

…/…

<grid id="forum-address-grid" name="address-grid"
title="Address list" model="com.axelor.apps.base.db.Address"
edit-icon="true">

…/…

For the domain, there is no id
You copy the domain in your specific module
But, you just need to add the new fields:

<?xml version="1.0" encoding="UTF-8"?>
    <domain-models xmlns="http://axelor.com/xml/ns/domain-models"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.0.xsd">

    module name="base" package="com.axelor.apps.base.db"/>

    <entity name="Address" lang="java">

         <string name="newField" title="New field" />
        
     </entity>

    </domain-models>

Regards

Hello PakMax,

Is this the only method? I saw that we could use extensions, isn’t it done precisely for the use of already existing views? I am wrong ?

Thanks for your first response.

For domains,
with the previous
solution, you keep the same entity (same table, with additional fields)
with extends you create another entity (AppExpense: new table) related to the original table App.

	<entity name="AppExpense" lang="java" extends="App">
		<boolean name="computeDistanceWithWebService" />

The method with extends probably has advantages that some will be able to confirm (data migration, etc.).

For views
https://docs.axelor.com/adk/5.4/dev-guide/views/extensions.html

ok thanks , why do you always put lang=« java »?

It is not mandatory: it is the source code generation language and by default it is Java

Ok thank you
When I try to overload I have some problems:
yet my compile works.

When I run it in eclipse I get this error any idea? :

2022-03-28 15:07:42.636 DEBUG 17796 — [ost-startStop-1] com.axelor.app.AppModule : Configure module: com.axelor.apps.businessproject.module.BusinessProjectModule
2022-03-28 15:07:42.651 ERROR 17796 — [ost-startStop-1] o.a.c.c.C.[.[localhost].[/axelor-erp] : Exception lors de l’envoi de l’évènement contexte initialisé (context initialized) à l’instance de classe d’écoute (listener) [com.axelor.web.AppContextListener]
java.lang.NoClassDefFoundError: com/axelor/apps/supplychain/service/SaleOrderInvoiceServiceImpl
at com.axelor.apps.businessproject.module.BusinessProjectModule.configure(BusinessProjectModule.java:94)
at com.google.inject.AbstractModule.configure(AbstractModule.java:61)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:344)
at com.google.inject.AbstractModule.install(AbstractModule.java:103)
at com.axelor.app.AppModule.configure(AppModule.java:78)
at com.google.inject.AbstractModule.configure(AbstractModule.java:61)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:344)
at com.google.inject.AbstractModule.install(AbstractModule.java:103)
at com.axelor.web.AppServletModule.configureServlets(AppServletModule.java:110)
at com.google.inject.servlet.ServletModule.configure(ServletModule.java:52)
at com.google.inject.AbstractModule.configure(AbstractModule.java:61)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:344)
at com.google.inject.spi.Elements.getElements(Elements.java:103)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:137)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
at com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.inject.Guice.createInjector(Guice.java:69)
at com.google.inject.Guice.createInjector(Guice.java:59)
at com.axelor.web.AppContextListener.getInjector(AppContextListener.java:110)
at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
at com.axelor.web.AppContextListener.contextInitialized(AppContextListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4763)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.axelor.apps.supplychain.service.SaleOrderInvoiceServiceImpl
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1415)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1223)
… 30 common frames omitted
2022-03-28 15:07:42.651 ERROR 17796 — [ost-startStop-1] o.apache.catalina.core.StandardContext : Un ou plusieurs écouteurs n’ont pas pu démarrer, les détails sont dans le fichier de log du conteneur
2022-03-28 15:07:42.652 ERROR 17796 — [ost-startStop-1] o.apache.catalina.core.StandardContext : Erreur de démarrage du contexte [/axelor-erp] suite aux erreurs précédentes

I am trying to overload view and task domain in project. For information

Hello again,

I can’t overload the project view already present in the framework.

I know that I have to respect the same model etc… but even that does not work. Does anyone have an idea to solve my overload problem? please

I’m just trying to overload this view to add my fields to it while keeping the functioning of the existing model.

I just want to know what I should put in my domain and model, to keep the framework’s project view and model, while adding my custom fields.
Can you give me the steps to follow. Thank you

It is better to go through the overloads, it is the best practice rather than a copy paste, I confirm it to you.
Problem solved.
Thanks for the responses on this.

1 « J'aime »

Ce sujet a été automatiquement fermé après 30 jours. Aucune réponse n’est permise dorénavant.