temporary branch
This commit is contained in:
@@ -27,4 +27,5 @@ public interface IReport {
|
||||
public static final String CLIENT_SITUATION = "ClientSituation.rptdesign";
|
||||
public static final String MESSAGE_PDF = "MessagePDF.rptdesign";
|
||||
public static final String ABC_ANALYSIS = "AbcAnalysis.rptdesign";
|
||||
public static final String MEETING = "PVMeeting.rptdesign";
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.List;
|
||||
public interface AppBaseService extends AppService {
|
||||
|
||||
public static final int DEFAULT_NB_DECIMAL_DIGITS = 2;
|
||||
public static final int DEFAULT_NB_DECIMAL_DIGITS_SUPPLIER_LINE = 2;
|
||||
|
||||
public AppBase getAppBase();
|
||||
|
||||
|
||||
@@ -166,4 +166,12 @@ public class AppBaseController {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@CallMethod
|
||||
public void execWhatsApp2(String username,String message,String url,String id,String enc) throws IOException, ClassNotFoundException {
|
||||
String args[] = { "python", "/Users\\Bachir.souldi.SOPHAL\\Desktop\\dev\\whatsapp_erp\\index.py" , message, url , id };
|
||||
Process p = Runtime.getRuntime().exec(args);
|
||||
// BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package com.axelor.apps.base.web;
|
||||
|
||||
import com.axelor.apps.ReportFactory;
|
||||
import com.axelor.apps.base.db.FamilleProduit;
|
||||
import com.axelor.apps.base.db.Product;
|
||||
import com.axelor.apps.base.db.repo.ProductRepository;
|
||||
import com.axelor.apps.base.exceptions.IExceptionMessage;
|
||||
@@ -41,6 +42,8 @@ import java.lang.invoke.MethodHandles;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.axelor.rpc.Context;
|
||||
import java.util.Map;
|
||||
|
||||
@Singleton
|
||||
public class ProductController {
|
||||
@@ -132,4 +135,46 @@ public class ProductController {
|
||||
TraceBackService.trace(response, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void printProductQrCodes(ActionRequest request, ActionResponse response)
|
||||
throws AxelorException {
|
||||
try {
|
||||
|
||||
Context context = request.getContext();
|
||||
Long id = 1L;
|
||||
Integer typeSelect = Integer.parseInt(context.get("printingTypeSelect").toString());
|
||||
|
||||
switch (typeSelect) {
|
||||
case 1:
|
||||
id = new Long((Integer) ((Map) context.get("product")).get("id"));
|
||||
break;
|
||||
case 2:
|
||||
id = new Long((Integer) ((Map) request.getContext().get("stockLocation")).get("id"));
|
||||
break;
|
||||
case 3:
|
||||
id = ((FamilleProduit) request.getContext().get("familleProduit")).getId();
|
||||
break;
|
||||
default:
|
||||
id = 0L;
|
||||
break;
|
||||
}
|
||||
String name = I18n.get("QrCode printing");
|
||||
|
||||
String fileLink =
|
||||
ReportFactory.createReport("QrCodePrinting.rptdesign", name + "-${date}")
|
||||
.addParam("Locale", ReportSettings.getPrintingLocale(null))
|
||||
.addParam("typeSelect", typeSelect)
|
||||
.addParam("productId", id)
|
||||
.addParam("stockLocation", id)
|
||||
.addParam("familleProduit",id)
|
||||
.generate()
|
||||
.getFileLink();
|
||||
|
||||
logger.debug("Printing " + name);
|
||||
|
||||
response.setView(ActionView.define(name).add("html", fileLink).map());
|
||||
} catch (Exception e) {
|
||||
TraceBackService.trace(response, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,12 @@
|
||||
<many-to-one name="purchaseTax" ref="com.axelor.apps.account.db.Tax" title="Purchase Tax"/>
|
||||
<many-to-one name="saleTax" ref="com.axelor.apps.account.db.Tax" title="Sale Tax"/>
|
||||
<many-to-one name="tax" ref="com.axelor.apps.account.db.Tax" title="Tax"/>
|
||||
<many-to-one name="partner" ref="com.axelor.apps.base.db.Partner" title="Partner" />
|
||||
|
||||
<many-to-one name="product" ref="com.axelor.apps.base.db.Product" title="Product"/>
|
||||
<many-to-one name="productFamily" ref="com.axelor.apps.base.db.ProductFamily" title="Accounting family"/>
|
||||
|
||||
<finder-method name="findByProduct" using="product"/>
|
||||
|
||||
</entity>
|
||||
|
||||
|
||||
@@ -82,6 +82,9 @@
|
||||
|
||||
<boolean name="enableCheckTcoAccpeted" title="Enable check TCO Accepte" />
|
||||
|
||||
<!-- roq url -->
|
||||
<string name="roqURL" title="Roq URL" />
|
||||
|
||||
<extra-code>
|
||||
<![CDATA[
|
||||
public static final int DISCOUNT_SEPARATE = 1;
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
|
||||
<entity name="CompanyDepartment" lang="java">
|
||||
|
||||
<string name="name" title="Name"/>
|
||||
<string name="code" title="Code"/>
|
||||
<many-to-one name="company" ref="com.axelor.apps.base.db.Company"/>
|
||||
<string name="name" title="Name"/>
|
||||
<string name="code" title="Code"/>
|
||||
<many-to-one name="company" ref="com.axelor.apps.base.db.Company"/>
|
||||
<integer name="departmentLevel" title="Level" />
|
||||
<many-to-one name="parentDepartment" ref="com.axelor.apps.base.db.CompanyDepartment"/>
|
||||
|
||||
|
||||
</entity>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<string name="url" title="URL"/>
|
||||
<string name="subject" required="true" namecolumn="true" title="Subject"/>
|
||||
<string name="description" title="Description" large="true"/>
|
||||
<string name="decisions" title="Decisions" large="true"/>
|
||||
<string name="status" title="Status"/>
|
||||
<datetime name="startDateTime" required="true" title="Start date"/>
|
||||
<datetime name="endDateTime" required="true" title="End date"/>
|
||||
@@ -25,7 +26,10 @@
|
||||
<string name="subjectTeam"/>
|
||||
<integer name="typeSelect" title="Type" selection="icalendar.event.type.select" required="true" />
|
||||
<many-to-one name="user" column="user_id" ref="com.axelor.auth.db.User" title="Assigned to"/>
|
||||
<one-to-many name="companyDepartmentList" title="Company departments" ref="com.axelor.apps.base.db.CompanyDepartment" />
|
||||
|
||||
<finder-method name="findByUid" using="uid" />
|
||||
|
||||
|
||||
<extra-code>
|
||||
<![CDATA[
|
||||
|
||||
@@ -146,6 +146,10 @@
|
||||
<decimal name="pvg" title="PVG" />
|
||||
<decimal name="stklim" title="Stklim" />
|
||||
<decimal name="ug" title="UG" />
|
||||
|
||||
<boolean name="isDangerousProduct" title="Is dangerous" />
|
||||
|
||||
<finder-method name="findByCode" using="code" cacheable="true" />
|
||||
|
||||
<extra-code>
|
||||
<![CDATA[
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
|
||||
<integer name="stepStatusSelect" selection="base.user.form.step.select" default="0"/>
|
||||
|
||||
<many-to-one name="companyDepartment" ref="com.axelor.apps.base.db.CompanyDepartment" />
|
||||
|
||||
<finder-method name="findByCode" using="code" filter="LOWER(self.code) = LOWER(:code)"/>
|
||||
|
||||
<track>
|
||||
|
||||
@@ -24,19 +24,40 @@ import com.axelor.apps.base.service.user.UserService;
|
||||
import com.axelor.apps.base.test.UserServiceTest.MyModule;
|
||||
import com.axelor.apps.message.module.MessageModule;
|
||||
import com.axelor.apps.tool.module.ToolModule;
|
||||
import com.axelor.auth.db.User;
|
||||
import com.axelor.auth.db.repo.UserRepository;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.axelor.test.GuiceModules;
|
||||
import com.axelor.test.GuiceRunner;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.persist.Transactional;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.Persistence;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
||||
@RunWith(GuiceRunner.class)
|
||||
@GuiceModules({MyModule.class})
|
||||
@GuiceModules({UserServiceTest.MyModule.class})
|
||||
public class UserServiceTest {
|
||||
|
||||
static UserService userService;
|
||||
protected final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
|
||||
public static class MyModule extends AxelorModule {
|
||||
|
||||
@@ -55,6 +76,13 @@ public class UserServiceTest {
|
||||
userService = Beans.get(UserService.class);
|
||||
}
|
||||
|
||||
@Inject UserRepository injector;
|
||||
|
||||
|
||||
// public void test() {
|
||||
// assertNotNull(injector.find(1L));
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testMatchPasswordPatternUpperLowerDigit() {
|
||||
Assert.assertTrue(userService.matchPasswordPattern("Axelor123"));
|
||||
@@ -96,4 +124,20 @@ public class UserServiceTest {
|
||||
Assert.assertFalse(userService.matchPasswordPattern("AxelorAxelor"));
|
||||
Assert.assertFalse(userService.matchPasswordPattern("axelor123456"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void findUser() throws AxelorException {
|
||||
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("testUnitManager");
|
||||
EntityManager entityManager = entityManagerFactory.createEntityManager();
|
||||
|
||||
// Student student = new Student("Ramesh", "Fadatare", "rameshfadatare@javaguides.com");
|
||||
// Object partner = entityManager.createNativeQuery("select u from base_partner u where u.id = 1",Partner.class).getSingleResult();
|
||||
|
||||
// log.debug("data *******************************"+ partner.toString());
|
||||
entityManager.close();
|
||||
entityManagerFactory.close();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
|
||||
<persistence-unit name="testUnit" transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.hibernate.ejb.HibernatePersistence</provider>
|
||||
<persistence-unit name="testUnitManager" transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
|
||||
<properties>
|
||||
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
|
||||
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
|
||||
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/axelor-erp" />
|
||||
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/bdd_last" />
|
||||
|
||||
<property name="javax.persistence.jdbc.user" value="axelor" />
|
||||
<property name="javax.persistence.jdbc.password" value="" />
|
||||
<property name="javax.persistence.jdbc.user" value="postgres" />
|
||||
<property name="javax.persistence.jdbc.password" value="Ijlv=bB^hSG@PV$,9jkhHzO*74" />
|
||||
|
||||
<!--
|
||||
value="create" to build a new database on each run;
|
||||
|
||||
Reference in New Issue
Block a user