-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RM11765: Provenance - Définition d'une sous arborescence
implement #10
- Loading branch information
1 parent
9b1f988
commit cc1aff7
Showing
15 changed files
with
850 additions
and
1 deletion.
There are no files selected for viewing
Submodule abs
updated
from 1e8155 to 30743b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
...dule/src/main/java/com/axelor/apps/crm/web/AccesIndustrieConvertLeadWizardController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* Axelor Business Solutions | ||
* | ||
* Copyright (C) 2018 Axelor (<http://axelor.com>). | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.axelor.apps.crm.web; | ||
|
||
import java.util.Map; | ||
|
||
import com.axelor.apps.base.db.AppBase; | ||
import com.axelor.apps.base.db.Company; | ||
import com.axelor.apps.base.db.repo.CompanyRepository; | ||
import com.axelor.apps.base.db.repo.PartnerRepository; | ||
import com.axelor.apps.base.service.app.AppBaseService; | ||
import com.axelor.apps.crm.db.Lead; | ||
import com.axelor.apps.crm.db.repo.LeadRepository; | ||
import com.axelor.apps.crm.exception.IExceptionMessage; | ||
import com.axelor.apps.crm.service.ConvertLeadWizardService; | ||
import com.axelor.exception.AxelorException; | ||
import com.axelor.exception.db.IException; | ||
import com.axelor.exception.service.TraceBackService; | ||
import com.axelor.i18n.I18n; | ||
import com.axelor.rpc.ActionRequest; | ||
import com.axelor.rpc.ActionResponse; | ||
import com.axelor.rpc.Context; | ||
import com.google.inject.Inject; | ||
import com.google.inject.Singleton; | ||
|
||
@Singleton | ||
public class AccesIndustrieConvertLeadWizardController extends ConvertLeadWizardController { | ||
|
||
@Inject | ||
protected LeadRepository leadRepo; | ||
|
||
@Inject | ||
protected ConvertLeadWizardService convertLeadWizardService; | ||
|
||
@Inject | ||
protected PartnerRepository partnerRepo; | ||
|
||
@Inject | ||
protected CompanyRepository companyRepo; | ||
|
||
@Inject | ||
protected AppBaseService appBaseService; | ||
|
||
@Override | ||
public void setConvertLeadIntoOpportunity(ActionRequest request, ActionResponse response) { | ||
try { | ||
Context context = request.getContext(); | ||
Lead lead; | ||
if (context.getParent() != null | ||
&& context.getParent().get("_model").equals("com.axelor.apps.base.db.Wizard")) { | ||
lead = leadRepo.find(Long.parseLong(((Map) context.getParent().get("_lead")).get("id").toString())); | ||
} else { | ||
lead = leadRepo.find(Long.parseLong(((Map) context.get("_lead")).get("id").toString())); | ||
} | ||
|
||
if (lead == null) { | ||
throw new AxelorException(IException.NO_VALUE, I18n.get(IExceptionMessage.CONVERT_LEAD_MISSING)); | ||
} | ||
AppBase appBase = appBaseService.getAppBase(); | ||
response.setAttr("lead", "value", lead); | ||
response.setAttr("amount", "value", lead.getEstimatedBudget()); | ||
response.setAttr("description", "value", lead.getDescription()); | ||
response.setAttr("source", "value", lead.getSource()); | ||
response.setAttr("user", "value", lead.getUser()); | ||
response.setAttr("team", "value", lead.getTeam()); | ||
response.setAttr("salesStageSelect", "value", "1"); | ||
response.setAttr("webSite", "value", lead.getWebSite()); | ||
response.setAttr("source", "value", lead.getSource()); | ||
|
||
// Acces Industrie | ||
response.setAttr("subSource", "value", lead.getSubSource()); | ||
|
||
response.setAttr("department", "value", lead.getDepartment()); | ||
response.setAttr("team", "value", lead.getTeam()); | ||
response.setAttr("isCustomer", "value", true); | ||
response.setAttr("partnerTypeSelect", "value", "1"); | ||
response.setAttr("language", "value", appBase.getDefaultPartnerLanguage()); | ||
|
||
Company company = null; | ||
|
||
if (lead.getUser() != null && lead.getUser().getActiveCompany() != null) { | ||
company = lead.getUser().getActiveCompany(); | ||
} else if (companyRepo.all().count() == 1) { | ||
company = companyRepo.all().fetchOne(); | ||
} | ||
|
||
if (company != null) { | ||
response.setAttr("company", "value", company); | ||
response.setAttr("currency", "value", company.getCurrency()); | ||
} | ||
} catch (Exception e) { | ||
TraceBackService.trace(response, e); | ||
} | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
modules/acces-industrie-module/src/main/resources/domains/Lead.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?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="crm" package="com.axelor.apps.crm.db"/> | ||
|
||
<entity name="Lead"> | ||
<many-to-one name="subSource" ref="com.axelor.apps.base.db.SubSource" title="Sub-source"/> | ||
</entity> | ||
|
||
</domain-models> |
12 changes: 12 additions & 0 deletions
12
modules/acces-industrie-module/src/main/resources/domains/Opportunity.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?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="crm" package="com.axelor.apps.crm.db"/> | ||
|
||
<entity name="Opportunity"> | ||
<many-to-one name="subSource" ref="com.axelor.apps.base.db.SubSource" title="Sub-source"/> | ||
</entity> | ||
|
||
</domain-models> |
12 changes: 12 additions & 0 deletions
12
modules/acces-industrie-module/src/main/resources/domains/Source.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?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="Source"> | ||
<one-to-many name="subSourceList" ref="com.axelor.apps.base.db.SubSource" mappedBy="source" title="Sub-sources"/> | ||
</entity> | ||
|
||
</domain-models> |
16 changes: 16 additions & 0 deletions
16
modules/acces-industrie-module/src/main/resources/domains/SubSource.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?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="SubSource"> | ||
<string name="code"/> | ||
<string name="name"/> | ||
<many-to-one name="source" ref="com.axelor.apps.base.db.Source"/> | ||
|
||
<unique-constraint columns="code,source"/> | ||
</entity> | ||
|
||
</domain-models> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.