code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
package cn.bugstack.springframework.tx.transaction.interceptor; import java.io.Serializable; import java.util.List; /** * @author zhangdd on 2022/2/26 */ public class RuleBasedTransactionAttribute extends DefaultTransactionAttribute implements Serializable { private List<RollbackRuleAttribute> rollbackRules; public RuleBasedTransactionAttribute() { super(); } public void setRollbackRules(List<RollbackRuleAttribute> rollbackRules) { this.rollbackRules = rollbackRules; } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/interceptor/RuleBasedTransactionAttribute.java
Java
apache-2.0
519
package cn.bugstack.springframework.tx.transaction.interceptor; import cn.bugstack.springframework.beans.BeansException; import cn.bugstack.springframework.beans.factory.BeanFactory; import cn.bugstack.springframework.beans.factory.BeanFactoryAware; import cn.bugstack.springframework.beans.factory.InitializingBean; import cn.bugstack.springframework.tx.transaction.PlatformTransactionManager; import cn.bugstack.springframework.tx.transaction.TransactionStatus; import cn.bugstack.springframework.util.ClassUtils; import cn.hutool.core.lang.Assert; import cn.hutool.core.thread.threadlocal.NamedThreadLocal; import java.lang.reflect.Method; /** * @author zhangdd on 2022/2/23 */ public abstract class TransactionAspectSupport implements BeanFactoryAware, InitializingBean { private static final ThreadLocal<TransactionInfo> transactionInfoHolder = new NamedThreadLocal<>("Current aspect-driven transaction"); private BeanFactory beanFactory; private TransactionAttributeSource transactionAttributeSource; private PlatformTransactionManager transactionManager; protected Object invokeWithinTransaction(Method method, Class<?> targetClass, InvocationCallback invocation)throws Throwable { TransactionAttributeSource tas = getTransactionAttributeSource(); TransactionAttribute txAttr = (tas != null ? tas.getTransactionAttribute(method, targetClass) : null); PlatformTransactionManager tm = determineTransactionManager(); String joinpointIdentification = methodIdentification(method, targetClass); TransactionInfo txInfo = createTransactionIfNecessary(tm, txAttr, joinpointIdentification); Object retVal=null; try { retVal=invocation.proceedWithInvocation(); } catch (Throwable e) { completeTransactionAfterThrowing(txInfo, e); throw e; }finally { cleanupTransactionInfo(txInfo); } commitTransactionAfterReturning(txInfo); return retVal; } public TransactionAttributeSource getTransactionAttributeSource() { return transactionAttributeSource; } public void setTransactionAttributeSource(TransactionAttributeSource transactionAttributeSource) { this.transactionAttributeSource = transactionAttributeSource; } public PlatformTransactionManager getTransactionManager() { return transactionManager; } public void setTransactionManager(PlatformTransactionManager transactionManager) { this.transactionManager = transactionManager; } /** * 当前使用DataSourceTransactionManager */ protected PlatformTransactionManager determineTransactionManager() { return getTransactionManager(); } /** * 获取目标方法的唯一标识 */ private String methodIdentification(Method method, Class<?> targetClass) { return ClassUtils.getQualifiedMethodName(method, targetClass); } protected TransactionInfo createTransactionIfNecessary(PlatformTransactionManager tm,TransactionAttribute txAttr, String joinpointIdentification){ if (txAttr != null && txAttr.getName() == null) { txAttr = new DelegatingTransactionAttribute(txAttr) { @Override public String getName() { return joinpointIdentification; } }; } TransactionStatus status = null; if (txAttr != null) { if (tm != null) { status = tm.getTransaction(txAttr); } } return prepareTransactionInfo(tm, txAttr, joinpointIdentification, status); } protected TransactionInfo prepareTransactionInfo(PlatformTransactionManager tm, TransactionAttribute txAttr, String joinpointIdentification, TransactionStatus status) { TransactionInfo txInfo = new TransactionInfo(tm, txAttr, joinpointIdentification); if (txAttr != null) { txInfo.newTransactionStatus(status); } txInfo.bindToThread(); return txInfo; } protected void completeTransactionAfterThrowing(TransactionInfo txInfo, Throwable ex) { if (null != txInfo && null != txInfo.getTransactionStatus()) { if (txInfo.transactionAttribute != null && txInfo.transactionAttribute.rollbackOn(ex)) { try { txInfo.getTransactionManager().rollback(txInfo.getTransactionStatus()); } catch (RuntimeException | Error ex2) { throw ex2; } } else { try { txInfo.getTransactionManager().commit(txInfo.getTransactionStatus()); } catch (Exception ex2) { throw ex2; } } } } protected void cleanupTransactionInfo(TransactionInfo txInfo) { if (null != txInfo) { txInfo.restoreThreadLocalStatus(); } } protected void commitTransactionAfterReturning(TransactionInfo txInfo) { if (null != txInfo && null != txInfo.getTransactionStatus()) { txInfo.getTransactionManager().commit(txInfo.getTransactionStatus()); } } protected interface InvocationCallback { Object proceedWithInvocation() throws Throwable; } @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { this.beanFactory = beanFactory; } @Override public void afterPropertiesSet() throws Exception { } protected final class TransactionInfo { private final PlatformTransactionManager transactionManager; private final TransactionAttribute transactionAttribute; private final String joinpointIdentification; private TransactionStatus transactionStatus; private TransactionInfo oldTransactionInfo; public TransactionInfo(PlatformTransactionManager transactionManager, TransactionAttribute transactionAttribute, String joinpointIdentification) { this.transactionManager = transactionManager; this.transactionAttribute = transactionAttribute; this.joinpointIdentification = joinpointIdentification; } public PlatformTransactionManager getTransactionManager() { Assert.state(this.transactionManager != null, "No PlatformTransactionManager set"); return transactionManager; } public String getJoinpointIdentification() { return joinpointIdentification; } public TransactionAttribute getTransactionAttribute() { return transactionAttribute; } public void newTransactionStatus(TransactionStatus status) { this.transactionStatus = status; } public TransactionStatus getTransactionStatus() { return transactionStatus; } public boolean hasTransaction() { return null != this.transactionStatus; } private void bindToThread() { this.oldTransactionInfo = transactionInfoHolder.get(); transactionInfoHolder.set(this); } private void restoreThreadLocalStatus() { transactionInfoHolder.set(this.oldTransactionInfo); } } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/interceptor/TransactionAspectSupport.java
Java
apache-2.0
7,484
package cn.bugstack.springframework.tx.transaction.interceptor; import cn.bugstack.springframework.tx.transaction.TransactionDefinition; /** * @author zhangdd on 2022/2/26 */ public interface TransactionAttribute extends TransactionDefinition { boolean rollbackOn(Throwable ex); }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/interceptor/TransactionAttribute.java
Java
apache-2.0
291
package cn.bugstack.springframework.tx.transaction.interceptor; import java.lang.reflect.Method; /** * @author zhangdd on 2022/2/26 */ public interface TransactionAttributeSource { TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass); }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/interceptor/TransactionAttributeSource.java
Java
apache-2.0
276
package cn.bugstack.springframework.tx.transaction.interceptor; import cn.bugstack.springframework.aop.support.StaticMethodMatcherPointcut; import cn.bugstack.springframework.tx.transaction.PlatformTransactionManager; import java.io.Serializable; import java.lang.reflect.Method; /** * @author zhangdd on 2022/2/27 */ public abstract class TransactionAttributeSourcePointcut extends StaticMethodMatcherPointcut implements Serializable { @Override public boolean matches(Method method, Class<?> clazz) { if (PlatformTransactionManager.class.isAssignableFrom(clazz)) { return false; } TransactionAttributeSource tas = getTransactionAttributeSource(); return null == tas || tas.getTransactionAttribute(method, clazz) != null; } //--------------------------------------------------------------------- // Abstract methods to be implemented by subclasses start //--------------------------------------------------------------------- protected abstract TransactionAttributeSource getTransactionAttributeSource(); //--------------------------------------------------------------------- // Abstract methods to be implemented by subclasses end //--------------------------------------------------------------------- }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/interceptor/TransactionAttributeSourcePointcut.java
Java
apache-2.0
1,305
package cn.bugstack.springframework.tx.transaction.interceptor; import cn.bugstack.springframework.tx.transaction.PlatformTransactionManager; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import java.io.Serializable; /** * @author zhangdd on 2022/2/23 */ public class TransactionInterceptor extends TransactionAspectSupport implements MethodInterceptor, Serializable { public TransactionInterceptor(PlatformTransactionManager ptm, TransactionAttributeSource transactionAttributeSource) { setTransactionManager(ptm); setTransactionAttributeSource(transactionAttributeSource); } @Override public Object invoke(MethodInvocation invocation) throws Throwable { return invokeWithinTransaction(invocation.getMethod(), invocation.getThis().getClass(), invocation::proceed); } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/interceptor/TransactionInterceptor.java
Java
apache-2.0
902
package cn.bugstack.springframework.tx.transaction.support; import cn.bugstack.springframework.tx.transaction.PlatformTransactionManager; import cn.bugstack.springframework.tx.transaction.TransactionDefinition; import cn.bugstack.springframework.tx.transaction.TransactionException; import cn.bugstack.springframework.tx.transaction.TransactionStatus; import java.io.Serializable; /** * @author zhangdd on 2022/2/23 */ public abstract class AbstractPlatformTransactionManager implements PlatformTransactionManager, Serializable { private int defaultTimeout = TransactionDefinition.TIMEOUT_DEFAULT; @Override public final TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException { Object transaction = doGetTransaction(); if (null == definition) { definition = new DefaultTransactionDefinition(); } if (definition.getTimeout() < TransactionDefinition.TIMEOUT_DEFAULT) { throw new TransactionException("Invalid transaction timeout " + definition.getTimeout()); } try { //对于事务的传播行为暂时认为是默认的行为 //创建事务 DefaultTransactionStatus status = newTransactionStatus(definition, transaction, true); doBegin(transaction, definition); return status; } catch (RuntimeException | Error ex) { throw ex; } } protected DefaultTransactionStatus newTransactionStatus(TransactionDefinition definition, Object transaction, boolean newTransaction) { return new DefaultTransactionStatus(transaction, newTransaction); } protected int determineTimeout(TransactionDefinition definition) { if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) { return definition.getTimeout(); } return this.defaultTimeout; } @Override public void commit(TransactionStatus status) throws TransactionException { if (status.isCompleted()) { throw new IllegalArgumentException( "Transaction is already completed - do not call or rollback more than once per transaction"); } DefaultTransactionStatus defStatus = (DefaultTransactionStatus) status; processCommit(defStatus); } private void processCommit(DefaultTransactionStatus status) throws TransactionException { doCommit(status); } @Override public void rollback(TransactionStatus status) throws TransactionException { if (status.isCompleted()) { throw new IllegalArgumentException( "Transaction is already completed - do not call commit or rollback more than once per transaction"); } DefaultTransactionStatus defStatus = (DefaultTransactionStatus) status; processRollback(defStatus, false); } private void processRollback(DefaultTransactionStatus status, boolean unexpected) { doRollback(status); } //--------------------------------------------------------------------- // Abstract methods to be implemented by subclasses start //--------------------------------------------------------------------- /** * 获取事务 */ protected abstract Object doGetTransaction() throws TransactionException; /** * 提交事务 */ protected abstract void doCommit(DefaultTransactionStatus status) throws TransactionException; /** * 事务回滚 */ protected abstract void doRollback(DefaultTransactionStatus status) throws TransactionException; /** * 开始事务 */ protected abstract void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException; //--------------------------------------------------------------------- // Abstract methods to be implemented by subclasses end //--------------------------------------------------------------------- }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/support/AbstractPlatformTransactionManager.java
Java
apache-2.0
4,085
package cn.bugstack.springframework.tx.transaction.support; import cn.bugstack.springframework.tx.transaction.NestedTransactionNotSupportedException; import cn.bugstack.springframework.tx.transaction.SavepointManager; import cn.bugstack.springframework.tx.transaction.TransactionException; import cn.bugstack.springframework.tx.transaction.TransactionStatus; import java.io.IOException; /** * @author zhangdd on 2022/2/22 */ public abstract class AbstractTransactionStatus implements TransactionStatus { private boolean rollbackOnly = false; private boolean completed = false; private Object savepoint; @Override public void setRollbackOnly() { this.rollbackOnly = true; } @Override public boolean isRollbackOnly() { return (isLocalRollbackOnly() || isGlobalRollbackOnly()); } public boolean isLocalRollbackOnly() { return this.rollbackOnly; } public boolean isGlobalRollbackOnly() { return false; } @Override public void flush() throws IOException { } public void setCompleted() { this.completed = true; } @Override public boolean isCompleted() { return completed; } public void setSavepoint(Object savepoint) { this.savepoint = savepoint; } public Object getSavepoint() { return savepoint; } @Override public boolean hasSavepoint() { return this.savepoint != null; } //--------------------------------------------------------------------- // Implementation of SavepointManager interface //--------------------------------------------------------------------- @Override public Object createSavepoint() throws TransactionException { return getSavepointManager().createSavepoint(); } @Override public void rollbackToSavepoint(Object savepoint) throws TransactionException { getSavepointManager().rollbackToSavepoint(savepoint); } @Override public void releaseSavepoint(Object savepoint) throws TransactionException { getSavepointManager().releaseSavepoint(savepoint); } protected SavepointManager getSavepointManager() { throw new NestedTransactionNotSupportedException("This transaction does not support savepoints"); } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/support/AbstractTransactionStatus.java
Java
apache-2.0
2,322
package cn.bugstack.springframework.tx.transaction.support; import cn.bugstack.springframework.tx.transaction.TransactionDefinition; import java.io.Serializable; /** * @author zhangdd on 2022/2/24 */ public class DefaultTransactionDefinition implements TransactionDefinition, Serializable { private int propagationBehavior = PROPAGATION_REQUIRED; private int isolationLevel = ISOLATION_DEFAULT; private int timeout = TIMEOUT_DEFAULT; private boolean readOnly = false; private String name; public DefaultTransactionDefinition() { } public DefaultTransactionDefinition(TransactionDefinition other) { this.propagationBehavior = other.getPropagationBehavior(); this.isolationLevel = other.getIsolationLevel(); this.timeout = other.getTimeout(); this.readOnly = other.isReadOnly(); this.name = other.getName(); } public DefaultTransactionDefinition(int propagationBehavior) { this.propagationBehavior = propagationBehavior; } public void setPropagationBehavior(int propagationBehavior) { this.propagationBehavior = propagationBehavior; } @Override public final int getPropagationBehavior() { return this.propagationBehavior; } public final void setIsolationLevel(int isolationLevel) { this.isolationLevel = isolationLevel; } @Override public final int getIsolationLevel() { return this.isolationLevel; } public final void setTimeout(int timeout) { if (timeout < TIMEOUT_DEFAULT) { throw new IllegalArgumentException("Timeout must be a positive integer or TIMEOUT_DEFAULT"); } this.timeout = timeout; } @Override public final int getTimeout() { return this.timeout; } public final void setReadOnly(boolean readOnly) { this.readOnly = readOnly; } @Override public final boolean isReadOnly() { return this.readOnly; } public final void setName(String name) { this.name = name; } @Override public final String getName() { return this.name; } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/support/DefaultTransactionDefinition.java
Java
apache-2.0
2,161
package cn.bugstack.springframework.tx.transaction.support; /** * @author zhangdd on 2022/2/22 */ public class DefaultTransactionStatus extends AbstractTransactionStatus { private final Object transaction; private final boolean newTransaction; public DefaultTransactionStatus(Object transaction, boolean newTransaction) { this.transaction = transaction; this.newTransaction = newTransaction; } public Object getTransaction() { return transaction; } public boolean hasTransaction() { return this.transaction != null; } @Override public boolean isNewTransaction() { return hasTransaction() && this.newTransaction; } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/support/DefaultTransactionStatus.java
Java
apache-2.0
713
package cn.bugstack.springframework.tx.transaction.support; import cn.bugstack.springframework.tx.transaction.TransactionDefinition; import java.io.Serializable; /** * @author zhangdd on 2022/2/27 */ public abstract class DelegatingTransactionDefinition implements TransactionDefinition, Serializable { private final TransactionDefinition targetDefinition; public DelegatingTransactionDefinition(TransactionDefinition targetDefinition) { this.targetDefinition = targetDefinition; } @Override public int getPropagationBehavior() { return this.targetDefinition.getPropagationBehavior(); } @Override public int getIsolationLevel() { return this.targetDefinition.getIsolationLevel(); } @Override public int getTimeout() { return this.targetDefinition.getTimeout(); } @Override public boolean isReadOnly() { return this.targetDefinition.isReadOnly(); } @Override public String getName() { return this.targetDefinition.getName(); } @Override public boolean equals(Object other) { return this.targetDefinition.equals(other); } @Override public int hashCode() { return this.targetDefinition.hashCode(); } @Override public String toString() { return this.targetDefinition.toString(); } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/support/DelegatingTransactionDefinition.java
Java
apache-2.0
1,376
package cn.bugstack.springframework.tx.transaction.support; import cn.hutool.core.lang.Assert; import cn.hutool.core.thread.threadlocal.NamedThreadLocal; import java.util.HashMap; import java.util.Map; /** * @author zhangdd on 2022/3/6 */ public abstract class TransactionSynchronizationManager { /** * 当前线程的数据存储中心 */ private static final ThreadLocal<Map<Object, Object>> resources = new NamedThreadLocal<>("Transactional resources"); /** * 事务的名称 */ private static final ThreadLocal<String> currentTransactionName = new NamedThreadLocal<>("Current transaction name"); /** * 事务是否是只读 */ private static final ThreadLocal<Boolean> currentTransactionReadOnly = new NamedThreadLocal<>("Current transaction read-only status"); /** * 事务的隔离级别 */ private static final ThreadLocal<Integer> currentTransactionIsolationLevel = new NamedThreadLocal<>("Current transaction isolation level"); /** * 事务是否开启 */ private static final ThreadLocal<Boolean> actualTransactionActive = new NamedThreadLocal<>("Actual transaction active"); public static Object getResource(Object key) { return doGetResource(key); } private static Object doGetResource(Object actualKey) { Map<Object, Object> map = resources.get(); if (null == map) { return null; } return map.get(actualKey); } public static void bindResource(Object key, Object value) throws IllegalStateException { Assert.notNull(value, "Value must not be null"); Map<Object, Object> map = resources.get(); if (null == map) { map = new HashMap<>(); resources.set(map); } Object oldValue = map.put(key, value); } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/support/TransactionSynchronizationManager.java
Java
apache-2.0
1,915
package cn.bugstack.springframework.tx.transaction.support; import cn.hutool.core.lang.Assert; /** * @author zhangdd on 2022/3/6 */ public class TransactionSynchronizationUtils { static Object unwrapResourceIfNecessary(Object resource) { Assert.notNull(resource, "Resource must not be null"); Object resourceRef = resource; return resourceRef; } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/tx/transaction/support/TransactionSynchronizationUtils.java
Java
apache-2.0
387
package cn.bugstack.springframework.util; import cn.hutool.core.lang.Assert; import java.io.Closeable; import java.io.Externalizable; import java.io.Serializable; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.*; public class ClassUtils { private static final Set<Class<?>> javaLanguageInterfaces; private static final Map<String, Class<?>> commonClassCache = new HashMap<>(64); private static final Map<Class<?>, Class<?>> primitiveWrapperTypeMap = new IdentityHashMap<>(8); private static final Map<Class<?>, Class<?>> primitiveTypeToWrapperMap = new IdentityHashMap<>(8); static { Class<?>[] javaLanguageInterfaceArray = {Serializable.class, Externalizable.class, Closeable.class, AutoCloseable.class, Cloneable.class, Comparable.class}; registerCommonClasses(javaLanguageInterfaceArray); javaLanguageInterfaces = new HashSet<>(Arrays.asList(javaLanguageInterfaceArray)); } private static void registerCommonClasses(Class<?>... commonClasses) { for (Class<?> clazz : commonClasses) { commonClassCache.put(clazz.getName(), clazz); } } public static ClassLoader getDefaultClassLoader() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (Throwable ex) { // Cannot access thread context ClassLoader - falling back to system class loader... } if (cl == null) { // No thread context class loader -> use class loader of this class. cl = ClassUtils.class.getClassLoader(); } return cl; } /** * Check whether the specified class is a CGLIB-generated class. * @param clazz the class to check */ public static boolean isCglibProxyClass(Class<?> clazz) { return (clazz != null && isCglibProxyClassName(clazz.getName())); } /** * Check whether the specified class name is a CGLIB-generated class. * @param className the class name to check */ public static boolean isCglibProxyClassName(String className) { return (className != null && className.contains("$$")); } public static String getQualifiedMethodName(Method method, Class<?> clazz) { Assert.notNull(method, "Method must not be null"); return (clazz != null ? clazz : method.getDeclaringClass()).getName() + "." + method.getName(); } public static Class<?>[] getAllInterfacesForClass(Class<?> clazz) { return getAllInterfacesForClass(clazz, null); } public static Class<?>[] getAllInterfacesForClass(Class<?> clazz, ClassLoader classLoader) { return toClassArray(getAllInterfacesForClassAsSet(clazz, classLoader)); } public static Set<Class<?>> getAllInterfacesForClassAsSet(Class<?> clazz, ClassLoader classLoader) { Assert.notNull(clazz, "Class must not be null"); if (clazz.isInterface() && isVisible(clazz, classLoader)) { return Collections.singleton(clazz); } Set<Class<?>> interfaces = new LinkedHashSet<>(); Class<?> current = clazz; while (current != null) { Class<?>[] ifcs = current.getInterfaces(); for (Class<?> ifc : ifcs) { if (isVisible(ifc, classLoader)) { interfaces.add(ifc); } } current = current.getSuperclass(); } return interfaces; } public static boolean isVisible(Class<?> clazz, ClassLoader classLoader) { if (classLoader == null) { return true; } try { if (clazz.getClassLoader() == classLoader) { return true; } } catch (SecurityException ex) { // Fall through to loadable check below } // Visible if same Class can be loaded from given ClassLoader return isLoadable(clazz, classLoader); } private static boolean isLoadable(Class<?> clazz, ClassLoader classLoader) { try { return (clazz == classLoader.loadClass(clazz.getName())); // Else: different class with same name found } catch (ClassNotFoundException ex) { // No corresponding class found at all return false; } } public static Class<?>[] toClassArray(Collection<Class<?>> collection) { return collection.toArray(new Class<?>[0]); } public static boolean isJavaLanguageInterface(Class<?> ifc) { return javaLanguageInterfaces.contains(ifc); } public static boolean isInnerClass(Class<?> clazz) { return (clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers())); } public static boolean isAssignable(Class<?> lhsType, Class<?> rhsType) { Assert.notNull(lhsType, "Left-hand side type must not be null"); Assert.notNull(rhsType, "Right-hand side type must not be null"); if (lhsType.isAssignableFrom(rhsType)) { return true; } if (lhsType.isPrimitive()) { Class<?> resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType); if (lhsType == resolvedPrimitive) { return true; } } else { Class<?> resolvedWrapper = primitiveTypeToWrapperMap.get(rhsType); if (resolvedWrapper != null && lhsType.isAssignableFrom(resolvedWrapper)) { return true; } } return false; } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/util/ClassUtils.java
Java
apache-2.0
5,619
package cn.bugstack.springframework.util; import cn.hutool.core.lang.Assert; import org.jetbrains.annotations.Nullable; import java.math.BigDecimal; import java.math.BigInteger; import java.text.DecimalFormat; import java.text.NumberFormat; import java.text.ParseException; import java.util.Collections; import java.util.HashSet; import java.util.Set; /** * 博客:https://bugstack.cn - 沉淀、分享、成长,让自己和他人都能有所收获! * 公众号:bugstack虫洞栈 * Create by 小傅哥(fustack) * * 来自于对开源项目的学习; * 作者:DerekYRC https://github.com/DerekYRC/mini-spring */ public class NumberUtils { private static final BigInteger LONG_MIN = BigInteger.valueOf(Long.MIN_VALUE); private static final BigInteger LONG_MAX = BigInteger.valueOf(Long.MAX_VALUE); /** * Standard number types (all immutable): * Byte, Short, Integer, Long, BigInteger, Float, Double, BigDecimal. */ public static final Set<Class<?>> STANDARD_NUMBER_TYPES; static { Set<Class<?>> numberTypes = new HashSet<>(8); numberTypes.add(Byte.class); numberTypes.add(Short.class); numberTypes.add(Integer.class); numberTypes.add(Long.class); numberTypes.add(BigInteger.class); numberTypes.add(Float.class); numberTypes.add(Double.class); numberTypes.add(BigDecimal.class); STANDARD_NUMBER_TYPES = Collections.unmodifiableSet(numberTypes); } /** * Convert the given number into an instance of the given target class. * @param number the number to convert * @param targetClass the target class to convert to * @return the converted number * @throws IllegalArgumentException if the target class is not supported * (i.e. not a standard Number subclass as included in the JDK) * @see java.lang.Byte * @see java.lang.Short * @see java.lang.Integer * @see java.lang.Long * @see java.math.BigInteger * @see java.lang.Float * @see java.lang.Double * @see java.math.BigDecimal */ @SuppressWarnings("unchecked") public static <T extends Number> T convertNumberToTargetClass(Number number, Class<T> targetClass) throws IllegalArgumentException { Assert.notNull(number, "Number must not be null"); Assert.notNull(targetClass, "Target class must not be null"); if (targetClass.isInstance(number)) { return (T) number; } else if (Byte.class == targetClass) { long value = checkedLongValue(number, targetClass); if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) { raiseOverflowException(number, targetClass); } return (T) Byte.valueOf(number.byteValue()); } else if (Short.class == targetClass) { long value = checkedLongValue(number, targetClass); if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { raiseOverflowException(number, targetClass); } return (T) Short.valueOf(number.shortValue()); } else if (Integer.class == targetClass) { long value = checkedLongValue(number, targetClass); if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) { raiseOverflowException(number, targetClass); } return (T) Integer.valueOf(number.intValue()); } else if (Long.class == targetClass) { long value = checkedLongValue(number, targetClass); return (T) Long.valueOf(value); } else if (BigInteger.class == targetClass) { if (number instanceof BigDecimal) { // do not lose precision - use BigDecimal's own conversion return (T) ((BigDecimal) number).toBigInteger(); } else { // original value is not a Big* number - use standard long conversion return (T) BigInteger.valueOf(number.longValue()); } } else if (Float.class == targetClass) { return (T) Float.valueOf(number.floatValue()); } else if (Double.class == targetClass) { return (T) Double.valueOf(number.doubleValue()); } else if (BigDecimal.class == targetClass) { // always use BigDecimal(String) here to avoid unpredictability of BigDecimal(double) // (see BigDecimal javadoc for details) return (T) new BigDecimal(number.toString()); } else { throw new IllegalArgumentException("Could not convert number [" + number + "] of type [" + number.getClass().getName() + "] to unsupported target class [" + targetClass.getName() + "]"); } } /** * Check for a {@code BigInteger}/{@code BigDecimal} long overflow * before returning the given number as a long value. * @param number the number to convert * @param targetClass the target class to convert to * @return the long value, if convertible without overflow * @throws IllegalArgumentException if there is an overflow * @see #raiseOverflowException */ private static long checkedLongValue(Number number, Class<? extends Number> targetClass) { BigInteger bigInt = null; if (number instanceof BigInteger) { bigInt = (BigInteger) number; } else if (number instanceof BigDecimal) { bigInt = ((BigDecimal) number).toBigInteger(); } // Effectively analogous to JDK 8's BigInteger.longValueExact() if (bigInt != null && (bigInt.compareTo(LONG_MIN) < 0 || bigInt.compareTo(LONG_MAX) > 0)) { raiseOverflowException(number, targetClass); } return number.longValue(); } /** * Raise an <em>overflow</em> exception for the given number and target class. * @param number the number we tried to convert * @param targetClass the target class we tried to convert to * @throws IllegalArgumentException if there is an overflow */ private static void raiseOverflowException(Number number, Class<?> targetClass) { throw new IllegalArgumentException("Could not convert number [" + number + "] of type [" + number.getClass().getName() + "] to target class [" + targetClass.getName() + "]: overflow"); } /** * Parse the given {@code text} into a {@link Number} instance of the given * target class, using the corresponding {@code decode} / {@code valueOf} method. * <p>Trims all whitespace (leading, trailing, and in between characters) from * the input {@code String} before attempting to parse the number. * <p>Supports numbers in hex format (with leading "0x", "0X", or "#") as well. * @param text the text to convert * @param targetClass the target class to parse into * @return the parsed number * @throws IllegalArgumentException if the target class is not supported * (i.e. not a standard Number subclass as included in the JDK) * @see Byte#decode * @see Short#decode * @see Integer#decode * @see Long#decode * @see #decodeBigInteger(String) * @see Float#valueOf * @see Double#valueOf * @see java.math.BigDecimal#BigDecimal(String) */ @SuppressWarnings("unchecked") public static <T extends Number> T parseNumber(String text, Class<T> targetClass) { Assert.notNull(text, "Text must not be null"); Assert.notNull(targetClass, "Target class must not be null"); String trimmed = trimAllWhitespace(text); if (Byte.class == targetClass) { return (T) (isHexNumber(trimmed) ? Byte.decode(trimmed) : Byte.valueOf(trimmed)); } else if (Short.class == targetClass) { return (T) (isHexNumber(trimmed) ? Short.decode(trimmed) : Short.valueOf(trimmed)); } else if (Integer.class == targetClass) { return (T) (isHexNumber(trimmed) ? Integer.decode(trimmed) : Integer.valueOf(trimmed)); } else if (Long.class == targetClass) { return (T) (isHexNumber(trimmed) ? Long.decode(trimmed) : Long.valueOf(trimmed)); } else if (BigInteger.class == targetClass) { return (T) (isHexNumber(trimmed) ? decodeBigInteger(trimmed) : new BigInteger(trimmed)); } else if (Float.class == targetClass) { return (T) Float.valueOf(trimmed); } else if (Double.class == targetClass) { return (T) Double.valueOf(trimmed); } else if (BigDecimal.class == targetClass || Number.class == targetClass) { return (T) new BigDecimal(trimmed); } else { throw new IllegalArgumentException( "Cannot convert String [" + text + "] to target class [" + targetClass.getName() + "]"); } } /** * Parse the given {@code text} into a {@link Number} instance of the * given target class, using the supplied {@link NumberFormat}. * <p>Trims the input {@code String} before attempting to parse the number. * @param text the text to convert * @param targetClass the target class to parse into * @param numberFormat the {@code NumberFormat} to use for parsing (if * {@code null}, this method falls back to {@link #parseNumber(String, Class)}) * @return the parsed number * @throws IllegalArgumentException if the target class is not supported * (i.e. not a standard Number subclass as included in the JDK) * @see java.text.NumberFormat#parse * @see #convertNumberToTargetClass * @see #parseNumber(String, Class) */ public static <T extends Number> T parseNumber( String text, Class<T> targetClass, @Nullable NumberFormat numberFormat) { if (numberFormat != null) { Assert.notNull(text, "Text must not be null"); Assert.notNull(targetClass, "Target class must not be null"); DecimalFormat decimalFormat = null; boolean resetBigDecimal = false; if (numberFormat instanceof DecimalFormat) { decimalFormat = (DecimalFormat) numberFormat; if (BigDecimal.class == targetClass && !decimalFormat.isParseBigDecimal()) { decimalFormat.setParseBigDecimal(true); resetBigDecimal = true; } } try { Number number = numberFormat.parse(trimAllWhitespace(text)); return convertNumberToTargetClass(number, targetClass); } catch (ParseException ex) { throw new IllegalArgumentException("Could not parse number: " + ex.getMessage()); } finally { if (resetBigDecimal) { decimalFormat.setParseBigDecimal(false); } } } else { return parseNumber(text, targetClass); } } public static String trimAllWhitespace(String str) { if (!hasLength(str)) { return str; } int len = str.length(); StringBuilder sb = new StringBuilder(str.length()); for (int i = 0; i < len; i++) { char c = str.charAt(i); if (!Character.isWhitespace(c)) { sb.append(c); } } return sb.toString(); } public static boolean hasLength(@Nullable String str) { return (str != null && !str.isEmpty()); } /** * Determine whether the given {@code value} String indicates a hex number, * i.e. needs to be passed into {@code Integer.decode} instead of * {@code Integer.valueOf}, etc. */ private static boolean isHexNumber(String value) { int index = (value.startsWith("-") ? 1 : 0); return (value.startsWith("0x", index) || value.startsWith("0X", index) || value.startsWith("#", index)); } /** * Decode a {@link java.math.BigInteger} from the supplied {@link String} value. * <p>Supports decimal, hex, and octal notation. * @see BigInteger#BigInteger(String, int) */ private static BigInteger decodeBigInteger(String value) { int radix = 10; int index = 0; boolean negative = false; // Handle minus sign, if present. if (value.startsWith("-")) { negative = true; index++; } // Handle radix specifier, if present. if (value.startsWith("0x", index) || value.startsWith("0X", index)) { index += 2; radix = 16; } else if (value.startsWith("#", index)) { index++; radix = 16; } else if (value.startsWith("0", index) && value.length() > 1 + index) { index++; radix = 8; } BigInteger result = new BigInteger(value.substring(index), radix); return (negative ? result.negate() : result); } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/util/NumberUtils.java
Java
apache-2.0
13,148
package cn.bugstack.springframework.util; import cn.hutool.core.lang.Assert; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.UndeclaredThrowableException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * @author zhangdd on 2022/2/27 */ public class ReflectionUtils { private static final Map<Class<?>, Method[]> declaredMethodsCache = new ConcurrentHashMap<>(256); private static final Method[] EMPTY_METHOD_ARRAY = new Method[0]; public static Method findMethod(Class<?> clazz, String name) { return findMethod(clazz, name, new Class<?>[0]); } public static Object invokeMethod(Method method, Object target) { return invokeMethod(method, target, new Object[0]); } public static Object invokeMethod(Method method, Object target, Object... args) { try { return method.invoke(target, args); } catch (Exception ex) { handleReflectionException(ex); } throw new IllegalStateException("Should never get here"); } public static void handleReflectionException(Exception ex) { if (ex instanceof NoSuchMethodException) { throw new IllegalStateException("Method not found: " + ex.getMessage()); } if (ex instanceof IllegalAccessException) { throw new IllegalStateException("Could not access method: " + ex.getMessage()); } if (ex instanceof InvocationTargetException) { handleInvocationTargetException((InvocationTargetException) ex); } if (ex instanceof RuntimeException) { throw (RuntimeException) ex; } throw new UndeclaredThrowableException(ex); } public static void handleInvocationTargetException(InvocationTargetException ex) { rethrowRuntimeException(ex.getTargetException()); } public static void rethrowRuntimeException(Throwable ex) { if (ex instanceof RuntimeException) { throw (RuntimeException) ex; } if (ex instanceof Error) { throw (Error) ex; } throw new UndeclaredThrowableException(ex); } public static Method findMethod(Class<?> clazz, String name, Class<?>... paramTypes) { Assert.notNull(clazz, "Class must not be null"); Assert.notNull(name, "Method name must not be null"); Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : getDeclaredMethods(searchType)); for (Method method : methods) { if (name.equals(method.getName()) && (paramTypes == null || Arrays.equals(paramTypes, method.getParameterTypes()))) { return method; } } searchType = searchType.getSuperclass(); } return null; } private static Method[] getDeclaredMethods(Class<?> clazz) { Assert.notNull(clazz, "Class must not be null"); Method[] result = declaredMethodsCache.get(clazz); if (result == null) { try { Method[] declaredMethods = clazz.getDeclaredMethods(); List<Method> defaultMethods = findConcreteMethodsOnInterfaces(clazz); if (defaultMethods != null) { result = new Method[declaredMethods.length + defaultMethods.size()]; System.arraycopy(declaredMethods, 0, result, 0, declaredMethods.length); int index = declaredMethods.length; for (Method defaultMethod : defaultMethods) { result[index] = defaultMethod; index++; } } else { result = declaredMethods; } declaredMethodsCache.put(clazz, (result.length == 0 ? EMPTY_METHOD_ARRAY : result)); } catch (Throwable ex) { throw new IllegalStateException("Failed to introspect Class [" + clazz.getName() + "] from ClassLoader [" + clazz.getClassLoader() + "]", ex); } } return result; } private static List<Method> findConcreteMethodsOnInterfaces(Class<?> clazz) { List<Method> result = null; for (Class<?> ifc : clazz.getInterfaces()) { for (Method ifcMethod : ifc.getMethods()) { if (!Modifier.isAbstract(ifcMethod.getModifiers())) { if (result == null) { result = new ArrayList<>(); } result.add(ifcMethod); } } } return result; } public static Method[] getAllDeclaredMethods(Class<?> leafClass) { final List<Method> methods = new ArrayList<>(32); doWithMethods(leafClass, methods::add); return methods.toArray(EMPTY_METHOD_ARRAY); } public static void doWithMethods(Class<?> clazz, MethodCallback mc) { doWithMethods(clazz, mc, null); } public static void doWithMethods(Class<?> clazz, MethodCallback mc, MethodFilter mf) { // Keep backing up the inheritance hierarchy. Method[] methods = getDeclaredMethods(clazz); for (Method method : methods) { if (mf != null && !mf.matches(method)) { continue; } try { mc.doWith(method); } catch (IllegalAccessException ex) { throw new IllegalStateException("Not allowed to access method '" + method.getName() + "': " + ex); } } if (clazz.getSuperclass() != null) { doWithMethods(clazz.getSuperclass(), mc, mf); } else if (clazz.isInterface()) { for (Class<?> superIfc : clazz.getInterfaces()) { doWithMethods(superIfc, mc, mf); } } } public interface MethodCallback { /** * Perform an operation using the given method. * * @param method the method to operate on */ void doWith(Method method) throws IllegalArgumentException, IllegalAccessException; } public interface MethodFilter { /** * Determine whether the given method matches. * * @param method the method to check */ boolean matches(Method method); } public static void makeAccessible(Method method) { if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers())) && !method.isAccessible()) { method.setAccessible(true); } } public static boolean isEqualsMethod(Method method) { if (method == null || !method.getName().equals("equals")) { return false; } Class<?>[] paramTypes = method.getParameterTypes(); return (paramTypes.length == 1 && paramTypes[0] == Object.class); } public static boolean isHashCodeMethod( Method method) { return (method != null && method.getName().equals("hashCode") && method.getParameterCount() == 0); } public static boolean isToStringMethod( Method method) { return (method != null && method.getName().equals("toString") && method.getParameterCount() == 0); } }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/util/ReflectionUtils.java
Java
apache-2.0
7,578
package cn.bugstack.springframework.util; /** * Simple strategy interface for resolving a String value. * Used by {@link cn.bugstack.springframework.beans.factory.config.ConfigurableBeanFactory}. * <p> * 博客:https://bugstack.cn - 沉淀、分享、成长,让自己和他人都能有所收获! * 公众号:bugstack虫洞栈 * Create by 小傅哥(fustack) * * 来自于对开源项目的学习; * 作者:DerekYRC https://github.com/DerekYRC/mini-spring */ public interface StringValueResolver { String resolveStringValue(String strVal); }
2302_77879529/spring
small-spring-step-19/src/main/java/cn/bugstack/springframework/util/StringValueResolver.java
Java
apache-2.0
569
package cn.bugstack.springframework.test; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.sql.Connection; /** * @author zhangdd on 2022/2/15 */ public class TransactionProxy implements InvocationHandler { private final Connection connection; private final Object target; public TransactionProxy(Connection connection, Object target) { this.connection = connection; this.target = target; } @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { //开启事务 connection.setAutoCommit(true); //如果发生异常则进行回滚 Object invokeResult = null; try { invokeResult = method.invoke(target, args); } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) { e.printStackTrace(); connection.rollback(); } //提交 connection.commit(); return invokeResult; } }
2302_77879529/spring
small-spring-step-19/src/test/java/cn/bugstack/springframework/test/TransactionProxy.java
Java
apache-2.0
1,102
package cn.bugstack.springframework.test.service; import cn.bugstack.springframework.jdbc.support.JdbcTemplate; import java.sql.SQLException; /** * @author zhangdd on 2022/2/15 */ public interface JdbcService { void saveDataWithTranslation() throws SQLException; void saveData(JdbcTemplate jdbcTemplate) ; }
2302_77879529/spring
small-spring-step-19/src/test/java/cn/bugstack/springframework/test/service/JdbcService.java
Java
apache-2.0
324
package cn.bugstack.springframework.test.service.impl; import cn.bugstack.springframework.jdbc.support.JdbcTemplate; import cn.bugstack.springframework.test.service.JdbcService; import cn.bugstack.springframework.tx.transaction.annotation.Transactional; import java.sql.SQLException; import java.sql.Statement; /** * @author zhangdd on 2022/2/15 */ public class JdbcServiceImpl implements JdbcService { private Statement statement; public JdbcServiceImpl() { } public JdbcServiceImpl(Statement statement) { this.statement = statement; } @Override public void saveDataWithTranslation() throws SQLException { statement.execute("insert into teacher(teacher_name) values ('赵老师')"); statement.execute("insert into user(id,username) values(1,'重复数据1')"); } @Transactional(rollbackFor = Exception.class) @Override public void saveData(JdbcTemplate jdbcTemplate) { jdbcTemplate.execute("insert into teacher(teacher_name) values ('李老师')"); jdbcTemplate.execute("insert into user(id,username) values(1,'重复数据')"); } }
2302_77879529/spring
small-spring-step-19/src/test/java/cn/bugstack/springframework/test/service/impl/JdbcServiceImpl.java
Java
apache-2.0
1,134
package cj_code import std.collection.* import std.core.* // ======================= // 一、基础数据结构:状态 和 NFA // ======================= // 状态 class State { public var name: String // 状态名称 public var isAccept: Bool // 是否为接受态 public var transitions: HashMap<String, ArrayList<State>> // 转移表 init() { this.name = "" this.isAccept = false this.transitions = HashMap<String, ArrayList<State>>() } init(name: String, isAccept: Bool) { this.name = name this.isAccept = isAccept this.transitions = HashMap<String, ArrayList<State>>() } // 添加一条转移 func addTransition(symbol: String, state: State) { if (!this.transitions.contains(symbol)) { this.transitions[symbol] = ArrayList<State>() } let arr = this.transitions[symbol] arr.add(state) this.transitions[symbol] = arr } func toString(): String { "状态名称: ${this.name}, 是否为接受态: ${this.isAccept}" } } // NFA class NFA { public var startState: State // 起始状态 public var acceptState: State // 接受态 public var states: ArrayList<State> // 状态列表 public var statesNum: Int64 // 状态数量 // 单字符的 NFA 构造函数 init(inputChar: String) { this.startState = State("0", false) this.acceptState = State("1", true) this.states = ArrayList<State>() this.states.add(this.startState) this.states.add(this.acceptState) this.statesNum = 2 // 起始状态经 inputChar 转移到接受状态 this.startState.addTransition(inputChar, this.acceptState) } // 向 NFA 中添加状态 func addState(s: State) { this.states.add(s) this.statesNum = this.states.size } // 刷新状态数量 func modifyNum() { this.statesNum = this.states.size } // 打印 NFA 的结构 func toString(): String { var out = "NFA,包含 ${this.statesNum} 个状态:\n" // 先明确给出起始状态和接受状态 out = "${out}起始状态: ${this.startState.name},接受状态: ${this.acceptState.name}\n" for (state in this.states) { out = "${out}状态 名称: ${state.name}, 是否接受态: ${state.isAccept}\n" for (k in state.transitions.keys()) { let arr = state.transitions[k] if (arr.size > 0) { out = "${out}${state.name} --${k}--> " for (ns in arr) { out = "${out}${ns.name} " } out = "${out}\n" } } } out } } // ======================= // 二、正则表达式处理:中缀 → 后缀 // ======================= // 判断是否为字母(本实验只支持字母作为输入符号) func isLetter(r: Rune): Bool { (r >= r'a' && r <= r'z') || (r >= r'A' && r <= r'Z') } // 将隐式连接插入显式连接符 '.' // 例如 ab 变成 a.b,a(b) 变成 a.(b),a*b 变成 a*.b func regexInsertConcatenation(regex: String): String { var result = "" var prevSet: Bool = false var prevRune: Rune = r' ' for (ch in regex.runes()) { if (prevSet) { let cIsToken = isLetter(prevRune) || prevRune == r')' || prevRune == r'*' let nIsToken = isLetter(ch) || ch == r'(' if (cIsToken && nIsToken) { result = "${result}." } } result = "${result}${ch.toString()}" prevRune = ch prevSet = true } result } // 运算符优先级 func precedence(op: Rune): Int64 { match (op) { case r'*' => 3 case r'.' => 2 case r'|' => 1 case _ => 0 } } // 中缀正则转后缀(支持 | . * 和括号) func regexToPostfix(regex: String): String { let r = regexInsertConcatenation(regex) var output = "" var ops = ArrayList<Rune>() // 运算符栈 var opsLen: Int64 = 0 let arr = r.toRuneArray() var i: Int64 = 0 while (i < arr.size) { let ch = arr[i] if (isLetter(ch)) { // 操作数直接输出 output = "${output}${ch.toString()}" } else if (ch == r'(') { if (opsLen < ops.size) { ops[opsLen] = ch } else { ops.add(ch) } opsLen += 1 } else if (ch == r')') { while (opsLen > 0 && ops[opsLen - 1] != r'(') { let top = ops[opsLen - 1] opsLen -= 1 output = "${output}${top.toString()}" } if (opsLen > 0 && ops[opsLen - 1] == r'(') { opsLen -= 1 } } else { // 其他运算符,根据优先级弹栈 while (opsLen > 0 && precedence(ops[opsLen - 1]) >= precedence(ch)) { let top = ops[opsLen - 1] opsLen -= 1 output = "${output}${top.toString()}" } if (opsLen < ops.size) { ops[opsLen] = ch } else { ops.add(ch) } opsLen += 1 } i += 1 } // 栈中剩余运算符全部弹出 while (opsLen > 0) { let top = ops[opsLen - 1] opsLen -= 1 output = "${output}${top.toString()}" } output } // ======================= // 三、Thompson 构造:后缀 → NFA // ======================= // 连接:nfa1 · nfa2 func nfaConcatenate(nfa1: NFA, nfa2: NFA): NFA { // 原 nfa1 的接受态不再是接受态 nfa1.acceptState.isAccept = false // 在接受态加一条 epsilon 转移到 nfa2 的起始态 nfa1.acceptState.addTransition(" ", nfa2.startState) // 合并状态集合 for (s in nfa2.states) { nfa1.addState(s) } // nfa1 的接受态更新为 nfa2 的接受态 nfa1.acceptState = nfa2.acceptState nfa1.modifyNum() nfa1 } // 闭包:nfa* func nfaClosure(nfa: NFA): NFA { let newStart = State("", false) let newAccept = State("", true) // newStart 通过 epsilon 指向原 start 和 newAccept(0 次) newStart.addTransition(" ", nfa.startState) newStart.addTransition(" ", newAccept) // 原接受态不再为接受态 nfa.acceptState.isAccept = false // 原接受态 -> epsilon -> 原 start(回环) nfa.acceptState.addTransition(" ", nfa.startState) // 原接受态 -> epsilon -> newAccept(退出) nfa.acceptState.addTransition(" ", newAccept) // 把 newStart/newAccept 加入状态集合 nfa.addState(newStart) nfa.addState(newAccept) // 给两个新状态命名为末尾两个索引 let idxStart = nfa.states.size - 2 let idxAccept = nfa.states.size - 1 if (idxStart >= 0) { newStart.name = idxStart.toString() } if (idxAccept >= 0) { newAccept.name = idxAccept.toString() } nfa.startState = newStart nfa.acceptState = newAccept nfa.modifyNum() nfa } // 并:nfa1 | nfa2 func nfaOr(nfa1: NFA, nfa2: NFA): NFA { let newStart = State("", false) let newAccept = State("", true) // 新起点 epsilon 指向两个子 NFA 的起点 newStart.addTransition(" ", nfa1.startState) newStart.addTransition(" ", nfa2.startState) // 原接受态不再接受 nfa1.acceptState.isAccept = false nfa2.acceptState.isAccept = false // 两个原接受态都 epsilon 指向 newAccept nfa1.acceptState.addTransition(" ", newAccept) nfa2.acceptState.addTransition(" ", newAccept) // 合并状态 for (s in nfa2.states) { nfa1.addState(s) } nfa1.addState(newStart) nfa1.addState(newAccept) // 为新状态命名 let idxStart = nfa1.states.size - 2 let idxAccept = nfa1.states.size - 1 if (idxStart >= 0) { newStart.name = idxStart.toString() } if (idxAccept >= 0) { newAccept.name = idxAccept.toString() } nfa1.startState = newStart nfa1.acceptState = newAccept nfa1.modifyNum() nfa1 } // 后缀表达式转 NFA func postfixToNFA(postfix: String): NFA { let stack = ArrayList<NFA>() var stackLen: Int64 = 0 for (ch in postfix.runes()) { if (isLetter(ch)) { let s = ch.toString() if (stackLen < stack.size) { stack[stackLen] = NFA(s) } else { stack.add(NFA(s)) } stackLen += 1 } else if (ch == r'*') { let a = stack[stackLen - 1] stackLen -= 1 let res = nfaClosure(a) if (stackLen < stack.size) { stack[stackLen] = res } else { stack.add(res) } stackLen += 1 } else if (ch == r'.') { let a = stack[stackLen - 1] stackLen -= 1 let b = stack[stackLen - 1] stackLen -= 1 let res = nfaConcatenate(b, a) if (stackLen < stack.size) { stack[stackLen] = res } else { stack.add(res) } stackLen += 1 } else if (ch == r'|') { let a = stack[stackLen - 1] stackLen -= 1 let b = stack[stackLen - 1] stackLen -= 1 let res = nfaOr(b, a) if (stackLen < stack.size) { stack[stackLen] = res } else { stack.add(res) } stackLen += 1 } } let resultNFA = stack[0] renumberNFA(resultNFA) resultNFA } // 给 NFA 状态重新编号(0,1,2,...) func renumberNFA(nfa: NFA) { var idx: Int64 = 0 for (s in nfa.states) { s.name = idx.toString() idx += 1 } nfa.modifyNum() } // ======================= // 四、NFA 上的 epsilon-closure / move / testNFA // ======================= // 判断一个状态是否在状态集合中 func containsState(arr: ArrayList<State>, s: State): Bool { for (x in arr) { if (x.name == s.name) { return true } } false } // epsilon 闭包 func epsilonClosure(states: ArrayList<State>): ArrayList<State> { let result = ArrayList<State>() let queue = ArrayList<State>() var qLen: Int64 = 0 // 初始化 for (s in states) { if (!containsState(result, s)) { result.add(s) } if (qLen < queue.size) { queue[qLen] = s } else { queue.add(s) } qLen += 1 } // BFS 展开所有 epsilon 转移 while (qLen > 0) { let cur = queue[qLen - 1] qLen -= 1 if (cur.transitions.contains(" ")) { let arr = cur.transitions[" "] for (ns in arr) { if (!containsState(result, ns)) { result.add(ns) if (qLen < queue.size) { queue[qLen] = ns } else { queue.add(ns) } qLen += 1 } } } } result } // move 操作:从一组状态读一个符号能到达的状态集合 func move(states: ArrayList<State>, ch: String): ArrayList<State> { let result = ArrayList<State>() for (s in states) { if (s.transitions.contains(ch)) { let arr = s.transitions[ch] for (ns in arr) { if (!containsState(result, ns)) { result.add(ns) } } } } result } // 利用 epsilonClosure 和 move 在 NFA 上测试一个字符串是否被接受 func testNFA(nfa: NFA, input: String): Bool { // 初始状态集合为 startState 的 epsilon 闭包 let startSet = ArrayList<State>() startSet.add(nfa.startState) var current = epsilonClosure(startSet) // 逐字符读取 for (ch in input.runes()) { let sym = ch.toString() let moved = move(current, sym) current = epsilonClosure(moved) if (current.size == 0) { break } } // 只要当前集合中存在接受态,则接受 for (s in current) { if (s.isAccept) { return true } } false } // ======================= // 五、DFA 结构 + NFA → DFA + DFA 测试 // ======================= // 判断两个状态集合是否相同 func sameSet(a: ArrayList<State>, b: ArrayList<State>): Bool { if (a.size != b.size) { return false } for (s in a) { if (!containsState(b, s)) { return false } } true } // DFA 状态 class DFAState { public var name: String public var states: ArrayList<State> // 对应的 NFA 状态子集 public var isAccept: Bool public var transitions: HashMap<String, DFAState> init() { this.name = "" this.states = ArrayList<State>() this.isAccept = false this.transitions = HashMap<String, DFAState>() } init(name: String, isAccept: Bool) { this.name = name this.states = ArrayList<State>() this.isAccept = isAccept this.transitions = HashMap<String, DFAState>() } func addTransition(sym: String, target: DFAState) { this.transitions[sym] = target } func toString(): String { var out = "DFA状态 ${this.name},包含NFA状态:" for (s in this.states) { out = "${out}${s.name} " } out = "${out},是否接受态: ${this.isAccept}" out } } // DFA class DFA { public var startState: DFAState public var states: ArrayList<DFAState> public var acceptStates: ArrayList<DFAState> init(startState: DFAState) { this.startState = startState this.states = ArrayList<DFAState>() this.acceptStates = ArrayList<DFAState>() } func addState(s: DFAState) { this.states.add(s) } func addAcceptState(s: DFAState) { this.acceptStates.add(s) } func toString(): String { var out = "DFA,共 ${this.states.size} 个状态:\n" // 明确打印起始状态 out = "${out}起始状态: ${this.startState.name}\n" // 明确打印接受状态集合 var acc = "" for (s in this.acceptStates) { acc = "${acc}${s.name} " } if (this.acceptStates.size > 0) { out = "${out}接受状态集合: { ${acc}}\n" } else { out = "${out}接受状态集合: { }\n" } // 然后再打印每个状态的详细信息与转移 for (st in this.states) { out = "${out}${st.toString()}\n" for (k in st.transitions.keys()) { let t = st.transitions[k] out = "${out} ${st.name} --${k}--> ${t.name}\n" } } out } } // 从正则表达式中收集字母表 func collectAlphabetFromRegex(regex: String): ArrayList<String> { let result = ArrayList<String>() for (ch in regex.runes()) { if (isLetter(ch)) { let s = ch.toString() var exists = false for (x in result) { if (x == s) { exists = true } } if (!exists) { result.add(s) } } } result } // NFA → DFA(子集构造) func nfaToDfa(nfa: NFA, alphabet: ArrayList<String>): DFA { // 起始子集:start 的 epsilon 闭包 let startSet = ArrayList<State>() startSet.add(nfa.startState) let startClosure = epsilonClosure(startSet) let startDfa = DFAState("0", false) for (s in startClosure) { startDfa.states.add(s) if (s.isAccept) { startDfa.isAccept = true } } let dfa = DFA(startDfa) dfa.addState(startDfa) if (startDfa.isAccept) { dfa.addAcceptState(startDfa) } let worklist = ArrayList<DFAState>() var wLen: Int64 = 0 worklist.add(startDfa) wLen = 1 while (wLen > 0) { let cur = worklist[wLen - 1] wLen -= 1 for (sym in alphabet) { let moved = move(cur.states, sym) if (moved.size == 0) { continue } let cl = epsilonClosure(moved) if (cl.size == 0) { continue } // 查找是否已有等价子集 var existingIndex: Int64 = -1 var idx: Int64 = 0 while (idx < dfa.states.size) { let st = dfa.states[idx] if (sameSet(st.states, cl)) { existingIndex = idx break } idx += 1 } if (existingIndex == -1) { let newName = dfa.states.size.toString() let newState = DFAState(newName, false) for (s in cl) { newState.states.add(s) if (s.isAccept) { newState.isAccept = true } } dfa.addState(newState) if (newState.isAccept) { dfa.addAcceptState(newState) } cur.addTransition(sym, newState) if (wLen < worklist.size) { worklist[wLen] = newState } else { worklist.add(newState) } wLen += 1 } else { let existState = dfa.states[existingIndex] cur.addTransition(sym, existState) } } } dfa } // 在 DFA 上测试字符串 func testDFA(dfa: DFA, input: String): Bool { var cur = dfa.startState for (ch in input.runes()) { let sym = ch.toString() if (!cur.transitions.contains(sym)) { return false } cur = cur.transitions[sym] } cur.isAccept } // ======================= // 六、DFA 最小化(Hopcroft 划分) // ======================= // 找到某个状态属于哪个分组 func getPartitionIndex(state: DFAState, partition: ArrayList<ArrayList<DFAState>>): Int64 { var i: Int64 = 0 while (i < partition.size) { let group = partition[i] for (s in group) { if (s.name == state.name) { return i } } i += 1 } -1 } // 构造 DFA 的字母表(从转移中收集) func collectAlphabetFromDFA(dfa: DFA): ArrayList<String> { let alphabet = ArrayList<String>() for (st in dfa.states) { for (k in st.transitions.keys()) { var exists = false for (a in alphabet) { if (a == k) { exists = true } } if (!exists) { alphabet.add(k) } } } alphabet } // DFA 最小化 func minimizeDFA(dfa: DFA): DFA { let alphabet = collectAlphabetFromDFA(dfa) // 初始划分:接受态和非接受态 let partition = ArrayList<ArrayList<DFAState>>() let acceptGroup = ArrayList<DFAState>() let nonAcceptGroup = ArrayList<DFAState>() for (st in dfa.states) { if (st.isAccept) { acceptGroup.add(st) } else { nonAcceptGroup.add(st) } } if (acceptGroup.size > 0) { partition.add(acceptGroup) } if (nonAcceptGroup.size > 0) { partition.add(nonAcceptGroup) } var changed = true while (changed) { changed = false let newPartition = ArrayList<ArrayList<DFAState>>() for (group in partition) { if (group.size <= 1) { newPartition.add(group) continue } // 签名:对每个符号,看转到哪个分组 let sigMap = HashMap<String, ArrayList<DFAState>>() for (st in group) { let sigParts = ArrayList<String>() for (sym in alphabet) { var tgtIndex: Int64 = -1 if (st.transitions.contains(sym)) { let tgt = st.transitions[sym] tgtIndex = getPartitionIndex(tgt, partition) } sigParts.add(tgtIndex.toString()) } var sigStr = "" for (p in sigParts) { sigStr = sigStr + p + "," } if (!sigMap.contains(sigStr)) { sigMap[sigStr] = ArrayList<DFAState>() } let arr = sigMap[sigStr] arr.add(st) } for (sig in sigMap.keys()) { let subGroup = sigMap[sig] newPartition.add(subGroup) if (subGroup.size < group.size) { changed = true } } } // 更新划分 partition.clear() for (g in newPartition) { partition.add(g) } } // 根据最终划分构造新的最小 DFA let minimized = DFA(DFAState("0", false)) minimized.states.clear() minimized.acceptStates.clear() let stateMap = HashMap<String, DFAState>() // 旧groupIndex -> 新状态 var idx: Int64 = 0 while (idx < partition.size) { let group = partition[idx] if (group.size == 0) { idx += 1 continue } let rep = group[0] let newSt = DFAState(idx.toString(), rep.isAccept) // 保留一下包含的 NFA 状态集合(便于看) for (s in rep.states) { newSt.states.add(s) } minimized.addState(newSt) if (newSt.isAccept) { minimized.addAcceptState(newSt) } stateMap[idx.toString()] = newSt idx += 1 } // 起始状态:原起始状态所在分组 var startIndex = getPartitionIndex(dfa.startState, partition) if (startIndex < 0) { startIndex = 0 } minimized.startState = stateMap[startIndex.toString()] // 构造转移 idx = 0 while (idx < partition.size) { let group = partition[idx] if (group.size == 0) { idx += 1 continue } let rep = group[0] let newSt = stateMap[idx.toString()] for (sym in alphabet) { if (rep.transitions.contains(sym)) { let tgt = rep.transitions[sym] let tgtIdx = getPartitionIndex(tgt, partition) if (tgtIdx >= 0 && stateMap.contains(tgtIdx.toString())) { let newTgt = stateMap[tgtIdx.toString()] newSt.addTransition(sym, newTgt) } } } idx += 1 } minimized } // ======================= // 七、主函数:1+2+3 全部串起来 // ======================= main(args: Array<String>) { if (args.size < 2) { println("用法: cj_code <正则表达式> <测试串1> [测试串2 ...]") println("示例: cj_code \"a(b|c)*\" \"ab\" \"accc\" \"b\"") return } let regex = args[0] if (regex.isEmpty()) { println("错误: 正则表达式不能为空") return } // 收集所有测试字符串 let testStrings = ArrayList<String>() var i: Int64 = 1 while (i < args.size) { testStrings.add(args[i]) i += 1 } try { // ========= 目标1:正则 → NFA,并用 NFA 测试 ========= let postfix = regexToPostfix(regex) println("后缀表达式: " + postfix) let nfa = postfixToNFA(postfix) println("") println("构造得到的 NFA:") println(nfa.toString()) println("") println("=== 使用 NFA 进行匹配测试(目标1) ===") println("正则表达式: " + regex) for (s in testStrings) { let ok = testNFA(nfa, s) println("测试字符串: \"" + s + "\" -> " + if (ok) { "接受" } else { "拒绝" }) } // ========= 目标2:NFA → DFA,并用 DFA 测试 ========= let alphabet = collectAlphabetFromRegex(regex) let dfa = nfaToDfa(nfa, alphabet) println("") println("构造得到的 DFA:") println(dfa.toString()) println("") println("=== 使用 DFA 进行匹配测试(目标2) ===") for (s in testStrings) { let ok = testDFA(dfa, s) println("测试字符串: \"" + s + "\" -> " + if (ok) { "接受" } else { "拒绝" }) } // ========= 目标3:DFA 最小化,并用最小化 DFA 测试 ========= let minimizedDFA = minimizeDFA(dfa) println("") println("最小化后的 DFA:") println(minimizedDFA.toString()) println("") println("最小化前状态数: " + dfa.states.size.toString()) println("最小化后状态数: " + minimizedDFA.states.size.toString()) println("") println("=== 使用最小化 DFA 进行匹配测试(目标3) ===") for (s in testStrings) { let ok = testDFA(minimizedDFA, s) println("测试字符串: \"" + s + "\" -> " + if (ok) { "接受" } else { "拒绝" }) } } catch (e: Exception) { println("发生异常: ${e.toString()}") } }
2302_79418196/cangjie
src/package cj_code.groovy
Groovy
unknown
25,405
package cj_code import std.collection.* import std.core.* // ======================= // 一、基础数据结构:状态 和 NFA // ======================= // 状态 class State { public var name: String // 状态名称 public var isAccept: Bool // 是否为接受态 public var transitions: HashMap<String, ArrayList<State>> // 转移表 init() { this.name = "" this.isAccept = false this.transitions = HashMap<String, ArrayList<State>>() } init(name: String, isAccept: Bool) { this.name = name this.isAccept = isAccept this.transitions = HashMap<String, ArrayList<State>>() } // 添加一条转移 func addTransition(symbol: String, state: State) { if (!this.transitions.contains(symbol)) { this.transitions[symbol] = ArrayList<State>() } let arr = this.transitions[symbol] arr.add(state) this.transitions[symbol] = arr } func toString(): String { "状态名称: ${this.name}, 是否为接受态: ${this.isAccept}" } } // NFA class NFA { public var startState: State // 起始状态 public var acceptState: State // 接受态 public var states: ArrayList<State> // 状态列表 public var statesNum: Int64 // 状态数量 // 单字符的 NFA 构造函数 init(inputChar: String) { this.startState = State("0", false) this.acceptState = State("1", true) this.states = ArrayList<State>() this.states.add(this.startState) this.states.add(this.acceptState) this.statesNum = 2 // 起始状态经 inputChar 转移到接受状态 this.startState.addTransition(inputChar, this.acceptState) } // 向 NFA 中添加状态 func addState(s: State) { this.states.add(s) this.statesNum = this.states.size } // 刷新状态数量 func modifyNum() { this.statesNum = this.states.size } // 打印 NFA 的结构 func toString(): String { var out = "NFA,包含 ${this.statesNum} 个状态:\n" // 先明确给出起始状态和接受状态 out = "${out}起始状态: ${this.startState.name},接受状态: ${this.acceptState.name}\n" for (state in this.states) { out = "${out}状态 名称: ${state.name}, 是否接受态: ${state.isAccept}\n" for (k in state.transitions.keys()) { let arr = state.transitions[k] if (arr.size > 0) { out = "${out}${state.name} --${k}--> " for (ns in arr) { out = "${out}${ns.name} " } out = "${out}\n" } } } out } } // ======================= // NFA的DOT可视化输出 // ======================= func nfaToDot(nfa: NFA): String { var out = "digraph NFA {\n" out = "${out} rankdir=LR;\n" out = "${out} node [shape=circle];\n" // 虚拟起始结点,指向真正的起始状态 out = "${out} __start__ [shape=point];\n" out = "${out} __start__ -> ${nfa.startState.name};\n" // 所有结点:接受态双圈 for (state in nfa.states) { if (state.isAccept) { out = "${out} ${state.name} [shape=doublecircle];\n" } else { out = "${out} ${state.name} [shape=circle];\n" } } // 所有边 for (state in nfa.states) { for (k in state.transitions.keys()) { let arr = state.transitions[k] let label = if (k == " ") { "ε" } else { k } for (ns in arr) { out = "${out} ${state.name} -> ${ns.name} [label=\"${label}\"];\n" } } } out = "${out}}\n" out } // ======================= // 二、正则表达式处理:中缀 → 后缀 // ======================= // 判断是否为字母(本实验只支持字母作为输入符号) func isLetter(r: Rune): Bool { (r >= r'a' && r <= r'z') || (r >= r'A' && r <= r'Z') } // 将隐式连接插入显式连接符 '.' // 例如 ab 变成 a.b,a(b) 变成 a.(b),a*b 变成 a*.b func regexInsertConcatenation(regex: String): String { var result = "" var prevSet: Bool = false var prevRune: Rune = r' ' for (ch in regex.runes()) { if (prevSet) { let cIsToken = isLetter(prevRune) || prevRune == r')' || prevRune == r'*' let nIsToken = isLetter(ch) || ch == r'(' if (cIsToken && nIsToken) { result = "${result}." } } result = "${result}${ch.toString()}" prevRune = ch prevSet = true } result } // 运算符优先级 func precedence(op: Rune): Int64 { match (op) { case r'*' => 3 case r'.' => 2 case r'|' => 1 case _ => 0 } } // 中缀正则转后缀(支持 | . * 和括号) func regexToPostfix(regex: String): String { let r = regexInsertConcatenation(regex) var output = "" var ops = ArrayList<Rune>() // 运算符栈 var opsLen: Int64 = 0 let arr = r.toRuneArray() var i: Int64 = 0 while (i < arr.size) { let ch = arr[i] if (isLetter(ch)) { // 操作数直接输出 output = "${output}${ch.toString()}" } else if (ch == r'(') { if (opsLen < ops.size) { ops[opsLen] = ch } else { ops.add(ch) } opsLen += 1 } else if (ch == r')') { while (opsLen > 0 && ops[opsLen - 1] != r'(') { let top = ops[opsLen - 1] opsLen -= 1 output = "${output}${top.toString()}" } if (opsLen > 0 && ops[opsLen - 1] == r'(') { opsLen -= 1 } } else { // 其他运算符,根据优先级弹栈 while (opsLen > 0 && precedence(ops[opsLen - 1]) >= precedence(ch)) { let top = ops[opsLen - 1] opsLen -= 1 output = "${output}${top.toString()}" } if (opsLen < ops.size) { ops[opsLen] = ch } else { ops.add(ch) } opsLen += 1 } i += 1 } // 栈中剩余运算符全部弹出 while (opsLen > 0) { let top = ops[opsLen - 1] opsLen -= 1 output = "${output}${top.toString()}" } output } // ======================= // 三、Thompson 构造:后缀 → NFA // ======================= // 连接:nfa1 · nfa2 func nfaConcatenate(nfa1: NFA, nfa2: NFA): NFA { // 原 nfa1 的接受态不再是接受态 nfa1.acceptState.isAccept = false // 在接受态加一条 epsilon 转移到 nfa2 的起始态 nfa1.acceptState.addTransition(" ", nfa2.startState) // 合并状态集合 for (s in nfa2.states) { nfa1.addState(s) } // nfa1 的接受态更新为 nfa2 的接受态 nfa1.acceptState = nfa2.acceptState nfa1.modifyNum() nfa1 } // 闭包:nfa* func nfaClosure(nfa: NFA): NFA { let newStart = State("", false) let newAccept = State("", true) // newStart 通过 epsilon 指向原 start 和 newAccept(0 次) newStart.addTransition(" ", nfa.startState) newStart.addTransition(" ", newAccept) // 原接受态不再为接受态 nfa.acceptState.isAccept = false // 原接受态 -> epsilon -> 原 start(回环) nfa.acceptState.addTransition(" ", nfa.startState) // 原接受态 -> epsilon -> newAccept(退出) nfa.acceptState.addTransition(" ", newAccept) // 把 newStart/newAccept 加入状态集合 nfa.addState(newStart) nfa.addState(newAccept) // 给两个新状态命名为末尾两个索引 let idxStart = nfa.states.size - 2 let idxAccept = nfa.states.size - 1 if (idxStart >= 0) { newStart.name = idxStart.toString() } if (idxAccept >= 0) { newAccept.name = idxAccept.toString() } nfa.startState = newStart nfa.acceptState = newAccept nfa.modifyNum() nfa } // 并:nfa1 | nfa2 func nfaOr(nfa1: NFA, nfa2: NFA): NFA { let newStart = State("", false) let newAccept = State("", true) // 新起点 epsilon 指向两个子 NFA 的起点 newStart.addTransition(" ", nfa1.startState) newStart.addTransition(" ", nfa2.startState) // 原接受态不再接受 nfa1.acceptState.isAccept = false nfa2.acceptState.isAccept = false // 两个原接受态都 epsilon 指向 newAccept nfa1.acceptState.addTransition(" ", newAccept) nfa2.acceptState.addTransition(" ", newAccept) // 合并状态 for (s in nfa2.states) { nfa1.addState(s) } nfa1.addState(newStart) nfa1.addState(newAccept) // 为新状态命名 let idxStart = nfa1.states.size - 2 let idxAccept = nfa1.states.size - 1 if (idxStart >= 0) { newStart.name = idxStart.toString() } if (idxAccept >= 0) { newAccept.name = idxAccept.toString() } nfa1.startState = newStart nfa1.acceptState = newAccept nfa1.modifyNum() nfa1 } // 后缀表达式转 NFA func postfixToNFA(postfix: String): NFA { let stack = ArrayList<NFA>() var stackLen: Int64 = 0 for (ch in postfix.runes()) { if (isLetter(ch)) { let s = ch.toString() if (stackLen < stack.size) { stack[stackLen] = NFA(s) } else { stack.add(NFA(s)) } stackLen += 1 } else if (ch == r'*') { let a = stack[stackLen - 1] stackLen -= 1 let res = nfaClosure(a) if (stackLen < stack.size) { stack[stackLen] = res } else { stack.add(res) } stackLen += 1 } else if (ch == r'.') { let a = stack[stackLen - 1] stackLen -= 1 let b = stack[stackLen - 1] stackLen -= 1 let res = nfaConcatenate(b, a) if (stackLen < stack.size) { stack[stackLen] = res } else { stack.add(res) } stackLen += 1 } else if (ch == r'|') { let a = stack[stackLen - 1] stackLen -= 1 let b = stack[stackLen - 1] stackLen -= 1 let res = nfaOr(b, a) if (stackLen < stack.size) { stack[stackLen] = res } else { stack.add(res) } stackLen += 1 } } let resultNFA = stack[0] renumberNFA(resultNFA) resultNFA } // 给 NFA 状态重新编号(0,1,2,...) func renumberNFA(nfa: NFA) { var idx: Int64 = 0 for (s in nfa.states) { s.name = idx.toString() idx += 1 } nfa.modifyNum() } // ======================= // 四、NFA 上的 epsilon-closure / move / testNFA // ======================= // 判断一个状态是否在状态集合中 func containsState(arr: ArrayList<State>, s: State): Bool { for (x in arr) { if (x.name == s.name) { return true } } false } // epsilon 闭包 func epsilonClosure(states: ArrayList<State>): ArrayList<State> { let result = ArrayList<State>() let queue = ArrayList<State>() var qLen: Int64 = 0 // 初始化 for (s in states) { if (!containsState(result, s)) { result.add(s) } if (qLen < queue.size) { queue[qLen] = s } else { queue.add(s) } qLen += 1 } // BFS 展开所有 epsilon 转移 while (qLen > 0) { let cur = queue[qLen - 1] qLen -= 1 if (cur.transitions.contains(" ")) { let arr = cur.transitions[" "] for (ns in arr) { if (!containsState(result, ns)) { result.add(ns) if (qLen < queue.size) { queue[qLen] = ns } else { queue.add(ns) } qLen += 1 } } } } result } // move 操作:从一组状态读一个符号能到达的状态集合 func move(states: ArrayList<State>, ch: String): ArrayList<State> { let result = ArrayList<State>() for (s in states) { if (s.transitions.contains(ch)) { let arr = s.transitions[ch] for (ns in arr) { if (!containsState(result, ns)) { result.add(ns) } } } } result } // 利用 epsilonClosure 和 move 在 NFA 上测试一个字符串是否被接受 func testNFA(nfa: NFA, input: String): Bool { // 初始状态集合为 startState 的 epsilon 闭包 let startSet = ArrayList<State>() startSet.add(nfa.startState) var current = epsilonClosure(startSet) // 逐字符读取 for (ch in input.runes()) { let sym = ch.toString() let moved = move(current, sym) current = epsilonClosure(moved) if (current.size == 0) { break } } // 只要当前集合中存在接受态,则接受 for (s in current) { if (s.isAccept) { return true } } false } // ======================= // 五、DFA 结构 + NFA → DFA + DFA 测试 // ======================= // 判断两个状态集合是否相同 func sameSet(a: ArrayList<State>, b: ArrayList<State>): Bool { if (a.size != b.size) { return false } for (s in a) { if (!containsState(b, s)) { return false } } true } // DFA 状态 class DFAState { public var name: String public var states: ArrayList<State> // 对应的 NFA 状态子集 public var isAccept: Bool public var transitions: HashMap<String, DFAState> init() { this.name = "" this.states = ArrayList<State>() this.isAccept = false this.transitions = HashMap<String, DFAState>() } init(name: String, isAccept: Bool) { this.name = name this.states = ArrayList<State>() this.isAccept = isAccept this.transitions = HashMap<String, DFAState>() } func addTransition(sym: String, target: DFAState) { this.transitions[sym] = target } func toString(): String { var out = "DFA状态 ${this.name},包含NFA状态:" for (s in this.states) { out = "${out}${s.name} " } out = "${out},是否接受态: ${this.isAccept}" out } } // DFA class DFA { public var startState: DFAState public var states: ArrayList<DFAState> public var acceptStates: ArrayList<DFAState> init(startState: DFAState) { this.startState = startState this.states = ArrayList<DFAState>() this.acceptStates = ArrayList<DFAState>() } func addState(s: DFAState) { this.states.add(s) } func addAcceptState(s: DFAState) { this.acceptStates.add(s) } func toString(): String { var out = "DFA,共 ${this.states.size} 个状态:\n" // 明确打印起始状态 out = "${out}起始状态: ${this.startState.name}\n" // 明确打印接受状态集合 var acc = "" for (s in this.acceptStates) { acc = "${acc}${s.name} " } if (this.acceptStates.size > 0) { out = "${out}接受状态集合: { ${acc}}\n" } else { out = "${out}接受状态集合: { }\n" } // 然后再打印每个状态的详细信息与转移 for (st in this.states) { out = "${out}${st.toString()}\n" for (k in st.transitions.keys()) { let t = st.transitions[k] out = "${out} ${st.name} --${k}--> ${t.name}\n" } } out } } // ======================= // DFA的DOT可视化输出 // ======================= func dfaToDot(dfa: DFA): String { var out = "digraph DFA {\n" out = "${out} rankdir=LR;\n" out = "${out} node [shape=circle];\n" // 虚拟起始结点 out = "${out} __start__ [shape=point];\n" out = "${out} __start__ -> ${dfa.startState.name};\n" // 结点:接受态双圈 for (st in dfa.states) { if (st.isAccept) { out = "${out} ${st.name} [shape=doublecircle];\n" } else { out = "${out} ${st.name} [shape=circle];\n" } } // 边 for (st in dfa.states) { for (k in st.transitions.keys()) { let t = st.transitions[k] out = "${out} ${st.name} -> ${t.name} [label=\"${k}\"];\n" } } out = "${out}}\n" out } // 从正则表达式中收集字母表 func collectAlphabetFromRegex(regex: String): ArrayList<String> { let result = ArrayList<String>() for (ch in regex.runes()) { if (isLetter(ch)) { let s = ch.toString() var exists = false for (x in result) { if (x == s) { exists = true } } if (!exists) { result.add(s) } } } result } // NFA → DFA(子集构造) func nfaToDfa(nfa: NFA, alphabet: ArrayList<String>): DFA { // 起始子集:start 的 epsilon 闭包 let startSet = ArrayList<State>() startSet.add(nfa.startState) let startClosure = epsilonClosure(startSet) let startDfa = DFAState("0", false) for (s in startClosure) { startDfa.states.add(s) if (s.isAccept) { startDfa.isAccept = true } } let dfa = DFA(startDfa) dfa.addState(startDfa) if (startDfa.isAccept) { dfa.addAcceptState(startDfa) } let worklist = ArrayList<DFAState>() var wLen: Int64 = 0 worklist.add(startDfa) wLen = 1 while (wLen > 0) { let cur = worklist[wLen - 1] wLen -= 1 for (sym in alphabet) { let moved = move(cur.states, sym) if (moved.size == 0) { continue } let cl = epsilonClosure(moved) if (cl.size == 0) { continue } // 查找是否已有等价子集 var existingIndex: Int64 = -1 var idx: Int64 = 0 while (idx < dfa.states.size) { let st = dfa.states[idx] if (sameSet(st.states, cl)) { existingIndex = idx break } idx += 1 } if (existingIndex == -1) { let newName = dfa.states.size.toString() let newState = DFAState(newName, false) for (s in cl) { newState.states.add(s) if (s.isAccept) { newState.isAccept = true } } dfa.addState(newState) if (newState.isAccept) { dfa.addAcceptState(newState) } cur.addTransition(sym, newState) if (wLen < worklist.size) { worklist[wLen] = newState } else { worklist.add(newState) } wLen += 1 } else { let existState = dfa.states[existingIndex] cur.addTransition(sym, existState) } } } dfa } // 在 DFA 上测试字符串 func testDFA(dfa: DFA, input: String): Bool { var cur = dfa.startState for (ch in input.runes()) { let sym = ch.toString() if (!cur.transitions.contains(sym)) { return false } cur = cur.transitions[sym] } cur.isAccept } // ======================= // 六、DFA 最小化(Hopcroft 划分) // ======================= // 找到某个状态属于哪个分组 func getPartitionIndex(state: DFAState, partition: ArrayList<ArrayList<DFAState>>): Int64 { var i: Int64 = 0 while (i < partition.size) { let group = partition[i] for (s in group) { if (s.name == state.name) { return i } } i += 1 } -1 } // 构造 DFA 的字母表(从转移中收集) func collectAlphabetFromDFA(dfa: DFA): ArrayList<String> { let alphabet = ArrayList<String>() for (st in dfa.states) { for (k in st.transitions.keys()) { var exists = false for (a in alphabet) { if (a == k) { exists = true } } if (!exists) { alphabet.add(k) } } } alphabet } // DFA 最小化 func minimizeDFA(dfa: DFA): DFA { let alphabet = collectAlphabetFromDFA(dfa) // 初始划分:接受态和非接受态 let partition = ArrayList<ArrayList<DFAState>>() let acceptGroup = ArrayList<DFAState>() let nonAcceptGroup = ArrayList<DFAState>() for (st in dfa.states) { if (st.isAccept) { acceptGroup.add(st) } else { nonAcceptGroup.add(st) } } if (acceptGroup.size > 0) { partition.add(acceptGroup) } if (nonAcceptGroup.size > 0) { partition.add(nonAcceptGroup) } var changed = true while (changed) { changed = false let newPartition = ArrayList<ArrayList<DFAState>>() for (group in partition) { if (group.size <= 1) { newPartition.add(group) continue } // 签名:对每个符号,看转到哪个分组 let sigMap = HashMap<String, ArrayList<DFAState>>() for (st in group) { let sigParts = ArrayList<String>() for (sym in alphabet) { var tgtIndex: Int64 = -1 if (st.transitions.contains(sym)) { let tgt = st.transitions[sym] tgtIndex = getPartitionIndex(tgt, partition) } sigParts.add(tgtIndex.toString()) } var sigStr = "" for (p in sigParts) { sigStr = sigStr + p + "," } if (!sigMap.contains(sigStr)) { sigMap[sigStr] = ArrayList<DFAState>() } let arr = sigMap[sigStr] arr.add(st) } for (sig in sigMap.keys()) { let subGroup = sigMap[sig] newPartition.add(subGroup) if (subGroup.size < group.size) { changed = true } } } // 更新划分 partition.clear() for (g in newPartition) { partition.add(g) } } // 根据最终划分构造新的最小 DFA let minimized = DFA(DFAState("0", false)) minimized.states.clear() minimized.acceptStates.clear() let stateMap = HashMap<String, DFAState>() // 旧groupIndex -> 新状态 var idx: Int64 = 0 while (idx < partition.size) { let group = partition[idx] if (group.size == 0) { idx += 1 continue } let rep = group[0] let newSt = DFAState(idx.toString(), rep.isAccept) // 保留一下包含的 NFA 状态集合(便于看) for (s in rep.states) { newSt.states.add(s) } minimized.addState(newSt) if (newSt.isAccept) { minimized.addAcceptState(newSt) } stateMap[idx.toString()] = newSt idx += 1 } // 起始状态:原起始状态所在分组 var startIndex = getPartitionIndex(dfa.startState, partition) if (startIndex < 0) { startIndex = 0 } minimized.startState = stateMap[startIndex.toString()] // 构造转移 idx = 0 while (idx < partition.size) { let group = partition[idx] if (group.size == 0) { idx += 1 continue } let rep = group[0] let newSt = stateMap[idx.toString()] for (sym in alphabet) { if (rep.transitions.contains(sym)) { let tgt = rep.transitions[sym] let tgtIdx = getPartitionIndex(tgt, partition) if (tgtIdx >= 0 && stateMap.contains(tgtIdx.toString())) { let newTgt = stateMap[tgtIdx.toString()] newSt.addTransition(sym, newTgt) } } } idx += 1 } minimized } // ======================= // 七、主函数:1+2+3 全部串起来 // ======================= main(args: Array<String>) { if (args.size < 2) { println("用法: cj_code <正则表达式> <测试串1> [测试串2 ...]") println("示例: cj_code \"a(b|c)*\" \"ab\" \"accc\" \"b\"") return } let regex = args[0] if (regex.isEmpty()) { println("错误: 正则表达式不能为空") return } // 收集所有测试字符串 let testStrings = ArrayList<String>() var i: Int64 = 1 while (i < args.size) { testStrings.add(args[i]) i += 1 } try { // ========= 目标1:正则 → NFA,并用 NFA 测试 ========= let postfix = regexToPostfix(regex) println("后缀表达式: " + postfix) let nfa = postfixToNFA(postfix) println("") println("构造得到的 NFA:") println(nfa.toString()) println("") println("=== NFA的DOT可视化描述,可以复制到Graphviz画图 ===") println(nfaToDot(nfa)) println("") println("=== 使用 NFA 进行匹配测试(目标1) ===") println("正则表达式: " + regex) for (s in testStrings) { let ok = testNFA(nfa, s) println("测试字符串: \"" + s + "\" -> " + if (ok) { "接受" } else { "拒绝" }) } // ========= 目标2:NFA → DFA,并用 DFA 测试 ========= let alphabet = collectAlphabetFromRegex(regex) let dfa = nfaToDfa(nfa, alphabet) println("") println("构造得到的 DFA:") println(dfa.toString()) println("") println("=== DFA的DOT可视化描述,可以复制到Graphviz画图 ===") println(dfaToDot(dfa)) println("") println("=== 使用 DFA 进行匹配测试(目标2) ===") for (s in testStrings) { let ok = testDFA(dfa, s) println("测试字符串: \"" + s + "\" -> " + if (ok) { "接受" } else { "拒绝" }) } // ========= 目标3:DFA 最小化,并用最小化 DFA 测试 ========= let minimizedDFA = minimizeDFA(dfa) println("") println("最小化后的 DFA:") println(minimizedDFA.toString()) println("") println("=== 最小化DFA的DOT可视化描述,可以复制到Graphviz画图 ===") println(dfaToDot(minimizedDFA)) println("") println("最小化前状态数: " + dfa.states.size.toString()) println("最小化后状态数: " + minimizedDFA.states.size.toString()) println("") println("=== 使用最小化 DFA 进行匹配测试(目标3) ===") for (s in testStrings) { let ok = testDFA(minimizedDFA, s) println("测试字符串: \"" + s + "\" -> " + if (ok) { "接受" } else { "拒绝" }) } } catch (e: Exception) { println("发生异常: ${e.toString()}") } }
2302_79418196/cangjie
src/package cj_code_see.groovy
Groovy
unknown
27,679
__version__ = '1.0.0'
2302_79757062/commit
commit/__init__.py
Python
agpl-3.0
24
import frappe import json import os from commit.commit.code_analysis.apis import find_all_occurrences_of_whitelist @frappe.whitelist(allow_guest=True) def get_apis_for_project(project_branch: str): ''' Gets the Project Branch document with the organization and app name ''' branch_doc = frappe.get_doc("Commit Project Branch", project_branch) apis = json.loads(branch_doc.whitelisted_apis).get("apis", []) if branch_doc.whitelisted_apis else [] documentation = json.loads(branch_doc.documentation).get("apis", []) if branch_doc.documentation else [] print('documentation', len(documentation)) for api in apis: # find the documentation for the api whose function_name equals to name and path same as path for doc in documentation: if doc.get("function_name") == api.get("name") and doc.get("path") == api.get("api_path"): api["documentation"] = doc.get("documentation") break app_name, organization, app_logo = frappe.db.get_value("Commit Project", branch_doc.project, ["app_name", "org", "image"]) organization_name, org_logo, organization_id = frappe.db.get_value("Commit Organization", organization, ["organization_name", "image", "name"]) return { "apis": apis, "app_name": app_name, "organization_name": organization_name, "organization_id": organization_id, "app_logo": app_logo, "org_logo": org_logo, "branch_name": branch_doc.branch_name, "project_branch": branch_doc.name, "last_updated": branch_doc.last_fetched } @frappe.whitelist(allow_guest=True) def get_file_content_from_path(project_branch: str, file_path: str,block_start: int, block_end: int,viewer_type: str): ''' Gets the Project Branch document with the organization and app name ''' if viewer_type == "project": branch_doc = frappe.get_doc("Commit Project Branch", project_branch) api_data = json.loads(branch_doc.whitelisted_apis)['apis'] else: app_path = frappe.get_app_path(project_branch) # remove last part of the path which is the app name app_path = app_path.rsplit('/', 1)[0] api_data = find_all_occurrences_of_whitelist(app_path,project_branch) found = False for api in api_data: if api['file'] == file_path: found = True break if not found: frappe.throw("File not found-") else: if os.path.isfile(file_path): file_content = open(file_path, 'r') file_content = file_content.readlines() # fetch the block file_content = file_content[block_start:block_end] return { "file_content": file_content } else: frappe.throw("File not found")
2302_79757062/commit
commit/api/api_explorer.py
Python
agpl-3.0
2,859
import frappe @frappe.whitelist(allow_guest=True) def generate_bruno_file(data, return_type='download'): request_data = frappe.parse_json(data) """ Generates .bru file content for a single request based on the provided request data. :param request_data: A dictionary containing request information. Expected keys are: - name: The name of the request. - arguments: A list of dictionaries containing argument information. - def: The function definition. - def_index: The index of the function definition. - request_types: A list of request types (e.g., ['GET', 'POST']). - xss_safe: A boolean indicating if the request is XSS safe. - allow_guest: A boolean indicating if guests are allowed. - other_decorators: A list of other decorators. - index: An index number. - block_start: The start of the block. - block_end: The end of the block. - file: The file path. - api_path: The API path in the format 'raven.www.raven.get_context_for_dev'. :return: A dictionary where keys are request types and values are the content of the corresponding .bru files. """ base_url_template = "{{baseUrl}}/api/method" def format_name(name): return ' '.join(word.capitalize() for word in name.split('_')) name = format_name(request_data.get('name', 'Request')) api_path = request_data.get('api_path', '') request_types = request_data.get('request_types', ['GET']) or ['GET'] # Default to GET if empty params = {arg['argument']: arg['default'] for arg in request_data.get('arguments', []) if arg['argument']} bru_files = {} request_type = request_types[0] seq = 1 request_type_upper = request_type.upper() request_type_lower = request_type.lower() url = f"{base_url_template}/{api_path}" query_string = '&'.join([f'{k}={v}' for k, v in params.items() if v]) full_url = f'{url}?{query_string}' if query_string else url bru_content = [] # Meta section bru_content.append(f'meta {{\n name: {name}\n type: http\n seq: {seq}\n}}\n') # Request section bru_content.append(f'{request_type_lower} {{\n url: {full_url}\n body: none\n auth: none\n}}\n') # Params section if params: bru_content.append(f'params:query {{\n') for k, v in params.items(): if v: bru_content.append(f' {k}: {v}\n') bru_content.append('}\n') bru_files[request_type_upper] = '\n'.join(bru_content) if return_type == 'download': frappe.local.response.filename = f'{name} {request_type}.bru' if len(request_types) > 1 else f'{name}.bru' frappe.local.response.filecontent = bru_files[request_type_upper] frappe.local.response.type = 'download' else: return bru_files[request_type_upper]
2302_79757062/commit
commit/api/bruno.py
Python
agpl-3.0
3,136
import frappe from commit.api.github import get_file_in_repo, get_all_files_in_repo, search_for_file_in_repo from commit.utils.conversions import convert_module_name from commit.utils.api_analysis import get_api_details_from_file_contents access_token = "*" @frappe.whitelist(allow_guest=True) def get_name_of_app(organization, repo): ''' Get name of app from repo ''' file_type = None app_name = None root_files = get_all_files_in_repo(access_token, organization, repo) if type(root_files) == dict and root_files.get("message", "") == "Not Found": return frappe.throw(f'Repository {repo} not found in organization {organization}') for file in root_files: if file["name"] == "pyproject.toml": file_type = "pyproject.toml" break elif file["name"] == "setup.py": file_type = "setup.py" break if file_type == "pyproject.toml": app_name = get_app_name_from_pyproject_toml(organization, repo) elif file_type == "setup.py": app_name = get_app_name_from_setup_py(organization, repo) return app_name def get_app_name_from_setup_py(organization, repo): ''' Get app name from setup.py ''' setup_py = get_file_in_repo(access_token, organization, repo, "setup.py") app_name = setup_py.split("name=")[1].split(",")[0].strip().replace("'", "").replace('"', '') return app_name def get_app_name_from_pyproject_toml(organization, repo): ''' Get app name from pyproject.toml ''' pyproject_toml = get_file_in_repo(access_token, organization, repo, "pyproject.toml") split_result = pyproject_toml.split("name = ") if len(split_result) > 1: app_name = pyproject_toml.split("name = ")[1].split("\n")[0].strip().replace("'", "").replace('"', '') else: app_name = get_app_name_from_setup_py(organization, repo) return app_name # TODO: Function to get app version # def get_app_version # TODO: Function to get list of all dependencies in Python app # def get_list_of_dependencies @frappe.whitelist(allow_guest=True) def get_list_of_modules(organization, repo, app_name): ''' Get list of modules for a Frappe app ''' modules = get_file_in_repo(access_token, organization, repo, app_name + "/modules.txt") return modules.split("\n") @frappe.whitelist(allow_guest=True) def get_list_of_doctypes_in_module(organization, repo, app_name, module: str): ''' Get list of doctypes in a module ''' module_pathname = convert_module_name(module) query = f"path:{app_name}/{module_pathname}/doctype+{module} in:file" search_results = search_for_file_in_repo(access_token, organization, repo, query, 'json') if search_results.get("total_count", 0) == 0: return [] doctypes = [] for result in search_results["items"]: path = result["path"] doctype_json_content = get_file_in_repo(access_token, organization, repo, path) doctype_json = frappe.parse_json(doctype_json_content) if doctype_json.get("doctype", "") == "DocType": doctypes.append(doctype_json) return { "module": module, "doctypes": doctypes, "count": len(doctypes) } @frappe.whitelist(allow_guest=True) def get_customized_doctypes_in_module(organization, repo, app_name, module: str): ''' Get list of all customized doctypes for a Frappe app ''' module_pathname = convert_module_name(module) query = f"path:{app_name}/{module_pathname}/custom+custom_fields in:file" search_results = search_for_file_in_repo(access_token, organization, repo, query, 'json') if search_results.get("total_count", 0) == 0: return [] doctypes = [] for result in search_results["items"]: path = result["path"] doctype_json_content = get_file_in_repo(access_token, organization, repo, path) doctype_json = frappe.parse_json(doctype_json_content) doctypes.append(doctype_json) return { "module": module, "doctypes": doctypes, "count": len(doctypes) } @frappe.whitelist(allow_guest=True) def get_all_whitelisted_api_in_app(organization, repo): ''' Get list of all whitelisted API in a Frappe app with: 1. Type 2. Path 3. Method name 4. Arguments 5. Python code snippet ''' query = f"@frappe.whitelist in:file+language:python" search_results = search_for_file_in_repo(access_token, organization, repo, query) if search_results.get("total_count", 0) == 0: return [] apis = [] for result in search_results["items"]: path = result["path"] file_content = get_file_in_repo(access_token, organization, repo, path) apis_in_file = get_api_details_from_file_contents(file_content, path) for api in apis_in_file: apis.append(api) # break # api = get_whitelisted_api_in_file(path) # if api: # apis.append(api) return { "count": len(apis), "apis": apis }
2302_79757062/commit
commit/api/code_analysis.py
Python
agpl-3.0
5,108
import frappe @frappe.whitelist(allow_guest=True) def get_project_list_with_branches(): """ Get list of projects with branches for each organization """ organizations = frappe.get_all("Commit Organization", fields=[ "name", 'organization_name', 'github_org', 'image', 'about', 'creation']) for organization in organizations: projects = frappe.get_all("Commit Project", filters={ "org": organization.get("name")}, fields=["name", "display_name", "repo_name", "app_name", "image", "banner_image", "path_to_folder", 'description'], order_by="creation desc") # organization["projects"] = projects for project in projects: branches = frappe.get_all("Commit Project Branch", filters={"project": project.get( "name")}, fields=["branch_name", "last_fetched", "modules", "whitelisted_apis", "name", "frequency"]) project["branches"] = branches organization["projects"] = projects return organizations
2302_79757062/commit
commit/api/commit_project/commit_project.py
Python
agpl-3.0
1,061
import frappe from commit.commit.code_analysis.schema_builder import get_schema_from_doctypes_json import json @frappe.whitelist(allow_guest=True) def get_doctype_json(project_branch: str, doctype: str): ''' Get doctype json from a project branch ''' project_branch = frappe.get_cached_doc( "Commit Project Branch", project_branch) doctype_json = project_branch.get_doctype_json(doctype) return doctype_json @frappe.whitelist(allow_guest=True) def get_erd_schema_for_module(project_branch: str, module: str): ''' Get ERD schema for a module ''' project_branch = frappe.get_cached_doc( "Commit Project Branch", project_branch) module_doctypes = project_branch.get_doctypes_in_module(module) schema = get_erd_schema_for_doctypes( project_branch.name, json.dumps(module_doctypes)) return schema @frappe.whitelist(allow_guest=True) def get_erd_schema_for_doctypes(project_branch: list, doctypes): doctypes = json.loads(doctypes) branch_doctypes = {} doctype_list = [] for doctype in doctypes: if doctype['project_branch'] not in branch_doctypes: branch_doctypes[doctype['project_branch']] = [] branch_doctypes[doctype['project_branch']].append(doctype['doctype']) doctype_list.append(doctype['doctype']) doctype_jsons = [] for project_branch, doctypes in branch_doctypes.items(): project_branch_doc = frappe.get_cached_doc( "Commit Project Branch", project_branch) for doctype in doctypes: doctype_json = project_branch_doc.get_doctype_json(doctype) doctype_jsons.append(doctype_json) schema = get_schema_from_doctypes_json({ 'doctypes': doctype_jsons, 'doctype_names': doctype_list }) return schema @frappe.whitelist() def get_meta_erd_schema_for_doctypes(doctypes:list): ''' Get ERD schema for a list of doctypes ''' doctype_jsons = [] for doctype in doctypes: doctype_json = frappe.get_meta(doctype) doctype_jsons.append(doctype_json) schema = get_schema_from_doctypes_json({ 'doctypes': doctype_jsons, 'doctype_names': doctypes }) return schema @frappe.whitelist() def get_meta_for_doctype(doctype): ''' Get meta for a doctype ''' return frappe.get_meta(doctype)
2302_79757062/commit
commit/api/erd_viewer.py
Python
agpl-3.0
2,373
import json import re from commit.commit.doctype.open_ai_settings.open_ai_settings import open_ai_call import frappe def generate_docs_for_apis(api_definitions): max_tokens_per_request = 1800 # This is a safe limit to avoid hitting the max token limit chunks = chunk_data(api_definitions, max_tokens_per_request) all_docs = [] for chunk in chunks: chunk_docs = generate_docs_for_chunk(chunk) if chunk_docs: all_docs.extend(chunk_docs) else: print("No docs generated for this chunk, check raw response.") return all_docs def estimate_tokens(text): # Estimate tokens based on average character count return len(text) // 4 def chunk_data(data, max_tokens): chunks = [] current_chunk = [] current_tokens = 0 for item in data: item_text = f"Function: {item['function_name']}\nPath: {item['path']}\nCode:\n{item['code']}\n\n" item_tokens = estimate_tokens(item_text) if current_tokens + item_tokens > max_tokens: chunks.append(current_chunk) current_chunk = [] current_tokens = 0 current_chunk.append(item) current_tokens += item_tokens if current_chunk: chunks.append(current_chunk) return chunks def clean_response(response_text): # Remove non-JSON parts using regex cleaned_text = re.sub(r"```json|```", "", response_text.strip()) return cleaned_text def generate_docs_for_chunk(api_chunk): messages = [ { "role": "system", "content": ( "You are an expert documentation generator. Create detailed and comprehensive documentation " "for the code provided below in Markdown format. Each function should have the following sections:\n\n" "- **(api[Function Name])**\n" "- **Description**: Detailed description of what the function does and what it is used for \n" "- **Parameters**: List of parameters with their types, descriptions, and indicate which are mandatory or optional\n" "- **Return Type**: Type and description of the return value\n" "- **Examples**: Code examples demonstrating how to use the function (enclosed in triple backticks ``````).\n\n" "The response should be a valid JSON list of objects formatted as follows: " "{function_name: <function_name>, path: <path>, documentation: <documentation in Markdown>}.\n" "Ensure the response is in valid JSON format only, enclosed in triple backticks, and does not include `---`." ) } ] for api in api_chunk: user_message = f"function name: {api['function_name']}, path: {api['path']}, code:\n{api['code']}" messages.append({"role": "user", "content": user_message}) # print("Raw Response:\n", response_text) # Log raw response for debugging response_text = open_ai_call(messages) cleaned_response = clean_response(response_text) try: # Check if cleaned_response is already a list (or the expected type) if isinstance(cleaned_response, list): return cleaned_response # If cleaned_response is a string, attempt to decode it as JSON elif isinstance(cleaned_response, str): return json.loads(cleaned_response, strict=False) else: # Handle other unexpected types if necessary print("Unexpected type of cleaned_response:", type(cleaned_response)) return [] except json.JSONDecodeError as e: print("JSON Decode Error:", e) print("Cleaned Response:\n", cleaned_response) try: # Attempt to fix common issues like single quotes or trailing commas cleaned_response = cleaned_response.replace("'", '"') return json.loads(cleaned_response, strict=False) except json.JSONDecodeError as e: print("Second JSON Decode Error:", e) return [] # return cleaned_response
2302_79757062/commit
commit/api/generate_documentation.py
Python
agpl-3.0
4,081
import frappe import requests def prepare_headers(access_token=None, type="bearer", accept="application/vnd.github+json"): return { # "Authorization": type + " " + access_token, "Accept": accept, "X-GitHub-Api-Version": "2022-11-28" } def get_user(access_token=None): ''' Get user details from github ''' headers = prepare_headers(access_token) response = requests.get("https://api.github.com/user", headers=headers) return response.json() def get_user_organizations(access_token=None): ''' Get user organizations from github ''' headers = prepare_headers(access_token) response = requests.get("https://api.github.com/user/orgs", headers=headers) return response.json() def get_organization_repos(access_token, organization): ''' Get repositories in an organization from Github ''' headers = prepare_headers(access_token) response = requests.get(f"https://api.github.com/orgs/{organization}/repos", headers=headers) return response.json() def get_file_in_repo(access_token:str, organization:str, repo:str, path: str): ''' Get file in a repository from Github ''' headers = prepare_headers(access_token, accept="application/vnd.github.raw") response = requests.get(f"https://api.github.com/repos/{organization}/{repo}/contents/{path}", headers=headers) return response.text def get_all_files_in_repo(access_token:str, organization:str, repo:str, path:str=''): ''' Get all files in a repository from Github ''' # TODO: For every file, we need to store it in the database with the commit hash so that we do not need to call this API again to fetch the same result headers = prepare_headers(access_token) response = requests.get(f"https://api.github.com/repos/{organization}/{repo}/contents/{path}", headers=headers) return response.json() def search_for_file_in_repo(access_token:str, organization:str, repo:str, query:str | None =None, extension: str | None=None, page:int=1, per_page:int=100, accept=None): ''' Search for a file in a repository from Github query examples: 1. "CRM in:file" - searches for keyword CRM in all files 2. "path:erpnext/crm.doctype" - searches for all files in path erpnext/crm.doctype 3. Combined query: "path:erpnext/crm.doctype+CRM in:file" - searches for keyword CRM in all files in path erpnext/crm.doctype Extension and repo will be added to search query automatically ''' # TODO: This API is expensive to use. We need to store the result based on commit hash and return from our own database headers = prepare_headers(access_token, accept=accept) if query: query = f"{query}+repo:{organization}/{repo}" if extension: query = f"{query}+extension:{extension}" response = requests.get(f"https://api.github.com/search/code?q={query}+repo:{organization}/{repo}&page={page}&per_page={per_page}", headers=headers) return response.json()
2302_79757062/commit
commit/api/github.py
Python
agpl-3.0
3,003
import frappe from commit.commit.code_analysis.apis import find_all_occurrences_of_whitelist @frappe.whitelist() def get_installed_apps(): ''' Get all installed apps 1. Get the installed applications from the Installed Applications doctype 2. Get the app hooks for each app 3. Get the app description, publisher, logo, version and git branch 4. Return the updated apps ''' install_app_doc = frappe.get_cached_doc('Installed Applications') install_apps = install_app_doc.get('installed_applications') updated_apps = [] for app in install_apps: app_name = app.get('app_name') app_hooks = frappe.get_hooks(app_name=app_name) app_description = app_hooks.get('app_description') if app_description is not None: app_description = app_description[0] app_publisher = app_hooks.get('app_publisher') if app_publisher is not None: app_publisher = app_publisher[0] app_logo_url = app_hooks.get('app_logo_url') or app_hooks.get('app_logo') if app_logo_url is not None: app_logo_url = app_logo_url[0] app_version = app.get('app_version') git_branch = app.get('git_branch') updated_app = { 'app_name': app_name, 'app_publisher': app_publisher, 'app_description': app_description, 'app_logo_url': app_logo_url, 'app_version': app_version, 'git_branch': git_branch } updated_apps.append(updated_app) return updated_apps @frappe.whitelist() def get_apis_for_app(app_name: str): ''' Gets the Project Branch document with the organization and app name ''' app_path = frappe.get_app_path(app_name) # remove last part of the path which is the app name app_path = app_path.rsplit('/', 1)[0] apis = find_all_occurrences_of_whitelist(app_path,app_name) app_hooks = frappe.get_hooks(app_name=app_name) install_app_doc = frappe.get_cached_doc('Installed Applications') install_apps = install_app_doc.get('installed_applications') app = [app for app in install_apps if app.get('app_name') == app_name][0] branch_name = app.get('git_branch') return { "apis": apis, "app_name": app_name, "branch_name": branch_name, }
2302_79757062/commit
commit/api/meta_data.py
Python
agpl-3.0
2,379
import frappe from frappe.desk.search import search_widget, build_for_autosuggest # this is called by the Link Field @frappe.whitelist() def search_link( doctype, txt, query=None, filters=None, page_length=20, start=0, searchfield=None, reference_doctype=None, ignore_user_permissions=False, ): results = search_widget( doctype, txt.strip(), query, searchfield=searchfield, page_length=page_length, filters=filters, reference_doctype=reference_doctype, ignore_user_permissions=ignore_user_permissions, ) return build_for_autosuggest(results, doctype=doctype)
2302_79757062/commit
commit/api/search.py
Python
agpl-3.0
590
import os import ast other_decorators = [ '@cache_source', '@frappe.validate_and_sanitize_search_inputs', '@rate_limit' ] def find_all_occurrences_of_whitelist(path: str, app_name: str): ''' Find all occurences of @frappe.whitelist in the app repository These should only be in .py files ''' # Get list of all .py files in the app py_files = get_py_files(path, app_name) api_count = 0 file_count = 0 api_details = [] # print(py_files) # For each file, check if @frappe.whitelist is present for file in py_files: file_content = open(file, 'r').read() # @frappe.whitelist can be mentioned multiple times in a file # So, we need to find all occurrences # We can use the count() method to find the number of occurrences # If the count is greater than 0, then the string is present no_of_occurrences = file_content.count('@frappe.whitelist') if no_of_occurrences > 0: api_count += no_of_occurrences file_count += 1 ## Comment out later # if file.endswith('party.py'): indexes,line_nos,no_of_occurrences = find_indexes_of_whitelist(file_content, no_of_occurrences) api_count += no_of_occurrences apis = get_api_details(file, file_content, indexes,line_nos, path) api_details.extend(apis) return api_details # print(f'Number of APIs: {api_count}') # print(f'Number of files: {file_count}') # print(f'Number of Python files: {len(py_files)}') def find_indexes_of_whitelist(file_content: str, count: int): ''' Find indexes of @frappe.whitelist in the file content, ensuring it's not commented out or inside a string. ''' def is_in_string_or_comment(file_content, index): # State variables in_single_quote = False in_double_quote = False in_comment = False in_triple_single_quote = False in_triple_double_quote = False i = 0 while i < index: char = file_content[i] # Handle triple single-quoted strings if file_content[i:i+3] == "'''" and not in_double_quote: if in_triple_single_quote: in_triple_single_quote = False i += 2 else: in_triple_single_quote = True i += 2 # Handle triple double-quoted strings elif file_content[i:i+3] == '"""' and not in_single_quote: if in_triple_double_quote: in_triple_double_quote = False i += 2 else: in_triple_double_quote = True i += 2 # Handle single-quoted strings elif char == "'" and not in_double_quote and not in_triple_single_quote and not in_triple_double_quote: in_single_quote = not in_single_quote # Handle double-quoted strings elif char == '"' and not in_single_quote and not in_triple_single_quote and not in_triple_double_quote: in_double_quote = not in_double_quote # Handle single-line comments elif char == '#' and not in_single_quote and not in_double_quote and not in_triple_single_quote and not in_triple_double_quote: in_comment = True # Handle end of line for single-line comments elif char == '\n': in_comment = False i += 1 return in_single_quote or in_double_quote or in_comment or in_triple_single_quote or in_triple_double_quote indexes = [] line_nos = [] actual_count = count start = 0 while actual_count > 0: index = file_content.find('@frappe.whitelist', start) if index == -1: break if not is_in_string_or_comment(file_content, index): indexes.append(index) line_nos.append(file_content.count('\n', 0, index) + 1) actual_count -= 1 start = index + len('@frappe.whitelist') return indexes, line_nos, actual_count def get_api_details(file, file_content: str, indexes: list,line_nos:list, path: str): ''' Get details of the API ''' apis = [] for index in indexes: whitelist_details = get_whitelist_details(file_content, index) api_details = get_api_name(file_content, index) other_decorators = get_other_decorators(file_content, index, api_details.get('def_index')) apis.append({ **api_details, **whitelist_details, 'other_decorators': other_decorators, 'index': index, 'block_start': line_nos[indexes.index(index)], 'block_end': find_function_end_lines(file_content,api_details.get('name','')), 'file': file, 'api_path': file.replace(path, '').replace('\\', '/').replace('.py', '').replace('/', '.')[1:] + '.' + api_details.get('name') }) return apis def get_other_decorators(file_content: str, index: int, def_index: int): ''' See if other decorators are present in between the @frappe.whitelist decorator and the def ''' decorators = [] for decorator in other_decorators: decorator_index = file_content.find(decorator, index, def_index) if decorator_index != -1: decorators.append(decorator) return decorators def get_whitelist_details(file_content: str, index: int): ''' Get details of the @frappe.whitelist decorator The index is the index of the first occurrence of @frappe.whitelist We need to find the first occurrence of ")" after the index ''' whitelist_end_index = file_content.find(')', index) whitelisted_content = file_content[index:whitelist_end_index + 1] if "(" in whitelisted_content and ")" in whitelisted_content: args = whitelisted_content.split("(")[1].split(")")[0].split(",") else: args = [] request_types = [] xss_safe = False allow_guest = False for arg in args: if "methods" in arg: request_types = arg.split("=")[1].replace("[", "").replace("]", "").replace('"', '').replace("'", "").split(",") if "xss_safe" in arg: xss_safe = arg.split("=")[1].strip() == "True" if "allow_guest" in arg: allow_guest = arg.split("=")[1].strip() == "True" return { "request_types": request_types, "xss_safe": xss_safe, "allow_guest": allow_guest } def get_api_name(file_content: str, index: int): ''' Get name of the API. To do this, we need to find the first occurrence of "def api_name" after the index ''' api_name = '' # Find the first occurrence of "def" after the index def_index = file_content.find('def ', index) # Find occurrence of ":" after the def_index colon_index = file_content.find(':', def_index) # Get the string between def_index and colon_index api_def = file_content[def_index:colon_index].replace('\n', '').replace('\t', '') # api_def is of the form "def api_name(self, arg1, arg2, ...)" # We need to get the api_name. To do this, we can remove the "def " first api_name_with_params = api_def.replace('def ', '') api_name = extract_name_from_def(api_name_with_params) arguments = extract_arguments_from_def(api_name_with_params) return { 'name': api_name, 'arguments': arguments, 'def': api_def, 'def_index': def_index, } def extract_name_from_def(api_def: str): ''' Extract name from def ''' return api_def.split("(")[0].strip() def extract_arguments_from_def(api_def: str): ''' Extract arguments from def ''' if "(" not in api_def or ")" not in api_def: arguments_with_types_defaults = [] else: arguments_with_types_defaults = api_def.split("(")[1].split(")")[0].split(",") arguments = [] for arg in arguments_with_types_defaults: argument_with_types_default = arg.strip() default = "" argument = "" type = "" if "=" in argument_with_types_default: default_split = argument_with_types_default.split("=") default = default_split[1].strip().replace('"', '').replace("'", "") argument = default_split[0].strip() else: argument = argument_with_types_default if ":" in argument: type = argument.split(":")[1].strip() argument = argument.split(":")[0].strip() arguments.append({ "argument": argument, "type": type, "default": default }) return arguments def get_py_files(path: str, app_name: str): ''' Get list of all .py files in the app ''' py_files = [] for root, dirs, files in os.walk(os.path.join(path, app_name)): for file in files: if file.endswith('.py'): py_files.append(os.path.join(root, file)) return py_files def find_function_end_lines(source_code: str,function_name:str): tree = ast.parse(source_code) function_end_lines = {} for node in ast.walk(tree): if isinstance(node, ast.FunctionDef): decorators = get_decorators(node) if 'whitelist' in decorators: end_line = node.end_lineno function_end_lines[node.name] = end_line return function_end_lines.get(function_name,0) def get_decorator_name(node): if isinstance(node, ast.Call): if isinstance(node.func, ast.Name): return node.func.id elif isinstance(node.func, ast.Attribute): return node.func.attr elif isinstance(node, ast.Attribute): return node.attr else: return None def get_decorators(node): decorators = [] for decorator in node.decorator_list: decorator_name = get_decorator_name(decorator) if decorator_name is not None: decorators.append(decorator_name) return decorators
2302_79757062/commit
commit/commit/code_analysis/apis.py
Python
agpl-3.0
10,199
import os from commit.commit.code_analysis.utils import get_module_path, parse_module_name import json def get_doctypes_in_module(path: str, app_name: str, module: str): ''' Get list of doctypes in a module ''' doctype_names = [] module_path = get_module_path(path, app_name, module) doctype_folder_path = os.path.join(module_path, 'doctype') does_module_have_doctypes = os.path.isdir(doctype_folder_path) if does_module_have_doctypes: # Since the doctype folder exists - find all .json files within the folders (only one level deep) and return the file contents for dir in os.listdir(doctype_folder_path): # doctype .json files have the same name as the folder they are in doctype_file_path = os.path.join(doctype_folder_path, dir, dir + '.json') if os.path.isfile(doctype_file_path): doctype_file = open(doctype_file_path, 'r') doctype_json = json.loads(doctype_file.read()) # doctypes_list.append(doctype_json) doctype_names.append(doctype_json.get( 'name' )) return { 'module': module, # 'doctypes': doctypes_list, 'doctype_names': doctype_names, 'number_of_doctypes': len(doctype_names) } def get_doctype_json(path: str, app_name: str, module:str, doctype: str): module_path = get_module_path(path, app_name, module) module_doctypes_folder_path = os.path.join(module_path, 'doctype') does_module_have_doctypes = os.path.isdir(module_doctypes_folder_path) if does_module_have_doctypes: parsed_doctype_name = parse_module_name(doctype) doctype_folder_path = os.path.join(module_doctypes_folder_path, parsed_doctype_name) does_doctype_folder_exist = os.path.isdir(doctype_folder_path) if does_doctype_folder_exist: doctype_file_path = os.path.join(doctype_folder_path, parsed_doctype_name + '.json') if os.path.isfile(doctype_file_path): doctype_file = open(doctype_file_path, 'r') doctype_json = json.loads(doctype_file.read()) return doctype_json return None
2302_79757062/commit
commit/commit/code_analysis/doctypes.py
Python
agpl-3.0
2,220
import os import json DISALLOWED_FIELD_TYPES = ['Section Break', 'Tab Break', 'Fold', 'Column Break', 'Heading', 'HTML', 'Image', 'Icon', 'Button'] LINK_FIELD_TYPES = ['Link', 'Table', 'Table MultiSelect'] def get_schema_from_doctypes_json(doctypes_json: dict): ''' Parse doctype file ''' tables = [] relationships = [] doctype_names = doctypes_json.get('doctype_names') doctype_jsons = doctypes_json.get('doctypes') for doctype_json in doctype_jsons: doctype_name = doctype_json.get('name') if doctype_name: columns = [{ 'name': 'ID', 'id': 'name', 'format': 'Data', }] # dynamic_links = [] for field in doctype_json.get('fields'): fieldname = field.get('fieldname') fieldtype = field.get('fieldtype') if fieldtype not in DISALLOWED_FIELD_TYPES: column = { 'name': field.get('label', fieldname), 'id': fieldname, 'format': fieldtype, 'is_custom_field': field.get('is_custom_field') or False, } columns.append(column) if fieldtype in LINK_FIELD_TYPES: if field.get('options') in doctype_names: relationship = { 'id': doctype_name + "_" + fieldname, 'source_table_name': doctype_name, 'source_column_name': fieldname, 'target_table_name': field.get('options'), 'target_column_name': 'name', } relationships.append(relationship) table = { 'name': doctype_name, 'id': doctype_name, 'module': doctype_json.get('module'), 'istable': doctype_json.get('istable'), 'columns': columns, } tables.append(table) return { 'tables': tables, 'relationships': relationships, }
2302_79757062/commit
commit/commit/code_analysis/schema_builder.py
Python
agpl-3.0
2,292
import os def get_module_path(path: str, app_name: str, module_name: str): ''' Get path to modules directory ''' parsed_module_name = parse_module_name(module_name) modules_path = os.path.join(path, app_name, parsed_module_name) return modules_path def parse_module_name(module_name: str): ''' Parse module name ''' return module_name.replace('-', '_').replace(' ', '_').lower()
2302_79757062/commit
commit/commit/code_analysis/utils.py
Python
agpl-3.0
419
// Copyright (c) 2023, The Commit Company and contributors // For license information, please see license.txt // frappe.ui.form.on("Commit Organization", { // refresh(frm) { // }, // });
2302_79757062/commit
commit/commit/doctype/commit_organization/commit_organization.js
JavaScript
agpl-3.0
191
# Copyright (c) 2023, The Commit Company and contributors # For license information, please see license.txt import frappe from frappe.model.document import Document class CommitOrganization(Document): def on_trash(self): # find all project which are linked with this organisation # delete all projects projects = frappe.get_all('Commit Project',filters={ 'org':self.name },pluck='name') for project in projects: frappe.db.delete('Commit Project',project)
2302_79757062/commit
commit/commit/doctype/commit_organization/commit_organization.py
Python
agpl-3.0
476
// Copyright (c) 2023, The Commit Company and contributors // For license information, please see license.txt // frappe.ui.form.on("Commit Project", { // refresh(frm) { // }, // });
2302_79757062/commit
commit/commit/doctype/commit_project/commit_project.js
JavaScript
agpl-3.0
186
# Copyright (c) 2023, The Commit Company and contributors # For license information, please see license.txt import frappe import os import io from pathlib import Path from frappe.model.document import Document from commit.api.code_analysis import get_name_of_app class CommitProject(Document): def before_insert(self): self.app_name = get_name_of_app(self.org, self.repo_name) self.create_project_folder() def create_project_folder(self): ''' Need to create a project folder when a project is created The folder needs to be created in the site folder in public ''' # Create folder for the org in the sites folder if it does not exist main_folder_path = frappe.get_site_path("public", "organizations") if not os.path.exists(main_folder_path): os.mkdir(main_folder_path) org_path = frappe.get_site_path("public", "organizations", self.org) if not os.path.exists(org_path): os.mkdir(org_path) # Create a folder for the project in the org folder if it does not exist project_path = org_path + "/" + self.repo_name if not os.path.exists(project_path): os.mkdir(project_path) self.path_to_folder = project_path return def on_trash(self): # find all branches which are linked with this project # delete all branches branches = frappe.get_all("Commit Project Branch", filters={ 'project' : self.name }, pluck='name') for branch in branches: frappe.db.delete("Commit Project Branch", branch)
2302_79757062/commit
commit/commit/doctype/commit_project/commit_project.py
Python
agpl-3.0
1,461
// Copyright (c) 2023, The Commit Company and contributors // For license information, please see license.txt // frappe.ui.form.on("Commit Project Branch", { // refresh(frm) { // }, // });
2302_79757062/commit
commit/commit/doctype/commit_project_branch/commit_project_branch.js
JavaScript
agpl-3.0
193
# Copyright (c) 2023, The Commit Company and contributors # For license information, please see license.txt import frappe import git import os import shutil import json from frappe.model.document import Document from commit.commit.code_analysis.apis import find_all_occurrences_of_whitelist from commit.commit.code_analysis.doctypes import get_doctypes_in_module, get_doctype_json from frappe.utils import now from frappe.app import handle_exception from commit.api.api_explorer import get_file_content_from_path from commit.api.generate_documentation import generate_docs_for_apis class CommitProjectBranch(Document): def before_insert(self): self.path_to_folder = self.get_path_to_folder() self.create_branch_folder() def after_insert(self): frappe.enqueue( method = background_fetch_process, is_async = True, job_name="Fetch Project Branch", enqueue_after_commit = True, at_front = True, project_branch = self.name ) def on_update(self): old_doc = self.get_doc_before_save() if type(self.whitelisted_apis) == str: apis = json.loads(self.whitelisted_apis if self.whitelisted_apis else '').get("apis", []) else: apis = self.whitelisted_apis.get("apis", []) if self.whitelisted_apis else [] if old_doc and old_doc.whitelisted_apis != self.whitelisted_apis and len(apis) > 0: frappe.enqueue( method = generate_branch_documentation, is_async = True, job_name="Generate Branch Documentation", enqueue_after_commit = True, at_front = True, queue="long", project_branch = self.name ) def create_branch_folder(self): if not os.path.exists(self.path_to_folder): os.mkdir(self.path_to_folder) def get_path_to_folder(self): project = frappe.get_doc("Commit Project", self.project) return project.path_to_folder + "/" + self.branch_name def clone_repo(self): project = frappe.get_doc("Commit Project", self.project) self.app_name = project.app_name repo_url = "https://github.com/{}/{}".format( project.org, project.repo_name) folder_path = self.path_to_folder # print("Folder path", folder_path) # print("Repo url", repo_url) # print("Branch name", self.branch_name) repo = git.Repo.clone_from(repo_url, folder_path, branch=self.branch_name, single_branch=True) # print("Cloned repo") self.last_fetched = frappe.utils.now_datetime() self.commit_hash = repo.head.object.hexsha def fetch_repo(self): repo = git.Repo(self.path_to_folder) repo.remotes.origin.fetch() # Pull the latest changes from the remote repo.remotes.origin.pull() self.last_fetched = now() self.commit_hash = repo.head.object.hexsha self.get_modules() self.find_all_apis() # self.save() pass def get_modules(self): # print("Getting modules") modules_path = os.path.join( self.path_to_folder, self.app_name, 'modules.txt') if os.path.isfile(modules_path): modules_file = open(modules_path, 'r') modules = modules_file.read().splitlines() self.modules = ",".join(modules) module_doctypes_map = {} doctype_module_map = {} for module in modules: module_doctypes_map[module] = get_doctypes_in_module( self.path_to_folder, self.app_name, module) for doctype in module_doctypes_map[module].get("doctype_names", []): doctype_module_map[doctype] = module self.module_doctypes_map = module_doctypes_map self.doctype_module_map = doctype_module_map # print("Modules", self.modules) def find_all_apis(self): apis = find_all_occurrences_of_whitelist( self.path_to_folder, self.app_name) # print(apis) # Convert list to string and save to database self.whitelisted_apis = { "apis": apis } return apis def get_whitelisted_apis_code(self): apis = [] apis_code = [] if self.whitelisted_apis: if type(self.whitelisted_apis) == str: apis = json.loads(self.whitelisted_apis if self.whitelisted_apis else '').get("apis", []) else: apis = self.whitelisted_apis.get("apis", []) if self.whitelisted_apis else [] for api in apis: # file_content = get_file_content_from_path(self.name, api['file'], api['block_start'], api['block_end'], "project") file_content = get_code_from_file(api['file'], api['block_start'], api['block_end']) content = file_content.get("file_content", []) content = "".join(content) apis_code.append({ 'file': api['file'], 'path': api['api_path'], 'function_name': api['name'], 'code': content }) documentation = generate_docs_for_apis(apis_code) self.documentation= { "apis": documentation } def get_doctype_json(self, doctype_name): if self.doctype_module_map: doctype_module_map = json.loads(self.doctype_module_map) module = doctype_module_map.get(doctype_name) # print("Module", module) if module: return get_doctype_json(self.path_to_folder, self.app_name, module, doctype_name) return None def get_doctypes_in_module(self, module): if self.module_doctypes_map: module_doctypes_map = json.loads(self.module_doctypes_map) return module_doctypes_map.get(module, {}).get("doctype_names", []) def on_trash(self): # Delete the folder if self.path_to_folder and os.path.exists(self.path_to_folder): shutil.rmtree(self.path_to_folder) def get_code_from_file(file_path: str, block_start: int, block_end: int): if os.path.isfile(file_path): file_content = open(file_path, 'r') file_content = file_content.readlines() # fetch the block file_content = file_content[block_start:block_end] return { "file_content": file_content } else: frappe.throw("File not found") def background_fetch_process(project_branch): try: doc = frappe.get_doc("Commit Project Branch", project_branch) frappe.publish_realtime('commit_branch_clone_repo', { 'branch_name': doc.branch_name, 'project': doc.project, 'text': "Cloning repository...", 'is_completed': False }, user=frappe.session.user) doc.clone_repo() frappe.publish_realtime('commit_branch_get_modules', { 'branch_name': doc.branch_name, 'project': doc.project, 'text': "Getting all modules for your app...", 'is_completed': False }, user=frappe.session.user) doc.get_modules() frappe.publish_realtime('commit_branch_find_apis', { 'branch_name': doc.branch_name, 'project': doc.project, 'text': "Finding all APIs...", 'is_completed': False }, user=frappe.session.user) doc.find_all_apis() # doc.get_whitelisted_apis_code() doc.save() frappe.publish_realtime("commit_project_branch_created", { 'name': doc.name, 'branch_name': doc.branch_name, 'project': doc.project, 'text': "Branch created successfully.", 'is_completed': True }, user=frappe.session.user) except Exception as e: # throw the error and delete the document messages = [json.dumps({'message' :'There was an error while fetching branch repo.'})] frappe.clear_messages() frappe.publish_realtime('commit_branch_creation_error', { 'branch_name': doc.branch_name, 'project': doc.project, 'error':{ "exception": frappe.get_traceback(), "_server_messages": json.dumps(messages), }, # 'response': handle_exception(e), 'is_completed': False }, user=frappe.session.user) frappe.delete_doc("Commit Project Branch", project_branch) # frappe.throw("Project Branch not found") frappe.log(frappe.get_traceback()) # raise e @frappe.whitelist(allow_guest=True) def fetch_repo(doc, name = None): if name : project_branch = frappe.get_doc("Commit Project Branch", name) else: doc = json.loads(doc) project_branch = frappe.get_doc("Commit Project Branch", doc.get("name")) project_branch.fetch_repo() project_branch.save() return "Hello" def generate_branch_documentation(project_branch): frappe.publish_realtime('commit_branch_generate_documentation', { 'branch_name': project_branch, 'text': "Generating documentation...", 'is_completed': False }, user=frappe.session.user) doc = frappe.get_doc("Commit Project Branch", project_branch) doc.get_whitelisted_apis_code() doc.save() frappe.publish_realtime("commit_branch_generate_documentation", { 'branch_name': doc.branch_name, 'project': doc.project, 'text': "Documentation generated successfully.", 'is_completed': True }, user=frappe.session.user) return "Documentation generated successfully" @frappe.whitelist(allow_guest=True) def get_module_doctype_map_for_branches(branches: str): branches = json.loads(branches) module_doctypes_map = {} for branch in branches: project_branch = frappe.get_doc("Commit Project Branch", branch) module_doctypes_map[branch] = json.loads(project_branch.module_doctypes_map) return module_doctypes_map
2302_79757062/commit
commit/commit/doctype/commit_project_branch/commit_project_branch.py
Python
agpl-3.0
10,391
// Copyright (c) 2024, The Commit Company and contributors // For license information, please see license.txt // frappe.ui.form.on("Commit Settings", { // refresh(frm) { // }, // });
2302_79757062/commit
commit/commit/doctype/commit_settings/commit_settings.js
JavaScript
agpl-3.0
187
# Copyright (c) 2024, The Commit Company and contributors # For license information, please see license.txt # import frappe from frappe.model.document import Document class CommitSettings(Document): pass
2302_79757062/commit
commit/commit/doctype/commit_settings/commit_settings.py
Python
agpl-3.0
208
// Copyright (c) 2023, The Commit Company and contributors // For license information, please see license.txt frappe.ui.form.on('Github Settings', { // refresh: function(frm) { // } });
2302_79757062/commit
commit/commit/doctype/github_settings/github_settings.js
JavaScript
agpl-3.0
190
# Copyright (c) 2023, The Commit Company and contributors # For license information, please see license.txt import frappe from frappe.model.document import Document import requests import json class GithubSettings(Document): pass session = requests.Session() session.headers.update({'Accept': 'application/json'}) @frappe.whitelist(allow_guest=True) def authenticate_user(code, state=None): '''API to authenticate the user with GitHub''' # print("----- Auth Code: ", code) response = get_access_token(code) if response: user_data = get_user_details(response.get('access_token')) if user_data: # print("Inside user data: ", user_data) user = create_user(user_data) # print("----- User: ", user.as_dict()) def get_access_token(code): '''Get the access token from GitHub''' ''' 1. Make a POST request to GitHub to get the access token 2. Return the access token ''' github_settings = frappe.get_doc("Github Settings") client_id = github_settings.client_id client_secret = github_settings.get_password('client_secret') token_url = github_settings.token_uri data = { 'client_id': client_id, 'client_secret': client_secret, 'code': code, } headers = {'Accept': 'application/json'} response = requests.post(token_url, data=data, headers=headers) # print("----- Response: ", response.json()) return response.json() def get_user_details(access_token): user_response = requests.get( 'https://api.github.com/user', headers={'Authorization': 'token ' + access_token}) # print("----- User Response: ", user_response.json()) user_data = {} if user_response.status_code == 200 and user_response.json(): email_response = requests.get( 'https://api.github.com/user/emails', headers={'Authorization': 'token ' + access_token}) # print("----- Email Response: ", email_response.json()) user_data = {"user_details": user_response.json( ), "email_details": email_response.json()} return user_data def create_user(user_data): '''Create a user in the system''' ''' 1. Get the user details from GitHub 2. Create a user in the system 3. Return the user details ''' user = frappe.new_doc("User") user.first_name = user_data.get('user_details').get('name').split()[0] user.last_name = user_data.get('user_details').get('name').split()[1] user.email = user_data.get('email_details')[0].get('email') user.username = user_data.get('user_details').get('login') user.user_image = user_data.get('user_details').get('avatar_url') user.bio = user_data.get('user_details').get('bio') user.location = user_data.get('user_details').get('location') user.new_password = frappe.generate_hash() user.enabled = 1 user.user_type = 'Website User' user.insert(ignore_permissions=True) frappe.db.commit() return user
2302_79757062/commit
commit/commit/doctype/github_settings/github_settings.py
Python
agpl-3.0
2,981
// Copyright (c) 2023, The Commit Company and contributors // For license information, please see license.txt frappe.ui.form.on('Github Token', { // refresh: function(frm) { // } });
2302_79757062/commit
commit/commit/doctype/github_token/github_token.js
JavaScript
agpl-3.0
187
# Copyright (c) 2023, The Commit Company and contributors # For license information, please see license.txt # import frappe from frappe.model.document import Document class GithubToken(Document): pass
2302_79757062/commit
commit/commit/doctype/github_token/github_token.py
Python
agpl-3.0
204
// Copyright (c) 2024, The Commit Company and contributors // For license information, please see license.txt // frappe.ui.form.on("Open AI Settings", { // refresh(frm) { // }, // });
2302_79757062/commit
commit/commit/doctype/open_ai_settings/open_ai_settings.js
JavaScript
agpl-3.0
188
# Copyright (c) 2024, The Commit Company and contributors # For license information, please see license.txt import frappe from frappe.model.document import Document from openai import OpenAI class OpenAISettings(Document): pass def open_ai_call(message): # 1. Get the organization ID and API key from Open API Settings open_ai = frappe.get_single("Open AI Settings") org_id = open_ai.organization api_key = open_ai.get_password('api_key') if not org_id or not api_key: frappe.throw("Please set the organization ID and API key in Open API Settings") # 2. Initialize the Open AI client client = OpenAI(organization=org_id, api_key=api_key) # 2. Make the API call to Open AI response = client.chat.completions.create( model="gpt-3.5-turbo", messages=message, max_tokens=3900, temperature=0.3, # Lower temperature for more deterministic output stop=["Function Name:", "\n\n"] # Stop sequence to separate functions ) return response.choices[0].message.content
2302_79757062/commit
commit/commit/doctype/open_ai_settings/open_ai_settings.py
Python
agpl-3.0
1,070
from . import __version__ as app_version app_name = "commit" app_title = "commit" app_publisher = "The Commit Company" app_description = "The Commit Company" app_email = "support@thecommit.company" app_license = "MIT" # Includes in <head> # ------------------ # include js, css files in header of desk.html # app_include_css = "/assets/commit/css/commit.css" # app_include_js = "/assets/commit/js/commit.js" # include js, css files in header of web template # web_include_css = "/assets/commit/css/commit.css" # web_include_js = "/assets/commit/js/commit.js" # include custom scss in every website theme (without file extension ".scss") # website_theme_scss = "commit/public/scss/website" # include js, css files in header of web form # webform_include_js = {"doctype": "public/js/doctype.js"} # webform_include_css = {"doctype": "public/css/doctype.css"} # include js in page # page_js = {"page" : "public/js/file.js"} # include js in doctype views # doctype_js = {"doctype" : "public/js/doctype.js"} # doctype_list_js = {"doctype" : "public/js/doctype_list.js"} # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} # doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"} # Home Pages # ---------- # application home page (will override Website Settings) # home_page = "login" # website user home page (by Role) # role_home_page = { # "Role": "home_page" # } # Generators # ---------- # automatically create page for each record of this doctype # website_generators = ["Web Page"] # Jinja # ---------- # add methods and filters to jinja environment # jinja = { # "methods": "commit.utils.jinja_methods", # "filters": "commit.utils.jinja_filters" # } # Installation # ------------ # before_install = "commit.install.before_install" # after_install = "commit.install.after_install" # Uninstallation # ------------ # before_uninstall = "commit.uninstall.before_uninstall" # after_uninstall = "commit.uninstall.after_uninstall" # Desk Notifications # ------------------ # See frappe.core.notifications.get_notification_config # notification_config = "commit.notifications.get_notification_config" # Permissions # ----------- # Permissions evaluated in scripted ways # permission_query_conditions = { # "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions", # } # # has_permission = { # "Event": "frappe.desk.doctype.event.event.has_permission", # } # DocType Class # --------------- # Override standard doctype classes # override_doctype_class = { # "ToDo": "custom_app.overrides.CustomToDo" # } # Document Events # --------------- # Hook on document methods and events # doc_events = { # "*": { # "on_update": "method", # "on_cancel": "method", # "on_trash": "method" # } # } # Scheduled Tasks # --------------- # scheduler_events = { # "all": [ # "commit.tasks.all" # ], # "daily": [ # "commit.tasks.daily" # ], # "hourly": [ # "commit.tasks.hourly" # ], # "weekly": [ # "commit.tasks.weekly" # ], # "monthly": [ # "commit.tasks.monthly" # ], # } # Testing # ------- # before_tests = "commit.install.before_tests" # Overriding Methods # ------------------------------ # # override_whitelisted_methods = { # "frappe.desk.doctype.event.event.get_events": "commit.event.get_events" # } # # each overriding function accepts a `data` argument; # generated from the base implementation of the doctype dashboard, # along with any modifications made in other Frappe apps # override_doctype_dashboards = { # "Task": "commit.task.get_dashboard_data" # } # exempt linked doctypes from being automatically cancelled # # auto_cancel_exempted_doctypes = ["Auto Repeat"] # Ignore links to specified DocTypes when deleting documents # ----------------------------------------------------------- # ignore_links_on_delete = ["Communication", "ToDo"] # Request Events # ---------------- # before_request = ["commit.utils.before_request"] # after_request = ["commit.utils.after_request"] # Job Events # ---------- # before_job = ["commit.utils.before_job"] # after_job = ["commit.utils.after_job"] # User Data Protection # -------------------- # user_data_fields = [ # { # "doctype": "{doctype_1}", # "filter_by": "{filter_by}", # "redact_fields": ["{field_1}", "{field_2}"], # "partial": 1, # }, # { # "doctype": "{doctype_2}", # "filter_by": "{filter_by}", # "partial": 1, # }, # { # "doctype": "{doctype_3}", # "strict": False, # }, # { # "doctype": "{doctype_4}" # } # ] # Authentication and authorization # -------------------------------- # auth_hooks = [ # "commit.auth.validate" # ] fixtures = [{"doctype": "Server Script", "filters": [["module" , "in" , ("commit" )]]}] website_route_rules = [{'from_route': '/commit/<path:app_path>', 'to_route': 'commit'}]
2302_79757062/commit
commit/hooks.py
Python
agpl-3.0
4,749
import re def get_api_details_from_file_contents(file_contents: str, file_path: str): ''' Get list of all whitelisted API in a file string with: 1. Type 2. Path 3. Method name 4. Arguments 5. Python code snippet ''' whitelist_indexes = find_all_mentions_of_whitelist_in_file(file_contents) # TODO: Get whitelist type (e.g. methods, rate_limit, etc.) api_details = get_api_content_from_file_contents(file_contents, whitelist_indexes, file_path) return api_details # return "{}:{}".format(base_path, indexes) def convert_file_path_to_api_path(file_path: str): ''' Convert file path to API path ''' return file_path.replace("/", ".").replace(".py", "") def find_all_mentions_of_whitelist_in_file(file_contents: str): ''' Find all mentions of @frappe.whitelist() in a file ''' indexes = [m.start() for m in re.finditer('@frappe.whitelist', file_contents)] return indexes def get_api_content_from_file_contents(file_contents: str, indexes: list, file_path: str): ''' Get API name from file contents ''' # Loop over to find the first mention of "def" after the indexes base_path = convert_file_path_to_api_path(file_path) api_string = [] for index in indexes: whitelist_properties = {} newline_after_whitelist = file_contents.find("\n", index) if newline_after_whitelist != -1: whitelisted_content = file_contents[index:newline_after_whitelist] whitelist_properties = parse_whitelist(whitelisted_content) index_of_def = file_contents.find("def", index) if index_of_def != -1: # Found the first mention of "def" after the index # Get the API name by looking for the first ":" after the index_of_def index_of_colon = file_contents.find(":", index_of_def) api_def = "" api_content = "" indentation_of_def = "" if index_of_colon != -1: api_def = file_contents[index_of_def + 4:index_of_colon] # Need to find the start and end of the API function # Need the level of indentation of the "def" line index_of_newline_before_def = file_contents.rfind("\n", 0, index_of_def) api_content = index_of_newline_before_def # Get the indentation string between the \n and the def indentation_of_def = file_contents[index_of_newline_before_def + 1:index_of_def] if indentation_of_def == "": # No indentation. Find first line after def that has no indentation pass else: pass # Find the next line containing the same number of indentation if api_def: api_string.append({ "function_def": api_def, "content": api_content, "indentation": indentation_of_def, "name": extract_name_from_def(api_def), "arguments": extract_arguments_from_def(api_def), "path": base_path, "file_path": file_path, **whitelist_properties, }) return api_string def extract_name_from_def(api_def: str): ''' Extract name from def ''' return api_def.split("(")[0].strip() def extract_arguments_from_def(api_def: str): ''' Extract arguments from def ''' arguments_with_types_defaults = api_def.split("(")[1].split(")")[0].split(",") arguments = [] for arg in arguments_with_types_defaults: argument_with_types_default = arg.strip() default = "" argument = "" type = "" if "=" in argument_with_types_default: default_split = argument_with_types_default.split("=") default = default_split[1].strip().replace('"', '').replace("'", "") argument = default_split[0].strip() else: argument = argument_with_types_default if ":" in argument: type = argument.split(":")[1].strip() argument = argument.split(":")[0].strip() arguments.append({ "argument": argument, "type": type, "default": default }) return arguments def parse_whitelist(whitelisted_content: str): ''' Input being @frappe.whitelist() with args, find request type and other params ''' args = whitelisted_content.split("(")[1].split(")")[0].split(",") request_types = [] xss_safe = False allow_guest = False for arg in args: if "methods" in arg: request_types = arg.split("=")[1].replace("[", "").replace("]", "").replace('"', '').replace("'", "").split(",") if "xss_safe" in arg: xss_safe = arg.split("=")[1].strip() == "True" if "allow_guest" in arg: allow_guest = arg.split("=")[1].strip() == "True" return { "request_types": request_types, "xss_safe": xss_safe, "allow_guest": allow_guest }
2302_79757062/commit
commit/utils/api_analysis.py
Python
agpl-3.0
5,183
def convert_module_name(module: str): ''' Convert module name to frappe module path name Replace spaces with underscores and convert to lowercase ''' return module.replace(" ", "_").lower()
2302_79757062/commit
commit/utils/conversions.py
Python
agpl-3.0
209
import frappe import json import frappe.sessions import re no_cache = 1 SCRIPT_TAG_PATTERN = re.compile(r"\<script[^<]*\</script\>") CLOSING_SCRIPT_TAG_PATTERN = re.compile(r"</script\>") def get_context(context): csrf_token = frappe.sessions.get_csrf_token() frappe.db.commit() context = frappe._dict() context.boot = get_boot() context.csrf_token = csrf_token context.build_version = frappe.utils.get_build_version() return context @frappe.whitelist(methods=['POST'], allow_guest=True) def get_context_for_dev(): if not frappe.conf.developer_mode: frappe.throw('This method is only meant for developer mode') return json.loads(get_boot()) def get_boot(): try: boot = frappe.sessions.get() except Exception as e: raise frappe.SessionBootFailed from e commit_settings = frappe.get_single("Commit Settings") show_system_apps = commit_settings.show_system_apps boot["show_system_apps"] = show_system_apps boot_json = frappe.as_json(boot, indent=None, separators=(",", ":")) boot_json = SCRIPT_TAG_PATTERN.sub("", boot_json) boot_json = CLOSING_SCRIPT_TAG_PATTERN.sub("", boot_json) boot_json = json.dumps(boot_json) return boot_json
2302_79757062/commit
commit/www/commit.py
Python
agpl-3.0
1,239
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> <link rel="manifest" href="/site.webmanifest"> <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#000000"> <meta name="msapplication-TileColor" content="#da532c"> <meta name="theme-color" content="#ffffff"> <title>Commit - Developer tooling for the Frappeverse</title> </head> <body> <div id="root"></div> <script>window.csrf_token = '{{ frappe.session.csrf_token }}';</script> <script> if (!window.frappe) window.frappe = {}; frappe.boot = JSON.parse({{ boot }}); </script> <script type="module" src="/src/main.tsx"></script> </body> </html>
2302_79757062/commit
dashboard/index.html
HTML
agpl-3.0
955
export default { plugins: { tailwindcss: {}, autoprefixer: {}, }, }
2302_79757062/commit
dashboard/postcss.config.js
JavaScript
agpl-3.0
80
let webserver_port = "8001"; try { const common_site_config = require('../../../sites/common_site_config.json'); webserver_port = common_site_config.webserver_port; } catch { } export default { '^/(app|api|assets|files|private)': { target: `http://127.0.0.1:${webserver_port}`, ws: true, changeOrigin: true, secure: false, router: function (req) { const site_name = req.headers.host.split(':')[0]; return `http://${site_name}:${webserver_port}`; }, }, };
2302_79757062/commit
dashboard/proxyOptions.js
JavaScript
agpl-3.0
499
import { FrappeProvider } from 'frappe-react-sdk' import { BrowserRouter, Route, Routes } from 'react-router-dom' import { APIViewerContainer } from './pages/features/api_viewer/APIViewer' import { Overview } from './pages/overview/Overview' import { ERDViewer } from './pages/features/erd/ERDViewer' import { AppAPIViewerContainer } from './pages/features/api_viewer/AppAPIViewer' import { CreateERD } from './pages/features/erd/meta/CreateERDForMeta' function App() { const getSiteName = () => { // @ts-ignore if (window.frappe?.boot?.versions?.frappe && (window.frappe.boot.versions.frappe.startsWith('15') || window.frappe.boot.versions.frappe.startsWith('16'))) { // @ts-ignore return window.frappe?.boot?.sitename ?? import.meta.env.VITE_SITE_NAME } return import.meta.env.VITE_SITE_NAME } return ( <FrappeProvider socketPort={import.meta.env.VITE_SOCKET_PORT ?? undefined} siteName={getSiteName()}> <BrowserRouter basename={import.meta.env.VITE_BASE_PATH}> {/* <UserProvider> */} <Routes> {/** Public Routes */} {/* <Route path="/sign-up" element={<SignUp />} /> */} {/** Private Routes */} {/* <Route path="/" element={<ProtectedRoute />} /> */} {/* default route on '/' */} <Route path="/" index element={<Overview />} /> {/*TODO: Need to Change below route */} <Route path='/project-erd' element={<ERDViewer />} /> <Route path="/project-viewer/:ID" element={<APIViewerContainer />} /> <Route path="/meta-viewer/:ID" element={<AppAPIViewerContainer />} /> <Route path='/meta-erd/:ID' element={<ERDViewer />} /> <Route path='/meta-erd/create' element={<CreateERD />} /> </Routes> {/* </UserProvider> */} </BrowserRouter> </FrappeProvider> ) } export default App
2302_79757062/commit
dashboard/src/App.tsx
TSX
agpl-3.0
1,884
import { FrappeError, useFrappePostCall } from 'frappe-react-sdk' import { PropsWithChildren, useEffect, useRef } from 'react' import { Filter, useFrappeGetCall } from "frappe-react-sdk"; import { useCallback, useMemo, useState } from "react"; import { RegisterOptions, useController, useFormContext } from "react-hook-form"; import { UseComboboxReturnValue, UseComboboxState, UseComboboxStateChangeOptions, useCombobox } from "downshift"; import { useAtom } from 'jotai' import { Input, InputProps } from '@/components/ui/input'; import { getSystemDefault } from '@/utils/defaults'; import { useGetDoctypeMeta } from '@/hooks/useGetDoctypeMeta'; import { useDebounce } from '@/hooks/useDebounce'; import { getLinkTitleAtom, setLinkTitleAtom } from './LinkTitles'; import { AsyncSpinnerLoader } from '../FullPageLoader/SpinnerLoader'; import { getErrorMessages } from '../ErrorBanner/ErrorBanner'; import { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer'; interface ResultItem { value: string, description: string, label?: string } interface BaseDropdownProps extends Partial<InputProps> { /** DocType to be fetched */ doctype: string; /** Filters to be applied. Default: none */ filters?: Filter[] /** Number of records to paginate with. Default: Comes from System Settings or 10 */ limit?: number; /** TODO: Should the dropdown allow pagination when the user scrolls. Default: true */ allowPagination?: boolean; /** * API to call to fetch records. * * Default: `emotive_app.emotive_app.search.search_link` * * If you want to use a custom API, you can pass the path to the API here. * * The API should return a list of documents in the following format: * [{value: string, description: string, label?: string}] - where the value is the ID of the document. * * If the API sends a label, it will be used as the label in the dropdown. * * Refer: Cost Codes query */ searchAPIPath?: string; /** * Field you want to search against in the doctype. * * Default: `name` * * If you want to search against a different field, you can pass the fieldname here. * * If you want to search against multiple fields, you can try using the `searchAPIPath` prop to call a custom API, * or use a custom query in the `customQuery` prop. */ searchfield?: string; /** * Custom query to be used to fetch records. * * If you want to use a custom query, you can pass the query here. * * The query should be in the following format: * { * query: string, * filters: { * fieldname: string, * operator: string, * value: string * } * } */ customQuery?: { /** Path to function for the query. * * Refer: Item/Supplier query */ query: string, /** Filters are usually an object instead of an array in a custom query */ filters?: any, }, /** * Used for certain queries where a reference doctype is needed. * * For example when searching a supplier in a "Purchase Invoice", the reference_doctype is "Purchase Invoice" * * TODO: This can be auto-filled eventually from FormContext since we will know the doctype of the form. */ reference_doctype?: string, /** * Some doctypes are "creatable" - for example "Item" * * This means that if the user does not find a match, they can create a new record from the dropdown itself. * * A popup will open up with the form to create a new record. * * You can pass in default values for the new record to be created. */ defaultValuesForCreate?: Record<string, any>, /** Placeholder for the dropdown. Default: `doctype` */ placeholder?: string; /** * Should the field be read-only. * * The Dropdown takes in the FormContext and automatically sets the field to readOnly if the docstatus is 1 (Submitted) or 2 (Cancelled) * * If `allowOnSubmit` is set to true, the field will be readOnly only if the docstatus is 2 (Cancelled) */ isReadOnly?: boolean; /** Should the field be disabled. Default: false */ isDisabled?: boolean; /** Open the record (if available) in a new tab */ clickOpenInNewTab?: boolean, /** Set to true to auto focus the input */ autoFocus?: boolean, /** Open the menu on focus */ openMenuOnFocus?: boolean, heightAdjust?: boolean; /** * Function to filter the options based on the input value/other criteria. * * For example, you might want to limit the companies shown in the dropdown since they have been already added (like in Cost Codes) */ filterOption?: (option: ResultItem, inputValue: string) => boolean, } interface AsyncDropdownProps extends BaseDropdownProps { /** Fieldname */ name: string; /** * Rules to add for the field to validate input, show errors, and trigger effects onChange/onBlur etc. * * Refer:https://react-hook-form.com/docs/useform/register#options */ rules?: RegisterOptions, /** * Is the field editable on submit. If true, the field will be readOnly only if the docstatus is 2 (Cancelled) * * Default: false */ allowOnSubmit?: boolean; } /** * The AsyncDropdown component is used to handle Link fields in any form. * It needs to be used inside a React Hook Form FormProvider. * The component takes in a doctype and a fieldname and returns an input field with a dropdown list of options fetched from the server. * @param props * @returns */ export const AsyncDropdown = ({ doctype, reference_doctype, name, filters = [], allowPagination = true, customQuery, searchfield, searchAPIPath = "commit.api.search.search_link", limit, rules, isReadOnly, placeholder = doctype, isDisabled, clickOpenInNewTab = false, defaultValuesForCreate, autoFocus, openMenuOnFocus = false, allowOnSubmit = false, filterOption, heightAdjust = false, ...inputProps }: AsyncDropdownProps) => { const pageLimit = useMemo(() => limit || getSystemDefault('link_field_results_limit') || 10, [limit]) /** Load the Doctype meta so that we can determine the search fields + the name of the title field */ const { data: meta, isLoading: isMetaLoading } = useGetDoctypeMeta(doctype) const { watch, control } = useFormContext() const { field } = useController({ control, name: name, disabled: isDisabled, rules: rules, }) /** If routing is available on eMotive, we will route the user to the corresponding page on click */ /** If the doctype is creatable, we will allow the user to create a new record from the dropdown itself */ const [isOpened, setIsOpened] = useState(false) const [searchInput, setSearchInput] = useState(field.value ?? '') const debouncedInput = useDebounce(searchInput) // Maintain link titles in an Atom const [getLinkTitle] = useAtom(getLinkTitleAtom) const [, setLinkTitle] = useAtom(setLinkTitleAtom) const { call: linkTitleCall } = useFrappePostCall('frappe.desk.search.get_link_title') const loadingLinkTitle = useRef(false) // On mount, we want to check if the link title is available in the atom // If it is, set the search input to the link title useEffect(() => { if (meta) { const showTitleField = meta.show_title_field_in_link if (showTitleField && field.value) { const t = getLinkTitle(doctype, field.value) if (t) { setSearchInput(t) } else { // The link title is not available in the atom // We need to fetch it from the server if (!loadingLinkTitle.current) { loadingLinkTitle.current = true linkTitleCall({ doctype, docname: field.value }).then(response => { const title = response.message setLinkTitle(doctype, field.value, title) setSearchInput(title) }) } } } else { setSearchInput(field.value ?? '') } } }, [field.value, meta]) const docstatus = watch('docstatus') const isFieldReadOnly = useMemo(() => { /** If isReadOnly is passed in explicitly, then we use that value. */ if (isReadOnly !== undefined) { return isReadOnly } /** If isReadOnly is not passed in, then we check the docstatus */ if (allowOnSubmit) { return docstatus === 2 } return docstatus === 1 || docstatus === 2 }, [isReadOnly, docstatus, allowOnSubmit]) const isFieldDisabled = useMemo(() => { if (field.disabled !== undefined) { return field.disabled } return false }, [field.disabled]) const { data, error, isLoading } = useFrappeGetCall<{ message: ResultItem[] }>(searchAPIPath, { doctype, txt: debouncedInput, page_length: pageLimit, query: customQuery?.query, searchfield, filters: JSON.stringify(customQuery?.filters || filters || []), reference_doctype, }, () => { if (!isOpened) { return null } else { let key = `${searchAPIPath}_${doctype}_${debouncedInput}` if (pageLimit) { key += `_${pageLimit}` } if (customQuery?.filters) { key += `_${JSON.stringify(customQuery.filters)}` } else if (filters) { key += `_${JSON.stringify(filters)}` } if (customQuery && customQuery.query) { key += `_${customQuery.query}` } if (reference_doctype) { key += `_${reference_doctype}` } if (searchfield && searchfield !== 'name') { key += `_${searchfield}` } return key } }, { revalidateOnFocus: false, revalidateIfStale: false, revalidateOnMount: true, shouldRetryOnError: false, revalidateOnReconnect: false, }) const items = filterOption ? data?.message.slice(0, 50).filter((item) => filterOption(item, searchInput)) : data?.message const stateReducer = useCallback((state: UseComboboxState<ResultItem>, actionAndChanges: UseComboboxStateChangeOptions<ResultItem>) => { const { type, changes } = actionAndChanges // returning an uppercased version of the item string. switch (type) { case useCombobox.stateChangeTypes.ItemClick: // Set the field value to the selected item field.onChange(changes.selectedItem?.value ?? '') if (changes.selectedItem?.label) { setLinkTitle(doctype, changes.selectedItem.value, changes.selectedItem.label) } return changes case useCombobox.stateChangeTypes.InputKeyDownEnter: if (changes.inputValue && state.highlightedIndex === -1) { return { ...changes, inputValue: '', selectedItem: null } } else { field.onChange(changes.selectedItem?.value ?? '') return changes } case useCombobox.stateChangeTypes.InputKeyDownEscape: case useCombobox.stateChangeTypes.InputKeyDownHome: case useCombobox.stateChangeTypes.FunctionCloseMenu: case useCombobox.stateChangeTypes.InputBlur: // When the input blurs, we want to check if the value in the input is the same as the selected item. //If not, then we want to clear the input value // That will in turn clear the field value as well if (field.value !== changes.inputValue) { return { ...changes, inputValue: '' } } //Fire the onBlur event on the field field.onBlur() return changes default: return changes // otherwise business as usual. } }, [field, items]) const { isOpen, getMenuProps, getInputProps, highlightedIndex, getItemProps, openMenu, selectedItem, } = useCombobox<ResultItem>({ onInputValueChange({ inputValue }) { setSearchInput(inputValue ?? '') if (inputValue === '') { field.onChange('') } }, onSelectedItemChange: ({ selectedItem }) => { field.onChange(selectedItem?.value ?? '') if (selectedItem?.label) { setLinkTitle(doctype, selectedItem.value, selectedItem.label) } }, items: items || [], inputValue: searchInput, itemToString(item) { return item ? (item.label ?? item.value) : '' }, onIsOpenChange: ({ isOpen }) => { // Set the state so that we do not fetch data when the dropdown is closed setIsOpened(isOpen ? true : false) }, stateReducer }) return ( <div className="relative w-full"> <div> <div className="relative w-full "> <Input className="w-full pr-9" placeholder={placeholder} {...getInputProps({ readOnly: isFieldReadOnly, disabled: isFieldDisabled, autoFocus: autoFocus, onClick: (event) => { if (isFieldReadOnly || isFieldDisabled) { // If the field is read only/disabled - do not fire the downshift event of opening the menu //@ts-expect-error event.nativeEvent.preventDownshiftDefault = true } }, onFocus: () => { if (openMenuOnFocus && !isFieldDisabled && !isFieldReadOnly) { openMenu() } } })} {...inputProps} /> {isLoading ? <AsyncSpinnerLoader /> : null } </div> </div> {!isMetaLoading && !isLoading && items?.length === 0 && <NoResultsContainer isOpen={isOpen}> <NoRecordsFound /> </NoResultsContainer> } <ErrorContainer error={error} /> <DropdownContainer getMenuProps={getMenuProps} isOpen={isOpen} items={items} isFieldDisabled={isFieldDisabled} isFieldReadOnly={isFieldReadOnly} heightAdjust={heightAdjust} > {isOpen && items?.slice(0, 50).map((item, index) => ( <DropdownItem item={item} index={index} getItemProps={getItemProps} highlightedIndex={highlightedIndex} selectedItem={selectedItem} key={item.value} /> ))} </DropdownContainer> </div> ) } const NoResultsContainer = ({ children, isOpen }: { children: React.ReactNode, isOpen: boolean }) => { return ( <div className={`shadow-lg border border-gray-200 bg-white rounded-md mt-1 z-10 absolute ${isOpen ? '' : 'hidden'} p-2 w-full`} style={{ boxShadow: '0px 8px 14px rgba(25, 39, 52, 0.08), 0px 2px 6px rgba(25, 39, 52, 0.04)' }}> {children} </div> ); }; const NoRecordsFound = () => { return ( <div className="flex justify-center items-center min-h-[66px] w-full"> <p className="text-gray-500 text-sm">No records found.</p> </div> ); }; const ErrorContainer = ({ error }: { error?: FrappeError }) => { if (error) { return ( <div className="absolute w-full z-10 bg-white dark:bg-gray-800 shadow-lg border border-gray-200 rounded-b-md p-2" style={{ boxShadow: '0px 8px 14px rgba(25, 39, 52, 0.08), 0px 2px 6px rgba(25, 39, 52, 0.04)' }}> <p className="text-red-500 text-sm"> {getErrorMessages(error).map(e => <MarkdownRenderer key={e.message} content={e.message} />)} </p> </div> ); } return null; }; const DropdownContainer = ({ children, getMenuProps, isOpen, items, isFieldDisabled, isFieldReadOnly, heightAdjust }: PropsWithChildren<{ getMenuProps: UseComboboxReturnValue<ResultItem>['getMenuProps'], isOpen: boolean, items?: ResultItem[], isFieldDisabled: boolean, isFieldReadOnly: boolean, heightAdjust?: boolean }>) => { return ( <ul className={`absolute w-full shadow-lg border border-gray-200 rounded-md bg-white ${heightAdjust ? 'max-h-[140px]' : 'max-h-80' } overflow-y-auto p-1.5 mt-2 flex flex-col gap-1 z-10 ${!(isOpen && items?.length) ? 'hidden' : ''}`} style={{ boxShadow: '0px 8px 14px rgba(25, 39, 52, 0.08), 0px 2px 6px rgba(25, 39, 52, 0.04)', }} {...getMenuProps({ disabled: isFieldDisabled, readOnly: isFieldReadOnly })} > {children} </ul> ); }; const DropdownItem = ({ item, index, getItemProps, highlightedIndex, selectedItem }: { item: ResultItem, index: number, getItemProps: UseComboboxReturnValue<ResultItem>['getItemProps'], highlightedIndex: number | null, selectedItem: ResultItem | null }) => { return ( <li className={`px-2 py-2 rounded-md cursor-pointer ${highlightedIndex === index ? 'bg-gray-100' : 'hover:bg-gray-200' } ${selectedItem?.value === item.value ? 'font-bold' : ''}`} {...getItemProps({ item, index })} > <div className="flex flex-col gap-0"> <span className="block text-sm leading-5"><strong>{item.label ?? item.value}</strong></span> <span className="text-xs">{(item.description ?? '').replace(htmlReplaceRegex, "")}</span> </div> </li> ); }; const htmlReplaceRegex = /(<([^>]+)>)/gi;
2302_79757062/commit
dashboard/src/components/common/AsyncDropdown/AsyncDropdown.tsx
TSX
agpl-3.0
19,309
import { atom } from 'jotai' // We will create an "atom" for all the link titles export const linkTitlesAtom = atom<Record<string, string>>({}) export const getLinkTitleAtom = atom((get) => (doctype: string, docname: string) => { const linkTitles = get(linkTitlesAtom) return linkTitles[`${doctype}::${docname}`] }) export const setLinkTitleAtom = atom(null, (get, set, doctype: string, docname: string, title: string) => { const linkTitles = get(linkTitlesAtom) linkTitles[`${doctype}::${docname}`] = title set(linkTitlesAtom, linkTitles) })
2302_79757062/commit
dashboard/src/components/common/AsyncDropdown/LinkTitles.ts
TypeScript
agpl-3.0
565
import { Button, ButtonProps } from "@/components/ui/button" import { useToast } from "@/components/ui/use-toast" import { CheckIcon, CopyIcon } from "@radix-ui/react-icons" import { useEffect, useState } from "react" interface CopyButtonProps extends ButtonProps { value: string } export function CopyButton({ value, className, ...props }: CopyButtonProps) { const [hasCopied, setHasCopied] = useState(false) const { toast } = useToast() const copyToClipboardWithMeta = async (value: string) => { try { await navigator.clipboard.writeText(value).then(() => toast({ description: "Copied to clipboard", duration: 1500 })) } catch (err) { console.error("Failed to copy: ", err) } } useEffect(() => { setTimeout(() => { setHasCopied(false) }, 2000) }, [hasCopied]) return ( <Button size="icon" variant="ghost" className={className} onClick={() => { copyToClipboardWithMeta(value) .then(() => setHasCopied(true)) .catch(() => { console.error("Failed to copy") setHasCopied(false) }) }} {...props} > <span className="sr-only">Copy</span> {hasCopied ? ( <CheckIcon className="h-4 w-4" /> ) : ( <CopyIcon className="h-4 w-4" /> )} </Button> ) } export default CopyButton
2302_79757062/commit
dashboard/src/components/common/CopyToClipboard/CopyToClipboard.tsx
TSX
agpl-3.0
1,562
import { FrappeError } from 'frappe-react-sdk' import { useMemo } from 'react' import { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer' interface ErrorBannerProps extends React.HTMLAttributes<HTMLDivElement> { error?: FrappeError | null, overrideHeading?: string, } interface ParsedErrorMessage { message: string, title?: string, indicator?: string, } export const getErrorMessages = (error?: FrappeError | null): ParsedErrorMessage[] => { if (!error) return [] let eMessages: ParsedErrorMessage[] = error?._server_messages ? JSON.parse(error?._server_messages) : [] eMessages = eMessages.map((m: any) => { try { return JSON.parse(m) } catch (e) { return m } }) if (eMessages.length === 0) { // Get the message from the exception by removing the exc_type const indexOfFirstColon = error?.exception?.indexOf(':') if (indexOfFirstColon) { const exception = error?.exception?.slice(indexOfFirstColon + 1) if (exception) { eMessages = [{ message: exception, title: "Error" }] } } if (eMessages.length === 0) { eMessages = [{ message: error?.message, title: "Error", indicator: "red" }] } } return eMessages } export const ErrorBanner = ({ error, overrideHeading, ...props }: ErrorBannerProps) => { //exc_type: "ValidationError" or "PermissionError" etc // exc: With entire traceback - useful for reporting maybe // httpStatus and httpStatusText - not needed // _server_messages: Array of messages - useful for showing to user const messages = useMemo(() => { if (!error) return [] let eMessages: ParsedErrorMessage[] = error?._server_messages ? JSON.parse(error?._server_messages) : [] eMessages = eMessages.map((m: any) => { try { // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument return JSON.parse(m) } catch (e) { // eslint-disable-next-line @typescript-eslint/no-unsafe-return return m } }) if (eMessages.length === 0) { // Get the message from the exception by removing the exc_type const indexOfFirstColon = error?.exception?.indexOf(':') if (indexOfFirstColon) { const exception = error?.exception?.slice(indexOfFirstColon + 1) if (exception) { eMessages = [{ message: exception, title: "Error" }] } } if (eMessages.length === 0) { eMessages = [{ message: error?.message, title: "Error", indicator: "red" }] } } return eMessages }, [error]) const parseHeading = (message?: ParsedErrorMessage) => { if (message?.title === 'Message' || message?.title === 'Error') return undefined return message?.title } // TODO: Sometimes, error message has links which route to the ERPNext interface. We need to parse the link to route to the correct page in our interface // Links are of format <a href="{host_name}/app/{doctype}/{name}">LEAD-00001</a> return ( <div className="bg-red-50 border-l-4 border-red-400 p-4"> <div className="flex"> <div className="flex-shrink-0"> {/* <!-- Heroicon name: solid/x-circle --> */} <svg className="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> <path fillRule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1.414-9.414a1 1 0 00-1.414-1.414L10 8.586 8.414 7. 002a1 1 0 00-1.414 1.414L8.586 10l-1.. 5 1.414 1.414L10 11.414l1.586 1.586 1.414-1.414L11.414 10l1.414-1.414z" clipRule="evenodd" /> </svg> </div> <div className="ml-3"> <p className="text-sm text-red-700"> {messages.map((m, i) => <MarkdownRenderer key={i} content={m.message} />)} </p> </div> </div> </div> ) }
2302_79757062/commit
dashboard/src/components/common/ErrorBanner/ErrorBanner.tsx
TSX
agpl-3.0
4,768
import { FormControl } from '@/components/ui/form' import { SlotProps } from '@radix-ui/react-slot' import { useMemo } from 'react' import { useFormContext } from 'react-hook-form' export interface ControlProps extends SlotProps { allowOnSubmit?: boolean } /** * Control is a wrapper around FormControl that adds some extra functionality **/ export const Control = ({ allowOnSubmit, ...props }: ControlProps) => { const formContext = useFormContext() const docstatus = formContext?.watch('docstatus') ?? 0 const isReadOnly = useMemo(() => { if (props['aria-readonly'] !== undefined) return props['aria-readonly'] //If document is cancelled, do no edit if (docstatus === 2) return true // If document is submitted, only edit if allowOnSubmit is true if (docstatus === 1) return !allowOnSubmit return false }, [docstatus, props['aria-readonly'], allowOnSubmit]) return <FormControl {...props} aria-readonly={isReadOnly} /> }
2302_79757062/commit
dashboard/src/components/common/Forms/FormControl/Control.tsx
TSX
agpl-3.0
1,001
import { useFormState } from 'react-hook-form'; import { Control, ControlProps } from './Control'; import { FormDescription, FormMessage } from '@/components/ui/form'; import { Label } from '../../Label'; interface FormElementProps extends ControlProps { name: string; label?: string; tooltip?: string } /** * FormElement is a wrapper around FormControl that adds some extra functionality * like showing errors and disabling the control if the docstatus is not 0 * @param name name of the field * @param label label of the field * @param children the input to be wrapped * @example - * <FormElement name="payment_term_name" label="Payment Term Name" isRequired> * <Input {...register("payment_term_name", { * required: 'Payment Term Name is required', maxLength: { * value: 140, * message: 'Payment Term Name cannot exceed 140 characters.' * } * })} * isDisabled={isEdit} * placeholder="Payment Term Name" /> * </FormElement> **/ export const FormElement = ({ name, label, children, tooltip, ...props }: FormElementProps) => { const { errors } = useFormState() /** * The name can be a path like `items.0.item_code` so we need to split it * and then get the error message from the errors object * */ let error: Record<string, any> = errors const path = name.split('.') for (let i = 0; i < path.length; i++) { error = error?.[path[i]] } return ( <Control aria-invalid={!!error} {...props}> <div className='flex flex-col gap-1'> {label && <div className='flex flex-row gap-1'> <Label label={label} htmlFor={name} /> {props['aria-required'] && <span className='text-red-500 text-xs' style={{ fontSize: '16px' }}>*</span>} </div> } {children} {tooltip && <FormDescription>{tooltip}</FormDescription>} {error && <FormMessage> {error.message} </FormMessage> } </div> </Control> ) };
2302_79757062/commit
dashboard/src/components/common/Forms/FormControl/FormElement.tsx
TSX
agpl-3.0
2,170
export * from './Control' export * from './FormElement'
2302_79757062/commit
dashboard/src/components/common/Forms/FormControl/index.ts
TypeScript
agpl-3.0
55
import React from 'react'; export const FullPageLoader = ({ className = '', ...props }: React.DetailedHTMLProps< React.HTMLAttributes<HTMLDivElement>, HTMLDivElement >) => { return ( <div className={`flex items-center justify-center h-full ${className}`} {...props} > <div className='inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]' role='status' > <span className='!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]'> Loading... </span> </div> </div> ); };
2302_79757062/commit
dashboard/src/components/common/FullPageLoader/FullPageLoader.tsx
TSX
agpl-3.0
730
import React from 'react'; interface AsyncSpinnerLoaderProps { size?: number; color?: string; position?: 'absolute' | 'fixed'; top?: string; right?: string; bottom?: string; left?: string; } export const AsyncSpinnerLoader: React.FC<AsyncSpinnerLoaderProps> = ({ size = 4, color = 'text-gray-200', position = 'fixed', top = '50%', right = '50%', bottom = 'auto', left = 'auto', }) => { const spinnerStyle = { borderWidth: size / 8, width: size, height: size, borderColor: 'currentColor', borderTopColor: 'transparent', }; const containerStyle = { top, right, bottom, left, }; return ( <div className={`inline-block ${color} mr-2 animate-spin rounded-full border-2 border-solid align-[-0.125em] text-surface motion-reduce:animate-[spin_1.5s_linear_infinite] dark:text-white`} style={{ ...spinnerStyle, ...containerStyle, position }} role="status" ></div> ); }; export interface SpinnerLoaderProps { className?: string; } export const SpinnerLoader = ({ className }: SpinnerLoaderProps) => { return ( <div className={`inline-block h-4 w-4 mr-2 animate-spin rounded-full border-2 border-solid border-current text-gray-200 border-e-transparent align-[-0.125em] text-surface motion-reduce:animate-[spin_1.5s_linear_infinite] dark:text-white ${className}`} role="status"> </div> ) }
2302_79757062/commit
dashboard/src/components/common/FullPageLoader/SpinnerLoader.tsx
TSX
agpl-3.0
1,539
import { Link } from 'react-router-dom' import CommitLogo from '../../assets/commit-logo.png' import { Button } from "@/components/ui/button" import { GitHubLogoIcon } from '@radix-ui/react-icons' export const Header = ({ text }: { text?: string }) => { return ( <header className='flex justify-between items-center px-4 py-3 border-b-[1px] h-14'> <div className='flex flex-col gap-1 sm:flex-row items-start sm:gap-2'> <Link to='/'> <img src={CommitLogo} alt='Commit.' className="h-6" /> </Link> {text && <h1 className='mt-[-1px] sm:text-lg text-sm'>{text}</h1>} </div> <div className='flex gap-2 items-center'> <Button variant='outline' color='primary' size='sm' onClick={() => window.open('https://github.com/The-Commit-Company', '_blank')}> <GitHubLogoIcon className='w-4 h-4 mr-2' /> GitHub </Button> <Button asChild size='sm'> <Link to={'https://forms.gle/cNpbkGRKbwnthQ6Q8'} target='_blank' rel='noreferrer' className='text-center'> Take our survey </Link> </Button> </div> </header> ) }
2302_79757062/commit
dashboard/src/components/common/Header.tsx
TSX
agpl-3.0
1,283
import { IconType } from 'react-icons' import { GrCurrency, GrFormAttachment, GrTextAlignFull } from 'react-icons/gr' import { AiFillCode, AiFillFileImage, AiFillHtml5, AiOutlineHtml5, AiOutlineLink, AiOutlinePhone, AiOutlineStar, AiOutlineTable } from 'react-icons/ai' import { BiBarcode, BiCheckboxChecked, BiColorFill, BiCurrentLocation, BiEdit, BiHeading, BiStopwatch, BiTime } from 'react-icons/bi' import { BsBodyText, BsCalendarDate, BsFileEarmarkImage, BsFiletypeMdx, BsLink45Deg, BsMenuButton, BsPercent } from 'react-icons/bs' import { TbTxt } from 'react-icons/tb' import { HiOutlineLightBulb } from 'react-icons/hi' import { TiSortNumerically } from 'react-icons/ti' import { MdOutlineFunctions, MdOutlineNumbers } from 'react-icons/md' import { FaIcons } from 'react-icons/fa' import { VscJson } from 'react-icons/vsc' import { RiLockPasswordLine } from 'react-icons/ri' import { CiRead } from 'react-icons/ci' import { IoIosArrowDropdown } from 'react-icons/io' import { PiSignatureLight } from 'react-icons/pi' import { LuText } from 'react-icons/lu' export type ICON_KEY = 'Autocomplete' | 'Attach' | 'Attach Image' | 'Barcode' | 'Button' | 'Check' | 'Code' | 'Color' | 'Currency' | 'Data' | 'Date' | 'Datetime' | 'Duration' | 'Dynamic Link' | 'Float' | 'Fold' | 'Geolocation' | 'Heading' | 'HTML' | 'HTML Editor' | 'Icon' | 'Image' | 'Int' | 'JSON' | 'Link' | 'Long Text' | 'Markdown Editor' | 'Password' | 'Percent' | 'Phone' | 'Read Only' | 'Rating' | 'Select' | 'Signature' | 'Small Text' | 'Table' | 'Table MultiSelect' | 'Text' | 'Text Editor' | 'Time' export const ICON_KEY_MAP: Record<ICON_KEY, IconType> = { 'Autocomplete': HiOutlineLightBulb as IconType, 'Attach': GrFormAttachment as IconType, 'Attach Image': AiFillFileImage as IconType, 'Barcode': BiBarcode as IconType, 'Button': BsMenuButton as IconType, 'Check': BiCheckboxChecked as IconType, 'Code': AiFillCode as IconType, 'Color': BiColorFill as IconType, 'Currency': GrCurrency as IconType, 'Data': TbTxt as IconType, 'Date': BsCalendarDate as IconType, 'Datetime': BsCalendarDate as IconType, 'Duration': BiStopwatch as IconType, 'Dynamic Link': BsLink45Deg as IconType, 'Float': TiSortNumerically as IconType, 'Fold': MdOutlineFunctions as IconType, 'Geolocation': BiCurrentLocation as IconType, 'Heading': BiHeading as IconType, 'HTML': AiOutlineHtml5 as IconType, 'HTML Editor': AiFillHtml5 as IconType, 'Icon': FaIcons as IconType, 'Image': BsFileEarmarkImage as IconType, 'Int': MdOutlineNumbers as IconType, 'JSON': VscJson as IconType, 'Link': AiOutlineLink as IconType, 'Long Text': BsBodyText as IconType, 'Markdown Editor': BsFiletypeMdx as IconType, 'Password': RiLockPasswordLine as IconType, 'Percent': BsPercent as IconType, 'Phone': AiOutlinePhone as IconType, 'Read Only': CiRead as IconType, 'Rating': AiOutlineStar as IconType, 'Select': IoIosArrowDropdown as IconType, 'Signature': PiSignatureLight as IconType, 'Small Text': LuText as IconType, 'Table': AiOutlineTable as IconType, 'Table MultiSelect': AiOutlineTable as IconType, 'Text': GrTextAlignFull as IconType, 'Text Editor': BiEdit as IconType, 'Time': BiTime as IconType, }
2302_79757062/commit
dashboard/src/components/common/Icons.ts
TypeScript
agpl-3.0
3,305
import { Accept } from "react-dropzone" import { useState } from "react" import { FrappeError, useFrappeFileUpload, useFrappePostCall } from "frappe-react-sdk" import { File } from "@/types/Core/File" import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@/components/ui/dialog" import { CustomFile } from "./ImageUploader" import { ErrorBanner } from "../ErrorBanner/ErrorBanner" import { Button } from "@/components/ui/button" import { SpinnerLoader } from "../FullPageLoader/SpinnerLoader" import { FileDrop } from "./FileDrop" export interface DocumentUploadModalProps { open: boolean, onClose: () => void, /** Triggered when the files are uploaded and the document is updated */ onUpdate?: (files: File[]) => void, doctype: string, docname: string, fieldname?: string, accept?: Accept, maxFileSize?: number maxFiles?: number } export const DocumentUploadModal = ({ open, onClose, onUpdate, doctype, docname, fieldname = 'image', accept, maxFileSize = 10000000, maxFiles = 10, ...props }: DocumentUploadModalProps) => { return ( <Dialog open={open} onOpenChange={onClose}> <DialogContent> <UploadModalContent doctype={doctype} docname={docname} fieldname={fieldname} accept={accept} maxFileSize={maxFileSize} maxFiles={maxFiles} onClose={onClose} onUpload={onUpdate} {...props} /> </DialogContent> </Dialog> ) } interface UploadModalContentProps { doctype: string, docname: string, fieldname?: string, accept?: Accept, maxFileSize?: number, maxFiles?: number onClose: () => void, onUpload?: (files: File[]) => void } const UploadModalContent = ({ doctype, docname, fieldname, maxFiles, accept, maxFileSize, onClose, onUpload, ...props }: UploadModalContentProps) => { const [files, setFiles] = useState<CustomFile[]>([]) const [fileErrors, setFileErrors] = useState<FrappeError[]>([]) const { upload, loading } = useFrappeFileUpload() const { call, loading: attachingLink } = useFrappePostCall('upload_file') const onFileChange = (newFiles: CustomFile[]) => { setFiles(newFiles) } const uploadFiles = async () => { const promises: Promise<File>[] = files.map(async (file: CustomFile) => { if (file.fileType === 'file') { // @ts-ignore return upload(file, { doctype: doctype, docname: docname, fieldname: fieldname, isPrivate: true, }).then(res => res) .catch((e) => { const serverMessage = JSON.parse(JSON.parse(e._server_messages)[0]) setFileErrors((e) => [...e, serverMessage]) throw e }) } else { return call({ doctype: doctype, docname: docname, fieldname: fieldname, file_name: file.fileName, file_url: file.fileURL, isPrivate: true, }).then(res => res.message) .catch((e) => { const serverMessage = JSON.parse(JSON.parse(e._server_messages)[0]) setFileErrors((e) => [...e, serverMessage]) throw e }) } }) await Promise.allSettled(promises).then((res) => { const fulfilledPromises: PromiseFulfilledResult<File>[] = res.filter((r) => r.status === 'fulfilled') as PromiseFulfilledResult<File>[] const rejectedPromises: PromiseRejectedResult[] = res.filter((r) => r.status === 'rejected') as PromiseRejectedResult[] const uploadedFiles = fulfilledPromises.map((r) => r.value) onUpload?.(uploadedFiles) if (rejectedPromises.length === 0) { onClose() } }) } const resetFilesAndErrors = () => { setFiles([]) setFileErrors([]) } return ( <> <DialogHeader>Upload</DialogHeader> <div> {fileErrors.length ? fileErrors?.map((e: any, index) => <ErrorBanner error={e} key={index} />) : <FileDrop files={files} onFileChange={onFileChange} maxFiles={maxFiles} accept={accept ? accept : { 'application/pdf': [], 'image/*': ['.jpeg', '.jpg', '.png'], 'text/csv': [], 'application/vnd.ms-excel': [], 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': [], 'application/octet-stream': ['.eml'], 'application/msword': ['.doc', '.docx'] }} maxFileSize={maxFileSize} showList {...props} />} </div> <DialogFooter> {fileErrors.length > 0 && <Button variant={'ghost'} onClick={resetFilesAndErrors}>Reset</Button>} <Button onClick={uploadFiles} disabled={attachingLink || loading || (files.length === 0) || (fileErrors.length > 0)}> {loading ? <div className="flex gap-2 items-center"> <SpinnerLoader /> Uploading </div> : 'Upload'} </Button> </DialogFooter> </> ) }
2302_79757062/commit
dashboard/src/components/common/ImageUploader2/DocumentUploadModal.tsx
TSX
agpl-3.0
5,692
import { Accept, useDropzone } from "react-dropzone" import { MdOutlineDevices } from "react-icons/md" import { useEffect, useState } from "react" import { CustomFile } from "./ImageUploader" import { useToast } from "@/components/ui/use-toast" import { Button } from "@/components/ui/button" import { TbTrash } from "react-icons/tb" import { FiFile, FiLink } from 'react-icons/fi' import { IoMdCheckmark } from "react-icons/io" export interface FileDropProps extends React.HTMLAttributes<HTMLDivElement> { /** Array of files */ files: CustomFile[], /** Function to set files in parent */ onFileChange: (files: CustomFile[]) => void, /** Option to show the list of files below the dropzone, Default: true */ showList?: boolean, /** Maximum no. of files that can be selected */ maxFiles?: number, /** Takes input MIME type as 'key' & array of extensions as 'value'; empty array - all extensions supported */ accept?: Accept, /** Boolean value that indicates that file upload has begun */ uploading?: boolean, /** Maximum file size in mb that can be selected */ maxFileSize?: number, /** Camera capture should available */ camera?: boolean /** Enable/Disable Link Attachment */ linkAttachment?: boolean } /** * File uploader with Drag 'n' Drop Zone * * It encompasses Box component, so all Box props can be used. */ export const FileDrop = ({ files, onFileChange, maxFiles = 1, uploading, accept, showList = true, maxFileSize, camera = false, linkAttachment = false, ...props }: FileDropProps) => { const { toast } = useToast() const [error, setError] = useState<{ code: string, message: string } | null>(null) const fileSizeValidator = (file: any) => { if (maxFileSize && file.size > maxFileSize * 1000000) { toast({ title: `Uh Oh! ${file.name} exceeded the maximum file size required.`, duration: 1500, }) return { code: "size-too-large", message: `File size is larger than the required size.` }; } else return null } const { getRootProps, getInputProps } = useDropzone({ onDrop: (receivedFiles, fileRejections) => { // @ts-expect-error onFileChange([...files, ...receivedFiles.map((file) => Object.assign(file, { fileID: file.name + Date.now(), fileType: 'file' }) as CustomFile)]) }, maxFiles: maxFiles ? maxFiles : 0, accept: accept ? accept : undefined, validator: fileSizeValidator, onDropRejected(fileRejections, event) { setError(fileRejections[0].errors[0]) }, onDropAccepted(files, event) { setError(null) }, }) const removeFile = (file: CustomFile) => { let newFiles = files.filter(f => f.fileID !== file.fileID) onFileChange(newFiles) } return ( <div className='flex flex-col items-center gap-4'> {(maxFiles === undefined || files.length < maxFiles) && ( <div className={`flex justify-center items-center rounded-lg h-28 ${uploading ? 'hidden' : 'flex'} ${error ? 'border-red-500 border-dashed' : 'border-gray-500 border-dashed'} border`} {...getRootProps()} onClick={() => { }} {...props}> <input type="file" {...getInputProps()} /> <div className="flex flex-col items-center space-y-2"> <p className="text-sm">Drag 'n' drop your files here.</p> <div className="flex space-x-4 items-center justify-center"> <button {...getRootProps()} className="flex items-center space-x-2 text-sm bg-transparent border-none"> <MdOutlineDevices size={20} /> <span>My Device</span> <input type="file" {...getInputProps()} /> </button> </div> </div> </div> )} { showList && files.length > 0 && ( <ul className="w-full"> {files.map((f: CustomFile) => <FileListItem key={f.fileID} file={f} isUploading={uploading} removeFile={() => removeFile(f)} />)} </ul> ) } </div> ) } export const getFileSize = (file: CustomFile) => { // @ts-expect-error return file.size / 1000 > 1000 ? <>{(file.size / 1000000).toFixed(2)} MB</> : <>{(file.size / 1000).toFixed(2)} KB</> } interface FileListItemProps extends React.HTMLAttributes<HTMLDivElement> { file: CustomFile, removeFile: VoidFunction, isUploading?: boolean } export const FileListItem = ({ file, removeFile, isUploading, ...props }: FileListItemProps) => { const previewURL = file.fileType === 'file' && useGetFilePreviewUrl(file) const fileSizeString = getFileSize(file) return ( <li className="flex items-center py-2 gap-4 w-full text-sm"> <div className="pl-1"> {previewURL ? ( <img src={previewURL} alt="File preview" className="h-8 w-8 rounded-md" /> ) : ( file.fileType === 'file' ? <FiFile className="h-6 w-6" /> : <FiLink className="h-6 w-6" /> )} </div> <span className="flex-1 truncate">{file.fileType === 'file' ? file.name : file.fileURL}</span> {file.fileType === 'file' && ( <span className="text-xs italic text-gray-400">{fileSizeString}</span> )} <div> {isUploading ? ( <IoMdCheckmark className="h-6 w-6 text-green-500" /> ) : ( <Button variant={'ghost'} size={'icon'} onClick={removeFile} className="text-red-500 hover:text-red-700"> <TbTrash className="h-6 w-6" /> </Button> )} </div> </li> ); } /** * Hook takes in a file and returns a blob URL for previewing the file if image * @param file * @returns File url */ export const useGetFilePreviewUrl = (file: CustomFile): string => { const [url, setUrl] = useState<string>("") useEffect(() => { let objectUrl = "" const validImageTypes = ['image/gif', 'image/jpeg', 'image/png', 'image/svg+xml', 'image/webp', 'image/jpg']; //Only create a URL for images // @ts-expect-error if (validImageTypes.includes(file.type)) { // create the preview // @ts-expect-error objectUrl = URL.createObjectURL(file) setUrl(objectUrl) } else { setUrl(objectUrl) } // free memory when ever this component is unmounted return () => { objectUrl && URL.revokeObjectURL(objectUrl) } }, [file]) return url }
2302_79757062/commit
dashboard/src/components/common/ImageUploader2/FileDrop.tsx
TSX
agpl-3.0
7,060
import { useFrappeUpdateDoc } from "frappe-react-sdk" import { Accept } from "react-dropzone" import { MdOutlineFileUpload } from 'react-icons/md' import { useState } from "react" import { useToast } from "@/components/ui/use-toast" import { File } from "@/types/Core/File" import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@/components/ui/dialog" import { DialogOverlay } from "@radix-ui/react-dialog" import { Button } from "@/components/ui/button" import { SpinnerLoader } from "../FullPageLoader/SpinnerLoader" import { DocumentUploadModal } from "./DocumentUploadModal" import { cn } from "@/lib/utils" import { useGetFilePreviewUrl } from "./FileDrop" /** * Custom File Type for FILE UPLOADER component; with 'fileID' for unique ID & 'preview' for blob URL. */ export type CustomFile = URLFile | NormalFile interface BaseFile { fileID: string, fileType: 'file' | 'url', } interface URLFile extends BaseFile { fileType: 'url', fileURL: string, fileName: string, } interface NormalFile extends File, BaseFile { fileType: 'file' } interface ImageUploaderProps extends React.HTMLAttributes<HTMLDivElement> { /** Array of files */ file: CustomFile | null, /** Doctype of the document */ doctype: string, /** Docname of the document */ docname: string, /** Refresh */ onUpdate: () => void, /** Takes input MIME type as 'key' & array of extensions as 'value'; empty array - all extensions supported */ accept?: Accept, /** Default file URL */ defaultFile?: string /** Maximum file size in mb that can be selected */ maxFileSize?: number, boxSize?: number, icon?: React.ReactNode, borderRadius?: string, /** * Fieldname of the file in the document. * Default: 'image' */ fieldname?: string } /** * File uploader with Drag 'n' Drop Zone * * It encompasses Box component, so all Box props can be used. */ export const ImageUploader = ({ file, doctype, docname, onUpdate, fieldname = 'image', icon, accept = { 'image/*': ['.jpeg', '.jpg', '.png'] }, maxFileSize, boxSize = 120, defaultFile, borderRadius = "50%", ...props }: ImageUploaderProps) => { const [isOpen, setOpen] = useState(false) const onOpen = () => setOpen(true) const onClose = () => setOpen(false) const [isDelete, setDelete] = useState(false) const onDeleteOpen = () => setDelete(true) const onDeleteClose = () => setDelete(false) const { updateDoc, error: updateDocError, loading: updatingDoc } = useFrappeUpdateDoc() const { toast } = useToast() const uploadImage = (files: File[]) => { if (files.length > 0) { updateDoc(doctype, docname, { [fieldname]: files[0]?.file_url }).then(() => { onUpdate() toast({ description: "Image uploaded successfully.", duration: 1500, }) }).catch(() => { toast({ title: `There was an error while uploading the image. ${updateDocError ? updateDocError.exception ?? updateDocError.httpStatusText : null}`, variant: 'destructive', duration: 1500, }) }) } } const deleteImage = () => { updateDoc(doctype, docname, { [fieldname]: null }).then(() => { onUpdate() toast({ title: "Image deleted successfully.", duration: 1500, }) }).catch(() => { toast({ title: `There was an error while deleting the image. ${updateDocError ? updateDocError.exception ?? updateDocError.httpStatusText : null}`, variant: 'destructive', duration: 1500, }) }) } return ( <div className='flex flex-col items-center gap-4'> {file || defaultFile ? <div className={`relative ${props.className} w-${boxSize} h-${boxSize} rounded-md`}> <div className="image-container group"> {file ? ( <ImagePreview file={file} size={boxSize} className="image group-hover:opacity-50" borderRadius={borderRadius} /> ) : ( <img src={defaultFile} className={`image w-${boxSize} h-${boxSize} object-cover rounded-${borderRadius} object-center group-hover:opacity-50`} alt={defaultFile} /> )} <div className="edit-button absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-hover:block hidden cursor-pointer"> <div onClick={onOpen} className="py-0.5"> <p className="text-sm underline">Change</p> </div> <div onClick={onDeleteOpen} className="py-0.5"> <p className="text-sm underline text-red-500">Remove</p> </div> </div> </div> </div> : updatingDoc ? <div className={cn(`w-${boxSize} h-${boxSize} rounded-md border border-dashed border-gray-400 flex items-center justify-center cursor-not-allowed`, props.className)}> <SpinnerLoader /> </div> : <div className={`h-${boxSize} aspect-square rounded-md border border-dashed border-gray-400 flex items-center justify-center cursor-pointer ${props.className}`} onClick={onOpen}> {icon ? icon : <MdOutlineFileUpload fontSize={40} />} </div>} <DocumentUploadModal open={isOpen} onClose={onClose} doctype={doctype} docname={docname} onUpdate={uploadImage} maxFiles={1} accept={accept} maxFileSize={maxFileSize} /> {deleteImage && <DeleteModal isOpen={isDelete} onClose={onDeleteClose} onDelete={deleteImage} />} </div> ) } export interface ImagePreviewProps extends React.HTMLAttributes<HTMLDivElement> { file: CustomFile, size: number, borderRadius: string } export const ImagePreview = ({ file, size, borderRadius = "50%", ...props }: ImagePreviewProps) => { const previewURL = file.fileType === 'file' ? useGetFilePreviewUrl(file) : '' return ( <img src={previewURL} alt={file.fileType === 'file' ? file.name : 'Image'} className={`object-cover rounded-md h-${size} w-${size} border-r-${borderRadius} ${props.className}`} /> ) } export const DeleteModal = ({ isOpen, onClose, onDelete }: { isOpen: boolean, onClose: () => void, onDelete: () => void }) => { const handleClose = () => { onDelete() onClose() } return ( <Dialog open={isOpen} onOpenChange={onClose}> <DialogOverlay /> <DialogContent> <DialogHeader>Delete</DialogHeader> <div className="text-md font-medium"> Are you sure you want to delete this image? </div> <DialogFooter> <div className="flex gap-2"> <Button variant='ghost' onClick={onClose}>Close</Button> <Button onClick={handleClose}>Delete</Button> </div> </DialogFooter> </DialogContent> </Dialog> ) }
2302_79757062/commit
dashboard/src/components/common/ImageUploader2/ImageUploader.tsx
TSX
agpl-3.0
7,480
import { FormLabel } from "@/components/ui/form" import { LabelProps } from "@radix-ui/react-label" interface FormLabelProps extends LabelProps { label: string } export const Label = ({ label, ...props }: FormLabelProps) => { return ( <FormLabel {...props}> {label} </FormLabel> ) }
2302_79757062/commit
dashboard/src/components/common/Label/Label.tsx
TSX
agpl-3.0
326
export { Label } from './Label'
2302_79757062/commit
dashboard/src/components/common/Label/index.ts
TypeScript
agpl-3.0
31
import React from 'react' import rehypeRaw from 'rehype-raw' import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' import './markdown.css' interface MarkdownRendererProps { content: string } export const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({ content }) => { return <ReactMarkdown remarkPlugins={[remarkGfm]} //@ts-expect-error rehype-raw types are not updated rehypePlugins={[rehypeRaw]} className='markdown'> {content} </ReactMarkdown> }
2302_79757062/commit
dashboard/src/components/common/MarkdownRenderer/MarkdownRenderer.tsx
TSX
agpl-3.0
533
.markdown { font-size: var(--chakra-fontSizes-sm) }
2302_79757062/commit
dashboard/src/components/common/MarkdownRenderer/markdown.css
CSS
agpl-3.0
55
import { useState } from "react" export interface TabProps { tabs: { name: string, content: JSX.Element }[], variant?: 'button' | 'underlined' } export const Tabs = ({ tabs, variant = 'underlined' }: TabProps) => { const [activeTabIndex, setActiveTabIndex] = useState(0) function classNames(...classes: string[]) { return classes.filter(Boolean).join(' ') } if (variant === 'button') { return ( <> <nav className="hidden lg:flex lg:space-x-4 lg:py-2" aria-label="Global"> {tabs.map((item, idx) => ( <a key={item.name} onClick={() => setActiveTabIndex(idx)} className={classNames( idx === activeTabIndex ? 'bg-gray-100 text-gray-900 cursor-pointer' : 'text-gray-900 hover:bg-gray-50 hover:text-gray-900 cursor-pointer', 'inline-flex items-center rounded-md py-1 px-3 text-sm font-medium cursor-pointer' )} aria-current={idx === activeTabIndex ? 'page' : undefined} > {item.name} </a> ))} </nav> <div className=""> {tabs[activeTabIndex].content} </div> </> ) } if (variant === 'underlined') { return ( <div> <div className="hidden sm:block"> <div className="border-b border-gray-200 space-x-8"> {tabs.map((tab, idx) => ( <button key={tab.name} onClick={() => setActiveTabIndex(idx)} className={classNames( idx === activeTabIndex ? 'border-blue-500 text-blue-500 cursor-pointer' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 cursor-pointer', 'whitespace-nowrap border-b-2 pb-1 px-1 text-sm font-medium cursor-pointer' )} aria-current={idx === activeTabIndex ? 'page' : undefined} > {tab.name} </button> ))} </div> </div> <div className="mt-2"> {tabs[activeTabIndex].content} </div> </div> ) } return null }
2302_79757062/commit
dashboard/src/components/common/Tabs.tsx
TSX
agpl-3.0
2,798
export const APIJSON = [ { "name": "retry_failing_transaction", "arguments": [ { "argument": "log_date", "type": "", "default": "None" } ], "def": "def retry_failing_transaction(log_date=None)", "def_index": 338, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 318, "file": "erpnext/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.py" }, { "name": "get_linked_material_requests", "arguments": [ { "argument": "items", "type": "", "default": "" } ], "def": "def get_linked_material_requests(items)", "def_index": 3689, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3669, "file": "erpnext/erpnext/buying/utils.py" }, { "name": "get_scoring_standing", "arguments": [ { "argument": "standing_name", "type": "", "default": "" } ], "def": "def get_scoring_standing(standing_name)", "def_index": 251, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 231, "file": "erpnext/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.py" }, { "name": "get_standings_list", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_standings_list()", "def_index": 405, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 385, "file": "erpnext/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.py" }, { "name": "get_criteria_list", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_criteria_list()", "def_index": 1074, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1054, "file": "erpnext/erpnext/buying/doctype/supplier_scorecard_criteria/supplier_scorecard_criteria.py" }, { "name": "make_purchase_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_purchase_order(source_name, target_doc=None)", "def_index": 3602, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3582, "file": "erpnext/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py" }, { "name": "make_purchase_invoice", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_purchase_invoice(source_name, target_doc=None)", "def_index": 4706, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4686, "file": "erpnext/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py" }, { "name": "make_quotation", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_quotation(source_name, target_doc=None)", "def_index": 5153, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5133, "file": "erpnext/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py" }, { "name": "get_last_purchase_rate", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_last_purchase_rate(self)", "def_index": 7947, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7926, "file": "erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py" }, { "name": "close_or_unclose_purchase_orders", "arguments": [ { "argument": "names", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def close_or_unclose_purchase_orders(names, status)", "def_index": 15214, "request_types": ['GET', 'POST', 'PUT'], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 15194, "file": "erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py" }, { "name": "make_purchase_receipt", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_purchase_receipt(source_name, target_doc=None)", "def_index": 15943, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 15923, "file": "erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py" }, { "name": "make_purchase_invoice", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_purchase_invoice(source_name, target_doc=None)", "def_index": 17276, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 17256, "file": "erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py" }, { "name": "make_purchase_invoice_from_portal", "arguments": [ { "argument": "purchase_order_name", "type": "", "default": "" } ], "def": "def make_purchase_invoice_from_portal(purchase_order_name)", "def_index": 17416, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 17396, "file": "erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py" }, { "name": "update_status", "arguments": [ { "argument": "status", "type": "", "default": "" }, { "argument": "name", "type": "", "default": "" } ], "def": "def update_status(status, name)", "def_index": 20124, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20104, "file": "erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py" }, { "name": "make_inter_company_sales_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_inter_company_sales_order(source_name, target_doc=None)", "def_index": 20292, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20272, "file": "erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py" }, { "name": "make_subcontracting_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_subcontracting_order(source_name, target_doc=None)", "def_index": 20560, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20540, "file": "erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py" }, { "name": "is_subcontracting_order_created", "arguments": [ { "argument": "po_name", "type": "", "default": "" } ], "def": "def is_subcontracting_order_created(po_name) -> bool", "def_index": 21886, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21866, "file": "erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py" }, { "name": "get_supplier_group_details", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_supplier_group_details(self)", "def_index": 2618, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2597, "file": "erpnext/erpnext/buying/doctype/supplier/supplier.py" }, { "name": "get_supplier_primary_contact", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_supplier_primary_contact(doctype, txt, searchfield, start, page_len, filters)", "def_index": 4756, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 4692, "file": "erpnext/erpnext/buying/doctype/supplier/supplier.py" }, { "name": "get_timeline_data", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "name", "type": "", "default": "" } ], "def": "def get_timeline_data(doctype, name)", "def_index": 3275, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3255, "file": "erpnext/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py" }, { "name": "make_all_scorecards", "arguments": [ { "argument": "docname", "type": "", "default": "" } ], "def": "def make_all_scorecards(docname)", "def_index": 4500, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4480, "file": "erpnext/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py" }, { "name": "get_supplier_email_preview", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "supplier", "type": "", "default": "" } ], "def": "def get_supplier_email_preview(self, supplier)", "def_index": 2882, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2861, "file": "erpnext/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py" }, { "name": "send_supplier_emails", "arguments": [ { "argument": "rfq_name", "type": "", "default": "" } ], "def": "def send_supplier_emails(rfq_name)", "def_index": 8701, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8681, "file": "erpnext/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py" }, { "name": "make_supplier_quotation_from_rfq", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" }, { "argument": "for_supplier", "type": "", "default": "None" } ], "def": "def make_supplier_quotation_from_rfq(source_name, target_doc=None, for_supplier=None)", "def_index": 9537, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9517, "file": "erpnext/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py" }, { "name": "create_supplier_quotation", "arguments": [ { "argument": "doc", "type": "", "default": "" } ], "def": "def create_supplier_quotation(doc)", "def_index": 10619, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10599, "file": "erpnext/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py" }, { "name": "get_pdf", "arguments": [ { "argument": "name", "type": "", "default": "" } ], "def": "def get_pdf(name", "def_index": 12209, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12189, "file": "erpnext/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py" }, { "name": "get_item_from_material_requests_based_on_supplier", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def get_item_from_material_requests_based_on_supplier(source_name, target_doc=None)", "def_index": 12659, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12639, "file": "erpnext/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py" }, { "name": "get_supplier_tag", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_supplier_tag()", "def_index": 14026, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 14006, "file": "erpnext/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py" }, { "name": "get_rfq_containing_supplier", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_rfq_containing_supplier(doctype, txt, searchfield, start, page_len, filters)", "def_index": 14281, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 14217, "file": "erpnext/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py" }, { "name": "get_product_filter_data", "arguments": [ { "argument": "query_args", "type": "", "default": "None" } ], "def": "def get_product_filter_data(query_args=None)", "def_index": 476, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 440, "file": "erpnext/erpnext/e_commerce/api.py" }, { "name": "get_guest_redirect_on_action", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_guest_redirect_on_action()", "def_index": 2401, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 2365, "file": "erpnext/erpnext/e_commerce/api.py" }, { "name": "get_attributes_and_values", "arguments": [ { "argument": "item_code", "type": "", "default": "" } ], "def": "def get_attributes_and_values(item_code)", "def_index": 1661, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 1625, "file": "erpnext/erpnext/e_commerce/variant_selector/utils.py" }, { "name": "get_next_attribute_and_values", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "selected_attributes", "type": "", "default": "" } ], "def": "def get_next_attribute_and_values(item_code, selected_attributes)", "def_index": 2885, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 2849, "file": "erpnext/erpnext/e_commerce/variant_selector/utils.py" }, { "name": "get_cart_quotation", "arguments": [ { "argument": "doc", "type": "", "default": "None" } ], "def": "def get_cart_quotation(doc=None)", "def_index": 1092, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1072, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "get_shipping_addresses", "arguments": [ { "argument": "party", "type": "", "default": "None" } ], "def": "def get_shipping_addresses(party=None)", "def_index": 1694, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1674, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "get_billing_addresses", "arguments": [ { "argument": "party", "type": "", "default": "None" } ], "def": "def get_billing_addresses(party=None)", "def_index": 2001, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1981, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "place_order", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def place_order()", "def_index": 2306, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2286, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "request_for_quotation", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def request_for_quotation()", "def_index": 3977, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3957, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "update_cart", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "qty", "type": "", "default": "" }, { "argument": "additional_notes", "type": "", "default": "None" }, { "argument": "with_items", "type": "", "default": "False" } ], "def": "def update_cart(item_code, qty, additional_notes=None, with_items=False)", "def_index": 4236, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4216, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "get_shopping_cart_menu", "arguments": [ { "argument": "context", "type": "", "default": "None" } ], "def": "def get_shopping_cart_menu(context=None)", "def_index": 5620, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5600, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "add_new_address", "arguments": [ { "argument": "doc", "type": "", "default": "" } ], "def": "def add_new_address(doc)", "def_index": 5821, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5801, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "create_lead_for_item_inquiry", "arguments": [ { "argument": "lead", "type": "", "default": "" }, { "argument": "subject", "type": "", "default": "" }, { "argument": "message", "type": "", "default": "" } ], "def": "def create_lead_for_item_inquiry(lead, subject, message)", "def_index": 6038, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 6002, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "get_terms_and_conditions", "arguments": [ { "argument": "terms_name", "type": "", "default": "" } ], "def": "def get_terms_and_conditions(terms_name)", "def_index": 6929, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6909, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "update_cart_address", "arguments": [ { "argument": "address_type", "type": "", "default": "" }, { "argument": "address_name", "type": "", "default": "" } ], "def": "def update_cart_address(address_type, address_name)", "def_index": 7066, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7046, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "apply_shipping_rule", "arguments": [ { "argument": "shipping_rule", "type": "", "default": "" } ], "def": "def apply_shipping_rule(shipping_rule)", "def_index": 16923, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 16903, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "apply_coupon_code", "arguments": [ { "argument": "applied_code", "type": "", "default": "" }, { "argument": "applied_referral_sales_partner", "type": "", "default": "" } ], "def": "def apply_coupon_code(applied_code, applied_referral_sales_partner)", "def_index": 19129, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 19093, "file": "erpnext/erpnext/e_commerce/shopping_cart/cart.py" }, { "name": "get_product_info_for_website", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "skip_quotation_creation", "type": "", "default": "False" } ], "def": "def get_product_info_for_website(item_code, skip_quotation_creation=False)", "def_index": 517, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 481, "file": "erpnext/erpnext/e_commerce/shopping_cart/product_info.py" }, { "name": "get_offer_details", "arguments": [ { "argument": "offer_id", "type": "", "default": "" } ], "def": "def get_offer_details(offer_id)", "def_index": 277, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 241, "file": "erpnext/erpnext/e_commerce/doctype/website_offer/website_offer.py" }, { "name": "get_item_reviews", "arguments": [ { "argument": "web_item", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "0" }, { "argument": "end", "type": "", "default": "10" }, { "argument": "data", "type": "", "default": "None" } ], "def": "def get_item_reviews(web_item, start=0, end=10, data=None)", "def_index": 935, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 915, "file": "erpnext/erpnext/e_commerce/doctype/item_review/item_review.py" }, { "name": "add_item_review", "arguments": [ { "argument": "web_item", "type": "", "default": "" }, { "argument": "title", "type": "", "default": "" }, { "argument": "rating", "type": "", "default": "" }, { "argument": "comment", "type": "", "default": "None" } ], "def": "def add_item_review(web_item, title, rating, comment=None)", "def_index": 2895, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2875, "file": "erpnext/erpnext/e_commerce/doctype/item_review/item_review.py" }, { "name": "copy_specification_from_item_group", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def copy_specification_from_item_group(self)", "def_index": 9505, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9484, "file": "erpnext/erpnext/e_commerce/doctype/website_item/website_item.py" }, { "name": "make_website_item", "arguments": [ { "argument": "doc", "type": "", "default": "" } ], "def": "def make_website_item(doc", "def_index": 12748, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12728, "file": "erpnext/erpnext/e_commerce/doctype/website_item/website_item.py" }, { "name": "is_cart_enabled", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def is_cart_enabled()", "def_index": 5826, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 5790, "file": "erpnext/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.py" }, { "name": "add_to_wishlist", "arguments": [ { "argument": "item_code", "type": "", "default": "" } ], "def": "def add_to_wishlist(item_code)", "def_index": 257, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 237, "file": "erpnext/erpnext/e_commerce/doctype/wishlist/wishlist.py" }, { "name": "remove_from_wishlist", "arguments": [ { "argument": "item_code", "type": "", "default": "" } ], "def": "def remove_from_wishlist(item_code)", "def_index": 1597, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1577, "file": "erpnext/erpnext/e_commerce/doctype/wishlist/wishlist.py" }, { "name": "get_funnel_data", "arguments": [ { "argument": "from_date", "type": "", "default": "" }, { "argument": "to_date", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def get_funnel_data(from_date, to_date, company)", "def_index": 526, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 506, "file": "erpnext/erpnext/selling/page/sales_funnel/sales_funnel.py" }, { "name": "get_opp_by_lead_source", "arguments": [ { "argument": "from_date", "type": "", "default": "" }, { "argument": "to_date", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def get_opp_by_lead_source(from_date, to_date, company)", "def_index": 1841, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1821, "file": "erpnext/erpnext/selling/page/sales_funnel/sales_funnel.py" }, { "name": "get_pipeline_data", "arguments": [ { "argument": "from_date", "type": "", "default": "" }, { "argument": "to_date", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def get_pipeline_data(from_date, to_date, company)", "def_index": 3287, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3267, "file": "erpnext/erpnext/selling/page/sales_funnel/sales_funnel.py" }, { "name": "get_items", "arguments": [ { "argument": "start", "type": "", "default": "" }, { "argument": "page_length", "type": "", "default": "" }, { "argument": "price_list", "type": "", "default": "" }, { "argument": "item_group", "type": "", "default": "" }, { "argument": "pos_profile", "type": "", "default": "" }, { "argument": "search_term", "type": "", "default": "" } ], "def": "def get_items(start, page_length, price_list, item_group, pos_profile, search_term=\"\")", "def_index": 2445, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2425, "file": "erpnext/erpnext/selling/page/point_of_sale/point_of_sale.py" }, { "name": "search_for_serial_or_batch_or_barcode_number", "arguments": [ { "argument": "search_value", "type": "", "default": "" } ], "def": "def search_for_serial_or_batch_or_barcode_number(search_value", "def_index": 5132, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5112, "file": "erpnext/erpnext/selling/page/point_of_sale/point_of_sale.py" }, { "name": "item_group_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def item_group_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 6195, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 6131, "file": "erpnext/erpnext/selling/page/point_of_sale/point_of_sale.py" }, { "name": "check_opening_entry", "arguments": [ { "argument": "user", "type": "", "default": "" } ], "def": "def check_opening_entry(user)", "def_index": 6795, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6775, "file": "erpnext/erpnext/selling/page/point_of_sale/point_of_sale.py" }, { "name": "create_opening_voucher", "arguments": [ { "argument": "pos_profile", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "balance_details", "type": "", "default": "" } ], "def": "def create_opening_voucher(pos_profile, company, balance_details)", "def_index": 7119, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7099, "file": "erpnext/erpnext/selling/page/point_of_sale/point_of_sale.py" }, { "name": "get_past_order_list", "arguments": [ { "argument": "search_term", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" }, { "argument": "limit", "type": "", "default": "20" } ], "def": "def get_past_order_list(search_term, status, limit=20)", "def_index": 7637, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7617, "file": "erpnext/erpnext/selling/page/point_of_sale/point_of_sale.py" }, { "name": "set_customer_info", "arguments": [ { "argument": "fieldname", "type": "", "default": "" }, { "argument": "customer", "type": "", "default": "" }, { "argument": "value", "type": "", "default": "" } ], "def": "def set_customer_info(fieldname, customer, value=\"\")", "def_index": 8432, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8412, "file": "erpnext/erpnext/selling/page/point_of_sale/point_of_sale.py" }, { "name": "get_pos_profile_data", "arguments": [ { "argument": "pos_profile", "type": "", "default": "" } ], "def": "def get_pos_profile_data(pos_profile)", "def_index": 9767, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9747, "file": "erpnext/erpnext/selling/page/point_of_sale/point_of_sale.py" }, { "name": "get_customers_or_items", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_customers_or_items(doctype, txt, searchfield, start, page_len, filters)", "def_index": 2100, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 2036, "file": "erpnext/erpnext/selling/report/payment_terms_status_for_sales_order/payment_terms_status_for_sales_order.py" }, { "name": "declare_enquiry_lost", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "lost_reasons_list", "type": "", "default": "" }, { "argument": "competitors", "type": "", "default": "" }, { "argument": "detailed_reason", "type": "", "default": "None" } ], "def": "def declare_enquiry_lost(self, lost_reasons_list, competitors, detailed_reason=None)", "def_index": 4693, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4672, "file": "erpnext/erpnext/selling/doctype/quotation/quotation.py" }, { "name": "make_sales_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" } ], "def": "def make_sales_order(source_name", "def_index": 7127, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7107, "file": "erpnext/erpnext/selling/doctype/quotation/quotation.py" }, { "name": "make_sales_invoice", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_sales_invoice(source_name, target_doc=None)", "def_index": 11747, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11727, "file": "erpnext/erpnext/selling/doctype/quotation/quotation.py" }, { "name": "get_new_item_code", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_new_item_code(doctype, txt, searchfield, start, page_len, filters)", "def_index": 2028, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 1964, "file": "erpnext/erpnext/selling/doctype/product_bundle/product_bundle.py" }, { "name": "create_stock_reservation_entries", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "items_details", "type": "", "default": "None" }, { "argument": "notify", "type": "", "default": "True" } ], "def": "def create_stock_reservation_entries(self, items_details=None, notify=True)", "def_index": 17691, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 17670, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "close_or_unclose_sales_orders", "arguments": [ { "argument": "names", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def close_or_unclose_sales_orders(names, status)", "def_index": 22753, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22733, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_material_request", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_material_request(source_name, target_doc=None)", "def_index": 23615, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 23595, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_project", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_project(source_name, target_doc=None)", "def_index": 25281, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 25261, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_delivery_note", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" }, { "argument": "skip_item_mapping", "type": "", "default": "False" } ], "def": "def make_delivery_note(source_name, target_doc=None, skip_item_mapping=False)", "def_index": 25792, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 25772, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_sales_invoice", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" }, { "argument": "ignore_permissions", "type": "", "default": "False" } ], "def": "def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False)", "def_index": 28114, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28094, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_maintenance_schedule", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_maintenance_schedule(source_name, target_doc=None)", "def_index": 31117, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 31097, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_maintenance_visit", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_maintenance_visit(source_name, target_doc=None)", "def_index": 31766, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 31746, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "get_events", "arguments": [ { "argument": "start", "type": "", "default": "" }, { "argument": "end", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "None" } ], "def": "def get_events(start, end, filters=None)", "def_index": 32474, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 32454, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_purchase_order_for_default_supplier", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "selected_items", "type": "", "default": "None" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_purchase_order_for_default_supplier(source_name, selected_items=None, target_doc=None)", "def_index": 33551, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 33531, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_purchase_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "selected_items", "type": "", "default": "None" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_purchase_order(source_name, selected_items=None, target_doc=None)", "def_index": 37388, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 37368, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_work_orders", "arguments": [ { "argument": "items", "type": "", "default": "" }, { "argument": "sales_order", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "project", "type": "", "default": "None" } ], "def": "def make_work_orders(items, sales_order, company, project=None)", "def_index": 41296, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 41276, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "update_status", "arguments": [ { "argument": "status", "type": "", "default": "" }, { "argument": "name", "type": "", "default": "" } ], "def": "def update_status(status, name)", "def_index": 42263, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 42243, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_raw_material_request", "arguments": [ { "argument": "items", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "sales_order", "type": "", "default": "" }, { "argument": "project", "type": "", "default": "None" } ], "def": "def make_raw_material_request(items, company, sales_order, project=None)", "def_index": 42386, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 42366, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "make_inter_company_purchase_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_inter_company_purchase_order(source_name, target_doc=None)", "def_index": 44201, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 44181, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "create_pick_list", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def create_pick_list(source_name, target_doc=None)", "def_index": 44469, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 44449, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "get_work_order_items", "arguments": [ { "argument": "sales_order", "type": "", "default": "" }, { "argument": "for_raw_material_request", "type": "", "default": "0" } ], "def": "def get_work_order_items(sales_order, for_raw_material_request=0)", "def_index": 46837, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 46817, "file": "erpnext/erpnext/selling/doctype/sales_order/sales_order.py" }, { "name": "create_receiver_list", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def create_receiver_list(self)", "def_index": 365, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 344, "file": "erpnext/erpnext/selling/doctype/sms_center/sms_center.py" }, { "name": "send_sms", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def send_sms(self)", "def_index": 3074, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3053, "file": "erpnext/erpnext/selling/doctype/sms_center/sms_center.py" }, { "name": "get_customer_group_details", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_customer_group_details(self)", "def_index": 3225, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3204, "file": "erpnext/erpnext/selling/doctype/customer/customer.py" }, { "name": "make_quotation", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_quotation(source_name, target_doc=None)", "def_index": 10102, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10082, "file": "erpnext/erpnext/selling/doctype/customer/customer.py" }, { "name": "make_opportunity", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_opportunity(source_name, target_doc=None)", "def_index": 10869, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10849, "file": "erpnext/erpnext/selling/doctype/customer/customer.py" }, { "name": "get_loyalty_programs", "arguments": [ { "argument": "doc", "type": "", "default": "" } ], "def": "def get_loyalty_programs(doc)", "def_index": 11801, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11781, "file": "erpnext/erpnext/selling/doctype/customer/customer.py" }, { "name": "send_emails", "arguments": [ { "argument": "args", "type": "", "default": "" } ], "def": "def send_emails(args)", "def_index": 15068, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 15048, "file": "erpnext/erpnext/selling/doctype/customer/customer.py" }, { "name": "get_customer_primary_contact", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_customer_primary_contact(doctype, txt, searchfield, start, page_len, filters)", "def_index": 20428, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 20364, "file": "erpnext/erpnext/selling/doctype/customer/customer.py" }, { "name": "set_parameters", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def set_parameters(self)", "def_index": 235, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 214, "file": "erpnext/erpnext/quality_management/doctype/quality_feedback/quality_feedback.py" }, { "name": "get_children", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "None" }, { "argument": "parent_quality_procedure", "type": "", "default": "None" }, { "argument": "is_root", "type": "", "default": "False" } ], "def": "def get_children(doctype, parent=None, parent_quality_procedure=None, is_root=False)", "def_index": 2006, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1986, "file": "erpnext/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py" }, { "name": "add_node", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def add_node()", "def_index": 2668, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2648, "file": "erpnext/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py" }, { "name": "query_task", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def query_task(doctype, txt, searchfield, start, page_len, filters)", "def_index": 260, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 196, "file": "erpnext/erpnext/projects/utils.py" }, { "name": "daily_reminder", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def daily_reminder()", "def_index": 239, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 219, "file": "erpnext/erpnext/projects/doctype/project_update/project_update.py" }, { "name": "get_users_for_project", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_users_for_project(doctype, txt, searchfield, start, page_len, filters)", "def_index": 11550, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 11486, "file": "erpnext/erpnext/projects/doctype/project/project.py" }, { "name": "get_cost_center_name", "arguments": [ { "argument": "project", "type": "", "default": "" } ], "def": "def get_cost_center_name(project)", "def_index": 12431, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12411, "file": "erpnext/erpnext/projects/doctype/project/project.py" }, { "name": "create_duplicate_project", "arguments": [ { "argument": "prev_doc", "type": "", "default": "" }, { "argument": "project_name", "type": "", "default": "" } ], "def": "def create_duplicate_project(prev_doc, project_name)", "def_index": 14407, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 14387, "file": "erpnext/erpnext/projects/doctype/project/project.py" }, { "name": "create_kanban_board_if_not_exists", "arguments": [ { "argument": "project", "type": "", "default": "" } ], "def": "def create_kanban_board_if_not_exists(project)", "def_index": 19045, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 19025, "file": "erpnext/erpnext/projects/doctype/project/project.py" }, { "name": "set_project_status", "arguments": [ { "argument": "project", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def set_project_status(project, status)", "def_index": 19393, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 19373, "file": "erpnext/erpnext/projects/doctype/project/project.py" }, { "name": "check_if_child_exists", "arguments": [ { "argument": "name", "type": "", "default": "" } ], "def": "def check_if_child_exists(name)", "def_index": 8128, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8108, "file": "erpnext/erpnext/projects/doctype/task/task.py" }, { "name": "get_project", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_project(doctype, txt, searchfield, start, page_len, filters)", "def_index": 8393, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 8329, "file": "erpnext/erpnext/projects/doctype/task/task.py" }, { "name": "set_multiple_status", "arguments": [ { "argument": "names", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def set_multiple_status(names, status)", "def_index": 9193, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9173, "file": "erpnext/erpnext/projects/doctype/task/task.py" }, { "name": "make_timesheet", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" }, { "argument": "ignore_permissions", "type": "", "default": "False" } ], "def": "def make_timesheet(source_name, target_doc=None, ignore_permissions=False)", "def_index": 9726, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9706, "file": "erpnext/erpnext/projects/doctype/task/task.py" }, { "name": "get_children", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "" }, { "argument": "task", "type": "", "default": "None" }, { "argument": "project", "type": "", "default": "None" }, { "argument": "is_root", "type": "", "default": "False" } ], "def": "def get_children(doctype, parent, task=None, project=None, is_root=False)", "def_index": 10290, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10270, "file": "erpnext/erpnext/projects/doctype/task/task.py" }, { "name": "add_node", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def add_node()", "def_index": 10885, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10865, "file": "erpnext/erpnext/projects/doctype/task/task.py" }, { "name": "add_multiple_tasks", "arguments": [ { "argument": "data", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "" } ], "def": "def add_multiple_tasks(data, parent)", "def_index": 11201, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11181, "file": "erpnext/erpnext/projects/doctype/task/task.py" }, { "name": "get_projectwise_timesheet_data", "arguments": [ { "argument": "project", "type": "", "default": "None" }, { "argument": "parent", "type": "", "default": "None" }, { "argument": "from_time", "type": "", "default": "None" }, { "argument": "to_time", "type": "", "default": "None" } ], "def": "def get_projectwise_timesheet_data(project=None, parent=None, from_time=None, to_time=None)", "def_index": 8202, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8182, "file": "erpnext/erpnext/projects/doctype/timesheet/timesheet.py" }, { "name": "get_timesheet_detail_rate", "arguments": [ { "argument": "timelog", "type": "", "default": "" }, { "argument": "currency", "type": "", "default": "" } ], "def": "def get_timesheet_detail_rate(timelog, currency)", "def_index": 9327, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9307, "file": "erpnext/erpnext/projects/doctype/timesheet/timesheet.py" }, { "name": "get_timesheet", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_timesheet(doctype, txt, searchfield, start, page_len, filters)", "def_index": 9902, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 9838, "file": "erpnext/erpnext/projects/doctype/timesheet/timesheet.py" }, { "name": "get_timesheet_data", "arguments": [ { "argument": "name", "type": "", "default": "" }, { "argument": "project", "type": "", "default": "" } ], "def": "def get_timesheet_data(name, project)", "def_index": 10620, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10600, "file": "erpnext/erpnext/projects/doctype/timesheet/timesheet.py" }, { "name": "make_sales_invoice", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "item_code", "type": "", "default": "None" }, { "argument": "customer", "type": "", "default": "None" }, { "argument": "currency", "type": "", "default": "None" } ], "def": "def make_sales_invoice(source_name, item_code=None, customer=None, currency=None)", "def_index": 11206, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11186, "file": "erpnext/erpnext/projects/doctype/timesheet/timesheet.py" }, { "name": "get_activity_cost", "arguments": [ { "argument": "employee", "type": "", "default": "None" }, { "argument": "activity_type", "type": "", "default": "None" }, { "argument": "currency", "type": "", "default": "None" } ], "def": "def get_activity_cost(employee=None, activity_type=None, currency=None)", "def_index": 12744, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12724, "file": "erpnext/erpnext/projects/doctype/timesheet/timesheet.py" }, { "name": "get_events", "arguments": [ { "argument": "start", "type": "", "default": "" }, { "argument": "end", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "None" } ], "def": "def get_events(start, end, filters=None)", "def_index": 13512, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 13492, "file": "erpnext/erpnext/projects/doctype/timesheet/timesheet.py" }, { "name": "get_open_activities", "arguments": [ { "argument": "ref_doctype", "type": "", "default": "" }, { "argument": "ref_docname", "type": "", "default": "" } ], "def": "def get_open_activities(ref_doctype, ref_docname)", "def_index": 4038, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4018, "file": "erpnext/erpnext/crm/utils.py" }, { "name": "add_note", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "note", "type": "", "default": "" } ], "def": "def add_note(self, note)", "def_index": 5701, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5680, "file": "erpnext/erpnext/crm/utils.py" }, { "name": "edit_note", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "note", "type": "", "default": "" }, { "argument": "row_id", "type": "", "default": "" } ], "def": "def edit_note(self, note, row_id)", "def_index": 5904, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5883, "file": "erpnext/erpnext/crm/utils.py" }, { "name": "delete_note", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "row_id", "type": "", "default": "" } ], "def": "def delete_note(self, row_id)", "def_index": 6051, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6030, "file": "erpnext/erpnext/crm/utils.py" }, { "name": "get_last_interaction", "arguments": [ { "argument": "contact", "type": "", "default": "None" }, { "argument": "lead", "type": "", "default": "None" } ], "def": "def get_last_interaction(contact=None, lead=None)", "def_index": 36, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 16, "file": "erpnext/erpnext/crm/doctype/utils.py" }, { "name": "get_contract_template", "arguments": [ { "argument": "template_name", "type": "", "default": "" }, { "argument": "doc", "type": "", "default": "" } ], "def": "def get_contract_template(template_name, doc)", "def_index": 387, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 367, "file": "erpnext/erpnext/crm/doctype/contract_template/contract_template.py" }, { "name": "declare_enquiry_lost", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "lost_reasons_list", "type": "", "default": "" }, { "argument": "competitors", "type": "", "default": "" }, { "argument": "detailed_reason", "type": "", "default": "None" } ], "def": "def declare_enquiry_lost(self, lost_reasons_list, competitors, detailed_reason=None)", "def_index": 5433, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5412, "file": "erpnext/erpnext/crm/doctype/opportunity/opportunity.py" }, { "name": "get_item_details", "arguments": [ { "argument": "item_code", "type": "", "default": "" } ], "def": "def get_item_details(item_code)", "def_index": 8188, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8168, "file": "erpnext/erpnext/crm/doctype/opportunity/opportunity.py" }, { "name": "make_quotation", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_quotation(source_name, target_doc=None)", "def_index": 8713, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8693, "file": "erpnext/erpnext/crm/doctype/opportunity/opportunity.py" }, { "name": "make_request_for_quotation", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_request_for_quotation(source_name, target_doc=None)", "def_index": 10118, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10098, "file": "erpnext/erpnext/crm/doctype/opportunity/opportunity.py" }, { "name": "make_customer", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_customer(source_name, target_doc=None)", "def_index": 10640, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10620, "file": "erpnext/erpnext/crm/doctype/opportunity/opportunity.py" }, { "name": "make_supplier_quotation", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_supplier_quotation(source_name, target_doc=None)", "def_index": 11135, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11115, "file": "erpnext/erpnext/crm/doctype/opportunity/opportunity.py" }, { "name": "set_multiple_status", "arguments": [ { "argument": "names", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def set_multiple_status(names, status)", "def_index": 11507, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11487, "file": "erpnext/erpnext/crm/doctype/opportunity/opportunity.py" }, { "name": "make_opportunity_from_communication", "arguments": [ { "argument": "communication", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "ignore_communication_links", "type": "", "default": "False" } ], "def": "def make_opportunity_from_communication(communication, company, ignore_communication_links=False)", "def_index": 12338, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12318, "file": "erpnext/erpnext/crm/doctype/opportunity/opportunity.py" }, { "name": "make_customer", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_customer(source_name, target_doc=None)", "def_index": 1885, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1865, "file": "erpnext/erpnext/crm/doctype/prospect/prospect.py" }, { "name": "make_opportunity", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_opportunity(source_name, target_doc=None)", "def_index": 2456, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2436, "file": "erpnext/erpnext/crm/doctype/prospect/prospect.py" }, { "name": "get_opportunities", "arguments": [ { "argument": "prospect", "type": "", "default": "" } ], "def": "def get_opportunities(prospect)", "def_index": 3028, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3008, "file": "erpnext/erpnext/crm/doctype/prospect/prospect.py" }, { "name": "get_authorization_url", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_authorization_url(self)", "def_index": 402, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 381, "file": "erpnext/erpnext/crm/doctype/linkedin_settings/linkedin_settings.py" }, { "name": "callback", "arguments": [ { "argument": "code", "type": "", "default": "None" }, { "argument": "error", "type": "", "default": "None" }, { "argument": "error_description", "type": "", "default": "None" } ], "def": "def callback(code=None, error=None, error_description=None)", "def_index": 6225, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 6189, "file": "erpnext/erpnext/crm/doctype/linkedin_settings/linkedin_settings.py" }, { "name": "create_prospect_and_contact", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "data", "type": "", "default": "" } ], "def": "def create_prospect_and_contact(self, data)", "def_index": 4981, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4960, "file": "erpnext/erpnext/crm/doctype/lead/lead.py" }, { "name": "make_customer", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_customer(source_name, target_doc=None)", "def_index": 7029, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7009, "file": "erpnext/erpnext/crm/doctype/lead/lead.py" }, { "name": "make_opportunity", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_opportunity(source_name, target_doc=None)", "def_index": 7911, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7891, "file": "erpnext/erpnext/crm/doctype/lead/lead.py" }, { "name": "make_quotation", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_quotation(source_name, target_doc=None)", "def_index": 8567, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8547, "file": "erpnext/erpnext/crm/doctype/lead/lead.py" }, { "name": "get_lead_details", "arguments": [ { "argument": "lead", "type": "", "default": "" }, { "argument": "posting_date", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" } ], "def": "def get_lead_details(lead, posting_date=None, company=None)", "def_index": 9595, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9575, "file": "erpnext/erpnext/crm/doctype/lead/lead.py" }, { "name": "make_lead_from_communication", "arguments": [ { "argument": "communication", "type": "", "default": "" }, { "argument": "ignore_communication_links", "type": "", "default": "False" } ], "def": "def make_lead_from_communication(communication, ignore_communication_links=False)", "def_index": 10430, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10410, "file": "erpnext/erpnext/crm/doctype/lead/lead.py" }, { "name": "add_lead_to_prospect", "arguments": [ { "argument": "lead", "type": "", "default": "" }, { "argument": "prospect", "type": "", "default": "" } ], "def": "def add_lead_to_prospect(lead, prospect)", "def_index": 11593, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11573, "file": "erpnext/erpnext/crm/doctype/lead/lead.py" }, { "name": "delete_post", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def delete_post(self)", "def_index": 939, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 918, "file": "erpnext/erpnext/crm/doctype/social_media_post/social_media_post.py" }, { "name": "get_post", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_post(self)", "def_index": 1308, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1287, "file": "erpnext/erpnext/crm/doctype/social_media_post/social_media_post.py" }, { "name": "post", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def post(self)", "def_index": 1706, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1685, "file": "erpnext/erpnext/crm/doctype/social_media_post/social_media_post.py" }, { "name": "get_authorize_url", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_authorize_url(self)", "def_index": 412, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 391, "file": "erpnext/erpnext/crm/doctype/twitter_settings/twitter_settings.py" }, { "name": "callback", "arguments": [ { "argument": "oauth_token", "type": "", "default": "None" }, { "argument": "oauth_verifier", "type": "", "default": "None" } ], "def": "def callback(oauth_token=None, oauth_verifier=None)", "def_index": 3726, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 3690, "file": "erpnext/erpnext/crm/doctype/twitter_settings/twitter_settings.py" }, { "name": "get_exchange_rate", "arguments": [ { "argument": "from_currency", "type": "", "default": "" }, { "argument": "to_currency", "type": "", "default": "" }, { "argument": "transaction_date", "type": "", "default": "None" }, { "argument": "args", "type": "", "default": "None" } ], "def": "def get_exchange_rate(from_currency, to_currency, transaction_date=None, args=None)", "def_index": 1255, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1235, "file": "erpnext/erpnext/setup/utils.py" }, { "name": "get_weekly_off_dates", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_weekly_off_dates(self)", "def_index": 478, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 457, "file": "erpnext/erpnext/setup/doctype/holiday_list/holiday_list.py" }, { "name": "clear_table", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def clear_table(self)", "def_index": 2067, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2046, "file": "erpnext/erpnext/setup/doctype/holiday_list/holiday_list.py" }, { "name": "get_events", "arguments": [ { "argument": "start", "type": "", "default": "" }, { "argument": "end", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "None" } ], "def": "def get_events(start, end, filters=None)", "def_index": 2139, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2119, "file": "erpnext/erpnext/setup/doctype/holiday_list/holiday_list.py" }, { "name": "get_terms_and_conditions", "arguments": [ { "argument": "template_name", "type": "", "default": "" }, { "argument": "doc", "type": "", "default": "" } ], "def": "def get_terms_and_conditions(template_name, doc)", "def_index": 633, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 613, "file": "erpnext/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py" }, { "name": "get_children", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "is_root", "type": "", "default": "False" } ], "def": "def get_children(doctype, parent=None, company=None, is_root=False)", "def_index": 1424, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1404, "file": "erpnext/erpnext/setup/doctype/department/department.py" }, { "name": "add_node", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def add_node()", "def_index": 1873, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1853, "file": "erpnext/erpnext/setup/doctype/department/department.py" }, { "name": "get_party_type", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_party_type(doctype, txt, searchfield, start, page_len, filters)", "def_index": 269, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 205, "file": "erpnext/erpnext/setup/doctype/party_type/party_type.py" }, { "name": "get_users", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_users(self)", "def_index": 1014, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 993, "file": "erpnext/erpnext/setup/doctype/email_digest/email_digest.py" }, { "name": "send", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def send(self)", "def_index": 1584, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1563, "file": "erpnext/erpnext/setup/doctype/email_digest/email_digest.py" }, { "name": "get_digest_msg", "arguments": [ { "argument": "name", "type": "", "default": "" } ], "def": "def get_digest_msg(name)", "def_index": 27384, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 27364, "file": "erpnext/erpnext/setup/doctype/email_digest/email_digest.py" }, { "name": "deactivate_sales_person", "arguments": [ { "argument": "status", "type": "", "default": "None" }, { "argument": "employee", "type": "", "default": "None" } ], "def": "def deactivate_sales_person(status=None, employee=None)", "def_index": 9443, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9423, "file": "erpnext/erpnext/setup/doctype/employee/employee.py" }, { "name": "create_user", "arguments": [ { "argument": "employee", "type": "", "default": "" }, { "argument": "user", "type": "", "default": "None" }, { "argument": "email", "type": "", "default": "None" } ], "def": "def create_user(employee, user=None, email=None)", "def_index": 9707, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9687, "file": "erpnext/erpnext/setup/doctype/employee/employee.py" }, { "name": "get_children", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "is_root", "type": "", "default": "False" }, { "argument": "is_tree", "type": "", "default": "False" } ], "def": "def get_children(doctype, parent=None, company=None, is_root=False, is_tree=False)", "def_index": 11562, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11542, "file": "erpnext/erpnext/setup/doctype/employee/employee.py" }, { "name": "get_doctypes_to_be_ignored", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_doctypes_to_be_ignored()", "def_index": 7215, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7195, "file": "erpnext/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py" }, { "name": "get_defaults", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_defaults(self)", "def_index": 1641, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1620, "file": "erpnext/erpnext/setup/doctype/global_defaults/global_defaults.py" }, { "name": "check_if_transactions_exist", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def check_if_transactions_exist(self)", "def_index": 918, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 897, "file": "erpnext/erpnext/setup/doctype/company/company.py" }, { "name": "create_default_tax_template", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def create_default_tax_template(self)", "def_index": 2237, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2216, "file": "erpnext/erpnext/setup/doctype/company/company.py" }, { "name": "get_children", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "is_root", "type": "", "default": "False" } ], "def": "def get_children(doctype, parent=None, company=None, is_root=False)", "def_index": 21222, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21202, "file": "erpnext/erpnext/setup/doctype/company/company.py" }, { "name": "add_node", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def add_node()", "def_index": 21604, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21584, "file": "erpnext/erpnext/setup/doctype/company/company.py" }, { "name": "get_default_company_address", "arguments": [ { "argument": "name", "type": "", "default": "" }, { "argument": "sort_key", "type": "", "default": "is_primary_address" }, { "argument": "existing_address", "type": "", "default": "None" } ], "def": "def get_default_company_address(name, sort_key=\"is_primary_address\", existing_address=None)", "def_index": 23438, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 23418, "file": "erpnext/erpnext/setup/doctype/company/company.py" }, { "name": "create_transaction_deletion_request", "arguments": [ { "argument": "company", "type": "", "default": "" } ], "def": "def create_transaction_deletion_request(company)", "def_index": 24107, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 24087, "file": "erpnext/erpnext/setup/doctype/company/company.py" }, { "name": "get_work_orders", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_work_orders(doctype, txt, searchfield, start, page_len, filters)", "def_index": 2230, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 2166, "file": "erpnext/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.py" }, { "name": "set_data_based_on_workstation_type", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def set_data_based_on_workstation_type(self)", "def_index": 902, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 881, "file": "erpnext/erpnext/manufacturing/doctype/workstation/workstation.py" }, { "name": "get_default_holiday_list", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_default_holiday_list()", "def_index": 3056, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3036, "file": "erpnext/erpnext/manufacturing/doctype/workstation/workstation.py" }, { "name": "get_routing", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_routing(self)", "def_index": 6963, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6942, "file": "erpnext/erpnext/manufacturing/doctype/bom/bom.py" }, { "name": "get_bom_material_detail", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "args", "type": "", "default": "None" } ], "def": "def get_bom_material_detail(self, args=None)", "def_index": 8699, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8678, "file": "erpnext/erpnext/manufacturing/doctype/bom/bom.py" }, { "name": "update_cost", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "update_parent", "type": "", "default": "True" }, { "argument": "from_child_bom", "type": "", "default": "False" }, { "argument": "update_hour_rate", "type": "", "default": "True" }, { "argument": "save", "type": "", "default": "True" } ], "def": "def update_cost(self, update_parent=True, from_child_bom=False, update_hour_rate=True, save=True)", "def_index": 11528, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11507, "file": "erpnext/erpnext/manufacturing/doctype/bom/bom.py" }, { "name": "get_bom_items", "arguments": [ { "argument": "bom", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "qty", "type": "", "default": "1" }, { "argument": "fetch_exploded", "type": "", "default": "1" } ], "def": "def get_bom_items(bom, company, qty=1, fetch_exploded=1)", "def_index": 35286, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 35266, "file": "erpnext/erpnext/manufacturing/doctype/bom/bom.py" }, { "name": "get_children", "arguments": [ { "argument": "parent", "type": "", "default": "None" }, { "argument": "is_root", "type": "", "default": "False" }, { "argument": "**filters", "type": "", "default": "" } ], "def": "def get_children(parent=None, is_root=False, **filters)", "def_index": 36429, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 36409, "file": "erpnext/erpnext/manufacturing/doctype/bom/bom.py" }, { "name": "get_bom_diff", "arguments": [ { "argument": "bom1", "type": "", "default": "" }, { "argument": "bom2", "type": "", "default": "" } ], "def": "def get_bom_diff(bom1, bom2)", "def_index": 39941, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 39921, "file": "erpnext/erpnext/manufacturing/doctype/bom/bom.py" }, { "name": "item_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def item_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 41469, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 41405, "file": "erpnext/erpnext/manufacturing/doctype/bom/bom.py" }, { "name": "make_variant_bom", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "bom_no", "type": "", "default": "" }, { "argument": "item", "type": "", "default": "" }, { "argument": "variant_items", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_variant_bom(source_name, bom_no, item, variant_items, target_doc=None)", "def_index": 42965, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 42945, "file": "erpnext/erpnext/manufacturing/doctype/bom/bom.py" }, { "name": "get_required_items", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_required_items(self)", "def_index": 14647, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 14626, "file": "erpnext/erpnext/manufacturing/doctype/job_card/job_card.py" }, { "name": "make_time_log", "arguments": [ { "argument": "args", "type": "", "default": "" } ], "def": "def make_time_log(args)", "def_index": 28413, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28393, "file": "erpnext/erpnext/manufacturing/doctype/job_card/job_card.py" }, { "name": "get_operation_details", "arguments": [ { "argument": "work_order", "type": "", "default": "" }, { "argument": "operation", "type": "", "default": "" } ], "def": "def get_operation_details(work_order, operation)", "def_index": 28645, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28625, "file": "erpnext/erpnext/manufacturing/doctype/job_card/job_card.py" }, { "name": "get_operations", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_operations(doctype, txt, searchfield, start, page_len, filters)", "def_index": 28889, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28869, "file": "erpnext/erpnext/manufacturing/doctype/job_card/job_card.py" }, { "name": "make_material_request", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_material_request(source_name, target_doc=None)", "def_index": 29398, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 29378, "file": "erpnext/erpnext/manufacturing/doctype/job_card/job_card.py" }, { "name": "make_stock_entry", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_stock_entry(source_name, target_doc=None)", "def_index": 30085, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 30065, "file": "erpnext/erpnext/manufacturing/doctype/job_card/job_card.py" }, { "name": "get_job_details", "arguments": [ { "argument": "start", "type": "", "default": "" }, { "argument": "end", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "None" } ], "def": "def get_job_details(start, end, filters=None)", "def_index": 31792, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 31772, "file": "erpnext/erpnext/manufacturing/doctype/job_card/job_card.py" }, { "name": "make_corrective_job_card", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "operation", "type": "", "default": "None" }, { "argument": "for_operation", "type": "", "default": "None" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_corrective_job_card(source_name, operation=None, for_operation=None, target_doc=None)", "def_index": 32975, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 32955, "file": "erpnext/erpnext/manufacturing/doctype/job_card/job_card.py" }, { "name": "get_items_and_operations_from_bom", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_items_and_operations_from_bom(self)", "def_index": 27175, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 27154, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "make_bom", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def make_bom(self)", "def_index": 31536, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 31515, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "get_bom_operations", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_bom_operations(doctype, txt, searchfield, start, page_len, filters)", "def_index": 32308, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 32244, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "get_item_details", "arguments": [ { "argument": "item", "type": "", "default": "" }, { "argument": "project", "type": "", "default": "None" }, { "argument": "skip_bom_info", "type": "", "default": "False" } ], "def": "def get_item_details(item, project=None, skip_bom_info=False)", "def_index": 32557, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 32537, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "make_work_order", "arguments": [ { "argument": "bom_no", "type": "", "default": "" }, { "argument": "item", "type": "", "default": "" }, { "argument": "qty", "type": "", "default": "0" }, { "argument": "project", "type": "", "default": "None" }, { "argument": "variant_items", "type": "", "default": "None" } ], "def": "def make_work_order(bom_no, item, qty=0, project=None, variant_items=None)", "def_index": 33966, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 33946, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "check_if_scrap_warehouse_mandatory", "arguments": [ { "argument": "bom_no", "type": "", "default": "" } ], "def": "def check_if_scrap_warehouse_mandatory(bom_no)", "def_index": 35696, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 35676, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "set_work_order_ops", "arguments": [ { "argument": "name", "type": "", "default": "" } ], "def": "def set_work_order_ops(name)", "def_index": 35942, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 35922, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "make_stock_entry", "arguments": [ { "argument": "work_order_id", "type": "", "default": "" }, { "argument": "purpose", "type": "", "default": "" }, { "argument": "qty", "type": "", "default": "None" } ], "def": "def make_stock_entry(work_order_id, purpose, qty=None)", "def_index": 36078, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 36058, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "get_default_warehouse", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_default_warehouse()", "def_index": 37370, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 37350, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "stop_unstop", "arguments": [ { "argument": "work_order", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def stop_unstop(work_order, status)", "def_index": 37630, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 37610, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "query_sales_order", "arguments": [ { "argument": "production_item", "type": "", "default": "" } ], "def": "def query_sales_order(production_item)", "def_index": 38197, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 38177, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "make_job_card", "arguments": [ { "argument": "work_order", "type": "", "default": "" }, { "argument": "operations", "type": "", "default": "" } ], "def": "def make_job_card(work_order, operations)", "def_index": 38668, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 38648, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "close_work_order", "arguments": [ { "argument": "work_order", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def close_work_order(work_order, status)", "def_index": 39125, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 39105, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "create_pick_list", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" }, { "argument": "for_qty", "type": "", "default": "None" } ], "def": "def create_pick_list(source_name, target_doc=None, for_qty=None)", "def_index": 43011, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 42991, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "make_stock_return_entry", "arguments": [ { "argument": "work_order", "type": "", "default": "" } ], "def": "def make_stock_return_entry(work_order)", "def_index": 45185, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 45165, "file": "erpnext/erpnext/manufacturing/doctype/work_order/work_order.py" }, { "name": "enqueue_replace_bom", "arguments": [ { "argument": "boms", "type": "", "default": "" } ], "def": "def enqueue_replace_bom(boms", "def_index": 421, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 401, "file": "erpnext/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py" }, { "name": "enqueue_update_cost", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def enqueue_update_cost() -> \"BOMUpdateLog\"", "def_index": 785, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 765, "file": "erpnext/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py" }, { "name": "is_material_consumption_enabled", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def is_material_consumption_enabled()", "def_index": 510, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 490, "file": "erpnext/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py" }, { "name": "make_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" } ], "def": "def make_order(source_name)", "def_index": 1628, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1608, "file": "erpnext/erpnext/manufacturing/doctype/blanket_order/blanket_order.py" }, { "name": "get_open_sales_orders", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_open_sales_orders(self)", "def_index": 2642, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2621, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "get_pending_material_requests", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_pending_material_requests(self)", "def_index": 3282, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3261, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "get_items", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_items(self)", "def_index": 4868, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4847, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "set_status", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "close", "type": "", "default": "None" } ], "def": "def set_status(self, close=None)", "def_index": 12520, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12499, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "make_work_order", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def make_work_order(self)", "def_index": 14811, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 14790, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "make_material_request", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def make_material_request(self)", "def_index": 18805, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 18784, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "get_sub_assembly_items", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "manufacturing_type", "type": "", "default": "None" } ], "def": "def get_sub_assembly_items(self, manufacturing_type=None)", "def_index": 21049, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21028, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "download_raw_materials", "arguments": [ { "argument": "doc", "type": "", "default": "" }, { "argument": "warehouses", "type": "", "default": "None" } ], "def": "def download_raw_materials(doc, warehouses=None)", "def_index": 24733, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 24713, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "get_bin_details", "arguments": [ { "argument": "row", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "for_warehouse", "type": "", "default": "None" }, { "argument": "all_warehouse", "type": "", "default": "False" } ], "def": "def get_bin_details(row, company, for_warehouse=None, all_warehouse=False)", "def_index": 34762, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 34742, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "get_so_details", "arguments": [ { "argument": "sales_order", "type": "", "default": "" } ], "def": "def get_so_details(sales_order)", "def_index": 35917, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 35897, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "get_items_for_material_requests", "arguments": [ { "argument": "doc", "type": "", "default": "" }, { "argument": "warehouses", "type": "", "default": "None" }, { "argument": "get_parent_warehouse_data", "type": "", "default": "None" } ], "def": "def get_items_for_material_requests(doc, warehouses=None, get_parent_warehouse_data=None)", "def_index": 36476, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 36456, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "get_item_data", "arguments": [ { "argument": "item_code", "type": "", "default": "" } ], "def": "def get_item_data(item_code)", "def_index": 43956, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 43936, "file": "erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py" }, { "name": "get_appointment_settings", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_appointment_settings()", "def_index": 645, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 609, "file": "erpnext/erpnext/www/book_appointment/index.py" }, { "name": "get_timezones", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_timezones()", "def_index": 906, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 870, "file": "erpnext/erpnext/www/book_appointment/index.py" }, { "name": "get_appointment_slots", "arguments": [ { "argument": "date", "type": "", "default": "" }, { "argument": "timezone", "type": "", "default": "" } ], "def": "def get_appointment_slots(date, timezone)", "def_index": 1006, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 970, "file": "erpnext/erpnext/www/book_appointment/index.py" }, { "name": "create_appointment", "arguments": [ { "argument": "date", "type": "", "default": "" }, { "argument": "time", "type": "", "default": "" }, { "argument": "tz", "type": "", "default": "" }, { "argument": "contact", "type": "", "default": "" } ], "def": "def create_appointment(date, time, tz, contact)", "def_index": 3339, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 3303, "file": "erpnext/erpnext/www/book_appointment/index.py" }, { "name": "handle_incoming_call", "arguments": [ { "argument": "**kwargs", "type": "", "default": "" } ], "def": "def handle_incoming_call(**kwargs)", "def_index": 308, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 272, "file": "erpnext/erpnext/erpnext_integrations/exotel_integration.py" }, { "name": "handle_end_call", "arguments": [ { "argument": "**kwargs", "type": "", "default": "" } ], "def": "def handle_end_call(**kwargs)", "def_index": 852, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 816, "file": "erpnext/erpnext/erpnext_integrations/exotel_integration.py" }, { "name": "handle_missed_call", "arguments": [ { "argument": "**kwargs", "type": "", "default": "" } ], "def": "def handle_missed_call(**kwargs)", "def_index": 959, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 923, "file": "erpnext/erpnext/erpnext_integrations/exotel_integration.py" }, { "name": "get_call_status", "arguments": [ { "argument": "call_id", "type": "", "default": "" } ], "def": "def get_call_status(call_id)", "def_index": 3002, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2982, "file": "erpnext/erpnext/erpnext_integrations/exotel_integration.py" }, { "name": "make_a_call", "arguments": [ { "argument": "from_number", "type": "", "default": "" }, { "argument": "to_number", "type": "", "default": "" }, { "argument": "caller_id", "type": "", "default": "" }, { "argument": "**kwargs", "type": "", "default": "" } ], "def": "def make_a_call(from_number, to_number, caller_id, **kwargs)", "def_index": 3240, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3220, "file": "erpnext/erpnext/erpnext_integrations/exotel_integration.py" }, { "name": "order", "arguments": [ { "argument": "*args", "type": "", "default": "" }, { "argument": "**kwargs", "type": "", "default": "" } ], "def": "def order(*args, **kwargs)", "def_index": 593, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 557, "file": "erpnext/erpnext/erpnext_integrations/connectors/woocommerce_connection.py" }, { "name": "generate_secret", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def generate_secret()", "def_index": 2074, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2054, "file": "erpnext/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py" }, { "name": "get_series", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_series()", "def_index": 2265, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2245, "file": "erpnext/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py" }, { "name": "webhooks", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def webhooks()", "def_index": 203, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 167, "file": "erpnext/erpnext/erpnext_integrations/doctype/gocardless_settings/__init__.py" }, { "name": "get_account_balance_info", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_account_balance_info(self)", "def_index": 2896, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2875, "file": "erpnext/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py" }, { "name": "verify_transaction", "arguments": [ { "argument": "**kwargs", "type": "", "default": "" } ], "def": "def verify_transaction(**kwargs)", "def_index": 5629, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 5593, "file": "erpnext/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py" }, { "name": "process_balance_info", "arguments": [ { "argument": "**kwargs", "type": "", "default": "" } ], "def": "def process_balance_info(**kwargs)", "def_index": 9718, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 9682, "file": "erpnext/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py" }, { "name": "new_doc", "arguments": [ { "argument": "document", "type": "", "default": "" } ], "def": "def new_doc(document)", "def_index": 816, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 796, "file": "erpnext/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py" }, { "name": "process_master_data", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def process_master_data(self)", "def_index": 22212, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22191, "file": "erpnext/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py" }, { "name": "import_master_data", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def import_master_data(self)", "def_index": 22408, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22387, "file": "erpnext/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py" }, { "name": "process_day_book_data", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def process_day_book_data(self)", "def_index": 22601, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22580, "file": "erpnext/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py" }, { "name": "import_day_book_data", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def import_day_book_data(self)", "def_index": 22803, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22782, "file": "erpnext/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py" }, { "name": "get_link_token", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_link_token()", "def_index": 619, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 598, "file": "erpnext/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py" }, { "name": "get_plaid_configuration", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_plaid_configuration()", "def_index": 722, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 702, "file": "erpnext/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py" }, { "name": "add_institution", "arguments": [ { "argument": "token", "type": "", "default": "" }, { "argument": "response", "type": "", "default": "" } ], "def": "def add_institution(token, response)", "def_index": 1055, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1035, "file": "erpnext/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py" }, { "name": "add_bank_accounts", "arguments": [ { "argument": "response", "type": "", "default": "" }, { "argument": "bank", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def add_bank_accounts(response, bank, company)", "def_index": 1686, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1666, "file": "erpnext/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py" }, { "name": "enqueue_synchronization", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def enqueue_synchronization()", "def_index": 8515, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8495, "file": "erpnext/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py" }, { "name": "get_link_token_for_update", "arguments": [ { "argument": "access_token", "type": "", "default": "" } ], "def": "def get_link_token_for_update(access_token)", "def_index": 8903, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8883, "file": "erpnext/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py" }, { "name": "update_bank_account_ids", "arguments": [ { "argument": "response", "type": "", "default": "" } ], "def": "def update_bank_account_ids(response)", "def_index": 9556, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9536, "file": "erpnext/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py" }, { "name": "callback", "arguments": [ { "argument": "*args", "type": "", "default": "" }, { "argument": "**kwargs", "type": "", "default": "" } ], "def": "def callback(*args, **kwargs)", "def_index": 662, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 642, "file": "erpnext/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py" }, { "name": "migrate", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def migrate(self)", "def_index": 2096, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2075, "file": "erpnext/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py" }, { "name": "transaction_processing", "arguments": [ { "argument": "data", "type": "", "default": "" }, { "argument": "from_doctype", "type": "", "default": "" }, { "argument": "to_doctype", "type": "", "default": "" } ], "def": "def transaction_processing(data, from_doctype, to_doctype)", "def_index": 106, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 86, "file": "erpnext/erpnext/utilities/bulk_transaction.py" }, { "name": "get_id_from_url", "arguments": [ { "argument": "url", "type": "", "default": "" } ], "def": "def get_id_from_url(url)", "def_index": 2345, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2325, "file": "erpnext/erpnext/utilities/doctype/video/video.py" }, { "name": "batch_update_youtube_data", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def batch_update_youtube_data()", "def_index": 2724, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2704, "file": "erpnext/erpnext/utilities/doctype/video/video.py" }, { "name": "get_doctypes", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_doctypes()", "def_index": 343, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 323, "file": "erpnext/erpnext/utilities/doctype/rename_tool/rename_tool.py" }, { "name": "upload", "arguments": [ { "argument": "select_doctype", "type": "", "default": "None" }, { "argument": "rows", "type": "", "default": "None" } ], "def": "def upload(select_doctype=None, rows=None)", "def_index": 508, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 488, "file": "erpnext/erpnext/utilities/doctype/rename_tool/rename_tool.py" }, { "name": "add_call_summary_and_call_type", "arguments": [ { "argument": "call_log", "type": "", "default": "" }, { "argument": "summary", "type": "", "default": "" }, { "argument": "call_type", "type": "", "default": "" } ], "def": "def add_call_summary_and_call_type(call_log, summary, call_type)", "def_index": 3381, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3361, "file": "erpnext/erpnext/telephony/doctype/call_log/call_log.py" }, { "name": "get_fiscal_year", "arguments": [ { "argument": "date", "type": "", "default": "None" }, { "argument": "fiscal_year", "type": "", "default": "None" }, { "argument": "label", "type": "", "default": "Date" }, { "argument": "verbose", "type": "", "default": "1" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "as_dict", "type": "", "default": "False" }, { "argument": "boolean", "type": "", "default": "False" } ], "def": "def get_fiscal_year(date=None, fiscal_year=None, label=\"Date\", verbose=1, company=None, as_dict=False, boolean=False)", "def_index": 1326, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1306, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "get_fiscal_year_filter_field", "arguments": [ { "argument": "company", "type": "", "default": "None" } ], "def": "def get_fiscal_year_filter_field(company=None)", "def_index": 3533, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3513, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "get_balance_on", "arguments": [ { "argument": "account", "type": "", "default": "None" }, { "argument": "date", "type": "", "default": "None" }, { "argument": "party_type", "type": "", "default": "None" }, { "argument": "party", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "in_account_currency", "type": "", "default": "True" }, { "argument": "cost_center", "type": "", "default": "None" }, { "argument": "ignore_account_permission", "type": "", "default": "False" }, { "argument": "", "type": "", "default": "" } ], "def": "def get_balance_on(account=None,date=None,party_type=None,party=None,company=None,in_account_currency=True,cost_center=None,ignore_account_permission=False,)", "def_index": 4364, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4344, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "add_ac", "arguments": [ { "argument": "args", "type": "", "default": "None" } ], "def": "def add_ac(args=None)", "def_index": 10515, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10495, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "add_cc", "arguments": [ { "argument": "args", "type": "", "default": "None" } ], "def": "def add_cc(args=None)", "def_index": 11110, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11090, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "get_company_default", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "fieldname", "type": "", "default": "" }, { "argument": "ignore_validation", "type": "", "default": "False" } ], "def": "def get_company_default(company, fieldname, ignore_validation=False)", "def_index": 22647, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22627, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "get_companies", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_companies()", "def_index": 28525, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28505, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "get_children", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "is_root", "type": "", "default": "False" } ], "def": "def get_children(doctype, parent, company, is_root=False)", "def_index": 28706, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28686, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "get_account_balances", "arguments": [ { "argument": "accounts", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def get_account_balances(accounts, company)", "def_index": 29542, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 29522, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "update_cost_center", "arguments": [ { "argument": "docname", "type": "", "default": "" }, { "argument": "cost_center_name", "type": "", "default": "" }, { "argument": "cost_center_number", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "merge", "type": "", "default": "" } ], "def": "def update_cost_center(docname, cost_center_name, cost_center_number, company, merge)", "def_index": 31761, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 31741, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "get_coa", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "" }, { "argument": "is_root", "type": "", "default": "" }, { "argument": "chart", "type": "", "default": "None" } ], "def": "def get_coa(doctype, parent, is_root, chart=None)", "def_index": 33551, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 33531, "file": "erpnext/erpnext/accounts/utils.py" }, { "name": "get_party_details", "arguments": [ { "argument": "party", "type": "", "default": "None" }, { "argument": "account", "type": "", "default": "None" }, { "argument": "party_type", "type": "", "default": "Customer" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "posting_date", "type": "", "default": "None" }, { "argument": "bill_date", "type": "", "default": "None" }, { "argument": "price_list", "type": "", "default": "None" }, { "argument": "currency", "type": "", "default": "None" }, { "argument": "doctype", "type": "", "default": "None" }, { "argument": "ignore_permissions", "type": "", "default": "False" }, { "argument": "fetch_payment_terms_template", "type": "", "default": "True" }, { "argument": "party_address", "type": "", "default": "None" }, { "argument": "company_address", "type": "", "default": "None" }, { "argument": "shipping_address", "type": "", "default": "None" }, { "argument": "pos_profile", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def get_party_details(party=None,account=None,party_type=\"Customer\",company=None,posting_date=None,bill_date=None,price_list=None,currency=None,doctype=None,ignore_permissions=False,fetch_payment_terms_template=True,party_address=None,company_address=None,shipping_address=None,pos_profile=None,)", "def_index": 1253, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1233, "file": "erpnext/erpnext/accounts/party.py" }, { "name": "get_party_account", "arguments": [ { "argument": "party_type", "type": "", "default": "" }, { "argument": "party", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "include_advance", "type": "", "default": "False" } ], "def": "def get_party_account(party_type, party=None, company=None, include_advance=False)", "def_index": 10188, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10168, "file": "erpnext/erpnext/accounts/party.py" }, { "name": "get_party_bank_account", "arguments": [ { "argument": "party_type", "type": "", "default": "" }, { "argument": "party", "type": "", "default": "" } ], "def": "def get_party_bank_account(party_type, party)", "def_index": 12966, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12946, "file": "erpnext/erpnext/accounts/party.py" }, { "name": "get_due_date", "arguments": [ { "argument": "posting_date", "type": "", "default": "" }, { "argument": "party_type", "type": "", "default": "" }, { "argument": "party", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "bill_date", "type": "", "default": "None" } ], "def": "def get_due_date(posting_date, party_type, party, company=None, bill_date=None)", "def_index": 16775, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 16755, "file": "erpnext/erpnext/accounts/party.py" }, { "name": "get_address_tax_category", "arguments": [ { "argument": "tax_category", "type": "", "default": "None" }, { "argument": "billing_address", "type": "", "default": "None" }, { "argument": "shipping_address", "type": "", "default": "None" } ], "def": "def get_address_tax_category(tax_category=None, billing_address=None, shipping_address=None)", "def_index": 19606, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 19586, "file": "erpnext/erpnext/accounts/party.py" }, { "name": "set_taxes", "arguments": [ { "argument": "party", "type": "", "default": "" }, { "argument": "party_type", "type": "", "default": "" }, { "argument": "posting_date", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "customer_group", "type": "", "default": "None" }, { "argument": "supplier_group", "type": "", "default": "None" }, { "argument": "tax_category", "type": "", "default": "None" }, { "argument": "billing_address", "type": "", "default": "None" }, { "argument": "shipping_address", "type": "", "default": "None" }, { "argument": "use_for_shopping_cart", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def set_taxes(party,party_type,posting_date,company,customer_group=None,supplier_group=None,tax_category=None,billing_address=None,shipping_address=None,use_for_shopping_cart=None,)", "def_index": 20167, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20147, "file": "erpnext/erpnext/accounts/party.py" }, { "name": "get_payment_terms_template", "arguments": [ { "argument": "party_name", "type": "", "default": "" }, { "argument": "party_type", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "None" } ], "def": "def get_payment_terms_template(party_name, party_type, company=None)", "def_index": 21352, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21332, "file": "erpnext/erpnext/accounts/party.py" }, { "name": "get", "arguments": [ { "argument": "chart_name", "type": "", "default": "None" }, { "argument": "chart", "type": "", "default": "None" }, { "argument": "no_cache", "type": "", "default": "None" }, { "argument": "filters", "type": "", "default": "None" }, { "argument": "from_date", "type": "", "default": "None" }, { "argument": "to_date", "type": "", "default": "None" }, { "argument": "timespan", "type": "", "default": "None" }, { "argument": "time_interval", "type": "", "default": "None" }, { "argument": "heatmap_year", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def get(chart_name=None,chart=None,no_cache=None,filters=None,from_date=None,to_date=None,timespan=None,time_interval=None,heatmap_year=None,)", "def_index": 469, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@cache_source" ], "index": 435, "file": "erpnext/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py" }, { "name": "get_invoiced_item_gross_margin", "arguments": [ { "argument": "sales_invoice", "type": "", "default": "None" }, { "argument": "item_code", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "with_item_data", "type": "", "default": "False" } ], "def": "def get_invoiced_item_gross_margin(sales_invoice=None, item_code=None, company=None, with_item_data=False)", "def_index": 4203, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4183, "file": "erpnext/erpnext/accounts/report/utils.py" }, { "name": "get_shipping_address", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "address", "type": "", "default": "None" } ], "def": "def get_shipping_address(company, address=None)", "def_index": 1347, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1327, "file": "erpnext/erpnext/accounts/custom/address.py" }, { "name": "pos_profile_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def pos_profile_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 4660, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 4596, "file": "erpnext/erpnext/accounts/doctype/pos_profile/pos_profile.py" }, { "name": "set_default_profile", "arguments": [ { "argument": "pos_profile", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def set_default_profile(pos_profile, company)", "def_index": 5642, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5622, "file": "erpnext/erpnext/accounts/doctype/pos_profile/pos_profile.py" }, { "name": "make_jv_entry", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "account", "type": "", "default": "" }, { "argument": "amount", "type": "", "default": "" }, { "argument": "payment_account", "type": "", "default": "" }, { "argument": "credit_applicant_type", "type": "", "default": "" }, { "argument": "credit_applicant", "type": "", "default": "" }, { "argument": "debit_applicant_type", "type": "", "default": "" }, { "argument": "debit_applicant", "type": "", "default": "" }, { "argument": "", "type": "", "default": "" } ], "def": "def make_jv_entry(company,account,amount,payment_account,credit_applicant_type,credit_applicant,debit_applicant_type,debit_applicant,)", "def_index": 9820, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9800, "file": "erpnext/erpnext/accounts/doctype/share_transfer/share_transfer.py" }, { "name": "make_invoices", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def make_invoices(self)", "def_index": 6488, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6467, "file": "erpnext/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py" }, { "name": "get_temporary_opening_account", "arguments": [ { "argument": "company", "type": "", "default": "None" } ], "def": "def get_temporary_opening_account(company=None)", "def_index": 8274, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8254, "file": "erpnext/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py" }, { "name": "upload_bank_statement", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def upload_bank_statement()", "def_index": 249, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 229, "file": "erpnext/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py" }, { "name": "create_bank_entries", "arguments": [ { "argument": "columns", "type": "", "default": "" }, { "argument": "data", "type": "", "default": "" }, { "argument": "bank_account", "type": "", "default": "" } ], "def": "def create_bank_entries(columns, data, bank_account)", "def_index": 978, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 958, "file": "erpnext/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py" }, { "name": "remove_payment_entries", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def remove_payment_entries(self)", "def_index": 4395, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4374, "file": "erpnext/erpnext/accounts/doctype/bank_transaction/bank_transaction.py" }, { "name": "get_doctypes_for_bank_reconciliation", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_doctypes_for_bank_reconciliation()", "def_index": 5799, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5779, "file": "erpnext/erpnext/accounts/doctype/bank_transaction/bank_transaction.py" }, { "name": "unclear_reference_payment", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "docname", "type": "", "default": "" }, { "argument": "bt_name", "type": "", "default": "" } ], "def": "def unclear_reference_payment(doctype, docname, bt_name)", "def_index": 12637, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12617, "file": "erpnext/erpnext/accounts/doctype/bank_transaction/bank_transaction.py" }, { "name": "get_payment_entries", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_payment_entries(self)", "def_index": 433, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 412, "file": "erpnext/erpnext/accounts/doctype/bank_clearance/bank_clearance.py" }, { "name": "update_clearance_date", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def update_clearance_date(self)", "def_index": 1688, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1667, "file": "erpnext/erpnext/accounts/doctype/bank_clearance/bank_clearance.py" }, { "name": "make_payment_request", "arguments": [ { "argument": "**args", "type": "", "default": "" } ], "def": "def make_payment_request(**args)", "def_index": 12178, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 12142, "file": "erpnext/erpnext/accounts/doctype/payment_request/payment_request.py" }, { "name": "get_print_format_list", "arguments": [ { "argument": "ref_doctype", "type": "", "default": "" } ], "def": "def get_print_format_list(ref_doctype)", "def_index": 17513, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 17493, "file": "erpnext/erpnext/accounts/doctype/payment_request/payment_request.py" }, { "name": "resend_payment_email", "arguments": [ { "argument": "docname", "type": "", "default": "" } ], "def": "def resend_payment_email(docname)", "def_index": 17787, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 17751, "file": "erpnext/erpnext/accounts/doctype/payment_request/payment_request.py" }, { "name": "make_payment_entry", "arguments": [ { "argument": "docname", "type": "", "default": "" } ], "def": "def make_payment_entry(docname)", "def_index": 17908, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 17888, "file": "erpnext/erpnext/accounts/doctype/payment_request/payment_request.py" }, { "name": "get_subscription_details", "arguments": [ { "argument": "reference_doctype", "type": "", "default": "" }, { "argument": "reference_name", "type": "", "default": "" } ], "def": "def get_subscription_details(reference_doctype, reference_name)", "def_index": 19696, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 19676, "file": "erpnext/erpnext/accounts/doctype/payment_request/payment_request.py" }, { "name": "make_payment_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_payment_order(source_name, target_doc=None)", "def_index": 20199, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20179, "file": "erpnext/erpnext/accounts/doctype/payment_request/payment_request.py" }, { "name": "validate_company", "arguments": [ { "argument": "company", "type": "", "default": "" } ], "def": "def validate_company(company)", "def_index": 1126, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1106, "file": "erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py" }, { "name": "import_coa", "arguments": [ { "argument": "file_name", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def import_coa(file_name, company)", "def_index": 1813, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1793, "file": "erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py" }, { "name": "get_coa", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "" }, { "argument": "is_root", "type": "", "default": "False" }, { "argument": "file_name", "type": "", "default": "None" }, { "argument": "for_validate", "type": "", "default": "0" } ], "def": "def get_coa(doctype, parent, is_root=False, file_name=None, for_validate=0)", "def_index": 3898, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3878, "file": "erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py" }, { "name": "download_template", "arguments": [ { "argument": "file_type", "type": "", "default": "" }, { "argument": "template_type", "type": "", "default": "" } ], "def": "def download_template(file_type, template_type)", "def_index": 7946, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7926, "file": "erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py" }, { "name": "validate_accounts", "arguments": [ { "argument": "file_doc", "type": "", "default": "" }, { "argument": "extension", "type": "", "default": "" } ], "def": "def validate_accounts(file_doc, extension)", "def_index": 10369, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10349, "file": "erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py" }, { "name": "check_journal_entry_condition", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def check_journal_entry_condition(self)", "def_index": 1941, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1920, "file": "erpnext/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py" }, { "name": "get_accounts_data", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_accounts_data(self)", "def_index": 2973, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2952, "file": "erpnext/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py" }, { "name": "make_jv_entries", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def make_jv_entries(self)", "def_index": 9856, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9835, "file": "erpnext/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py" }, { "name": "get_account_details", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "posting_date", "type": "", "default": "" }, { "argument": "account", "type": "", "default": "" }, { "argument": "party_type", "type": "", "default": "None" }, { "argument": "party", "type": "", "default": "None" }, { "argument": "rounding_loss_allowance", "type": "", "default": "" } ], "def": "def get_account_details(company, posting_date, account, party_type=None, party=None, rounding_loss_allowance", "def_index": 18520, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 18500, "file": "erpnext/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py" }, { "name": "get_reconciled_count", "arguments": [ { "argument": "docname", "type": "", "default": "" } ], "def": "def get_reconciled_count(docname", "def_index": 1598, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1578, "file": "erpnext/erpnext/accounts/doctype/process_payment_reconciliation/process_payment_reconciliation.py" }, { "name": "pause_job_for_doc", "arguments": [ { "argument": "docname", "type": "", "default": "" } ], "def": "def pause_job_for_doc(docname", "def_index": 2850, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2830, "file": "erpnext/erpnext/accounts/doctype/process_payment_reconciliation/process_payment_reconciliation.py" }, { "name": "trigger_job_for_doc", "arguments": [ { "argument": "docname", "type": "", "default": "" } ], "def": "def trigger_job_for_doc(docname", "def_index": 3216, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3196, "file": "erpnext/erpnext/accounts/doctype/process_payment_reconciliation/process_payment_reconciliation.py" }, { "name": "is_any_doc_running", "arguments": [ { "argument": "for_filter", "type": "", "default": "" } ], "def": "def is_any_doc_running(for_filter", "def_index": 15143, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 15123, "file": "erpnext/erpnext/accounts/doctype/process_payment_reconciliation/process_payment_reconciliation.py" }, { "name": "create_disbursement_entry", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def create_disbursement_entry(self)", "def_index": 5122, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5101, "file": "erpnext/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py" }, { "name": "close_loan", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def close_loan(self)", "def_index": 6886, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6865, "file": "erpnext/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py" }, { "name": "get_invoices", "arguments": [ { "argument": "filters", "type": "", "default": "" } ], "def": "def get_invoices(filters)", "def_index": 8615, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8595, "file": "erpnext/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py" }, { "name": "get_unreconciled_entries", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_unreconciled_entries(self)", "def_index": 965, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 944, "file": "erpnext/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py" }, { "name": "is_auto_process_enabled", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def is_auto_process_enabled(self)", "def_index": 8945, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8924, "file": "erpnext/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py" }, { "name": "calculate_difference_on_allocation_change", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "payment_entry", "type": "", "default": "" }, { "argument": "invoice", "type": "", "default": "" }, { "argument": "allocated_amount", "type": "", "default": "" } ], "def": "def calculate_difference_on_allocation_change(self, payment_entry, invoice, allocated_amount)", "def_index": 9087, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9066, "file": "erpnext/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py" }, { "name": "allocate_entries", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "args", "type": "", "default": "" } ], "def": "def allocate_entries(self, args)", "def_index": 9514, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9493, "file": "erpnext/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py" }, { "name": "reconcile", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def reconcile(self)", "def_index": 12719, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12698, "file": "erpnext/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py" }, { "name": "get_voucher_details", "arguments": [ { "argument": "bank_guarantee_type", "type": "", "default": "" } ], "def": "def get_voucher_details(bank_guarantee_type", "def_index": 730, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 710, "file": "erpnext/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py" }, { "name": "set_missing_values", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "for_validate", "type": "", "default": "False" } ], "def": "def set_missing_values(self, for_validate=False)", "def_index": 16177, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 16156, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "repost_accounting_entries", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def repost_accounting_entries(self)", "def_index": 20367, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20346, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "add_timesheet_data", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def add_timesheet_data(self)", "def_index": 32131, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 32110, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "get_bank_cash_account", "arguments": [ { "argument": "mode_of_payment", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def get_bank_cash_account(mode_of_payment, company)", "def_index": 63331, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 63311, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "make_maintenance_schedule", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_maintenance_schedule(source_name, target_doc=None)", "def_index": 63776, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 63756, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "make_delivery_note", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_delivery_note(source_name, target_doc=None)", "def_index": 64136, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 64116, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "make_sales_return", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_sales_return(source_name, target_doc=None)", "def_index": 65592, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 65572, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "make_inter_company_purchase_invoice", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_inter_company_purchase_invoice(source_name, target_doc=None)", "def_index": 68695, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 68675, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "get_loyalty_programs", "arguments": [ { "argument": "customer", "type": "", "default": "" } ], "def": "def get_loyalty_programs(customer)", "def_index": 78564, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 78544, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "create_invoice_discounting", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def create_invoice_discounting(source_name, target_doc=None)", "def_index": 79192, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 79172, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "create_dunning", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def create_dunning(source_name, target_doc=None)", "def_index": 81867, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 81847, "file": "erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py" }, { "name": "disable_dimension", "arguments": [ { "argument": "doc", "type": "", "default": "" } ], "def": "def disable_dimension(doc)", "def_index": 4859, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4839, "file": "erpnext/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py" }, { "name": "get_dimensions", "arguments": [ { "argument": "with_cost_center_and_project", "type": "", "default": "False" } ], "def": "def get_dimensions(with_cost_center_and_project=False)", "def_index": 6770, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6750, "file": "erpnext/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py" }, { "name": "set_missing_values", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "for_validate", "type": "", "default": "False" } ], "def": "def set_missing_values(self, for_validate=False)", "def_index": 14893, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 14872, "file": "erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py" }, { "name": "reset_mode_of_payments", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def reset_mode_of_payments(self)", "def_index": 15798, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 15777, "file": "erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py" }, { "name": "create_payment_request", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def create_payment_request(self)", "def_index": 16207, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 16186, "file": "erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py" }, { "name": "get_stock_availability", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "warehouse", "type": "", "default": "" } ], "def": "def get_stock_availability(item_code, warehouse)", "def_index": 17748, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 17728, "file": "erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py" }, { "name": "make_sales_return", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_sales_return(source_name, target_doc=None)", "def_index": 19807, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 19787, "file": "erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py" }, { "name": "make_merge_log", "arguments": [ { "argument": "invoices", "type": "", "default": "" } ], "def": "def make_merge_log(invoices)", "def_index": 20022, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20002, "file": "erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py" }, { "name": "convert_group_to_ledger", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def convert_group_to_ledger(self)", "def_index": 1258, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1237, "file": "erpnext/erpnext/accounts/doctype/cost_center/cost_center.py" }, { "name": "convert_ledger_to_group", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def convert_ledger_to_group(self)", "def_index": 1612, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1591, "file": "erpnext/erpnext/accounts/doctype/cost_center/cost_center.py" }, { "name": "cancel_subscription", "arguments": [ { "argument": "name", "type": "", "default": "" } ], "def": "def cancel_subscription(name)", "def_index": 22755, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22735, "file": "erpnext/erpnext/accounts/doctype/subscription/subscription.py" }, { "name": "restart_subscription", "arguments": [ { "argument": "name", "type": "", "default": "" } ], "def": "def restart_subscription(name)", "def_index": 23068, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 23048, "file": "erpnext/erpnext/accounts/doctype/subscription/subscription.py" }, { "name": "get_subscription_updates", "arguments": [ { "argument": "name", "type": "", "default": "" } ], "def": "def get_subscription_updates(name)", "def_index": 23339, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 23319, "file": "erpnext/erpnext/accounts/doctype/subscription/subscription.py" }, { "name": "start_payment_ledger_repost", "arguments": [ { "argument": "docname", "type": "", "default": "None" } ], "def": "def start_payment_ledger_repost(docname=None)", "def_index": 676, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 656, "file": "erpnext/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.py" }, { "name": "execute_repost_payment_ledger", "arguments": [ { "argument": "docname", "type": "", "default": "" } ], "def": "def execute_repost_payment_ledger(docname)", "def_index": 3043, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3023, "file": "erpnext/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.py" }, { "name": "get_party_details", "arguments": [ { "argument": "party", "type": "", "default": "" }, { "argument": "party_type", "type": "", "default": "" }, { "argument": "args", "type": "", "default": "None" } ], "def": "def get_party_details(party, party_type, args=None)", "def_index": 3818, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3798, "file": "erpnext/erpnext/accounts/doctype/tax_rule/tax_rule.py" }, { "name": "fetch_customers", "arguments": [ { "argument": "customer_collection", "type": "", "default": "" }, { "argument": "collection_name", "type": "", "default": "" }, { "argument": "primary_mandatory", "type": "", "default": "" } ], "def": "def fetch_customers(customer_collection, collection_name, primary_mandatory)", "def_index": 8119, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8099, "file": "erpnext/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py" }, { "name": "get_customer_emails", "arguments": [ { "argument": "customer_name", "type": "", "default": "" }, { "argument": "primary_mandatory", "type": "", "default": "" }, { "argument": "billing_and_primary", "type": "", "default": "True" } ], "def": "def get_customer_emails(customer_name, primary_mandatory, billing_and_primary=True)", "def_index": 9231, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9211, "file": "erpnext/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py" }, { "name": "download_statements", "arguments": [ { "argument": "document_name", "type": "", "default": "" } ], "def": "def download_statements(document_name)", "def_index": 10483, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10463, "file": "erpnext/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py" }, { "name": "send_emails", "arguments": [ { "argument": "document_name", "type": "", "default": "" }, { "argument": "from_scheduler", "type": "", "default": "False" } ], "def": "def send_emails(document_name, from_scheduler=False)", "def_index": 10797, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10777, "file": "erpnext/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py" }, { "name": "send_auto_email", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def send_auto_email()", "def_index": 12270, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12250, "file": "erpnext/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py" }, { "name": "create_party_link", "arguments": [ { "argument": "primary_role", "type": "", "default": "" }, { "argument": "primary_party", "type": "", "default": "" }, { "argument": "secondary_party", "type": "", "default": "" } ], "def": "def create_party_link(primary_role, primary_party, secondary_party)", "def_index": 1486, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1466, "file": "erpnext/erpnext/accounts/doctype/party_link/party_link.py" }, { "name": "get_loyalty_program_details_with_points", "arguments": [ { "argument": "customer", "type": "", "default": "" }, { "argument": "loyalty_program", "type": "", "default": "None" }, { "argument": "expiry_date", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "silent", "type": "", "default": "False" }, { "argument": "include_expired_entry", "type": "", "default": "False" }, { "argument": "current_transaction_amount", "type": "", "default": "0" }, { "argument": "", "type": "", "default": "" } ], "def": "def get_loyalty_program_details_with_points(customer,loyalty_program=None,expiry_date=None,company=None,silent=False,include_expired_entry=False,current_transaction_amount=0,)", "def_index": 1114, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1094, "file": "erpnext/erpnext/accounts/doctype/loyalty_program/loyalty_program.py" }, { "name": "get_loyalty_program_details", "arguments": [ { "argument": "customer", "type": "", "default": "" }, { "argument": "loyalty_program", "type": "", "default": "None" }, { "argument": "expiry_date", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "silent", "type": "", "default": "False" }, { "argument": "include_expired_entry", "type": "", "default": "False" }, { "argument": "", "type": "", "default": "" } ], "def": "def get_loyalty_program_details(customer,loyalty_program=None,expiry_date=None,company=None,silent=False,include_expired_entry=False,)", "def_index": 2024, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2004, "file": "erpnext/erpnext/accounts/doctype/loyalty_program/loyalty_program.py" }, { "name": "get_redeemption_factor", "arguments": [ { "argument": "loyalty_program", "type": "", "default": "None" }, { "argument": "customer", "type": "", "default": "None" } ], "def": "def get_redeemption_factor(loyalty_program=None, customer=None)", "def_index": 2830, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2810, "file": "erpnext/erpnext/accounts/doctype/loyalty_program/loyalty_program.py" }, { "name": "get_mop_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_mop_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 950, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 886, "file": "erpnext/erpnext/accounts/doctype/payment_order/payment_order.py" }, { "name": "get_supplier_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_supplier_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 1378, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 1314, "file": "erpnext/erpnext/accounts/doctype/payment_order/payment_order.py" }, { "name": "make_payment_records", "arguments": [ { "argument": "name", "type": "", "default": "" }, { "argument": "supplier", "type": "", "default": "" }, { "argument": "mode_of_payment", "type": "", "default": "None" } ], "def": "def make_payment_records(name, supplier, mode_of_payment=None)", "def_index": 1811, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1791, "file": "erpnext/erpnext/accounts/doctype/payment_order/payment_order.py" }, { "name": "get_dunning_letter_text", "arguments": [ { "argument": "dunning_type", "type": "", "default": "" }, { "argument": "doc", "type": "", "default": "" }, { "argument": "language", "type": "", "default": "None" } ], "def": "def get_dunning_letter_text(dunning_type, doc, language=None)", "def_index": 4280, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4260, "file": "erpnext/erpnext/accounts/doctype/dunning/dunning.py" }, { "name": "make_bank_account", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "docname", "type": "", "default": "" } ], "def": "def make_bank_account(doctype, docname)", "def_index": 1633, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1613, "file": "erpnext/erpnext/accounts/doctype/bank_account/bank_account.py" }, { "name": "get_bank_account_details", "arguments": [ { "argument": "bank_account", "type": "", "default": "" } ], "def": "def get_bank_account_details(bank_account)", "def_index": 1934, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1914, "file": "erpnext/erpnext/accounts/doctype/bank_account/bank_account.py" }, { "name": "create_or_update_cheque_print_format", "arguments": [ { "argument": "template_name", "type": "", "default": "" } ], "def": "def create_or_update_cheque_print_format(template_name)", "def_index": 266, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 246, "file": "erpnext/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py" }, { "name": "get_plan_rate", "arguments": [ { "argument": "plan", "type": "", "default": "" }, { "argument": "quantity", "type": "", "default": "1" }, { "argument": "customer", "type": "", "default": "None" }, { "argument": "start_date", "type": "", "default": "None" }, { "argument": "end_date", "type": "", "default": "None" }, { "argument": "prorate_factor", "type": "", "default": "1" } ], "def": "def get_plan_rate(plan, quantity=1, customer=None, start_date=None, end_date=None, prorate_factor=1)", "def_index": 615, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 595, "file": "erpnext/erpnext/accounts/doctype/subscription_plan/subscription_plan.py" }, { "name": "form_start_merge", "arguments": [ { "argument": "docname", "type": "", "default": "" } ], "def": "def form_start_merge(docname)", "def_index": 981, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 961, "file": "erpnext/erpnext/accounts/doctype/ledger_merge/ledger_merge.py" }, { "name": "make_debit_note", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_debit_note(source_name, target_doc=None)", "def_index": 59614, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 59594, "file": "erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py" }, { "name": "make_stock_entry", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_stock_entry(source_name, target_doc=None)", "def_index": 59832, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 59812, "file": "erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py" }, { "name": "change_release_date", "arguments": [ { "argument": "name", "type": "", "default": "" }, { "argument": "release_date", "type": "", "default": "None" } ], "def": "def change_release_date(name, release_date=None)", "def_index": 60240, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 60220, "file": "erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py" }, { "name": "unblock_invoice", "arguments": [ { "argument": "name", "type": "", "default": "" } ], "def": "def unblock_invoice(name)", "def_index": 60450, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 60430, "file": "erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py" }, { "name": "block_invoice", "arguments": [ { "argument": "name", "type": "", "default": "" }, { "argument": "release_date", "type": "", "default": "" }, { "argument": "hold_comment", "type": "", "default": "None" } ], "def": "def block_invoice(name, release_date, hold_comment=None)", "def_index": 60618, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 60598, "file": "erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py" }, { "name": "make_inter_company_sales_invoice", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_inter_company_sales_invoice(source_name, target_doc=None)", "def_index": 60841, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 60821, "file": "erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py" }, { "name": "make_purchase_receipt", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_purchase_receipt(source_name, target_doc=None)", "def_index": 61226, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 61206, "file": "erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py" }, { "name": "get_naming_series", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_naming_series()", "def_index": 246, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 226, "file": "erpnext/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.py" }, { "name": "get_preview_from_template", "arguments": [ { "argument": "data_import", "type": "", "default": "" }, { "argument": "import_file", "type": "", "default": "None" }, { "argument": "google_sheets_url", "type": "", "default": "None" } ], "def": "def get_preview_from_template(data_import, import_file=None, google_sheets_url=None)", "def_index": 2525, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2505, "file": "erpnext/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py" }, { "name": "form_start_import", "arguments": [ { "argument": "data_import", "type": "", "default": "" } ], "def": "def form_start_import(data_import)", "def_index": 2757, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2737, "file": "erpnext/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py" }, { "name": "download_errored_template", "arguments": [ { "argument": "data_import_name", "type": "", "default": "" } ], "def": "def download_errored_template(data_import_name)", "def_index": 2891, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2871, "file": "erpnext/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py" }, { "name": "upload_bank_statement", "arguments": [ { "argument": "**args", "type": "", "default": "" } ], "def": "def upload_bank_statement(**args)", "def_index": 6248, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6228, "file": "erpnext/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py" }, { "name": "convert_group_to_ledger", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def convert_group_to_ledger(self)", "def_index": 9812, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9791, "file": "erpnext/erpnext/accounts/doctype/account/account.py" }, { "name": "convert_ledger_to_group", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def convert_ledger_to_group(self)", "def_index": 10142, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10121, "file": "erpnext/erpnext/accounts/doctype/account/account.py" }, { "name": "get_parent_account", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_parent_account(doctype, txt, searchfield, start, page_len, filters)", "def_index": 11218, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 11154, "file": "erpnext/erpnext/accounts/doctype/account/account.py" }, { "name": "update_account_number", "arguments": [ { "argument": "name", "type": "", "default": "" }, { "argument": "account_name", "type": "", "default": "" }, { "argument": "account_number", "type": "", "default": "None" }, { "argument": "from_descendant", "type": "", "default": "False" } ], "def": "def update_account_number(name, account_name, account_number=None, from_descendant=False)", "def_index": 12947, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12927, "file": "erpnext/erpnext/accounts/doctype/account/account.py" }, { "name": "merge_account", "arguments": [ { "argument": "old", "type": "", "default": "" }, { "argument": "new", "type": "", "default": "" }, { "argument": "is_group", "type": "", "default": "" }, { "argument": "root_type", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def merge_account(old, new, is_group, root_type, company)", "def_index": 15136, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 15116, "file": "erpnext/erpnext/accounts/doctype/account/account.py" }, { "name": "get_root_company", "arguments": [ { "argument": "company", "type": "", "default": "" } ], "def": "def get_root_company(company)", "def_index": 15867, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 15847, "file": "erpnext/erpnext/accounts/doctype/account/account.py" }, { "name": "get_charts_for_country", "arguments": [ { "argument": "country", "type": "", "default": "" }, { "argument": "with_standard", "type": "", "default": "False" } ], "def": "def get_charts_for_country(country, with_standard=False)", "def_index": 4240, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4220, "file": "erpnext/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py" }, { "name": "validate_bank_account", "arguments": [ { "argument": "coa", "type": "", "default": "" }, { "argument": "bank_account", "type": "", "default": "" } ], "def": "def validate_bank_account(coa, bank_account)", "def_index": 6824, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6804, "file": "erpnext/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py" }, { "name": "build_tree_from_json", "arguments": [ { "argument": "chart_template", "type": "", "default": "" }, { "argument": "chart_data", "type": "", "default": "None" }, { "argument": "from_coa_importer", "type": "", "default": "False" } ], "def": "def build_tree_from_json(chart_template, chart_data=None, from_coa_importer=False)", "def_index": 7270, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7250, "file": "erpnext/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py" }, { "name": "get_balance", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "difference_account", "type": "", "default": "None" } ], "def": "def get_balance(self, difference_account=None)", "def_index": 30776, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 30755, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "get_outstanding_invoices", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_outstanding_invoices(self)", "def_index": 31808, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 31787, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "get_default_bank_cash_account", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "account_type", "type": "", "default": "None" }, { "argument": "mode_of_payment", "type": "", "default": "None" }, { "argument": "account", "type": "", "default": "None" } ], "def": "def get_default_bank_cash_account(company, account_type=None, mode_of_payment=None, account=None)", "def_index": 34916, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 34896, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "get_payment_entry_against_order", "arguments": [ { "argument": "dt", "type": "", "default": "" }, { "argument": "dn", "type": "", "default": "" }, { "argument": "amount", "type": "", "default": "None" }, { "argument": "debit_in_account_currency", "type": "", "default": "None" }, { "argument": "journal_entry", "type": "", "default": "False" }, { "argument": "bank_account", "type": "", "default": "None" } ], "def": "def get_payment_entry_against_order(dt, dn, amount=None, debit_in_account_currency=None, journal_entry=False, bank_account=None)", "def_index": 36510, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 36490, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "get_payment_entry_against_invoice", "arguments": [ { "argument": "dt", "type": "", "default": "" }, { "argument": "dn", "type": "", "default": "" }, { "argument": "amount", "type": "", "default": "None" }, { "argument": "debit_in_account_currency", "type": "", "default": "None" }, { "argument": "journal_entry", "type": "", "default": "False" }, { "argument": "bank_account", "type": "", "default": "None" } ], "def": "def get_payment_entry_against_invoice(dt, dn, amount=None, debit_in_account_currency=None, journal_entry=False, bank_account=None)", "def_index": 37978, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 37958, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "get_against_jv", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_against_jv(doctype, txt, searchfield, start, page_len, filters)", "def_index": 42064, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 42000, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "get_outstanding", "arguments": [ { "argument": "args", "type": "", "default": "" } ], "def": "def get_outstanding(args)", "def_index": 42886, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 42866, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "get_party_account_and_balance", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "party_type", "type": "", "default": "" }, { "argument": "party", "type": "", "default": "" }, { "argument": "cost_center", "type": "", "default": "None" } ], "def": "def get_party_account_and_balance(company, party_type, party, cost_center=None)", "def_index": 44846, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 44826, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "get_account_balance_and_party_type", "arguments": [ { "argument": "account", "type": "", "default": "" }, { "argument": "date", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "debit", "type": "", "default": "None" }, { "argument": "credit", "type": "", "default": "None" }, { "argument": "exchange_rate", "type": "", "default": "None" }, { "argument": "cost_center", "type": "", "default": "None" } ], "def": "def get_account_balance_and_party_type(account, date, company, debit=None, credit=None, exchange_rate=None, cost_center=None)", "def_index": 45485, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 45465, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "get_exchange_rate", "arguments": [ { "argument": "posting_date", "type": "", "default": "" }, { "argument": "account", "type": "", "default": "None" }, { "argument": "account_currency", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "reference_type", "type": "", "default": "None" }, { "argument": "reference_name", "type": "", "default": "None" }, { "argument": "debit", "type": "", "default": "None" }, { "argument": "credit", "type": "", "default": "None" }, { "argument": "exchange_rate", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def get_exchange_rate(posting_date,account=None,account_currency=None,company=None,reference_type=None,reference_name=None,debit=None,credit=None,exchange_rate=None,)", "def_index": 46927, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 46907, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "get_average_exchange_rate", "arguments": [ { "argument": "account", "type": "", "default": "" } ], "def": "def get_average_exchange_rate(account)", "def_index": 48249, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 48229, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "make_inter_company_journal_entry", "arguments": [ { "argument": "name", "type": "", "default": "" }, { "argument": "voucher_type", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def make_inter_company_journal_entry(name, voucher_type, company)", "def_index": 48625, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 48605, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "make_reverse_journal_entry", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_reverse_journal_entry(source_name, target_doc=None)", "def_index": 48971, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 48951, "file": "erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py" }, { "name": "apply_pricing_rule", "arguments": [ { "argument": "args", "type": "", "default": "" }, { "argument": "doc", "type": "", "default": "None" } ], "def": "def apply_pricing_rule(args, doc=None)", "def_index": 6728, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6708, "file": "erpnext/erpnext/accounts/doctype/pricing_rule/pricing_rule.py" }, { "name": "remove_pricing_rules", "arguments": [ { "argument": "item_list", "type": "", "default": "" } ], "def": "def remove_pricing_rules(item_list)", "def_index": 16390, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 16370, "file": "erpnext/erpnext/accounts/doctype/pricing_rule/pricing_rule.py" }, { "name": "make_pricing_rule", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "docname", "type": "", "default": "" } ], "def": "def make_pricing_rule(doctype, docname)", "def_index": 17244, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 17224, "file": "erpnext/erpnext/accounts/doctype/pricing_rule/pricing_rule.py" }, { "name": "get_item_uoms", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_item_uoms(doctype, txt, searchfield, start, page_len, filters)", "def_index": 17570, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 17506, "file": "erpnext/erpnext/accounts/doctype/pricing_rule/pricing_rule.py" }, { "name": "get_bank_transactions", "arguments": [ { "argument": "bank_account", "type": "", "default": "" }, { "argument": "from_date", "type": "", "default": "None" }, { "argument": "to_date", "type": "", "default": "None" } ], "def": "def get_bank_transactions(bank_account, from_date=None, to_date=None)", "def_index": 662, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 642, "file": "erpnext/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py" }, { "name": "get_account_balance", "arguments": [ { "argument": "bank_account", "type": "", "default": "" }, { "argument": "till_date", "type": "", "default": "" } ], "def": "def get_account_balance(bank_account, till_date)", "def_index": 1401, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1381, "file": "erpnext/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py" }, { "name": "update_bank_transaction", "arguments": [ { "argument": "bank_transaction_name", "type": "", "default": "" }, { "argument": "reference_number", "type": "", "default": "" }, { "argument": "party_type", "type": "", "default": "None" }, { "argument": "party", "type": "", "default": "None" } ], "def": "def update_bank_transaction(bank_transaction_name, reference_number, party_type=None, party=None)", "def_index": 2160, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2140, "file": "erpnext/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py" }, { "name": "create_journal_entry_bts", "arguments": [ { "argument": "bank_transaction_name", "type": "", "default": "" }, { "argument": "reference_number", "type": "", "default": "None" }, { "argument": "reference_date", "type": "", "default": "None" }, { "argument": "posting_date", "type": "", "default": "None" }, { "argument": "entry_type", "type": "", "default": "None" }, { "argument": "second_account", "type": "", "default": "None" }, { "argument": "mode_of_payment", "type": "", "default": "None" }, { "argument": "party_type", "type": "", "default": "None" }, { "argument": "party", "type": "", "default": "None" }, { "argument": "allow_edit", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def create_journal_entry_bts(bank_transaction_name,reference_number=None,reference_date=None,posting_date=None,entry_type=None,second_account=None,mode_of_payment=None,party_type=None,party=None,allow_edit=None,)", "def_index": 2913, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2893, "file": "erpnext/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py" }, { "name": "create_payment_entry_bts", "arguments": [ { "argument": "bank_transaction_name", "type": "", "default": "" }, { "argument": "reference_number", "type": "", "default": "None" }, { "argument": "reference_date", "type": "", "default": "None" }, { "argument": "party_type", "type": "", "default": "None" }, { "argument": "party", "type": "", "default": "None" }, { "argument": "posting_date", "type": "", "default": "None" }, { "argument": "mode_of_payment", "type": "", "default": "None" }, { "argument": "project", "type": "", "default": "None" }, { "argument": "cost_center", "type": "", "default": "None" }, { "argument": "allow_edit", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def create_payment_entry_bts(bank_transaction_name,reference_number=None,reference_date=None,party_type=None,party=None,posting_date=None,mode_of_payment=None,project=None,cost_center=None,allow_edit=None,)", "def_index": 5237, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5217, "file": "erpnext/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py" }, { "name": "auto_reconcile_vouchers", "arguments": [ { "argument": "bank_account", "type": "", "default": "" }, { "argument": "from_date", "type": "", "default": "None" }, { "argument": "to_date", "type": "", "default": "None" }, { "argument": "filter_by_reference_date", "type": "", "default": "None" }, { "argument": "from_reference_date", "type": "", "default": "None" }, { "argument": "to_reference_date", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def auto_reconcile_vouchers(bank_account,from_date=None,to_date=None,filter_by_reference_date=None,from_reference_date=None,to_reference_date=None,)", "def_index": 7032, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7012, "file": "erpnext/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py" }, { "name": "reconcile_vouchers", "arguments": [ { "argument": "bank_transaction_name", "type": "", "default": "" }, { "argument": "vouchers", "type": "", "default": "" } ], "def": "def reconcile_vouchers(bank_transaction_name, vouchers)", "def_index": 9259, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9239, "file": "erpnext/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py" }, { "name": "get_linked_payments", "arguments": [ { "argument": "bank_transaction_name", "type": "", "default": "" }, { "argument": "document_types", "type": "", "default": "None" }, { "argument": "from_date", "type": "", "default": "None" }, { "argument": "to_date", "type": "", "default": "None" }, { "argument": "filter_by_reference_date", "type": "", "default": "None" }, { "argument": "from_reference_date", "type": "", "default": "None" }, { "argument": "to_reference_date", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def get_linked_payments(bank_transaction_name,document_types=None,from_date=None,to_date=None,filter_by_reference_date=None,from_reference_date=None,to_reference_date=None,)", "def_index": 9625, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9605, "file": "erpnext/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py" }, { "name": "get_months", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_months(self)", "def_index": 309, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 288, "file": "erpnext/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.py" }, { "name": "get_outstanding_reference_documents", "arguments": [ { "argument": "args", "type": "", "default": "" }, { "argument": "validate", "type": "", "default": "False" } ], "def": "def get_outstanding_reference_documents(args, validate=False)", "def_index": 47871, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 47851, "file": "erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py" }, { "name": "get_party_details", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "party_type", "type": "", "default": "" }, { "argument": "party", "type": "", "default": "" }, { "argument": "date", "type": "", "default": "" }, { "argument": "cost_center", "type": "", "default": "None" } ], "def": "def get_party_details(company, party_type, party, date, cost_center=None)", "def_index": 58795, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 58775, "file": "erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py" }, { "name": "get_account_details", "arguments": [ { "argument": "account", "type": "", "default": "" }, { "argument": "date", "type": "", "default": "" }, { "argument": "cost_center", "type": "", "default": "None" } ], "def": "def get_account_details(account, date, cost_center=None)", "def_index": 59805, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 59785, "file": "erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py" }, { "name": "get_company_defaults", "arguments": [ { "argument": "company", "type": "", "default": "" } ], "def": "def get_company_defaults(company)", "def_index": 60732, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 60712, "file": "erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py" }, { "name": "get_reference_details", "arguments": [ { "argument": "reference_doctype", "type": "", "default": "" }, { "argument": "reference_name", "type": "", "default": "" }, { "argument": "party_account_currency", "type": "", "default": "" } ], "def": "def get_reference_details(reference_doctype, reference_name, party_account_currency)", "def_index": 61511, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 61491, "file": "erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py" }, { "name": "get_payment_entry", "arguments": [ { "argument": "dt", "type": "", "default": "" }, { "argument": "dn", "type": "", "default": "" }, { "argument": "party_amount", "type": "", "default": "None" }, { "argument": "bank_account", "type": "", "default": "None" }, { "argument": "bank_amount", "type": "", "default": "None" }, { "argument": "party_type", "type": "", "default": "None" }, { "argument": "payment_type", "type": "", "default": "None" }, { "argument": "reference_date", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def get_payment_entry(dt,dn,party_amount=None,bank_account=None,bank_amount=None,party_type=None,payment_type=None,reference_date=None,)", "def_index": 63763, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 63743, "file": "erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py" }, { "name": "get_party_and_account_balance", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "date", "type": "", "default": "" }, { "argument": "paid_from", "type": "", "default": "None" }, { "argument": "paid_to", "type": "", "default": "None" }, { "argument": "ptype", "type": "", "default": "None" }, { "argument": "pty", "type": "", "default": "None" }, { "argument": "cost_center", "type": "", "default": "None" } ], "def": "def get_party_and_account_balance(company, date, paid_from=None, paid_to=None, ptype=None, pty=None, cost_center=None)", "def_index": 80837, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 80817, "file": "erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py" }, { "name": "make_payment_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_payment_order(source_name, target_doc=None)", "def_index": 81286, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 81266, "file": "erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py" }, { "name": "set_as_default", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def set_as_default(self)", "def_index": 378, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 357, "file": "erpnext/erpnext/accounts/doctype/fiscal_year/fiscal_year.py" }, { "name": "check_duplicate_fiscal_year", "arguments": [ { "argument": "doc", "type": "", "default": "" } ], "def": "def check_duplicate_fiscal_year(doc)", "def_index": 3573, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3553, "file": "erpnext/erpnext/accounts/doctype/fiscal_year/fiscal_year.py" }, { "name": "auto_create_fiscal_year", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def auto_create_fiscal_year()", "def_index": 4096, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4076, "file": "erpnext/erpnext/accounts/doctype/fiscal_year/fiscal_year.py" }, { "name": "get_doctypes_for_closing", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_doctypes_for_closing(self)", "def_index": 1318, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1297, "file": "erpnext/erpnext/accounts/doctype/accounting_period/accounting_period.py" }, { "name": "get_payment_reconciliation_details", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_payment_reconciliation_details(self)", "def_index": 2700, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2679, "file": "erpnext/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py" }, { "name": "retry", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def retry(self)", "def_index": 3149, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3128, "file": "erpnext/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py" }, { "name": "get_cashiers", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_cashiers(doctype, txt, searchfield, start, page_len, filters)", "def_index": 3535, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 3471, "file": "erpnext/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py" }, { "name": "get_pos_invoices", "arguments": [ { "argument": "start", "type": "", "default": "" }, { "argument": "end", "type": "", "default": "" }, { "argument": "pos_profile", "type": "", "default": "" }, { "argument": "user", "type": "", "default": "" } ], "def": "def get_pos_invoices(start, end, pos_profile, user)", "def_index": 3760, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3740, "file": "erpnext/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py" }, { "name": "make_maintenance_visit", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_maintenance_visit(source_name, target_doc=None)", "def_index": 1107, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1087, "file": "erpnext/erpnext/support/doctype/warranty_claim/warranty_claim.py" }, { "name": "split_issue", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "subject", "type": "", "default": "" }, { "argument": "communication_id", "type": "", "default": "" } ], "def": "def split_issue(self, subject, communication_id)", "def_index": 2263, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2242, "file": "erpnext/erpnext/support/doctype/issue/issue.py" }, { "name": "set_multiple_status", "arguments": [ { "argument": "names", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def set_multiple_status(names, status)", "def_index": 5082, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5062, "file": "erpnext/erpnext/support/doctype/issue/issue.py" }, { "name": "set_status", "arguments": [ { "argument": "name", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def set_status(name, status)", "def_index": 5232, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5212, "file": "erpnext/erpnext/support/doctype/issue/issue.py" }, { "name": "make_task", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_task(source_name, target_doc=None)", "def_index": 6396, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6376, "file": "erpnext/erpnext/support/doctype/issue/issue.py" }, { "name": "make_issue_from_communication", "arguments": [ { "argument": "communication", "type": "", "default": "" }, { "argument": "ignore_communication_links", "type": "", "default": "False" } ], "def": "def make_issue_from_communication(communication, ignore_communication_links=False)", "def_index": 6552, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6532, "file": "erpnext/erpnext/support/doctype/issue/issue.py" }, { "name": "get_service_level_agreement_filters", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "name", "type": "", "default": "" }, { "argument": "customer", "type": "", "default": "None" } ], "def": "def get_service_level_agreement_filters(doctype, name, customer=None)", "def_index": 12085, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12065, "file": "erpnext/erpnext/support/doctype/service_level_agreement/service_level_agreement.py" }, { "name": "get_user_time", "arguments": [ { "argument": "user", "type": "", "default": "" }, { "argument": "to_string", "type": "", "default": "False" } ], "def": "def get_user_time(user, to_string=False)", "def_index": 30861, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 30841, "file": "erpnext/erpnext/support/doctype/service_level_agreement/service_level_agreement.py" }, { "name": "get_sla_doctypes", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_sla_doctypes()", "def_index": 31007, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 30987, "file": "erpnext/erpnext/support/doctype/service_level_agreement/service_level_agreement.py" }, { "name": "make_subcontracting_receipt", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_subcontracting_receipt(source_name, target_doc=None)", "def_index": 6451, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6431, "file": "erpnext/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py" }, { "name": "update_subcontracting_order_status", "arguments": [ { "argument": "sco", "type": "", "default": "" } ], "def": "def update_subcontracting_order_status(sco)", "def_index": 7468, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7448, "file": "erpnext/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py" }, { "name": "set_missing_values", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def set_missing_values(self)", "def_index": 3907, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3886, "file": "erpnext/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py" }, { "name": "make_subcontract_return", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_subcontract_return(source_name, target_doc=None)", "def_index": 13421, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 13401, "file": "erpnext/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py" }, { "name": "send_message", "arguments": [ { "argument": "sender", "type": "", "default": "" }, { "argument": "message", "type": "", "default": "" }, { "argument": "subject", "type": "", "default": "Website Query" } ], "def": "def send_message(sender, message, subject=\"Website Query\")", "def_index": 181, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 145, "file": "erpnext/erpnext/templates/utils.py" }, { "name": "get_product_list", "arguments": [ { "argument": "search", "type": "", "default": "None" }, { "argument": "start", "type": "", "default": "0" }, { "argument": "limit", "type": "", "default": "12" } ], "def": "def get_product_list(search=None, start=0, limit=12)", "def_index": 682, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 646, "file": "erpnext/erpnext/templates/pages/product_search.py" }, { "name": "search", "arguments": [ { "argument": "query", "type": "", "default": "" } ], "def": "def search(query)", "def_index": 1750, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 1714, "file": "erpnext/erpnext/templates/pages/product_search.py" }, { "name": "product_search", "arguments": [ { "argument": "query", "type": "", "default": "" }, { "argument": "limit", "type": "", "default": "10" }, { "argument": "fuzzy_search", "type": "", "default": "True" } ], "def": "def product_search(query, limit=10, fuzzy_search=True)", "def_index": 2034, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 1998, "file": "erpnext/erpnext/templates/pages/product_search.py" }, { "name": "get_category_suggestions", "arguments": [ { "argument": "query", "type": "", "default": "" } ], "def": "def get_category_suggestions(query)", "def_index": 3350, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 3314, "file": "erpnext/erpnext/templates/pages/product_search.py" }, { "name": "get_help_results_sections", "arguments": [ { "argument": "text", "type": "", "default": "" } ], "def": "def get_help_results_sections(text)", "def_index": 613, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 577, "file": "erpnext/erpnext/templates/pages/search_help.py" }, { "name": "get_task_html", "arguments": [ { "argument": "project", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "0" }, { "argument": "item_status", "type": "", "default": "None" } ], "def": "def get_task_html(project, start=0, item_status=None)", "def_index": 1671, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1651, "file": "erpnext/erpnext/templates/pages/projects.py" }, { "name": "get_timesheet_html", "arguments": [ { "argument": "project", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "0" } ], "def": "def get_timesheet_html(project, start=0)", "def_index": 2634, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2614, "file": "erpnext/erpnext/templates/pages/projects.py" }, { "name": "check_mandate", "arguments": [ { "argument": "data", "type": "", "default": "" }, { "argument": "reference_doctype", "type": "", "default": "" }, { "argument": "reference_docname", "type": "", "default": "" } ], "def": "def check_mandate(data, reference_doctype, reference_docname)", "def_index": 1286, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 1250, "file": "erpnext/erpnext/templates/pages/integrations/gocardless_checkout.py" }, { "name": "confirm_payment", "arguments": [ { "argument": "redirect_flow_id", "type": "", "default": "" }, { "argument": "reference_doctype", "type": "", "default": "" }, { "argument": "reference_docname", "type": "", "default": "" } ], "def": "def confirm_payment(redirect_flow_id, reference_doctype, reference_docname)", "def_index": 926, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 890, "file": "erpnext/erpnext/templates/pages/integrations/gocardless_confirmation.py" }, { "name": "generate_schedule", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def generate_schedule(self)", "def_index": 546, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 525, "file": "erpnext/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py" }, { "name": "validate_end_date_visits", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def validate_end_date_visits(self)", "def_index": 1264, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1243, "file": "erpnext/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py" }, { "name": "get_pending_data", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "data_type", "type": "", "default": "" }, { "argument": "s_date", "type": "", "default": "None" }, { "argument": "item_name", "type": "", "default": "None" } ], "def": "def get_pending_data(self, data_type, s_date=None, item_name=None)", "def_index": 11833, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11812, "file": "erpnext/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py" }, { "name": "get_serial_nos_from_schedule", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "schedule", "type": "", "default": "None" } ], "def": "def get_serial_nos_from_schedule(item_code, schedule=None)", "def_index": 12646, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12626, "file": "erpnext/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py" }, { "name": "make_maintenance_visit", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" }, { "argument": "item_name", "type": "", "default": "None" }, { "argument": "s_id", "type": "", "default": "None" } ], "def": "def make_maintenance_visit(source_name, target_doc=None, item_name=None, s_id=None)", "def_index": 12968, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12948, "file": "erpnext/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py" }, { "name": "export_invoices", "arguments": [ { "argument": "filters", "type": "", "default": "None" } ], "def": "def export_invoices(filters=None)", "def_index": 852, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 832, "file": "erpnext/erpnext/regional/italy/utils.py" }, { "name": "generate_single_invoice", "arguments": [ { "argument": "docname", "type": "", "default": "" } ], "def": "def generate_single_invoice(docname)", "def_index": 12129, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12109, "file": "erpnext/erpnext/regional/italy/utils.py" }, { "name": "irs_1099_print", "arguments": [ { "argument": "filters", "type": "", "default": "" } ], "def": "def irs_1099_print(filters)", "def_index": 2220, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2200, "file": "erpnext/erpnext/regional/report/irs_1099/irs_1099.py" }, { "name": "process_file_data", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def process_file_data(self)", "def_index": 4483, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4462, "file": "erpnext/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.py" }, { "name": "get_item_details", "arguments": [ { "argument": "args", "type": "", "default": "" }, { "argument": "doc", "type": "", "default": "None" }, { "argument": "for_validate", "type": "", "default": "False" }, { "argument": "overwrite_warehouse", "type": "", "default": "True" } ], "def": "def get_item_details(args, doc=None, for_validate=False, overwrite_warehouse=True)", "def_index": 1285, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1265, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_item_tax_info", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "tax_category", "type": "", "default": "" }, { "argument": "item_codes", "type": "", "default": "" }, { "argument": "item_rates", "type": "", "default": "None" }, { "argument": "item_tax_templates", "type": "", "default": "None" } ], "def": "def get_item_tax_info(company, tax_category, item_codes, item_rates=None, item_tax_templates=None)", "def_index": 16465, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 16445, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_item_tax_map", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "item_tax_template", "type": "", "default": "" }, { "argument": "as_json", "type": "", "default": "True" } ], "def": "def get_item_tax_map(company, item_tax_template, as_json=True)", "def_index": 20022, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20002, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "calculate_service_end_date", "arguments": [ { "argument": "args", "type": "", "default": "" }, { "argument": "item", "type": "", "default": "None" } ], "def": "def calculate_service_end_date(args, item=None)", "def_index": 20433, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20413, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_pos_profile", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "pos_profile", "type": "", "default": "None" }, { "argument": "user", "type": "", "default": "None" } ], "def": "def get_pos_profile(company, pos_profile=None, user=None)", "def_index": 33768, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 33748, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_conversion_factor", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "uom", "type": "", "default": "" } ], "def": "def get_conversion_factor(item_code, uom)", "def_index": 34579, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 34559, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_projected_qty", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "warehouse", "type": "", "default": "" } ], "def": "def get_projected_qty(item_code, warehouse)", "def_index": 35143, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 35123, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_bin_details", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "warehouse", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "include_child_warehouses", "type": "", "default": "False" } ], "def": "def get_bin_details(item_code, warehouse, company=None, include_child_warehouses=False)", "def_index": 35343, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 35323, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_batch_qty", "arguments": [ { "argument": "batch_no", "type": "", "default": "" }, { "argument": "warehouse", "type": "", "default": "" }, { "argument": "item_code", "type": "", "default": "" } ], "def": "def get_batch_qty(batch_no, warehouse, item_code)", "def_index": 36576, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 36556, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "apply_price_list", "arguments": [ { "argument": "args", "type": "", "default": "" }, { "argument": "as_doc", "type": "", "default": "False" } ], "def": "def apply_price_list(args, as_doc=False)", "def_index": 36783, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 36763, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_default_bom", "arguments": [ { "argument": "item_code", "type": "", "default": "None" } ], "def": "def get_default_bom(item_code=None)", "def_index": 40112, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 40092, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_valuation_rate", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "warehouse", "type": "", "default": "None" } ], "def": "def get_valuation_rate(item_code, company, warehouse=None)", "def_index": 40563, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 40543, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_serial_no", "arguments": [ { "argument": "args", "type": "", "default": "" }, { "argument": "serial_nos", "type": "", "default": "None" }, { "argument": "sales_order", "type": "", "default": "None" } ], "def": "def get_serial_no(args, serial_nos=None, sales_order=None)", "def_index": 41768, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 41748, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_blanket_order_details", "arguments": [ { "argument": "args", "type": "", "default": "" } ], "def": "def get_blanket_order_details(args)", "def_index": 42102, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 42082, "file": "erpnext/erpnext/stock/get_item_details.py" }, { "name": "get_stock_balance", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "warehouse", "type": "", "default": "" }, { "argument": "posting_date", "type": "", "default": "None" }, { "argument": "posting_time", "type": "", "default": "None" }, { "argument": "with_valuation_rate", "type": "", "default": "False" }, { "argument": "with_serial_no", "type": "", "default": "False" }, { "argument": "", "type": "", "default": "" } ], "def": "def get_stock_balance(item_code,warehouse,posting_date=None,posting_time=None,with_valuation_rate=False,with_serial_no=False,)", "def_index": 2410, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2390, "file": "erpnext/erpnext/stock/utils.py" }, { "name": "get_latest_stock_qty", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "warehouse", "type": "", "default": "None" } ], "def": "def get_latest_stock_qty(item_code, warehouse=None)", "def_index": 4509, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4489, "file": "erpnext/erpnext/stock/utils.py" }, { "name": "get_incoming_rate", "arguments": [ { "argument": "args", "type": "", "default": "" }, { "argument": "raise_error_if_no_rate", "type": "", "default": "True" } ], "def": "def get_incoming_rate(args, raise_error_if_no_rate=True)", "def_index": 6565, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6545, "file": "erpnext/erpnext/stock/utils.py" }, { "name": "scan_barcode", "arguments": [ { "argument": "search_value", "type": "", "default": "" } ], "def": "def scan_barcode(search_value", "def_index": 15889, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 15869, "file": "erpnext/erpnext/stock/utils.py" }, { "name": "get", "arguments": [ { "argument": "chart_name", "type": "", "default": "None" }, { "argument": "chart", "type": "", "default": "None" }, { "argument": "no_cache", "type": "", "default": "None" }, { "argument": "filters", "type": "", "default": "None" }, { "argument": "from_date", "type": "", "default": "None" }, { "argument": "to_date", "type": "", "default": "None" }, { "argument": "timespan", "type": "", "default": "None" }, { "argument": "time_interval", "type": "", "default": "None" }, { "argument": "heatmap_year", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def get(chart_name=None,chart=None,no_cache=None,filters=None,from_date=None,to_date=None,timespan=None,time_interval=None,heatmap_year=None,)", "def_index": 248, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@cache_source" ], "index": 214, "file": "erpnext/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py" }, { "name": "get_data", "arguments": [ { "argument": "item_code", "type": "", "default": "None" }, { "argument": "warehouse", "type": "", "default": "None" }, { "argument": "item_group", "type": "", "default": "None" }, { "argument": "start", "type": "", "default": "0" }, { "argument": "sort_by", "type": "", "default": "actual_qty" }, { "argument": "sort_order", "type": "", "default": "desc" } ], "def": "def get_data(item_code=None, warehouse=None, item_group=None, start=0, sort_by=\"actual_qty\", sort_order=\"desc\")", "def_index": 119, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 99, "file": "erpnext/erpnext/stock/dashboard/item_dashboard.py" }, { "name": "get_data", "arguments": [ { "argument": "item_code", "type": "", "default": "None" }, { "argument": "warehouse", "type": "", "default": "None" }, { "argument": "parent_warehouse", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "start", "type": "", "default": "0" }, { "argument": "sort_by", "type": "", "default": "stock_capacity" }, { "argument": "sort_order", "type": "", "default": "desc" }, { "argument": "", "type": "", "default": "" } ], "def": "def get_data(item_code=None,warehouse=None,parent_warehouse=None,company=None,start=0,sort_by=\"stock_capacity\",sort_order=\"desc\",)", "def_index": 173, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 153, "file": "erpnext/erpnext/stock/dashboard/warehouse_capacity_dashboard.py" }, { "name": "create_reposting_entries", "arguments": [ { "argument": "rows", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def create_reposting_entries(rows, company)", "def_index": 3530, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 3510, "file": "erpnext/erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py" }, { "name": "restart_reposting", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def restart_reposting(self)", "def_index": 6031, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6010, "file": "erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py" }, { "name": "execute_repost_item_valuation", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def execute_repost_item_valuation()", "def_index": 12309, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12289, "file": "erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py" }, { "name": "enqueue_job", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def enqueue_job(self)", "def_index": 1961, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1940, "file": "erpnext/erpnext/stock/doctype/closing_stock_balance/closing_stock_balance.py" }, { "name": "regenerate_closing_balance", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def regenerate_closing_balance(self)", "def_index": 2157, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2136, "file": "erpnext/erpnext/stock/doctype/closing_stock_balance/closing_stock_balance.py" }, { "name": "get_inventory_documents", "arguments": [ { "argument": "doctype", "type": "", "default": "None" }, { "argument": "txt", "type": "", "default": "None" }, { "argument": "searchfield", "type": "", "default": "None" }, { "argument": "start", "type": "", "default": "None" }, { "argument": "page_len", "type": "", "default": "None" }, { "argument": "filters", "type": "", "default": "None" } ], "def": "def get_inventory_documents(doctype=None, txt=None, searchfield=None, start=None, page_len=None, filters=None)", "def_index": 7184, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7164, "file": "erpnext/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py" }, { "name": "get_inventory_dimensions", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_inventory_dimensions()", "def_index": 9259, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9239, "file": "erpnext/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py" }, { "name": "delete_dimension", "arguments": [ { "argument": "dimension", "type": "", "default": "" } ], "def": "def delete_dimension(dimension)", "def_index": 9736, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9716, "file": "erpnext/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py" }, { "name": "get_parent_fields", "arguments": [ { "argument": "child_doctype", "type": "", "default": "" }, { "argument": "dimension_name", "type": "", "default": "" } ], "def": "def get_parent_fields(child_doctype, dimension_name)", "def_index": 9861, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9841, "file": "erpnext/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py" }, { "name": "get_item_manufacturer_part_no", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "manufacturer", "type": "", "default": "" } ], "def": "def get_item_manufacturer_part_no(item_code, manufacturer)", "def_index": 2045, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2025, "file": "erpnext/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py" }, { "name": "set_item_locations", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "save", "type": "", "default": "False" } ], "def": "def set_item_locations(self, save=False)", "def_index": 6026, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6005, "file": "erpnext/erpnext/stock/doctype/pick_list/pick_list.py" }, { "name": "create_delivery_note", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def create_delivery_note(source_name, target_doc=None)", "def_index": 21437, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21417, "file": "erpnext/erpnext/stock/doctype/pick_list/pick_list.py" }, { "name": "create_stock_entry", "arguments": [ { "argument": "pick_list", "type": "", "default": "" } ], "def": "def create_stock_entry(pick_list)", "def_index": 26323, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 26303, "file": "erpnext/erpnext/stock/doctype/pick_list/pick_list.py" }, { "name": "get_pending_work_orders", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_length", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" }, { "argument": "as_dict", "type": "", "default": "" } ], "def": "def get_pending_work_orders(doctype, txt, searchfield, start, page_length, filters, as_dict)", "def_index": 27178, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 27158, "file": "erpnext/erpnext/stock/doctype/pick_list/pick_list.py" }, { "name": "target_document_exists", "arguments": [ { "argument": "pick_list_name", "type": "", "default": "" }, { "argument": "purpose", "type": "", "default": "" } ], "def": "def target_document_exists(pick_list_name, purpose)", "def_index": 27821, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 27801, "file": "erpnext/erpnext/stock/doctype/pick_list/pick_list.py" }, { "name": "get_item_details", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "uom", "type": "", "default": "None" } ], "def": "def get_item_details(item_code, uom=None)", "def_index": 28041, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28021, "file": "erpnext/erpnext/stock/doctype/pick_list/pick_list.py" }, { "name": "auto_fetch_serial_number", "arguments": [ { "argument": "qty", "type": "", "default": "" } ], "def": "def auto_fetch_serial_number(qty", "def_index": 4773, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4753, "file": "erpnext/erpnext/stock/doctype/serial_no/serial_no.py" }, { "name": "get_pos_reserved_serial_nos", "arguments": [ { "argument": "filters", "type": "", "default": "" } ], "def": "def get_pos_reserved_serial_nos(filters)", "def_index": 6364, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6344, "file": "erpnext/erpnext/stock/doctype/serial_no/serial_no.py" }, { "name": "process_route", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "optimize", "type": "", "default": "" } ], "def": "def process_route(self, optimize)", "def_index": 2837, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2816, "file": "erpnext/erpnext/stock/doctype/delivery_trip/delivery_trip.py" }, { "name": "get_contact_and_address", "arguments": [ { "argument": "name", "type": "", "default": "" } ], "def": "def get_contact_and_address(name)", "def_index": 7949, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7929, "file": "erpnext/erpnext/stock/doctype/delivery_trip/delivery_trip.py" }, { "name": "get_contact_display", "arguments": [ { "argument": "contact", "type": "", "default": "" } ], "def": "def get_contact_display(contact)", "def_index": 9271, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9251, "file": "erpnext/erpnext/stock/doctype/delivery_trip/delivery_trip.py" }, { "name": "notify_customers", "arguments": [ { "argument": "delivery_trip", "type": "", "default": "" } ], "def": "def notify_customers(delivery_trip)", "def_index": 10087, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10067, "file": "erpnext/erpnext/stock/doctype/delivery_trip/delivery_trip.py" }, { "name": "get_driver_email", "arguments": [ { "argument": "driver", "type": "", "default": "" } ], "def": "def get_driver_email(driver)", "def_index": 12053, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12033, "file": "erpnext/erpnext/stock/doctype/delivery_trip/delivery_trip.py" }, { "name": "get_alternative_items", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_alternative_items(doctype, txt, searchfield, start, page_len, filters)", "def_index": 2298, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 2234, "file": "erpnext/erpnext/stock/doctype/item_alternative/item_alternative.py" }, { "name": "get_items", "arguments": [ { "argument": "warehouse", "type": "", "default": "" }, { "argument": "posting_date", "type": "", "default": "" }, { "argument": "posting_time", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "item_code", "type": "", "default": "None" }, { "argument": "ignore_empty_stock", "type": "", "default": "False" } ], "def": "def get_items(warehouse, posting_date, posting_time, company, item_code=None, ignore_empty_stock=False)", "def_index": 23509, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 23489, "file": "erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py" }, { "name": "get_stock_balance_for", "arguments": [ { "argument": "item_code", "type": "", "default": "" } ], "def": "def get_stock_balance_for(item_code", "def_index": 27210, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 27190, "file": "erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py" }, { "name": "get_difference_account", "arguments": [ { "argument": "purpose", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def get_difference_account(purpose, company)", "def_index": 28476, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28456, "file": "erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py" }, { "name": "cancel_stock_reservation_entries", "arguments": [ { "argument": "voucher_type", "type": "", "default": "" } ], "def": "def cancel_stock_reservation_entries(voucher_type", "def_index": 8379, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8359, "file": "erpnext/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py" }, { "name": "update_status", "arguments": [ { "argument": "name", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def update_status(name, status)", "def_index": 11212, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11192, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "make_purchase_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" }, { "argument": "args", "type": "", "default": "None" } ], "def": "def make_purchase_order(source_name, target_doc=None, args=None)", "def_index": 11412, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11392, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "make_request_for_quotation", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_request_for_quotation(source_name, target_doc=None)", "def_index": 12896, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12876, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "make_purchase_order_based_on_supplier", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" }, { "argument": "args", "type": "", "default": "None" } ], "def": "def make_purchase_order_based_on_supplier(source_name, target_doc=None, args=None)", "def_index": 13450, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 13430, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "get_items_based_on_default_supplier", "arguments": [ { "argument": "supplier", "type": "", "default": "" } ], "def": "def get_items_based_on_default_supplier(supplier)", "def_index": 14515, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 14495, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "get_material_requests_based_on_supplier", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_material_requests_based_on_supplier(doctype, txt, searchfield, start, page_len, filters)", "def_index": 14806, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 14742, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "get_default_supplier_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_default_supplier_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 16074, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 16010, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "make_supplier_quotation", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_supplier_quotation(source_name, target_doc=None)", "def_index": 16529, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 16509, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "make_stock_entry", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_stock_entry(source_name, target_doc=None)", "def_index": 17179, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 17159, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "raise_work_orders", "arguments": [ { "argument": "material_request", "type": "", "default": "" } ], "def": "def raise_work_orders(material_request)", "def_index": 19575, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 19555, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "create_pick_list", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def create_pick_list(source_name, target_doc=None)", "def_index": 21441, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21421, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "make_in_transit_stock_entry", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "in_transit_warehouse", "type": "", "default": "" } ], "def": "def make_in_transit_stock_entry(source_name, in_transit_warehouse)", "def_index": 21939, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21919, "file": "erpnext/erpnext/stock/doctype/material_request/material_request.py" }, { "name": "item_details", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def item_details(doctype, txt, searchfield, start, page_len, filters)", "def_index": 5322, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 5258, "file": "erpnext/erpnext/stock/doctype/packing_slip/packing_slip.py" }, { "name": "get_batch_qty", "arguments": [ { "argument": "batch_no", "type": "", "default": "None" }, { "argument": "warehouse", "type": "", "default": "None" }, { "argument": "item_code", "type": "", "default": "None" }, { "argument": "posting_date", "type": "", "default": "None" }, { "argument": "posting_time", "type": "", "default": "None" }, { "argument": "ignore_voucher_nos", "type": "", "default": "None" }, { "argument": "", "type": "", "default": "" } ], "def": "def get_batch_qty(batch_no=None,warehouse=None,item_code=None,posting_date=None,posting_time=None,ignore_voucher_nos=None,)", "def_index": 4631, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4611, "file": "erpnext/erpnext/stock/doctype/batch/batch.py" }, { "name": "get_batches_by_oldest", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "warehouse", "type": "", "default": "" } ], "def": "def get_batches_by_oldest(item_code, warehouse)", "def_index": 5747, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5727, "file": "erpnext/erpnext/stock/doctype/batch/batch.py" }, { "name": "split_batch", "arguments": [ { "argument": "batch_no", "type": "", "default": "" }, { "argument": "item_code", "type": "", "default": "" }, { "argument": "warehouse", "type": "", "default": "" }, { "argument": "qty", "type": "", "default": "" }, { "argument": "new_batch_id", "type": "", "default": "None" } ], "def": "def split_batch(batch_no, item_code, warehouse, qty, new_batch_id=None)", "def_index": 6140, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6120, "file": "erpnext/erpnext/stock/doctype/batch/batch.py" }, { "name": "get_pos_reserved_batch_qty", "arguments": [ { "argument": "filters", "type": "", "default": "" } ], "def": "def get_pos_reserved_batch_qty(filters)", "def_index": 9814, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9794, "file": "erpnext/erpnext/stock/doctype/batch/batch.py" }, { "name": "get_items_from_product_bundle", "arguments": [ { "argument": "row", "type": "", "default": "" } ], "def": "def get_items_from_product_bundle(row)", "def_index": 8955, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8935, "file": "erpnext/erpnext/stock/doctype/packed_item/packed_item.py" }, { "name": "get_item_details", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "None" } ], "def": "def get_item_details(item_code, company=None)", "def_index": 38912, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 38892, "file": "erpnext/erpnext/stock/doctype/item/item.py" }, { "name": "get_uom_conv_factor", "arguments": [ { "argument": "uom", "type": "", "default": "" }, { "argument": "stock_uom", "type": "", "default": "" } ], "def": "def get_uom_conv_factor(uom, stock_uom)", "def_index": 39169, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 39149, "file": "erpnext/erpnext/stock/doctype/item/item.py" }, { "name": "get_item_attribute", "arguments": [ { "argument": "parent", "type": "", "default": "" }, { "argument": "attribute_value", "type": "", "default": "" } ], "def": "def get_item_attribute(parent, attribute_value=\"\")", "def_index": 40406, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 40386, "file": "erpnext/erpnext/stock/doctype/item/item.py" }, { "name": "get_asset_naming_series", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_asset_naming_series()", "def_index": 41976, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 41956, "file": "erpnext/erpnext/stock/doctype/item/item.py" }, { "name": "get_available_putaway_capacity", "arguments": [ { "argument": "rule", "type": "", "default": "" } ], "def": "def get_available_putaway_capacity(rule)", "def_index": 2142, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2122, "file": "erpnext/erpnext/stock/doctype/putaway_rule/putaway_rule.py" }, { "name": "apply_putaway_rule", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "items", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "sync", "type": "", "default": "None" }, { "argument": "purpose", "type": "", "default": "None" } ], "def": "def apply_putaway_rule(doctype, items, company, sync=None, purpose=None)", "def_index": 2502, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2482, "file": "erpnext/erpnext/stock/doctype/putaway_rule/putaway_rule.py" }, { "name": "make_sales_invoice", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_sales_invoice(source_name, target_doc=None)", "def_index": 20238, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20218, "file": "erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py" }, { "name": "make_delivery_trip", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_delivery_trip(source_name, target_doc=None)", "def_index": 23147, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 23127, "file": "erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py" }, { "name": "make_installation_note", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_installation_note(source_name, target_doc=None)", "def_index": 24157, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 24137, "file": "erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py" }, { "name": "make_packing_slip", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_packing_slip(source_name, target_doc=None)", "def_index": 24870, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 24850, "file": "erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py" }, { "name": "make_shipment", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_shipment(source_name, target_doc=None)", "def_index": 26282, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 26262, "file": "erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py" }, { "name": "make_sales_return", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_sales_return(source_name, target_doc=None)", "def_index": 28667, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28647, "file": "erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py" }, { "name": "update_delivery_note_status", "arguments": [ { "argument": "docname", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def update_delivery_note_status(docname, status)", "def_index": 28884, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28864, "file": "erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py" }, { "name": "make_inter_company_purchase_receipt", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_inter_company_purchase_receipt(source_name, target_doc=None)", "def_index": 29029, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 29009, "file": "erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py" }, { "name": "get_address_name", "arguments": [ { "argument": "ref_doctype", "type": "", "default": "" }, { "argument": "docname", "type": "", "default": "" } ], "def": "def get_address_name(ref_doctype, docname)", "def_index": 1467, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1447, "file": "erpnext/erpnext/stock/doctype/shipment/shipment.py" }, { "name": "get_contact_name", "arguments": [ { "argument": "ref_doctype", "type": "", "default": "" }, { "argument": "docname", "type": "", "default": "" } ], "def": "def get_contact_name(ref_doctype, docname)", "def_index": 1613, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1593, "file": "erpnext/erpnext/stock/doctype/shipment/shipment.py" }, { "name": "get_company_contact", "arguments": [ { "argument": "user", "type": "", "default": "" } ], "def": "def get_company_contact(user)", "def_index": 1752, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1732, "file": "erpnext/erpnext/stock/doctype/shipment/shipment.py" }, { "name": "make_purchase_invoice", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_purchase_invoice(source_name, target_doc=None)", "def_index": 34430, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 34410, "file": "erpnext/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py" }, { "name": "make_purchase_return_against_rejected_warehouse", "arguments": [ { "argument": "source_name", "type": "", "default": "" } ], "def": "def make_purchase_return_against_rejected_warehouse(source_name)", "def_index": 38057, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 38037, "file": "erpnext/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py" }, { "name": "make_purchase_return", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_purchase_return(source_name, target_doc=None)", "def_index": 38312, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 38292, "file": "erpnext/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py" }, { "name": "update_purchase_receipt_status", "arguments": [ { "argument": "docname", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" } ], "def": "def update_purchase_receipt_status(docname, status)", "def_index": 38535, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 38515, "file": "erpnext/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py" }, { "name": "make_stock_entry", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_stock_entry(source_name, target_doc=None)", "def_index": 38686, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 38666, "file": "erpnext/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py" }, { "name": "make_inter_company_delivery_note", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_inter_company_delivery_note(source_name, target_doc=None)", "def_index": 39315, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 39295, "file": "erpnext/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py" }, { "name": "get_children", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" }, { "argument": "is_root", "type": "", "default": "False" } ], "def": "def get_children(doctype, parent=None, company=None, is_root=False)", "def_index": 4574, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4554, "file": "erpnext/erpnext/stock/doctype/warehouse/warehouse.py" }, { "name": "add_node", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def add_node()", "def_index": 4939, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4919, "file": "erpnext/erpnext/stock/doctype/warehouse/warehouse.py" }, { "name": "convert_to_group_or_ledger", "arguments": [ { "argument": "docname", "type": "", "default": "None" } ], "def": "def convert_to_group_or_ledger(docname=None)", "def_index": 5158, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5138, "file": "erpnext/erpnext/stock/doctype/warehouse/warehouse.py" }, { "name": "get_items_from_purchase_receipts", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_items_from_purchase_receipts(self)", "def_index": 500, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 479, "file": "erpnext/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py" }, { "name": "get_item_specification_details", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_item_specification_details(self)", "def_index": 1127, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1106, "file": "erpnext/erpnext/stock/doctype/quality_inspection/quality_inspection.py" }, { "name": "get_quality_inspection_template", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_quality_inspection_template(self)", "def_index": 1619, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1598, "file": "erpnext/erpnext/stock/doctype/quality_inspection/quality_inspection.py" }, { "name": "item_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def item_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 6714, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 6650, "file": "erpnext/erpnext/stock/doctype/quality_inspection/quality_inspection.py" }, { "name": "quality_inspection_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def quality_inspection_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 8829, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 8765, "file": "erpnext/erpnext/stock/doctype/quality_inspection/quality_inspection.py" }, { "name": "make_quality_inspection", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_quality_inspection(source_name, target_doc=None)", "def_index": 9234, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 9214, "file": "erpnext/erpnext/stock/doctype/quality_inspection/quality_inspection.py" }, { "name": "get_stock_item_details", "arguments": [ { "argument": "warehouse", "type": "", "default": "" }, { "argument": "date", "type": "", "default": "" }, { "argument": "item", "type": "", "default": "None" }, { "argument": "barcode", "type": "", "default": "None" } ], "def": "def get_stock_item_details(warehouse, date, item=None, barcode=None)", "def_index": 335, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 315, "file": "erpnext/erpnext/stock/doctype/quick_stock_balance/quick_stock_balance.py" }, { "name": "convert_to_item_wh_reposting", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def convert_to_item_wh_reposting(self)", "def_index": 906, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 885, "file": "erpnext/erpnext/stock/doctype/stock_reposting_settings/stock_reposting_settings.py" }, { "name": "make_stock_entry", "arguments": [ { "argument": "**args", "type": "", "default": "" } ], "def": "def make_stock_entry(**args)", "def_index": 817, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 797, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry_utils.py" }, { "name": "get_stock_and_rate", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_stock_and_rate(self)", "def_index": 21665, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21644, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "get_item_details", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "args", "type": "", "default": "None" }, { "argument": "for_update", "type": "", "default": "False" } ], "def": "def get_item_details(self, args=None, for_update=False)", "def_index": 45551, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 45530, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "set_items_for_stock_in", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def set_items_for_stock_in(self)", "def_index": 48477, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 48456, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "get_items", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_items(self)", "def_index": 49154, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 49133, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "move_sample_to_retention_warehouse", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "items", "type": "", "default": "" } ], "def": "def move_sample_to_retention_warehouse(company, items)", "def_index": 78944, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 78924, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "make_stock_in_entry", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_stock_in_entry(source_name, target_doc=None)", "def_index": 80667, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 80647, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "get_work_order_details", "arguments": [ { "argument": "work_order", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def get_work_order_details(work_order, company)", "def_index": 82058, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 82038, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "get_uom_details", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "uom", "type": "", "default": "" }, { "argument": "qty", "type": "", "default": "" } ], "def": "def get_uom_details(item_code, uom, qty)", "def_index": 85001, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 84981, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "get_expired_batch_items", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def get_expired_batch_items()", "def_index": 85580, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 85560, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "get_warehouse_details", "arguments": [ { "argument": "args", "type": "", "default": "" } ], "def": "def get_warehouse_details(args)", "def_index": 85998, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 85978, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "validate_sample_quantity", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "sample_quantity", "type": "", "default": "" }, { "argument": "qty", "type": "", "default": "" }, { "argument": "batch_no", "type": "", "default": "None" } ], "def": "def validate_sample_quantity(item_code, sample_quantity, qty, batch_no=None)", "def_index": 86434, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 86414, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "get_items_from_subcontract_order", "arguments": [ { "argument": "source_name", "type": "", "default": "" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def get_items_from_subcontract_order(source_name, target_doc=None)", "def_index": 88642, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 88622, "file": "erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py" }, { "name": "set_warehouse", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def set_warehouse(self)", "def_index": 12387, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 12366, "file": "erpnext/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py" }, { "name": "add_serial_batch", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "data", "type": "", "default": "" } ], "def": "def add_serial_batch(self, data)", "def_index": 20370, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20349, "file": "erpnext/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py" }, { "name": "download_blank_csv_template", "arguments": [ { "argument": "content", "type": "", "default": "" } ], "def": "def download_blank_csv_template(content)", "def_index": 20872, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20852, "file": "erpnext/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py" }, { "name": "upload_csv_file", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "file_path", "type": "", "default": "" } ], "def": "def upload_csv_file(item_code, file_path)", "def_index": 21161, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21141, "file": "erpnext/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py" }, { "name": "item_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" }, { "argument": "as_dict", "type": "", "default": "False" } ], "def": "def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False)", "def_index": 24548, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 24484, "file": "erpnext/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py" }, { "name": "get_serial_batch_ledgers", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "docstatus", "type": "", "default": "None" }, { "argument": "voucher_no", "type": "", "default": "None" }, { "argument": "name", "type": "", "default": "None" } ], "def": "def get_serial_batch_ledgers(item_code, docstatus=None, voucher_no=None, name=None)", "def_index": 24902, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 24882, "file": "erpnext/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py" }, { "name": "add_serial_batch_ledgers", "arguments": [ { "argument": "entries", "type": "", "default": "" }, { "argument": "child_row", "type": "", "default": "" }, { "argument": "doc", "type": "", "default": "" }, { "argument": "warehouse", "type": "", "default": "" } ], "def": "def add_serial_batch_ledgers(entries, child_row, doc, warehouse) -> object", "def_index": 26211, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 26191, "file": "erpnext/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py" }, { "name": "get_auto_data", "arguments": [ { "argument": "**kwargs", "type": "", "default": "" } ], "def": "def get_auto_data(**kwargs)", "def_index": 29842, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 29822, "file": "erpnext/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py" }, { "name": "get_all_customers", "arguments": [ { "argument": "date_range", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "field", "type": "", "default": "" }, { "argument": "limit", "type": "", "default": "None" } ], "def": "def get_all_customers(date_range, company, field, limit=None)", "def_index": 1549, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 1529, "file": "erpnext/erpnext/startup/leaderboard.py" }, { "name": "get_all_items", "arguments": [ { "argument": "date_range", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "field", "type": "", "default": "" }, { "argument": "limit", "type": "", "default": "None" } ], "def": "def get_all_items(date_range, company, field, limit=None)", "def_index": 2715, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2695, "file": "erpnext/erpnext/startup/leaderboard.py" }, { "name": "get_all_suppliers", "arguments": [ { "argument": "date_range", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "field", "type": "", "default": "" }, { "argument": "limit", "type": "", "default": "None" } ], "def": "def get_all_suppliers(date_range, company, field, limit=None)", "def_index": 4163, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4143, "file": "erpnext/erpnext/startup/leaderboard.py" }, { "name": "get_all_sales_partner", "arguments": [ { "argument": "date_range", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "field", "type": "", "default": "" }, { "argument": "limit", "type": "", "default": "None" } ], "def": "def get_all_sales_partner(date_range, company, field, limit=None)", "def_index": 5488, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5468, "file": "erpnext/erpnext/startup/leaderboard.py" }, { "name": "get_all_sales_person", "arguments": [ { "argument": "date_range", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "field", "type": "", "default": "None" }, { "argument": "limit", "type": "", "default": "0" } ], "def": "def get_all_sales_person(date_range, company, field=None, limit=0)", "def_index": 6164, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6144, "file": "erpnext/erpnext/startup/leaderboard.py" }, { "name": "get_round_off_applicable_accounts", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "account_list", "type": "", "default": "" } ], "def": "def get_round_off_applicable_accounts(company, account_list)", "def_index": 33275, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 33255, "file": "erpnext/erpnext/controllers/taxes_and_totals.py" }, { "name": "apply_shipping_rule", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def apply_shipping_rule(self)", "def_index": 26765, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 26744, "file": "erpnext/erpnext/controllers/accounts_controller.py" }, { "name": "set_advances", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def set_advances(self)", "def_index": 27479, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 27458, "file": "erpnext/erpnext/controllers/accounts_controller.py" }, { "name": "get_tax_rate", "arguments": [ { "argument": "account_head", "type": "", "default": "" } ], "def": "def get_tax_rate(account_head)", "def_index": 64725, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 64705, "file": "erpnext/erpnext/controllers/accounts_controller.py" }, { "name": "get_default_taxes_and_charges", "arguments": [ { "argument": "master_doctype", "type": "", "default": "" }, { "argument": "tax_template", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" } ], "def": "def get_default_taxes_and_charges(master_doctype, tax_template=None, company=None)", "def_index": 64885, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 64865, "file": "erpnext/erpnext/controllers/accounts_controller.py" }, { "name": "get_taxes_and_charges", "arguments": [ { "argument": "master_doctype", "type": "", "default": "" }, { "argument": "master_name", "type": "", "default": "" } ], "def": "def get_taxes_and_charges(master_doctype, master_name)", "def_index": 65393, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 65373, "file": "erpnext/erpnext/controllers/accounts_controller.py" }, { "name": "get_payment_terms", "arguments": [ { "argument": "terms_template", "type": "", "default": "" }, { "argument": "posting_date", "type": "", "default": "None" }, { "argument": "grand_total", "type": "", "default": "None" }, { "argument": "base_grand_total", "type": "", "default": "None" }, { "argument": "bill_date", "type": "", "default": "None" } ], "def": "def get_payment_terms(terms_template, posting_date=None, grand_total=None, base_grand_total=None, bill_date=None)", "def_index": 76710, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 76690, "file": "erpnext/erpnext/controllers/accounts_controller.py" }, { "name": "get_payment_term_details", "arguments": [ { "argument": "term", "type": "", "default": "" }, { "argument": "posting_date", "type": "", "default": "None" }, { "argument": "grand_total", "type": "", "default": "None" }, { "argument": "base_grand_total", "type": "", "default": "None" }, { "argument": "bill_date", "type": "", "default": "None" } ], "def": "def get_payment_term_details(term, posting_date=None, grand_total=None, base_grand_total=None, bill_date=None)", "def_index": 77162, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 77142, "file": "erpnext/erpnext/controllers/accounts_controller.py" }, { "name": "update_child_qty_rate", "arguments": [ { "argument": "parent_doctype", "type": "", "default": "" }, { "argument": "trans_items", "type": "", "default": "" }, { "argument": "parent_doctype_name", "type": "", "default": "" }, { "argument": "child_docname", "type": "", "default": "items" } ], "def": "def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, child_docname=\"items\")", "def_index": 85170, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 85150, "file": "erpnext/erpnext/controllers/accounts_controller.py" }, { "name": "get_current_stock", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_current_stock(self)", "def_index": 29708, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 29687, "file": "erpnext/erpnext/controllers/subcontracting_controller.py" }, { "name": "make_rm_stock_entry", "arguments": [ { "argument": "subcontract_order", "type": "", "default": "" }, { "argument": "rm_items", "type": "", "default": "None" }, { "argument": "order_doctype", "type": "", "default": "Subcontracting Order" }, { "argument": "target_doc", "type": "", "default": "None" } ], "def": "def make_rm_stock_entry(subcontract_order, rm_items=None, order_doctype=\"Subcontracting Order\", target_doc=None)", "def_index": 30887, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 30867, "file": "erpnext/erpnext/controllers/subcontracting_controller.py" }, { "name": "get_materials_from_supplier", "arguments": [ { "argument": "subcontract_order", "type": "", "default": "" }, { "argument": "rm_details", "type": "", "default": "" }, { "argument": "order_doctype", "type": "", "default": "Subcontracting Order" } ], "def": "def get_materials_from_supplier(subcontract_order, rm_details, order_doctype=\"Subcontracting Order\")", "def_index": 35540, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 35520, "file": "erpnext/erpnext/controllers/subcontracting_controller.py" }, { "name": "employee_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def employee_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 581, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 517, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "lead_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def lead_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 1626, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 1562, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "customer_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" }, { "argument": "as_dict", "type": "", "default": "False" } ], "def": "def customer_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False)", "def_index": 2868, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 2804, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "supplier_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" }, { "argument": "as_dict", "type": "", "default": "False" } ], "def": "def supplier_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False)", "def_index": 4166, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 4102, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "tax_account_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def tax_account_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 5286, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 5222, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "item_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" }, { "argument": "as_dict", "type": "", "default": "False" } ], "def": "def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False)", "def_index": 6636, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 6572, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "bom", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def bom(doctype, txt, searchfield, start, page_len, filters)", "def_index": 9679, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 9615, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_project_name", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_project_name(doctype, txt, searchfield, start, page_len, filters)", "def_index": 10537, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 10473, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_delivery_notes_to_be_billed", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" }, { "argument": "as_dict", "type": "", "default": "" } ], "def": "def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters, as_dict)", "def_index": 11746, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 11682, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_batch_no", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_batch_no(doctype, txt, searchfield, start, page_len, filters)", "def_index": 12956, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 12892, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_account_list", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_account_list(doctype, txt, searchfield, start, page_len, filters)", "def_index": 16880, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 16816, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_blanket_orders", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_blanket_orders(doctype, txt, searchfield, start, page_len, filters)", "def_index": 17726, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 17662, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_income_account", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_income_account(doctype, txt, searchfield, start, page_len, filters)", "def_index": 18369, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 18305, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_filtered_dimensions", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" }, { "argument": "reference_doctype", "type": "", "default": "None" } ], "def": "def get_filtered_dimensions(doctype, txt, searchfield, start, page_len, filters, reference_doctype=None)", "def_index": 19391, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 19327, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_expense_account", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_expense_account(doctype, txt, searchfield, start, page_len, filters)", "def_index": 20934, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 20870, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "warehouse_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def warehouse_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 21850, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 21786, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_batch_numbers", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_batch_numbers(doctype, txt, searchfield, start, page_len, filters)", "def_index": 23108, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 23044, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "item_manufacturer_query", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def item_manufacturer_query(doctype, txt, searchfield, start, page_len, filters)", "def_index": 23617, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 23553, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_purchase_receipts", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_purchase_receipts(doctype, txt, searchfield, start, page_len, filters)", "def_index": 24110, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 24046, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_purchase_invoices", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_purchase_invoices(doctype, txt, searchfield, start, page_len, filters)", "def_index": 24688, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 24624, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_tax_template", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_tax_template(doctype, txt, searchfield, start, page_len, filters)", "def_index": 25266, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 25202, "file": "erpnext/erpnext/controllers/queries.py" }, { "name": "get_variant", "arguments": [ { "argument": "template", "type": "", "default": "" }, { "argument": "args", "type": "", "default": "None" }, { "argument": "variant", "type": "", "default": "None" }, { "argument": "manufacturer", "type": "", "default": "None" }, { "argument": "manufacturer_part_no", "type": "", "default": "None" } ], "def": "def get_variant(template, args=None, variant=None, manufacturer=None, manufacturer_part_no=None)", "def_index": 445, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 425, "file": "erpnext/erpnext/controllers/item_variant.py" }, { "name": "create_variant", "arguments": [ { "argument": "item", "type": "", "default": "" }, { "argument": "args", "type": "", "default": "" } ], "def": "def create_variant(item, args)", "def_index": 6065, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6045, "file": "erpnext/erpnext/controllers/item_variant.py" }, { "name": "enqueue_multiple_variant_creation", "arguments": [ { "argument": "item", "type": "", "default": "" }, { "argument": "args", "type": "", "default": "" } ], "def": "def enqueue_multiple_variant_creation(item, args)", "def_index": 6633, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 6613, "file": "erpnext/erpnext/controllers/item_variant.py" }, { "name": "create_variant_doc_for_quick_entry", "arguments": [ { "argument": "template", "type": "", "default": "" }, { "argument": "args", "type": "", "default": "" } ], "def": "def create_variant_doc_for_quick_entry(template, args)", "def_index": 11924, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 11904, "file": "erpnext/erpnext/controllers/item_variant.py" }, { "name": "get_period_date_ranges", "arguments": [ { "argument": "period", "type": "", "default": "" }, { "argument": "fiscal_year", "type": "", "default": "None" }, { "argument": "year_start_date", "type": "", "default": "None" } ], "def": "def get_period_date_ranges(period, fiscal_year=None, year_start_date=None)", "def_index": 7835, "request_types": [], "xss_safe": false, "allow_guest": true, "other_decorators": [], "index": 7799, "file": "erpnext/erpnext/controllers/trends.py" }, { "name": "show_accounting_ledger_preview", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "doctype", "type": "", "default": "" }, { "argument": "docname", "type": "", "default": "" } ], "def": "def show_accounting_ledger_preview(company, doctype, docname)", "def_index": 28076, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28056, "file": "erpnext/erpnext/controllers/stock_controller.py" }, { "name": "show_stock_ledger_preview", "arguments": [ { "argument": "company", "type": "", "default": "" }, { "argument": "doctype", "type": "", "default": "" }, { "argument": "docname", "type": "", "default": "" } ], "def": "def show_stock_ledger_preview(company, doctype, docname)", "def_index": 28405, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 28385, "file": "erpnext/erpnext/controllers/stock_controller.py" }, { "name": "make_quality_inspections", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "docname", "type": "", "default": "" }, { "argument": "items", "type": "", "default": "" } ], "def": "def make_quality_inspections(doctype, docname, items)", "def_index": 32214, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 32194, "file": "erpnext/erpnext/controllers/stock_controller.py" }, { "name": "get_depr_schedule", "arguments": [ { "argument": "asset_name", "type": "", "default": "" }, { "argument": "status", "type": "", "default": "" }, { "argument": "finance_book", "type": "", "default": "None" } ], "def": "def get_depr_schedule(asset_name, status, finance_book=None)", "def_index": 21913, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21893, "file": "erpnext/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py" }, { "name": "calculate_next_due_date", "arguments": [ { "argument": "periodicity", "type": "", "default": "" }, { "argument": "start_date", "type": "", "default": "None" }, { "argument": "end_date", "type": "", "default": "None" }, { "argument": "last_completion_date", "type": "", "default": "None" }, { "argument": "next_due_date", "type": "", "default": "None" } ], "def": "def calculate_next_due_date(periodicity, start_date=None, end_date=None, last_completion_date=None, next_due_date=None)", "def_index": 2329, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2309, "file": "erpnext/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py" }, { "name": "get_team_members", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_team_members(doctype, txt, searchfield, start, page_len, filters)", "def_index": 4747, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 4683, "file": "erpnext/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py" }, { "name": "get_maintenance_log", "arguments": [ { "argument": "asset_name", "type": "", "default": "" } ], "def": "def get_maintenance_log(asset_name)", "def_index": 4965, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 4945, "file": "erpnext/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py" }, { "name": "set_warehouse_details", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def set_warehouse_details(self)", "def_index": 7619, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7598, "file": "erpnext/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py" }, { "name": "set_asset_values", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def set_asset_values(self)", "def_index": 7876, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 7855, "file": "erpnext/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py" }, { "name": "get_target_item_details", "arguments": [ { "argument": "item_code", "type": "", "default": "None" }, { "argument": "company", "type": "", "default": "None" } ], "def": "def get_target_item_details(item_code=None, company=None)", "def_index": 18014, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 17994, "file": "erpnext/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py" }, { "name": "get_consumed_stock_item_details", "arguments": [ { "argument": "args", "type": "", "default": "" } ], "def": "def get_consumed_stock_item_details(args)", "def_index": 19100, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 19080, "file": "erpnext/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py" }, { "name": "get_warehouse_details", "arguments": [ { "argument": "args", "type": "", "default": "" } ], "def": "def get_warehouse_details(args)", "def_index": 20472, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20452, "file": "erpnext/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py" }, { "name": "get_consumed_asset_details", "arguments": [ { "argument": "args", "type": "", "default": "" } ], "def": "def get_consumed_asset_details(args)", "def_index": 20835, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 20815, "file": "erpnext/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py" }, { "name": "get_service_item_details", "arguments": [ { "argument": "args", "type": "", "default": "" } ], "def": "def get_service_item_details(args)", "def_index": 22359, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22339, "file": "erpnext/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py" }, { "name": "get_manual_depreciation_entries", "arguments": [ { "argument": "self", "type": "", "default": "" } ], "def": "def get_manual_depreciation_entries(self)", "def_index": 14324, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 14303, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "get_depreciation_rate", "arguments": [ { "argument": "self", "type": "", "default": "" }, { "argument": "args", "type": "", "default": "" }, { "argument": "on_validate", "type": "", "default": "False" } ], "def": "def get_depreciation_rate(self, args, on_validate=False)", "def_index": 18818, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 18797, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "make_sales_invoice", "arguments": [ { "argument": "asset", "type": "", "default": "" }, { "argument": "item_code", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" }, { "argument": "serial_no", "type": "", "default": "None" } ], "def": "def make_sales_invoice(asset, item_code, company, serial_no=None)", "def_index": 21211, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21191, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "create_asset_maintenance", "arguments": [ { "argument": "asset", "type": "", "default": "" }, { "argument": "item_code", "type": "", "default": "" }, { "argument": "item_name", "type": "", "default": "" }, { "argument": "asset_category", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def create_asset_maintenance(asset, item_code, item_name, asset_category, company)", "def_index": 21795, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 21775, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "create_asset_repair", "arguments": [ { "argument": "asset", "type": "", "default": "" }, { "argument": "asset_name", "type": "", "default": "" } ], "def": "def create_asset_repair(asset, asset_name)", "def_index": 22160, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22140, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "create_asset_value_adjustment", "arguments": [ { "argument": "asset", "type": "", "default": "" }, { "argument": "asset_category", "type": "", "default": "" }, { "argument": "company", "type": "", "default": "" } ], "def": "def create_asset_value_adjustment(asset, asset_category, company)", "def_index": 22359, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22339, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "transfer_asset", "arguments": [ { "argument": "args", "type": "", "default": "" } ], "def": "def transfer_asset(args)", "def_index": 22654, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 22634, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "get_item_details", "arguments": [ { "argument": "item_code", "type": "", "default": "" }, { "argument": "asset_category", "type": "", "default": "" } ], "def": "def get_item_details(item_code, asset_category)", "def_index": 23121, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 23101, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "make_journal_entry", "arguments": [ { "argument": "asset_name", "type": "", "default": "" } ], "def": "def make_journal_entry(asset_name)", "def_index": 24410, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 24390, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "make_asset_movement", "arguments": [ { "argument": "assets", "type": "", "default": "" }, { "argument": "purpose", "type": "", "default": "None" } ], "def": "def make_asset_movement(assets, purpose=None)", "def_index": 25460, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 25440, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "get_asset_value_after_depreciation", "arguments": [ { "argument": "asset_name", "type": "", "default": "" }, { "argument": "finance_book", "type": "", "default": "None" } ], "def": "def get_asset_value_after_depreciation(asset_name, finance_book=None)", "def_index": 26287, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 26267, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "split_asset", "arguments": [ { "argument": "asset_name", "type": "", "default": "" }, { "argument": "split_qty", "type": "", "default": "" } ], "def": "def split_asset(asset_name, split_qty)", "def_index": 26483, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 26463, "file": "erpnext/erpnext/assets/doctype/asset/asset.py" }, { "name": "make_depreciation_entry", "arguments": [ { "argument": "asset_depr_schedule_name", "type": "", "default": "" }, { "argument": "date", "type": "", "default": "None" } ], "def": "def make_depreciation_entry(asset_depr_schedule_name, date=None)", "def_index": 2445, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 2425, "file": "erpnext/erpnext/assets/doctype/asset/depreciation.py" }, { "name": "scrap_asset", "arguments": [ { "argument": "asset_name", "type": "", "default": "" } ], "def": "def scrap_asset(asset_name)", "def_index": 8631, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 8611, "file": "erpnext/erpnext/assets/doctype/asset/depreciation.py" }, { "name": "restore_asset", "arguments": [ { "argument": "asset_name", "type": "", "default": "" } ], "def": "def restore_asset(asset_name)", "def_index": 10028, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 10008, "file": "erpnext/erpnext/assets/doctype/asset/depreciation.py" }, { "name": "get_disposal_account_and_cost_center", "arguments": [ { "argument": "company", "type": "", "default": "" } ], "def": "def get_disposal_account_and_cost_center(company)", "def_index": 17509, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 17489, "file": "erpnext/erpnext/assets/doctype/asset/depreciation.py" }, { "name": "get_value_after_depreciation_on_disposal_date", "arguments": [ { "argument": "asset", "type": "", "default": "" }, { "argument": "disposal_date", "type": "", "default": "" }, { "argument": "finance_book", "type": "", "default": "None" } ], "def": "def get_value_after_depreciation_on_disposal_date(asset, disposal_date, finance_book=None)", "def_index": 18044, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 18024, "file": "erpnext/erpnext/assets/doctype/asset/depreciation.py" }, { "name": "get_children", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "parent", "type": "", "default": "None" }, { "argument": "location", "type": "", "default": "None" }, { "argument": "is_root", "type": "", "default": "False" } ], "def": "def get_children(doctype, parent=None, location=None, is_root=False)", "def_index": 5387, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5367, "file": "erpnext/erpnext/assets/doctype/location/location.py" }, { "name": "add_node", "arguments": [ { "argument": "", "type": "", "default": "" } ], "def": "def add_node()", "def_index": 5772, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 5752, "file": "erpnext/erpnext/assets/doctype/location/location.py" }, { "name": "get_downtime", "arguments": [ { "argument": "failure_date", "type": "", "default": "" }, { "argument": "completion_date", "type": "", "default": "" } ], "def": "def get_downtime(failure_date, completion_date)", "def_index": 13046, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [], "index": 13026, "file": "erpnext/erpnext/assets/doctype/asset_repair/asset_repair.py" }, { "name": "get_maintenance_tasks", "arguments": [ { "argument": "doctype", "type": "", "default": "" }, { "argument": "txt", "type": "", "default": "" }, { "argument": "searchfield", "type": "", "default": "" }, { "argument": "start", "type": "", "default": "" }, { "argument": "page_len", "type": "", "default": "" }, { "argument": "filters", "type": "", "default": "" } ], "def": "def get_maintenance_tasks(doctype, txt, searchfield, start, page_len, filters)", "def_index": 1987, "request_types": [], "xss_safe": false, "allow_guest": false, "other_decorators": [ "@frappe.validate_and_sanitize_search_inputs" ], "index": 1923, "file": "erpnext/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.py" } ]
2302_79757062/commit
dashboard/src/components/features/api_viewer/API.ts
TypeScript
agpl-3.0
486,211
import CopyButton from "@/components/common/CopyToClipboard/CopyToClipboard" import { ErrorBanner } from "@/components/common/ErrorBanner/ErrorBanner" import { FullPageLoader } from "@/components/common/FullPageLoader/FullPageLoader" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Button } from "@/components/ui/button" import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { web_url } from "@/config/socket" import { APIData, Argument } from "@/types/APIData" import { XMarkIcon } from "@heroicons/react/24/outline" import { useFrappeGetCall } from "frappe-react-sdk" import { useMemo } from "react" import { MdOutlineFileDownload } from "react-icons/md" import Markdown from "react-markdown" export const APIDetails = ({ project_branch, endpointData, selectedEndpoint, setSelectedEndpoint, viewerType }: { project_branch: string, endpointData: APIData[], selectedEndpoint: string, setSelectedEndpoint: React.Dispatch<React.SetStateAction<string>>, viewerType: string }) => { const data = useMemo(() => { return endpointData.find((endpoint: APIData) => endpoint.name === selectedEndpoint) }, [endpointData, selectedEndpoint]) const tabs = [ { name: 'Parameters', content: <ParametersTable parameters={data?.arguments} /> }, { name: 'Code', content: <CodeSnippet apiData={data!} project_branch={project_branch} file_path={data?.file ?? ''} viewerType={viewerType} /> }, { name: 'Bruno', content: <Bruno doc={data!} /> }, ] data?.documentation && tabs.push({ name: 'Documentation', content: <Documentation documentation={data?.documentation ?? ''} /> }) const requestTypeBgColor = (requestType: string) => { switch (requestType) { case 'GET': return 'bg-green-100' case 'POST': return 'bg-blue-100' case 'PUT': return 'bg-yellow-100' case 'DELETE': return 'bg-red-100' default: return 'bg-gray-100' } } const requestTypeBorderColor = (requestType: string) => { switch (requestType) { case 'GET': return 'ring-green-600/20' case 'POST': return 'ring-blue-600/20' case 'PUT': return 'ring-yellow-600/20' case 'DELETE': return 'ring-red-600/20' default: return 'ring-gray-600/20' } } return ( <div className="flex flex-col space-y-3 p-3"> <div className="border-b border-gray-200 pb-3 flex items-center justify-between"> <div className="flex items-center gap-2"> <h1 className="text-lg font-semibold leading-6 text-gray-900">API Details</h1> {data?.allow_guest || data?.xss_safe ? <div className="border-b border-gray-100 space-x-2"> {data?.allow_guest && <span className="inline-flex items-center rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-700 ring-1 ring-inset ring-green-600/20"> Allow Guest </span>} {data?.xss_safe && <span className="inline-flex items-center rounded-md bg-yellow-50 px-2 py-1 text-xs font-medium text-yellow-800 ring-1 ring-inset ring-yellow-600/20"> XSS Safe </span>} </div> : null} </div> <div className="mt-3 flex sm:ml-4 sm:mt-0 space-x-2"> <button type="button" className="relative rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" onClick={() => setSelectedEndpoint('')} > <span className="absolute -inset-2.5" /> <span className="sr-only">Close panel</span> <XMarkIcon className="h-6 w-6" aria-hidden="true" /> </button> </div> </div> <div> <div className="mt-0 border-b border-gray-100"> <dl className="divide-y divide-gray-100"> <div className="py-2 grid grid-cols-5 gap-4 px-0"> <dt className="text-sm font-medium leading-6 text-gray-900">Name :</dt> <dd className="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"><code>{data?.name}</code></dd> </div> <div className="py-2 sm:grid sm:grid-cols-5 sm:gap-4 sm:px-0"> <dt className="text-sm font-medium leading-6 text-gray-900">Endpoint :</dt> <div className="flex items-start space-x-2 sm:col-span-4"> <dd className="mt-1 text-sm text-blue-500 cursor-pointer leading-6 sm:col-span-2 sm:mt-0 truncate w-[58ch]">{data?.api_path}</dd> <CopyButton value={data?.api_path ?? ''} className="h-6 w-6" /> </div> </div> <div className="py-2 sm:grid sm:grid-cols-5 sm:gap-4 sm:px-0"> <dt className="text-sm font-medium leading-6 text-gray-900">Req. Types :</dt> <dd className="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0 space-x-1"> {data?.request_types.map((type: string, idx: number) => ( <span key={idx} className={`inline-flex items-center rounded-md ${requestTypeBgColor(type)} px-2 py-1 text-xs font-medium text-gray-700 ring-1 ring-inset ${requestTypeBorderColor(type)}`}> {type} </span> ))} {data?.request_types.length === 0 && ['GET', 'POST', 'PUT', 'DELETE'].map((type: string, idx: number) => ( <span key={idx} className={`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium text-gray-700 ring-1 ring-inset ${requestTypeBgColor(type)} ${requestTypeBorderColor(type)}`}> {type} </span> ))} </dd> </div> </dl> </div> </div> <Tabs defaultValue="Parameters" className="w-full shadow-sm"> <TabsList className="w-full justify-start overflow-scroll"> <TabsTrigger value="Parameters">Parameters</TabsTrigger> <TabsTrigger value="Code">Code</TabsTrigger> <TabsTrigger value="Bruno">Bruno</TabsTrigger> {data?.documentation && <TabsTrigger value="Documentation">Documentation</TabsTrigger>} </TabsList> <TabsContent value="Parameters"> <ParametersTable parameters={data?.arguments} /> </TabsContent> <TabsContent value="Code"> <CodeSnippet apiData={data!} project_branch={project_branch} file_path={data?.file ?? ''} viewerType={viewerType} /> </TabsContent> <TabsContent value="Bruno"> <Bruno doc={data!} /> </TabsContent> {data?.documentation && <TabsContent value="Documentation"> <Documentation documentation={data?.documentation ?? ''} /> </TabsContent>} </Tabs> </div > ) } export const ParametersTable = ({ parameters }: { parameters?: Argument[] }) => { return ( <Table> <TableCaption>A list of parameters that can be used in the API</TableCaption> <TableHeader className="bg-gray-100"> <TableRow> <TableHead>Argument</TableHead> <TableHead>Type</TableHead> <TableHead>Default</TableHead> </TableRow> </TableHeader> <TableBody> {parameters?.map((parameter) => ( <TableRow key={parameter.argument} className="font-light text-sm"> <TableCell>{parameter.argument}</TableCell> <TableCell>{parameter.type ? parameter.type : '-'}</TableCell> <TableCell>{parameter.default ? parameter.default : '-'}</TableCell> </TableRow> ))} </TableBody> </Table> ) } export const CodeSnippet = ({ apiData, project_branch, file_path, viewerType }: { apiData: APIData, project_branch: string, file_path: string, viewerType: string }) => { const { data, error, isLoading } = useFrappeGetCall<{ message: { file_content: string } }>('commit.api.api_explorer.get_file_content_from_path', { project_branch: project_branch, file_path: file_path, block_start: apiData.block_start ?? 0, block_end: apiData.block_end ?? 0, viewer_type: viewerType }, undefined, { revalidateOnFocus: false, revalidateIfStale: false, }) const copyValue = () => { const content = JSON.parse(JSON.stringify(data?.message?.file_content ?? []) ?? '[]') return content?.join('') } return ( <div className="flex flex-col space-y-2"> {error && <ErrorBanner error={error} />} {isLoading && <div className="flex items-center justify-center h-[calc(100vh-16rem)]"> <FullPageLoader /> </div>} <code className="relative bg-gray-50 p-4 rounded-md text-sm overflow-auto border-2 border-gray-200 h-[calc(100vh-22rem)]"> <div className="absolute top-0 right-0 p-2"> <CopyButton value={copyValue()} className="h-6 w-6" variant={'outline'} /> </div> <pre className="counter-reset mb-2"> {isLoading && <FullPageLoader />} {data?.message?.file_content} </pre> </code> </div > ) } export const Documentation = ({ documentation }: { documentation: string }) => { console.log('documentation', documentation) const renderContent = () => { if (typeof documentation === 'string') { return <Markdown className={'p-2 flex flex-col gap-2'}>{documentation}</Markdown>; } else if (typeof documentation === 'object' && documentation !== null && !Array.isArray(documentation)) { return <pre className="p-2 flex flex-col gap-2">{JSON.stringify(documentation, null, 2)}</pre>; } else { return <div className="p-2 flex flex-col gap-2">Invalid documentation format</div>; } }; return ( <div className="flex flex-col space-y-2 rounded-md overflow-auto border-2 border-gray-200 h-[calc(100vh-20rem)]"> {renderContent()} </div> ) } export const Bruno = ({ doc }: { doc: APIData }) => { const rest = useMemo(() => { if (doc) { const { allow_guest, xss_safe, documentation, block_end, block_start, index, ...rest } = doc return rest } }, [doc]) const { data, error, isLoading } = useFrappeGetCall('commit.api.bruno.generate_bruno_file', { data: JSON.stringify(rest), type: 'copy' }, rest ? undefined : null, { revalidateOnFocus: false, revalidateIfStale: false, }) const copyValue = () => { const content = JSON.parse(JSON.stringify(data ?? '') ?? '[]') return content } return ( <div className="flex flex-col space-y-2 h-full overflow-y-hidden"> {error && <ErrorBanner error={error} />} {isLoading && <div className="flex items-center justify-center h-[calc(100vh-16rem)]"> <FullPageLoader /> </div>} <code className="relative bg-gray-50 p-4 rounded-md text-sm overflow-auto border-2 border-gray-200 h-[calc(100vh-22rem)]"> <div className="absolute top-0 right-0 p-2"> <div className="flex items-center space-x-1"> <Button variant={'outline'} size={'icon'} className="h-8 w-8"> <a href={`${web_url}/api/method/commit.api.bruno.generate_bruno_file?data=${JSON.stringify(rest)}`} target="_blank"> <MdOutlineFileDownload className="h-4 w-4" /> </a> </Button> <CopyButton value={copyValue()} className="h-8 w-8" variant={'outline'} /> </div> </div> <pre className="counter-reset mb-2"> {isLoading && <FullPageLoader />} {data && <pre>{data}</pre>} </pre> </code> <div className="flex flex-row gap-1 items-center"> <svg id="emoji" width="30" viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg"><g id="color"><path fill="#F4AA41" stroke="none" d="M23.5,14.5855l-4.5,1.75l-7.25,8.5l-4.5,10.75l2,5.25c1.2554,3.7911,3.5231,7.1832,7.25,10l2.5-3.3333 c0,0,3.8218,7.7098,10.7384,8.9598c0,0,10.2616,1.936,15.5949-0.8765c3.4203-1.8037,4.4167-4.4167,4.4167-4.4167l3.4167-3.4167 l1.5833,2.3333l2.0833-0.0833l5.4167-7.25L64,37.3355l-0.1667-4.5l-2.3333-5.5l-4.8333-7.4167c0,0-2.6667-4.9167-8.1667-3.9167 c0,0-6.5-4.8333-11.8333-4.0833S32.0833,10.6688,23.5,14.5855z"></path><polygon fill="#EA5A47" stroke="none" points="36,47.2521 32.9167,49.6688 30.4167,49.6688 30.3333,53.5021 31.0833,57.0021 32.1667,58.9188 35,60.4188 39.5833,59.8355 41.1667,58.0855 42.1667,53.8355 41.9167,49.8355 39.9167,50.0855"></polygon><polygon fill="#3F3F3F" stroke="none" points="32.5,36.9188 30.9167,40.6688 33.0833,41.9188 34.3333,42.4188 38.6667,42.5855 41.5833,40.3355 39.8333,37.0855"></polygon></g><g id="hair"></g><g id="skin"></g><g id="skin-shadow"></g><g id="line"><path fill="#000000" stroke="none" d="M29.5059,30.1088c0,0-1.8051,1.2424-2.7484,0.6679c-0.9434-0.5745-1.2424-1.8051-0.6679-2.7484 s1.805-1.2424,2.7484-0.6679S29.5059,30.1088,29.5059,30.1088z"></path><path fill="none" stroke="#000000" strokeLinecap="round" strokeLinejoin="round" strokeMiterlimit="10" strokeWidth="2" d="M33.1089,37.006h6.1457c0.4011,0,0.7634,0.2397,0.9203,0.6089l1.1579,2.7245l-2.1792,1.1456 c-0.6156,0.3236-1.3654-0.0645-1.4567-0.754"></path><path fill="none" stroke="#000000" strokeLinecap="round" strokeLinejoin="round" strokeMiterlimit="10" strokeWidth="2" d="M34.7606,40.763c-0.1132,0.6268-0.7757,0.9895-1.3647,0.7471l-2.3132-0.952l1.0899-2.9035 c0.1465-0.3901,0.5195-0.6486,0.9362-0.6486"></path><path fill="none" stroke="#000000" strokeLinecap="round" strokeLinejoin="round" strokeMiterlimit="10" strokeWidth="2" d="M30.4364,50.0268c0,0-0.7187,8.7934,3.0072,9.9375c2.6459,0.8125,5.1497,0.5324,6.0625-0.25 c0.875-0.75,2.6323-4.4741,1.8267-9.6875"></path><path fill="#000000" stroke="none" d="M44.2636,30.1088c0,0,1.805,1.2424,2.7484,0.6679c0.9434-0.5745,1.2424-1.8051,0.6679-2.7484 c-0.5745-0.9434-1.805-1.2424-2.7484-0.6679C43.9881,27.9349,44.2636,30.1088,44.2636,30.1088z"></path><path fill="none" stroke="#000000" strokeLinecap="round" strokeLinejoin="round" strokeMiterlimit="10" strokeWidth="2" d="M25.6245,42.8393c-0.475,3.6024,2.2343,5.7505,4.2847,6.8414c1.1968,0.6367,2.6508,0.5182,3.7176-0.3181l2.581-2.0233l2.581,2.0233 c1.0669,0.8363,2.5209,0.9548,3.7176,0.3181c2.0504-1.0909,4.7597-3.239,4.2847-6.8414"></path><path fill="none" stroke="#000000" strokeLinecap="round" strokeLinejoin="round" strokeMiterlimit="10" strokeWidth="2" d="M19.9509,28.3572c-2.3166,5.1597-0.5084,13.0249,0.119,15.3759c0.122,0.4571,0.0755,0.9355-0.1271,1.3631l-1.9874,4.1937 c-0.623,1.3146-2.3934,1.5533-3.331,0.4409c-3.1921-3.7871-8.5584-11.3899-6.5486-16.686 c7.0625-18.6104,15.8677-18.1429,15.8677-18.1429c2.8453-1.9336,13.1042-6.9375,24.8125,0.875c0,0,8.6323-1.7175,14.9375,16.9375 c1.8036,5.3362-3.4297,12.8668-6.5506,16.6442c-0.9312,1.127-2.7162,0.8939-3.3423-0.4272l-1.9741-4.1656 c-0.2026-0.4275-0.2491-0.906-0.1271-1.3631c0.6275-2.3509,2.4356-10.2161,0.119-15.3759"></path><path fill="none" stroke="#000000" strokeLinecap="round" strokeLinejoin="round" strokeMiterlimit="10" strokeWidth="2" d="M52.6309,46.4628c0,0-3.0781,6.7216-7.8049,8.2712"></path><path fill="none" stroke="#000000" strokeLinecap="round" strokeLinejoin="round" strokeMiterlimit="10" strokeWidth="2" d="M19.437,46.969c0,0,3.0781,6.0823,7.8049,7.632"></path><line x1="36.2078" x2="36.2078" y1="47.3393" y2="44.3093" fill="none" stroke="#000000" strokeLinecap="round" strokeLinejoin="round" strokeMiterlimit="10" strokeWidth="2"></line></g></svg> <div className="text-sm text-gray-500">bruno is a Fast and Git-Friendly Opensource API client.</div> <div className="text-sm underline text-blue-500"> <a href="https://www.usebruno.com/downloads" target="_blank"> Click here to download. </a> </div> </div> </div> ) }
2302_79757062/commit
dashboard/src/components/features/api_viewer/APIDetails.tsx
TSX
agpl-3.0
17,607
import { Input } from "@/components/ui/input" import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { APIData } from "@/types/APIData" import { useEffect, useMemo, useState } from "react" import { AiOutlineBranches } from "react-icons/ai" import { GoPackage } from "react-icons/go" export interface APIListProps { apiList: APIData[] app_name: string branch_name: string setSelectedEndpoint: (endpoint: string) => void selectedEndpoint?: string } export const APIList = ({ apiList, app_name, branch_name, setSelectedEndpoint, selectedEndpoint }: APIListProps) => { const [searchQuery, setSearchQuery] = useState<string>('') const [requestTypeFilter, setRequestTypeFilter] = useState<string>('All') const filterList = useMemo(() => { return apiList.filter((api: APIData) => { return api.name.toLowerCase().includes(searchQuery.toLowerCase()) && (requestTypeFilter !== 'All' ? api.request_types.includes(requestTypeFilter.toUpperCase()) : true) }) }, [searchQuery, apiList, requestTypeFilter]) useEffect(() => { setSelectedEndpoint(filterList[0]?.name ?? '') }, [filterList, setSelectedEndpoint]) return ( <div className="flex flex-col space-y-4 p-3 border-r border-gray-200"> <div className="flex space-x-2 items-center"> <div className="flex flex-wrap items-center space-x-1"> <GoPackage /> <p className="truncate text-md text-gray-700">{app_name}</p> </div> <div className="w-px h-4 bg-gray-200" /> <div className="flex flex-wrap items-center space-x-1"> <AiOutlineBranches /> <p>{branch_name}</p> </div> </div> <div className="flex flex-row space-x-4"> <div className="w-4/5 flex flex-row space-x-4"> <Input placeholder="Search" onChange={(e) => setSearchQuery(e.target.value)} /> </div> <div className="flex flex-row space-x-4"> <Select onValueChange={(value) => setRequestTypeFilter(value)} defaultValue="All"> <SelectTrigger className="w-[14ch]"> <SelectValue placeholder="Req. type" /> </SelectTrigger> <SelectContent> <SelectGroup> <SelectItem value="All">All</SelectItem> <SelectItem value="GET">GET</SelectItem> <SelectItem value="POST">POST</SelectItem> <SelectItem value="PUT">PUT</SelectItem> <SelectItem value="DELETE">DELETE</SelectItem> </SelectGroup> </SelectContent> </Select> </div> </div> {/* fixed height container */} <div className="flex flex-col space-y-4 overflow-y-auto h-[calc(100vh-12rem)]"> <ListView list={filterList} setSelectedEndpoint={setSelectedEndpoint} selectedEndpoint={selectedEndpoint} /> </div> </div> ) } export const ListView = ({ list, setSelectedEndpoint, selectedEndpoint }: { list: APIData[], setSelectedEndpoint: (endpoint: string) => void, selectedEndpoint?: string }) => { return ( <div> <ul role="list" className="divide-y divide-gray-100 px-1"> {list.length === 0 && ( <div className="flex flex-col items-center justify-center h-[calc(100vh-10rem)] space-y-2" style={{ minHeight: '20rem' }} > <p className="text-gray-500 text-lg">Sorry we couldn't find what you were looking for.</p> <p className="text-gray-500 text-lg">Try searching with different keywords.</p> </div> )} {list.map((person: APIData, index: number) => ( <li key={`${person.name}-${index}`} className={`flex justify-between gap-x-6 p-2 hover:bg-gray-100 cursor-pointer group ${selectedEndpoint === person.name ? 'bg-gray-100' : ''} `} onClick={() => setSelectedEndpoint(person.name)}> <div className="flex min-w-0 gap-x-4"> <div className="min-w-0 flex-auto"> <p className={`text-sm font-semibold leading-6 cursor-pointer group-hover:text-blue-600 ${selectedEndpoint === person.name ? 'text-blue-600' : 'text-gray-900'}`}><code>{person.name}</code></p> <p className="mt-1 truncate text-xs leading-5 text-gray-500">{person.api_path}</p> </div> </div> <div className="hidden shrink-0 sm:flex sm:flex-col sm:items-end"> <p className="text-sm leading-6 text-gray-900 space-x-1"> {person.request_types.map((type: string, idx: number) => ( <span key={idx} className="text-xs font-semibold leading-5 text-gray-500">{type} {idx !== person.request_types.length - 1 ? '/' : ''}</span> ))} </p> {person.allow_guest && ( <div className="mt-1 flex items-center gap-x-1.5"> <div className="flex-none rounded-full bg-red-500/20 p-1"> <div className="h-1.5 w-1.5 rounded-full bg-red-500" /> </div> <p className="text-xs leading-5 text-gray-500">Allow Guest</p> </div> )} </div> </li> ))} </ul> {/* create a div which is at fixed location and should be stick bottom which will show total list count at right corner of same w as above ul*/} {list.length && <div className="fixed bottom-0 flex justify-end p-2 w-[54%] bg-white h-10 border-t"> <p className="text-sm justify-end">Total {list.length} API's</p> </div>} </div> ) }
2302_79757062/commit
dashboard/src/components/features/api_viewer/APIList.tsx
TSX
agpl-3.0
6,335
import { FullPageLoader } from "@/components/common/FullPageLoader/FullPageLoader" import { useFrappeGetCall } from "frappe-react-sdk" import { useNavigate } from "react-router-dom" import { AppsData } from "./YourApps" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog" import { Button } from "@/components/ui/button" import { useCallback, useState } from "react" import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" import { Label } from "@/components/ui/label" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { Card, CardHeader, CardTitle, CardContent, CardFooter } from "@/components/ui/card" import { MdKeyboardArrowRight } from "react-icons/md" import api from '../../../assets/api.svg' export const YourAppAPIExplorer = () => { const { data, error, isLoading } = useFrappeGetCall<{ message: AppsData[] }>('commit.api.meta_data.get_installed_apps', {}, 'get_installed_apps', { keepPreviousData: true, revalidateOnFocus: true, revalidateIfStale: false, }) if (error) { return <div>Error</div> } if (isLoading) { return <FullPageLoader /> } if (data && data.message) { return ( <Card className="flex flex-col sm:flex-row items-start p-2 border rounded-lg w-full h-full shadow-sm bg-white relative"> <div className="flex-grow h-full"> <CardHeader className="pb-4"> <CardTitle>Explore your API's</CardTitle> </CardHeader> <CardContent> <div className="text-sm text-gray-500 sm:mb-8"> Explore and interact with your site installed apps whitelisted API's effortlessly using our API Explorer. </div> </CardContent> <CardFooter className="absolute bottom-0"> <Dialog> <DialogTrigger asChild> <Button size='sm' disabled={data.message?.length === 0} className="rounded-full px-4 pr-2 py-2 shadow-md"> Get Started <MdKeyboardArrowRight className="ml-2 mr-0 p-0" style={{ fontSize: '1rem' }} /> </Button> </DialogTrigger> <ViewAPIExplorerContent data={data.message} /> </Dialog> </CardFooter> </div> <div className="flex-shrink-0 sm:mb-0 mb-16 p-4 sm:p-0 items-center justify-center"> <img src={api} alt="API" height={'full'} className="w-full rounded-md sm:w-[170px] sm:mr-6 sm:rounded-md" /> </div> </Card> ) } } export const ViewAPIExplorerContent = ({ data }: { data: AppsData[] }) => { const [branch, setBranch] = useState<string>(data?.[0]?.app_name) const navigate = useNavigate() const onNavigate = useCallback(() => { navigate({ pathname: `/meta-viewer/${branch}` }) }, [branch, navigate]) return ( <DialogContent className="p-6 w-[90vw] sm:w-full overflow-hidden"> <DialogHeader className="text-left"> <DialogTitle>Select App</DialogTitle> <DialogDescription> Select the app to view API's </DialogDescription> </DialogHeader> <RadioGroup defaultValue={branch} onValueChange={(value) => setBranch(value)} className="flex flex-col space-y-1" > <ul role="list" className="divide-y divide-gray-200 max-h-[60vh] overflow-y-scroll"> {data?.map((app: AppsData) => { return ( <ViewAPIExplorerCard app={app} key={app.app_name} /> ) })} </ul> </RadioGroup> <DialogFooter> <Button onClick={onNavigate} disabled={branch.length === 0}> API Explorer </Button> </DialogFooter> </DialogContent> ) } export interface ViewAPIExplorerProps { app: AppsData } export const ViewAPIExplorerCard = ({ app }: ViewAPIExplorerProps) => { return ( <li className="w-full px-2"> <div className="flex items-center justify-between py-2 w-full"> <div className="flex space-x-3 items-center"> <Label htmlFor={`${app.app_name}`} className="flex items-center space-x-3"> <RadioGroupItem value={app.app_name} key={app.app_name} id={`${app.app_name}`} /> <h1 className="text-[16px] font-medium tracking-normal cursor-pointer" >{app.app_name}</h1> </Label> </div> <Select disabled defaultValue={app.git_branch} > <SelectTrigger className="h-8 w-40 truncate"> <SelectValue placeholder="Select Branch" /> </SelectTrigger> <SelectContent> <SelectItem value={app.git_branch ?? ''} key={app.git_branch} >{app.git_branch}</SelectItem> </SelectContent> </Select> </div> </li >) }
2302_79757062/commit
dashboard/src/components/features/meta_apps/YourAppAPIExplorer.tsx
TSX
agpl-3.0
5,700
import { FullPageLoader } from "@/components/common/FullPageLoader/FullPageLoader" import { Avatar, AvatarFallback } from "@/components/ui/avatar" import { AvatarImage } from "@radix-ui/react-avatar" import { useFrappeGetCall } from "frappe-react-sdk" import { useMemo } from "react" import { YourAppAPIExplorer } from "./YourAppAPIExplorer" import { ViewERDButtonForSiteApps } from "../projects/ViewERDButton" export interface AppsData { app_name: string app_publisher?: string app_description?: string app_logo_url?: string app_version?: string git_branch?: string } export const YourApps = () => { const { data, error, isLoading } = useFrappeGetCall<{ message: AppsData[] }>('commit.api.meta_data.get_installed_apps', {}, 'get_installed_apps', { keepPreviousData: true, revalidateOnFocus: true, revalidateIfStale: false, }) if (error) { return <div>Error</div> } if (isLoading) { return <FullPageLoader /> } if (data && data.message) { return ( <div className="mx-auto pl-2 pr-4 h-full overflow-y-auto pt-2"> <div className="h-full flex flex-col gap-4"> <div className="grid grid-cols-1 gap-6 justify-between sm:grid-cols-2"> <ViewERDButtonForSiteApps /> <YourAppAPIExplorer /> </div> <div className="flex flex-col gap-4"> <div className="flex flex-row items-end justify-between border-b pb-2"> <div className="text-xl font-semibold pt-1">Projects</div> </div> <div className="grid sm:grid-cols-2 gap-x-8 pb-4"> {data.message.map((org: AppsData) => { return ( <AppsCard app={org} key={org.app_name} /> ) })} </div> </div> </div> </div> ) } } const AppsCard = ({ app }: { app: AppsData }) => { const appNameInitials = useMemo(() => { return app.app_name.split('_').map((word) => word[0]).join('').toUpperCase(); }, [app]); return ( <div className="flex items-start border-b relative hover:bg-gray-100 p-4"> <div className="flex items-start gap-4"> <Avatar className="h-10 w-10 flex items-center rounded-lg"> <AvatarImage src={app.app_logo_url} className="object-contain h-full w-full" /> <AvatarFallback className="rounded-lg text-xl">{appNameInitials}</AvatarFallback> </Avatar> <div className="flex flex-col gap-1 cursor-default"> <div className="text-base font-semibold">{app.app_name}</div> <div className="text-sm text-gray-500 pb-4"> {app.app_description} </div> <div className="text-xs absolute bottom-2 text-gray-400">{app.app_publisher}</div> </div> </div> </div> ); };
2302_79757062/commit
dashboard/src/components/features/meta_apps/YourApps.tsx
TSX
agpl-3.0
3,237
import { Disclosure } from '@headlessui/react' import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline' import { Button } from '@/components/ui/button' import { GitHubLogoIcon } from '@radix-ui/react-icons' function classNames(...classes: any[]) { return classes.filter(Boolean).join(' ') } export const Navbar = ({ navigation }: { navigation: { name: string, content: JSX.Element }[] }) => { return ( <Disclosure as="header" className="bg-white shadow"> {({ open }) => ( <> <div className="mx-auto px-2 sm:px-4 lg:divide-y lg:divide-gray-200 lg:px-4"> <div className="relative flex h-16 justify-between"> <div className="relative z-10 flex px-2 lg:px-0"> <div className="flex flex-shrink-0 items-center space-x-2"> {/* <img className="h-8 w-auto" src="https://avatars.githubusercontent.com/u/125638080?s=200&v=4" alt="The Commit Company" /> */} <h1 className="text-3xl font-bold text-transparent bg-clip-text bg-gradient-to-br from-slate-900 to-zinc-500">commit <span className="text-green-500">.</span> </h1> </div> </div> <div className="relative z-0 flex flex-1 items-center justify-center px-2 sm:absolute sm:inset-0"> {/* <div className="w-full sm:max-w-xs"> <label htmlFor="search" className="sr-only"> Search </label> <div className="relative"> <div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"> <MagnifyingGlassIcon className="h-5 w-5 text-gray-400" aria-hidden="true" /> </div> <input id="search" name="search" className="block w-full rounded-md border-0 bg-white py-1.5 pl-10 pr-3 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" placeholder="Search" type="search" /> </div> </div> */} </div> <div className="relative z-10 flex items-center lg:hidden"> {/* Mobile menu button */} <Disclosure.Button className="relative inline-flex items-center justify-center rounded-md p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500"> <span className="absolute -inset-0.5" /> <span className="sr-only">Open menu</span> {open ? ( <XMarkIcon className="block h-6 w-6" aria-hidden="true" /> ) : ( <Bars3Icon className="block h-6 w-6" aria-hidden="true" /> )} </Disclosure.Button> </div> <div className="hidden lg:relative lg:z-10 lg:ml-4 lg:flex lg:items-center"> <Button variant='outline' color='primary' size={'sm'}> <GitHubLogoIcon className='w-4 h-4 mr-2' /> Github </Button> <div className="hidden lg:relative lg:z-10 lg:ml-2 lg:flex lg:items-center"> <a href="#_" className="relative px-5 py-1 font-medium text-white transition duration-300 bg-blue-400 rounded-md hover:bg-blue-500 ease"> <span className="absolute bottom-0 left-0 h-full -ml-2"> <svg viewBox="0 0 487 487" className="w-auto h-full opacity-100 object-stretch" xmlns="http://www.w3.org/2000/svg"><path d="M0 .3c67 2.1 134.1 4.3 186.3 37 52.2 32.7 89.6 95.8 112.8 150.6 23.2 54.8 32.3 101.4 61.2 149.9 28.9 48.4 77.7 98.8 126.4 149.2H0V.3z" fill="#FFF" fill-rule="nonzero" fill-opacity=".1"></path></svg> </span> <span className="absolute top-0 right-0 w-12 h-full -mr-3"> <svg viewBox="0 0 487 487" className="object-cover w-full h-full" xmlns="http://www.w3.org/2000/svg"><path d="M487 486.7c-66.1-3.6-132.3-7.3-186.3-37s-95.9-85.3-126.2-137.2c-30.4-51.8-49.3-99.9-76.5-151.4C70.9 109.6 35.6 54.8.3 0H487v486.7z" fill="#FFF" fill-rule="nonzero" fill-opacity=".1"></path></svg> </span> <span className="relative">Share Feedback</span> </a> </div> </div> </div> {/* FIXME: Enable Tabs Only after other tabs are ready */} {/* <Tabs tabs={navigation} variant='button' /> */} </div> </> ) } </Disclosure > ) }
2302_79757062/commit
dashboard/src/components/features/overview/Navbar.tsx
TSX
agpl-3.0
6,075
import { FullPageLoader } from "@/components/common/FullPageLoader/FullPageLoader" import { Button } from "@/components/ui/button" import { useFrappeGetCall } from "frappe-react-sdk" import { ProjectData, ProjectWithBranch } from "./Projects" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog" import { useCallback, useState } from "react" import { useNavigate } from "react-router-dom" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" import { CommitProjectBranch } from "@/types/commit/CommitProjectBranch" import { Label } from "@/components/ui/label" import { Card, CardHeader, CardTitle, CardContent, CardFooter } from "@/components/ui/card" import { MdKeyboardArrowRight } from "react-icons/md" import api from '../../../assets/api.svg' export const APIExplorer = () => { const { data, error, isLoading } = useFrappeGetCall<{ message: ProjectData[] }>('commit.api.commit_project.commit_project.get_project_list_with_branches', {}, 'get_project_list_with_branches', { keepPreviousData: true, revalidateOnFocus: true, revalidateIfStale: false, }) if (error) { return <div>Error</div> } if (isLoading) { return <FullPageLoader /> } if (data && data.message) { return ( <Card className="flex flex-col sm:flex-row items-start p-2 border rounded-lg w-full h-full shadow-sm bg-white relative"> <div className="flex-grow h-full"> <CardHeader className="pb-4"> <CardTitle>Explore your API's</CardTitle> </CardHeader> <CardContent> <div className="text-sm text-gray-500 sm:mb-8"> Explore and interact with your whitelisted API's effortlessly using our API Explorer. </div> </CardContent> <CardFooter className="absolute bottom-0"> <Dialog> <DialogTrigger asChild> <Button size='sm' disabled={data.message?.length === 0} className="rounded-full px-4 pr-2 py-2 shadow-md"> Get Started <MdKeyboardArrowRight className="ml-2 mr-0 p-0" style={{ fontSize: '1rem' }} /> </Button> </DialogTrigger> <ViewAPIExplorerContent data={data.message} /> </Dialog> </CardFooter> </div> <div className="flex-shrink-0 sm:mb-0 mb-16 p-4 sm:p-0 items-center justify-center"> <img src={api} alt="API" height={'full'} className="w-full rounded-md sm:w-[170px] sm:mr-6 sm:rounded-md" /> </div> </Card> ) } return null } export const ViewAPIExplorerContent = ({ data }: { data: ProjectData[] }) => { const [branch, setBranch] = useState<string>(data?.[0]?.projects?.[0]?.branches?.[0]?.name) const navigate = useNavigate() const onNavigate = useCallback(() => { navigate({ pathname: `/project-viewer/${branch}` }) }, [branch, navigate]) return ( <DialogContent className="p-6 w-[90vw] sm:w-full overflow-hidden"> <DialogHeader className="text-left"> <DialogTitle>Select App</DialogTitle> <DialogDescription> Select the app to view API's </DialogDescription> </DialogHeader> <RadioGroup defaultValue={branch} onValueChange={(value) => setBranch(value)} className="flex flex-col space-y-1" > <ul role="list" className="divide-y divide-gray-200 max-h-[60vh] overflow-y-scroll"> {data?.map((org: ProjectData) => { return org.projects?.filter((project) => project.branches?.length > 0)?.map((project => { return ( <ViewAPIExplorerCard project={project} key={project.name} /> ) } )) })} </ul> </RadioGroup> <DialogFooter> <Button onClick={onNavigate} disabled={branch?.length === 0}> API Explorer </Button> </DialogFooter> </DialogContent> ) } export interface ViewERDProjectCardProps { project: ProjectWithBranch } export const ViewAPIExplorerCard = ({ project }: ViewERDProjectCardProps) => { const [branch, setBranch] = useState<string>(project.branches[0]?.name) return ( <li className="w-full px-2"> <div className="flex items-center justify-between py-2 w-full"> <div className="flex space-x-3 items-center"> <Label htmlFor={`${project.name}-${branch}`} className="flex items-center space-x-3"> <RadioGroupItem value={branch} key={branch} id={`${project.name}-${branch}`} /> <h1 className="text-[16px] font-medium tracking-normal cursor-pointer" >{project.display_name}</h1> </Label> </div> <Select onValueChange={(value) => setBranch(value)} defaultValue={project.branches[0]?.name} > <SelectTrigger className="h-8 w-40"> <SelectValue placeholder="Select Branch" /> </SelectTrigger> <SelectContent> {project.branches.map((branch: CommitProjectBranch) => { return ( <SelectItem value={branch.name} key={branch.name}>{branch.branch_name}</SelectItem> ) })} </SelectContent> </Select> </div> </li >) }
2302_79757062/commit
dashboard/src/components/features/projects/APIExplorer.tsx
TSX
agpl-3.0
6,311
import { Button } from "@/components/ui/button" import { Dialog } from "@/components/ui/dialog" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" import { useState } from "react" import { IoIosGitBranch } from "react-icons/io" import { MdAdd } from "react-icons/md" import { VscGithubProject, VscOrganization } from "react-icons/vsc" import CreateOrgModal from "./Org/CreateOrgModal" import { KeyedMutator } from "swr" import { ProjectData } from "./Projects" import CreateProjectModal from "./Projects/CreateProjectModal" import CreateBranchModal from "./Branch/CreateBranchModal" export const AddMenuButton = ({ mutate }: { mutate: KeyedMutator<{ message: ProjectData[]; }> }) => { const [createOrg, setCreateOrg] = useState<boolean>(false) const handleOrgClose = () => { setCreateOrg(false) } const [createProject, setCreateProject] = useState<boolean>(false) const handleProjectClose = () => { setCreateProject(false) } const [open, setOpen] = useState(false) return ( <DropdownMenu> <DropdownMenuTrigger asChild> <Button size='sm' variant="outline"> Add <MdAdd className="ml-2 h-4 w-4" /> </Button> </DropdownMenuTrigger> <DropdownMenuContent className="w-56"> <DropdownMenuItem onClick={() => setCreateOrg(true)} > <VscOrganization className="mr-2 h-4 w-4" /> <span>Add Org</span> </DropdownMenuItem> <DropdownMenuItem onClick={() => setCreateProject(true)}> <VscGithubProject className="mr-2 h-4 w-4" /> <span>Add Project</span> </DropdownMenuItem> <DropdownMenuItem onClick={() => setOpen(true)} > <IoIosGitBranch className="mr-2 h-4 w-4" /> <span>Add Branch</span> </DropdownMenuItem> </DropdownMenuContent> <Dialog open={createOrg} onOpenChange={setCreateOrg}> <CreateOrgModal mutate={mutate} onClose={handleOrgClose} open={createOrg} /> </Dialog> <Dialog open={createProject} onOpenChange={setCreateProject}> <CreateProjectModal onClose={handleProjectClose} mutate={mutate} open={createProject} /> </Dialog> <Dialog open={open} onOpenChange={setOpen}> <CreateBranchModal mutate={mutate} setOpen={setOpen} open={open} /> </Dialog> </DropdownMenu> ) }
2302_79757062/commit
dashboard/src/components/features/projects/AddMenuButton.tsx
TSX
agpl-3.0
2,696
import { DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { FormProvider, useForm, SubmitHandler } from "react-hook-form" import { Input } from "@/components/ui/input" import { Button } from '@/components/ui/button' import { ProjectData } from "../Projects" import { useToast } from "@/components/ui/use-toast" import { useFrappeCreateDoc, useFrappeEventListener } from "frappe-react-sdk" import { KeyedMutator } from "swr" import { useEffect, useState } from "react" import { ErrorBanner } from "@/components/common/ErrorBanner/ErrorBanner" import { AsyncDropdown } from "@/components/common/AsyncDropdown/AsyncDropdown" import { FormElement } from "@/components/common/Forms/FormControl" type FormFields = { project: string, branch_name: string, } export interface BranchProps { mutate: KeyedMutator<{ message: ProjectData[]; }> setOpen: React.Dispatch<React.SetStateAction<boolean>> open: boolean } const CreateBranchModal = ({ mutate, setOpen, open }: BranchProps) => { const [desc, setDesc] = useState<string>() const [eventLoading, setEventLoading] = useState<boolean>(false) const { toast } = useToast() const methods = useForm<FormFields>() const project = methods.watch('project') const { createDoc, reset, loading, error } = useFrappeCreateDoc() const branchName = methods.watch('branch_name') useFrappeEventListener('commit_branch_clone_repo', (data) => { if (data.branch_name === branchName && data.project === project) { setDesc("Cloning repository...") } }) useFrappeEventListener('commit_branch_get_modules', (data) => { if (data.branch_name === branchName && data.project === project) { setDesc("Getting modules for app...") } }) useFrappeEventListener('commit_branch_find_apis', (data) => { if (data.branch_name === branchName && data.project === project) { setDesc("Finding all APIs...") } }) useFrappeEventListener('commit_project_branch_created', (data) => { if (data.branch_name === branchName && data.project === project) { setDesc("Branch created successfully.") handleClose(data.branch_name) } }) useFrappeEventListener('commit_branch_creation_error', (data) => { if (data.branch_name === branchName && data.project === project) { setDesc("") setCreationError(data.error) setEventLoading(false) } }) const [creationError, setCreationError] = useState(null) const handleClose = (branch_name: string) => { setEventLoading(false) setCreationError(null) methods.reset() toast({ description: `Branch ${branch_name} added.`, duration: 1500, }) reset() setDesc("") setOpen(false) } const { handleSubmit, register } = methods; const onSubmit: SubmitHandler<FormFields> = (data) => { createDoc('Commit Project Branch', data) .then(() => { mutate() setEventLoading(true) }) } useEffect(() => { methods.reset() }, [open]) return ( <DialogContent className="p-6 w-[90vw] sm:w-full overflow-hidden"> <DialogHeader className="text-left"> <DialogTitle>Add Branch</DialogTitle> </DialogHeader> {error && <ErrorBanner error={error} />} {creationError && <ErrorBanner error={creationError} />} <FormProvider {...methods}> <form onSubmit={handleSubmit(onSubmit)}> <div className="flex flex-col gap-3"> <FormElement name="project" label="Project" aria-required> <AsyncDropdown id="project" name="project" doctype="Commit Project" placeholder="Select Project" className="w-full" rules={{ required: "Project is required" }} /> </FormElement> <FormElement name="branch_name" label="Branch Name" aria-required> <Input {...register("branch_name", { required: "Branch Name is required" })} id="branch_name" type="text" placeholder="eg. main" /> </FormElement> <DialogFooter> <div className="flex flex-row items-center w-full justify-between"> <div className="text-sm text-gray-500">{desc}</div> <Button type="submit" disabled={loading || eventLoading}> {(loading || eventLoading) && <div className="inline-block h-4 w-4 mr-2 animate-spin rounded-full border-2 border-solid border-current text-gray-200 border-e-transparent align-[-0.125em] text-surface motion-reduce:animate-[spin_1.5s_linear_infinite] dark:text-white" role="status"> </div>} Submit </Button> </div> </DialogFooter> </div> </form> </FormProvider> </DialogContent> ) } export default CreateBranchModal
2302_79757062/commit
dashboard/src/components/features/projects/Branch/CreateBranchModal.tsx
TSX
agpl-3.0
5,761
import { Button } from '@/components/ui/button'; import { toast } from '@/components/ui/use-toast'; import { convertFrappeTimestampToTimeAgo } from '@/components/utils/dateconversion'; import { CommitProjectBranch } from '@/types/commit/CommitProjectBranch'; import { useFrappeDeleteDoc, useFrappePostCall, useFrappeUpdateDoc } from 'frappe-react-sdk'; import { AiOutlineDelete } from 'react-icons/ai'; import { IoMdSync } from 'react-icons/io'; import { ProjectData } from '../Projects'; import { KeyedMutator } from 'swr'; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Controller, FormProvider, useForm } from 'react-hook-form'; import { Label } from '@/components/ui/label'; import { useEffect, useState } from 'react'; import { HiOutlineDotsVertical } from "react-icons/hi"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'; const ManageBranchItem = ({ branch, mutate }: { branch: CommitProjectBranch, mutate: KeyedMutator<{ message: ProjectData[]; }> }) => { const { call, loading: syncLoading, reset: callReset } = useFrappePostCall<{ message: any }>('commit.commit.doctype.commit_project_branch.commit_project_branch.fetch_repo'); const { deleteDoc, loading: deleteLoading, reset } = useFrappeDeleteDoc(); const { updateDoc } = useFrappeUpdateDoc(); const [open, setOpen] = useState(false); const [isSmallScreen, setIsSmallScreen] = useState(false); const methods = useForm<CommitProjectBranch>({ defaultValues: { frequency: branch.frequency, }, }); useEffect(() => { const handleResize = () => { setIsSmallScreen(window.innerWidth < 840); // Tailwind's 'sm' breakpoint }; handleResize(); // Initial check window.addEventListener('resize', handleResize); return () => { window.removeEventListener('resize', handleResize); }; }, []); const handleDelete = () => { deleteDoc("Commit Project Branch", branch.name) .then(() => { mutate(); reset(); toast({ description: "Branch Deleted Successfully", duration: 1500, }); }); }; const handleSync = () => { call({ doc: {}, name: branch.name }) .then(() => { mutate(); callReset(); toast({ description: "Branch Synced!", duration: 1500, }); }); }; const onSubmit = (data: CommitProjectBranch) => { updateDoc("Commit Project Branch", branch.name, data) .then(() => { mutate(); methods.reset({ frequency: data.frequency }); toast({ description: `Branch ${branch.branch_name} will be updated ${data.frequency}`, duration: 2000, }); setOpen(false); }); }; return ( <li className="p-2 hover:shadow-sm flex justify-between items-center"> <BranchInfo branch={branch} /> <div className="flex gap-2 items-center"> {isSmallScreen ? ( <div className='flex gap-2'> <FrequencyPopover open={open} setOpen={setOpen} methods={methods} onSubmit={methods.handleSubmit(onSubmit)} control={methods.control} frequency={branch.frequency} /> <ActionDropdown syncLoading={syncLoading} onSync={handleSync} deleteLoading={deleteLoading} onDelete={handleDelete} /> </div> ) : ( <> <SyncButton loading={syncLoading} onSync={handleSync} /> <FrequencyPopover open={open} setOpen={setOpen} methods={methods} onSubmit={methods.handleSubmit(onSubmit)} control={methods.control} frequency={branch.frequency} /> <DeleteButton loading={deleteLoading} onDelete={handleDelete} /> </> )} </div> </li> ); }; const BranchInfo = ({ branch }: { branch: CommitProjectBranch }) => ( <div className="flex flex-col items-start"> <span className="text-md font-medium">{branch.branch_name}</span> <span className="text-xs text-gray-500">Last synced {convertFrappeTimestampToTimeAgo(branch.last_fetched)}</span> </div> ); const SyncButton = ({ loading, onSync }: { loading: boolean, onSync: () => void }) => ( <Button className="flex gap-2 text-sm" variant="outline" size="sm" onClick={onSync} disabled={loading} aria-label="Sync branch" > <IoMdSync className={loading ? 'animate-spin' : ''} /> Fetch latest code </Button> ); const FrequencyPopover = ({ open, setOpen, methods, onSubmit, control, frequency }: { open: boolean, setOpen: (open: boolean) => void, methods: any, onSubmit: any, control: any, frequency: string | undefined }) => ( <Popover open={open} onOpenChange={setOpen}> <PopoverTrigger asChild> <Button className="text-sm w-[14ch]" variant="outline" onClick={() => setOpen(true)} size="sm" aria-label="Set update frequency" > {frequency ? frequency : "Set Frequency"} </Button> </PopoverTrigger> <PopoverContent className="w-80"> <FormProvider {...methods}> <form onSubmit={onSubmit}> <div className="flex flex-col p-2"> <Label className="text-normal text-gray-700">Select frequency for updating Branch</Label> <Controller control={control} name="frequency" render={({ field }) => ( <Select onValueChange={field.onChange} value={field.value}> <SelectTrigger className="h-8 w-full mt-4"> <SelectValue> Set Frequency </SelectValue> </SelectTrigger> <SelectContent> <SelectItem value="Daily">Daily</SelectItem> <SelectItem value="Weekly">Weekly</SelectItem> <SelectItem value="Monthly">Monthly</SelectItem> </SelectContent> </Select> )} /> </div> <div className="flex justify-end mt-3"> <Button type="submit" size="sm">Set</Button> </div> </form> </FormProvider> </PopoverContent> </Popover> ); const DeleteButton = ({ loading, onDelete }: { loading: boolean, onDelete: () => void }) => ( <Button size="sm" className="text-lg p-2" variant="destructive" onClick={onDelete} disabled={loading} aria-label="Delete branch" > <AiOutlineDelete /> </Button> ); const ActionDropdown = ({ syncLoading, onSync, deleteLoading, onDelete, }: { syncLoading: boolean, onSync: () => void, deleteLoading: boolean, onDelete: () => void, }) => ( <DropdownMenu> <DropdownMenuTrigger> <Button className="text-lg p-2" variant="outline" size="sm" aria-label="Actions" > <HiOutlineDotsVertical /> </Button> </DropdownMenuTrigger> <DropdownMenuContent className='mr-8'> <DropdownMenuItem onClick={onSync} disabled={syncLoading}> <IoMdSync className={syncLoading ? 'animate-spin mr-2' : 'mr-2'} /> Fetch latest code </DropdownMenuItem> <DropdownMenuItem onClick={onDelete} disabled={deleteLoading}> <AiOutlineDelete className="mr-2" /> Delete branch </DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> ); export default ManageBranchItem;
2302_79757062/commit
dashboard/src/components/features/projects/Branch/ManageBranchItem.tsx
TSX
agpl-3.0
9,279
import { DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { ProjectData } from "../Projects" import { Button } from "@/components/ui/button" import { KeyedMutator } from "swr" import { CommitProjectBranch } from "@/types/commit/CommitProjectBranch" import ManageBranchItem from "./ManageBranchItem" export interface ManageBranchModalProps { branches: CommitProjectBranch[] mutate: KeyedMutator<{ message: ProjectData[]; }> setOpenManageModal: React.Dispatch<React.SetStateAction<boolean>> } const ManageBranchModal = ({ branches, mutate, setOpenManageModal }: ManageBranchModalProps) => { return ( <DialogContent className="p-6 w-[90vw] sm:max-w-[44vw] overflow-hidden"> <DialogHeader className="text-left"> <DialogTitle>Manage Branches</DialogTitle> </DialogHeader> <ul role="list" className="divide-y divide-gray-200 max-h-[60vh] overflow-y-scroll"> {branches?.map((branch: CommitProjectBranch) => { return ( <ManageBranchItem key={branch.name} branch={branch} mutate={mutate} /> ) } )} </ul> <DialogFooter> <Button variant="outline" onClick={() => setOpenManageModal(false)}> Close </Button> </DialogFooter> </DialogContent> ) } export default ManageBranchModal
2302_79757062/commit
dashboard/src/components/features/projects/Branch/ManageBranchModal.tsx
TSX
agpl-3.0
1,503
import { Button } from '@/components/ui/button' import { DialogHeader, DialogTitle, DialogContent, DialogFooter } from '@/components/ui/dialog' import { FormProvider, SubmitHandler, useForm } from 'react-hook-form' import { Input } from "@/components/ui/input" import { useFrappeCreateDoc } from 'frappe-react-sdk' import { useToast } from '@/components/ui/use-toast' import { ProjectData } from '../Projects' import { KeyedMutator } from 'swr' import { ErrorBanner } from '@/components/common/ErrorBanner/ErrorBanner' import { SpinnerLoader } from '@/components/common/FullPageLoader/SpinnerLoader' import { FormElement } from '@/components/common/Forms/FormControl' import { useEffect } from 'react' type FormFields = { organization_name: string, github_org: string, about: string, } interface CreateOrgModalProps { mutate: KeyedMutator<{ message: ProjectData[]; }> onClose: () => void open: boolean } const CreateOrgModal = ({ mutate, onClose, open }: CreateOrgModalProps) => { const { toast } = useToast() const methods = useForm<FormFields>() const { createDoc, reset, loading, error } = useFrappeCreateDoc() const onSubmit: SubmitHandler<FormFields> = (data) => { createDoc('Commit Organization', data) .then(() => { mutate() reset() onClose() }).then(() => toast({ description: "Organization Added", duration: 1500 })) } useEffect(() => { methods.reset() }, [open]) return ( <DialogContent className="p-6 w-[90vw] sm:w-full overflow-hidden"> <DialogHeader className="text-left"> <DialogTitle>Add Organization</DialogTitle> </DialogHeader> {error && <ErrorBanner error={error} />} <FormProvider {...methods}> <form onSubmit={methods.handleSubmit(onSubmit)}> <div className='flex flex-col gap-3'> <FormElement name='organization_name' label='Organization Name' aria-required> <Input {...methods.register("organization_name", { required: 'Organization Name is required' })} required id="organization_name" type="text" placeholder="eg. Frappe Framework" /> </FormElement> <FormElement name='github_org' label='Github Org' aria-required> <Input {...methods.register("github_org", { required: 'Github Org is required' })} id='github_org' type="text" placeholder="eg. frappe" /> </FormElement> <FormElement name='about' label='About'> <Input {...methods.register("about")} id='about' type="text" placeholder="eg: Frappe Framework is a full-stack web application." /> </FormElement> <DialogFooter> <Button type="submit" disabled={loading}> {loading && <SpinnerLoader />} Submit </Button> </DialogFooter> </div> </form> </FormProvider> </DialogContent> ) } export default CreateOrgModal
2302_79757062/commit
dashboard/src/components/features/projects/Org/CreateOrgModal.tsx
TSX
agpl-3.0
3,981
import { AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from '@/components/ui/alert-dialog' import { Button } from '@/components/ui/button' import { ProjectData } from '../Projects' import { useFrappeDeleteDoc } from 'frappe-react-sdk' import { toast } from '@/components/ui/use-toast' import { KeyedMutator } from 'swr' interface DeleteOrgModalProps { org: ProjectData, mutate: KeyedMutator<{ message: ProjectData[]; }> } const DeleteOrgModal = ({ org, mutate }: DeleteOrgModalProps) => { const { deleteDoc, reset } = useFrappeDeleteDoc() const handleOrgDelete = () => { deleteDoc("Commit Organization", `${org.name}`) .then(() => { mutate() reset() }).then(() => toast({ description: `Organization ${org.organization_name} Deleted`, duration: 1500 })) } return ( <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Delete Organization{' '}{org.organization_name}? </AlertDialogTitle> <AlertDialogDescription> This will remove this organization and the corresponding projects. </AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter className='!justify-end '> <AlertDialogCancel>Cancel</AlertDialogCancel> <Button variant="destructive" onClick={handleOrgDelete}> Delete </Button> </AlertDialogFooter> </AlertDialogContent> ) } export default DeleteOrgModal
2302_79757062/commit
dashboard/src/components/features/projects/Org/DeleteOrgModal.tsx
TSX
agpl-3.0
1,706
import { Button } from "@/components/ui/button"; import { isSystemManager } from "@/utils/roles"; import { AiOutlineDelete } from "react-icons/ai"; import { KeyedMutator } from "swr"; import { ProjectData } from "../Projects"; import DeleteOrgModal from "./DeleteOrgModal"; import { AlertDialog, AlertDialogTrigger } from "@/components/ui/alert-dialog"; import { ProjectCard } from "../Projects/ProjectCard"; interface OrgComponentProps { org: ProjectData, mutate: KeyedMutator<{ message: ProjectData[]; }> } export const OrgComponent = ({ org, mutate }: OrgComponentProps) => { const isCreateAccess = isSystemManager() return ( <div> <div className="flex justify-between items-center py-2 border-b-[1px]"> <h1 className="text-lg font-medium tracking-normal"> {org.organization_name} </h1> {isCreateAccess && <AlertDialog> <AlertDialogTrigger asChild> <Button size="icon" variant="outline" className="h-7 w-7"> <AiOutlineDelete /> </Button> </AlertDialogTrigger> <DeleteOrgModal org={org} mutate={mutate} /> </AlertDialog>} </div> <div className="pl-4"> {org.projects.map((project) => { return ( <ProjectCard project={project} key={project.name} mutate={mutate} /> ) } )} </div> </div> ) }
2302_79757062/commit
dashboard/src/components/features/projects/Org/OrgComponent.tsx
TSX
agpl-3.0
1,604
import { CalendarIcon } from "@radix-ui/react-icons" import { Avatar, AvatarFallback, AvatarImage, } from "@/components/ui/avatar" import { HoverCard, HoverCardContent, HoverCardTrigger, } from "@/components/ui/hover-card" export interface OrganizationHoverCardProps { organization_id: string organization_image: string joined_on: string onHoverText: string organization_about: string } export const OrganozationHoverCard = ({ organization_id, organization_image, joined_on, onHoverText, organization_about }: OrganizationHoverCardProps) => { return ( <HoverCard> <HoverCardTrigger asChild className="px-0"> {/* <Button variant="link" className="text-gray-700">{onHoverText}</Button> */} <a href="#" className="text-gray-700 pl-2 hover:underline">{onHoverText}</a> </HoverCardTrigger> <HoverCardContent className={organization_about ? "w-[20rem]" : "w-auto"}> <div className="flex justify-between space-x-4"> <Avatar> <AvatarImage src={organization_image} /> <AvatarFallback>VC</AvatarFallback> </Avatar> <div className="space-y-1"> <h4 className="text-sm font-semibold">{organization_id}</h4> <p className="text-sm"> {organization_about || "No description provided"} </p> <div className="flex items-center pt-2"> <CalendarIcon className="mr-2 h-4 w-4 opacity-70" />{" "} <span className="text-xs text-muted-foreground"> Joined {joined_on.split(" ")[0]} </span> </div> </div> </div> </HoverCardContent> </HoverCard > ) }
2302_79757062/commit
dashboard/src/components/features/projects/OrganizationHoverCard.tsx
TSX
agpl-3.0
1,998
import { DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { useFrappeCreateDoc } from "frappe-react-sdk" import { FormProvider, SubmitHandler, useForm } from "react-hook-form" import { Input } from "@/components/ui/input" import { Button } from '@/components/ui/button' import { useToast } from "@/components/ui/use-toast" import { ProjectData } from "../Projects" import { KeyedMutator } from "swr" import { AsyncDropdown } from "@/components/common/AsyncDropdown/AsyncDropdown" import { FormElement } from "@/components/common/Forms/FormControl" import { useEffect } from "react" export type FormFields = { org: string, repo_name: string, display_name: string, description: string, } interface CreateProjectModalProps { mutate: KeyedMutator<{ message: ProjectData[]; }>, onClose: VoidFunction open: boolean } const CreateProjectModal = ({ mutate, onClose, open }: CreateProjectModalProps) => { const { toast } = useToast() const methods = useForm<FormFields>() const { createDoc, reset } = useFrappeCreateDoc() const onSubmit: SubmitHandler<FormFields> = (data) => { createDoc('Commit Project', data) .then(() => { reset() }).then(() => { mutate() onClose() return toast({ description: "Project Added Successfully", duration: 1500 }) }) } useEffect(() => { methods.reset() }, [open]) return ( <DialogContent className="p-6 w-[90vw] sm:w-full overflow-hidden"> <DialogHeader className="text-left"> <DialogTitle>Add Project</DialogTitle> </DialogHeader> <FormProvider {...methods}> <form onSubmit={methods.handleSubmit(onSubmit)}> <div className="flex flex-col gap-3"> <FormElement name='org' label='Organization' aria-required> <AsyncDropdown name="org" doctype="Commit Organization" placeholder="Select Organization" id="org" rules={{ required: 'Organization is required' }} /> </FormElement> <FormElement name='display_name' label='Project Display Name' aria-required> <Input {...methods.register("display_name", { required: "Project Display Name is required" })} id="display_name" type="text" placeholder="eg. Leave Management System" /> </FormElement> <FormElement name='repo_name' label='Project Repo Name' aria-required> <Input {...methods.register("repo_name", { required: "Project Repo Name is required" })} id="repo_name" type="text" placeholder="eg. lms" /> </FormElement> <FormElement name='description' label='Description'> <Input {...methods.register("description")} id='description' type="text" placeholder="eg: Leave Management System is a full-stack web application." /> </FormElement> <DialogFooter> <Button type="submit"> Submit </Button> </DialogFooter> </div> </form> </FormProvider> </DialogContent> ) } export default CreateProjectModal
2302_79757062/commit
dashboard/src/components/features/projects/Projects/CreateProjectModal.tsx
TSX
agpl-3.0
4,204
import { KeyedMutator } from "swr"; import { ProjectData, ProjectWithBranch } from "../Projects" import { useFrappeDeleteDoc } from "frappe-react-sdk"; import { toast } from "@/components/ui/use-toast"; import { Button } from "@/components/ui/button"; import { AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from '@/components/ui/alert-dialog' interface DeleteProjectModalProps { project: ProjectWithBranch, mutate: KeyedMutator<{ message: ProjectData[]; }> } const DeleteProjectModal = ({ project, mutate }: DeleteProjectModalProps) => { const { deleteDoc, reset } = useFrappeDeleteDoc() const handleProjectDelete = () => { deleteDoc("Commit Project", `${project.name}`) .then(() => { mutate() reset() }).then(() => toast({ description: `Project ${project.display_name} Deleted`, duration: 1500 })) } return ( <AlertDialogContent className="p-6 w-[90vw] sm:w-full overflow-hidden"> <AlertDialogHeader className="text-left"> <AlertDialogTitle>Delete Project{' '}{project.display_name}? </AlertDialogTitle> <AlertDialogDescription> This will remove {project.display_name} from the list. </AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter className='!justify-end'> <AlertDialogCancel>Cancel</AlertDialogCancel> <Button variant="destructive" onClick={handleProjectDelete}> Delete </Button> </AlertDialogFooter> </AlertDialogContent> ) } export default DeleteProjectModal
2302_79757062/commit
dashboard/src/components/features/projects/Projects/DeleteProjectModal.tsx
TSX
agpl-3.0
1,814
import { Button } from "@/components/ui/button"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { AiOutlineDelete } from "react-icons/ai"; import { AlertDialog } from "@/components/ui/alert-dialog"; import { KeyedMutator } from "swr"; import { useMemo, useState } from "react"; import { isSystemManager } from "@/utils/roles"; import { RxDragHandleDots1 } from "react-icons/rx"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { BsThreeDotsVertical } from "react-icons/bs"; import { Dialog } from "@radix-ui/react-dialog"; import ManageBranchModal from "../Branch/ManageBranchModal"; import { ProjectWithBranch, ProjectData } from "../Projects"; import DeleteProjectModal from "./DeleteProjectModal"; export interface ProjectCardProps { project: ProjectWithBranch mutate: KeyedMutator<{ message: ProjectData[]; }> orgName: string githubOrg: string } const ProjectCard = ({ project, mutate, orgName, githubOrg }: ProjectCardProps) => { const appNameInitials = useMemo(() => { return project.display_name[0].toUpperCase() }, [project]) const isCreateAccess = isSystemManager() const [openManageModal, setOpenManageModal] = useState(false) const [openDeleteDialogModal, setOpenDeleteDialogModal] = useState(false) const openGithubRepo = () => { window.open(`https://github.com/${githubOrg}/${project.repo_name}`, '_blank') } return ( <div className="flex items-start border-b relative hover:bg-gray-100 p-4"> <div className="flex items-start gap-4"> <Avatar className="h-10 w-10 flex items-center rounded-lg"> <AvatarImage src={project.image} className="object-contain h-full w-full" /> <AvatarFallback className="rounded-lg text-xl"> {appNameInitials} </AvatarFallback> </Avatar> <div className="flex flex-col gap-1 cursor-default"> <div className="text-base font-semibold cursor-pointer hover:underline hover:text-blue-500" onClick={openGithubRepo}>{project.display_name}</div> <div className="text-sm text-gray-500 pb-4"> {project.description} </div> <div className="text-xs absolute bottom-2 text-gray-400">{orgName}</div> </div> </div> <div className="ml-auto flex items-center gap-2"> {isCreateAccess && ( <DropdownMenu> <DropdownMenuTrigger asChild> <Button variant="outline" size='icon' className="h-7 w-7"> <BsThreeDotsVertical /> </Button> </DropdownMenuTrigger> <DropdownMenuContent className="w-50 mr-4"> {project.branches.length > 0 && ( <DropdownMenuItem onClick={() => { setOpenManageModal(true) }}> <> <RxDragHandleDots1 className="h-4 w-4 mr-2" /> Manage Branches </> </DropdownMenuItem> )} <DropdownMenuItem onClick={() => setOpenDeleteDialogModal(true)}> <AiOutlineDelete className="h-4 w-4 mr-2" /> Delete Project </DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> )} </div> <AlertDialog open={openDeleteDialogModal} onOpenChange={setOpenDeleteDialogModal}> <DeleteProjectModal project={project} mutate={mutate} /> </AlertDialog> <Dialog open={openManageModal} onOpenChange={setOpenManageModal}> <ManageBranchModal branches={project.branches} mutate={mutate} setOpenManageModal={setOpenManageModal} /> </Dialog> </div> ); } export default ProjectCard;
2302_79757062/commit
dashboard/src/components/features/projects/Projects/ProjectCard.tsx
TSX
agpl-3.0
3,769
import { FullPageLoader } from "@/components/common/FullPageLoader/FullPageLoader"; import { CommitProject } from "@/types/commit/CommitProject"; import { useFrappeGetCall } from "frappe-react-sdk"; import { isSystemManager } from "@/utils/roles"; import { CommitProjectBranch } from "@/types/commit/CommitProjectBranch"; import { AddMenuButton } from "./AddMenuButton"; import { APIExplorer } from "./APIExplorer"; import ProjectCard from "./Projects/ProjectCard"; import { ViewERDButton } from "./ViewERDButton"; export interface ProjectWithBranch extends CommitProject { branches: CommitProjectBranch[]; } export interface ProjectData extends CommitProjectBranch { projects: ProjectWithBranch[]; organization_name: string; github_org: string; image: string; name: string; about: string; } export const Projects = () => { const isCreateAccess = isSystemManager(); const { data, error, isLoading, mutate } = useFrappeGetCall<{ message: ProjectData[]; }>( "commit.api.commit_project.commit_project.get_project_list_with_branches", {}, "get_project_list_with_branches", { keepPreviousData: true, revalidateOnFocus: true, revalidateIfStale: false, } ); if (error) { return <div>Error</div>; } if (isLoading) { return <FullPageLoader />; } if (data && data.message) { return ( <div className="mx-auto pl-2 pr-4 h-full overflow-y-auto pt-2"> <div className="h-full flex flex-col gap-4"> <div className="grid grid-cols-1 gap-6 justify-between sm:grid-cols-2"> <ViewERDButton data={data?.message} /> <APIExplorer /> </div> <div className="flex flex-col gap-4"> <div className="flex flex-row items-end justify-between border-b pb-2"> <div className="text-xl font-semibold pt-1">Projects</div> {isCreateAccess && <AddMenuButton mutate={mutate} />} </div> <div className="grid sm:grid-cols-2 gap-x-8 pb-4"> {data.message.map((org: ProjectData) => { const orgName = org.organization_name; return org.projects.map((project) => ( <ProjectCard orgName={orgName} githubOrg={org.github_org} project={project} key={project.name} mutate={mutate} /> )); })} </div> </div> </div> </div> ); } };
2302_79757062/commit
dashboard/src/components/features/projects/Projects.tsx
TSX
agpl-3.0
3,026
import { Button } from "@/components/ui/button" import { DialogHeader, DialogFooter, DialogContent, DialogDescription, DialogTitle } from "@/components/ui/dialog" import { useState } from "react" import { useNavigate } from "react-router-dom" import { ProjectData, ProjectWithBranch } from "./Projects" import { Checkbox } from "@/components/ui/checkbox" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { CommitProjectBranch } from "@/types/commit/CommitProjectBranch" import { Label } from "@/components/ui/label" export const ViewERDDialogContent = ({ data }: { data: ProjectData[] }) => { const [apps, setApps] = useState<string[]>([]) const navigate = useNavigate() const onViewERD = () => { window.sessionStorage.removeItem('ERDDoctypes') navigate('/project-erd', { state: { apps: apps } }) } return ( <DialogContent className="p-6 w-[90vw] sm:w-full overflow-hidden"> <DialogHeader className="text-left"> <DialogTitle>Select Apps</DialogTitle> <DialogDescription> Select the apps to view ERD </DialogDescription> </DialogHeader> <ul role="list" className="divide-y divide-gray-200 max-h-[60vh] overflow-y-scroll"> {data?.map((org: ProjectData) => { return org.projects?.filter((project) => project.branches?.length > 0)?.map((project => { return ( <ViewERDProjectCard project={project} key={project.name} setApps={setApps} apps={apps} /> ) } )) })} </ul> <DialogFooter> <Button onClick={onViewERD}>View ERD</Button> </DialogFooter> </DialogContent> ) } export interface ViewERDProjectCardProps { project: ProjectWithBranch setApps: (apps: string[]) => void apps: string[] } export const ViewERDProjectCard = ({ project, apps, setApps }: ViewERDProjectCardProps) => { const [branch, setBranch] = useState<string>(project.branches[0]?.name) return ( <li className="w-full h-auto hover:shadow-sm px-2"> <div className="flex items-center justify-between py-2 w-full"> <Label htmlFor={`${project.display_name}`} className="flex items-center space-x-3"> <Checkbox id={`${project.display_name}`} checked={apps.includes(branch)} className="border-gray-300 text-gray-600 shadow-sm" onCheckedChange={(checked) => { if (checked) { setApps([...apps, branch]) } else { setApps(apps.filter((app) => app !== branch)) } }} /> <h1 className="text-[16px] font-medium tracking-normal cursor-pointer">{project.display_name}</h1> </Label> <Select onValueChange={(value) => setBranch(value)} defaultValue={project.branches[0]?.name} > <SelectTrigger className="h-8 w-40"> <SelectValue placeholder="Select Branch" /> </SelectTrigger> <SelectContent> {project.branches.map((branch: CommitProjectBranch) => { return ( <SelectItem value={branch.name} key={branch.name}>{branch.branch_name}</SelectItem> ) })} </SelectContent> </Select> </div> </li >) }
2302_79757062/commit
dashboard/src/components/features/projects/ViewERDAppDialog.tsx
TSX
agpl-3.0
4,021
import { Card, CardHeader, CardTitle, CardContent, CardFooter } from "@/components/ui/card"; import { Dialog, DialogTrigger } from "@/components/ui/dialog"; import { Button } from "@/components/ui/button"; import { ViewERDDialogContent } from "./ViewERDAppDialog"; import { ProjectData } from "./Projects"; import { MdKeyboardArrowRight } from "react-icons/md"; import { useNavigate } from "react-router-dom"; import erd from '../../../assets/erd.svg' export const ViewERDButton = ({ data }: { data: ProjectData[] }) => { return ( <Card className="flex flex-col sm:flex-row items-center p-2 border rounded-lg w-full h-full shadow-sm bg-white relative"> <div className="flex-grow h-full"> <CardHeader className="pb-4"> <CardTitle>Visualize your database</CardTitle> </CardHeader> <CardContent> <div className="text-sm text-gray-500 sm:mb-8">Analyze and understand the relationships between your doctypes with an interactive Entity Relationship Diagram (ERD).</div> </CardContent> <CardFooter className="absolute bottom-0"> <Dialog> <DialogTrigger asChild> <Button size="sm" disabled={data.length === 0} className="rounded-full px-4 pr-2 py-2 shadow-md" > Get Started <MdKeyboardArrowRight className="ml-2 mr-0 p-0" style={{ fontSize: '1rem' }} /> </Button> </DialogTrigger> <ViewERDDialogContent data={data} /> </Dialog> </CardFooter> </div> <div className="flex-shrink-0 sm:mb-0 mb-16 p-4 sm:p-0"> <img src={erd} alt="ERD Diagram" height={'full'} className="w-full rounded-md sm:w-[180px] sm:mr-6 sm:rounded-md" /> </div> </Card> ); }; export const ViewERDButtonForSiteApps = () => { const navigate = useNavigate() return ( <Card className="flex flex-col sm:flex-row items-center p-2 border rounded-lg w-full h-full shadow-sm bg-white relative"> <div className="flex-grow h-full"> <CardHeader className="pb-4"> <CardTitle>Visualize your site database</CardTitle> </CardHeader> <CardContent> <div className="text-sm text-gray-500 sm:mb-8">Analyze and understand the relationships between your doctypes with an interactive Entity Relationship Diagram (ERD).</div> </CardContent> <CardFooter className="absolute bottom-0"> <Button size="sm" className="rounded-full px-4 pr-2 py-2 shadow-md" onClick={() => { window.sessionStorage.removeItem('ERDMetaDoctypes') navigate({ pathname: `/meta-erd/create`, }) }} > Get Started <MdKeyboardArrowRight className="ml-2 mr-0 p-0" style={{ fontSize: '1rem' }} /> </Button> </CardFooter> </div> <div className="flex-shrink-0 sm:mb-0 mb-16 p-4 sm:p-0"> <img src={erd} alt="ERD Diagram" width={180} height={'full'} className="w-full rounded-md sm:w-[180px] sm:mr-6 sm:rounded-md" /> </div> </Card> ); }
2302_79757062/commit
dashboard/src/components/features/projects/ViewERDButton.tsx
TSX
agpl-3.0
3,886
import * as React from "react" import * as AccordionPrimitive from "@radix-ui/react-accordion" import { ChevronDownIcon } from "@radix-ui/react-icons" import { cn } from "@/lib/utils" const Accordion = AccordionPrimitive.Root const AccordionItem = React.forwardRef< React.ElementRef<typeof AccordionPrimitive.Item>, React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item> >(({ className, ...props }, ref) => ( <AccordionPrimitive.Item ref={ref} className={cn("border-b", className)} {...props} /> )) AccordionItem.displayName = "AccordionItem" const AccordionTrigger = React.forwardRef< React.ElementRef<typeof AccordionPrimitive.Trigger>, React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> >(({ className, children, ...props }, ref) => ( <AccordionPrimitive.Header className="flex"> <AccordionPrimitive.Trigger ref={ref} className={cn( "flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180", className )} {...props} > {children} <ChevronDownIcon className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" /> </AccordionPrimitive.Trigger> </AccordionPrimitive.Header> )) AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName const AccordionContent = React.forwardRef< React.ElementRef<typeof AccordionPrimitive.Content>, React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content> >(({ className, children, ...props }, ref) => ( <AccordionPrimitive.Content ref={ref} className={cn( "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down", className )} {...props} > <div className="pb-4 pt-0">{children}</div> </AccordionPrimitive.Content> )) AccordionContent.displayName = AccordionPrimitive.Content.displayName export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
2302_79757062/commit
dashboard/src/components/ui/accordion.tsx
TSX
agpl-3.0
2,026
import * as React from "react" import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" import { cn } from "@/lib/utils" import { buttonVariants } from "@/components/ui/button" const AlertDialog = AlertDialogPrimitive.Root const AlertDialogTrigger = AlertDialogPrimitive.Trigger const AlertDialogPortal = ({ className, ...props }: AlertDialogPrimitive.AlertDialogPortalProps) => ( <AlertDialogPrimitive.Portal className={cn(className)} {...props} /> ) AlertDialogPortal.displayName = AlertDialogPrimitive.Portal.displayName const AlertDialogOverlay = React.forwardRef< React.ElementRef<typeof AlertDialogPrimitive.Overlay>, React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay> >(({ className, ...props }, ref) => ( <AlertDialogPrimitive.Overlay className={cn( "fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className )} {...props} ref={ref} /> )) AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName const AlertDialogContent = React.forwardRef< React.ElementRef<typeof AlertDialogPrimitive.Content>, React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> >(({ className, ...props }, ref) => ( <AlertDialogPortal> <AlertDialogOverlay /> <AlertDialogPrimitive.Content ref={ref} className={cn( "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full", className )} {...props} /> </AlertDialogPortal> )) AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => ( <div className={cn( "flex flex-col space-y-2 text-center sm:text-left", className )} {...props} /> ) AlertDialogHeader.displayName = "AlertDialogHeader" const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => ( <div className={cn( "flex flex-col-reverse sm:flex-row sm:justify-start sm:space-x-2", className )} {...props} /> ) AlertDialogFooter.displayName = "AlertDialogFooter" const AlertDialogTitle = React.forwardRef< React.ElementRef<typeof AlertDialogPrimitive.Title>, React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title> >(({ className, ...props }, ref) => ( <AlertDialogPrimitive.Title ref={ref} className={cn("text-lg font-semibold", className)} {...props} /> )) AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName const AlertDialogDescription = React.forwardRef< React.ElementRef<typeof AlertDialogPrimitive.Description>, React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description> >(({ className, ...props }, ref) => ( <AlertDialogPrimitive.Description ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} /> )) AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName const AlertDialogAction = React.forwardRef< React.ElementRef<typeof AlertDialogPrimitive.Action>, React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action> >(({ className, ...props }, ref) => ( <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} /> )) AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName const AlertDialogCancel = React.forwardRef< React.ElementRef<typeof AlertDialogPrimitive.Cancel>, React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel> >(({ className, ...props }, ref) => ( <AlertDialogPrimitive.Cancel ref={ref} className={cn( buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className )} {...props} /> )) AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName export { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, }
2302_79757062/commit
dashboard/src/components/ui/alert-dialog.tsx
TSX
agpl-3.0
4,607