diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ce9731e6ba9..686d5492ca0 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '12.1.5' +__version__ = '12.1.6' def get_default_company(user=None): '''Get default company for user''' diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/el_salvador_standard.json b/erpnext/accounts/doctype/account/chart_of_accounts/verified/el_salvador_standard.json new file mode 100644 index 00000000000..6409d95e639 --- /dev/null +++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/el_salvador_standard.json @@ -0,0 +1,809 @@ +{ + "country_code": "sv", + "name": "El Salvador Standard", + "tree": { + "100000 - ACTIVOS - xmC": { + "11000000 - ACTIVOS CORRIENTES - xmC": { + "11010000 - EFECTIVO Y EQUIVALENTES AL EFECTIVO - xmC": { + "11010100 - Caja general - xmC": { + "account_number": "11010100", + "account_type": "Cash" + }, + "Caja chica": { + "account_number": "11010200", + "account_type": "Cash", + "is_group": 1 + }, + "Efectivo en bancos": { + "account_number": "11010300", + "account_type": "Bank", + "is_group": 1 + }, + "account_number": "11010000", + "account_type": "Cash" + }, + "CUENTAS POR COBRAR ARRENDAMIENTOS FINANCIEROS": { + "Arrendamientos financieros por cobrar": { + "account_number": "11040100", + "is_group": 1 + }, + "Estimaci\u00f3n para cuentas de cobro dudoso (CR)": { + "account_number": "11040200", + "is_group": 1 + }, + "account_number": "11040000" + }, + "DEUDORES COMERCIALES Y OTRAS CUENTAS POR COBRAR": { + "11030100 - Deudores comerciales - xmC": { + "account_number": "11030100", + "account_type": "Receivable" + }, + "Estimaci\u00f3n para cuentas de cobro dudoso (CR)": { + "account_number": "11030200", + "account_type": "Receivable", + "is_group": 1 + }, + "Otras cuentas por cobrar no comerciales": { + "account_number": "11030300", + "account_type": "Receivable", + "is_group": 1 + }, + "account_number": "11030000", + "account_type": "Receivable" + }, + "GASTOS PAGADOS POR ANTICIPADO": { + "Adelantos a empleados": { + "account_number": "110904", + "account_type": "Temporary", + "is_group": 1 + }, + "Papeler\u00eda y \u00fatiles en existencia": { + "account_number": "11090300", + "account_type": "Temporary", + "is_group": 1 + }, + "Primas de seguros aun no vendidas": { + "account_number": "11090100", + "account_type": "Temporary", + "is_group": 1 + }, + "Rentas aun no corridas por los inmuebles": { + "account_number": "11090200", + "account_type": "Temporary", + "is_group": 1 + }, + "account_number": "11090000", + "account_type": "Temporary" + }, + "INVENTARIOS": { + "11050100 - Inventarios en bodega al costo - xmC": { + "account_number": "11050100", + "account_type": "Stock" + }, + "11050300 - Pedidos en transito - xmC": { + "account_number": "11050300", + "account_type": "Stock Received But Not Billed" + }, + "Estimaci\u00f3n para obsolescencia de inventarios o de lento movimiento (CR)": { + "account_number": "11050200", + "account_type": "Stock", + "is_group": 1 + }, + "Mercader\u00edas en consignaci\u00f3n": { + "account_number": "11050400", + "account_type": "Stock", + "is_group": 1 + }, + "account_number": "11050000", + "account_type": "Stock" + }, + "INVERSIONES TEMPORALES": { + "Acciones": { + "account_number": "11020100", + "account_type": "Temporary", + "is_group": 1 + }, + "Bonos": { + "account_number": "11020200", + "account_type": "Temporary", + "is_group": 1 + }, + "C\u00e9dulas hipotecarias": { + "account_number": "11020300", + "account_type": "Temporary", + "is_group": 1 + }, + "account_number": "11020000", + "account_type": "Temporary" + }, + "IVA CREDITO FISCAL": { + "IVA compras locales": { + "account_number": "11060100", + "account_type": "Tax", + "is_group": 1, + "tax_rate": 13.0 + }, + "IVA importaciones": { + "account_number": "11060200", + "account_type": "Tax", + "is_group": 1, + "tax_rate": 13.0 + }, + "account_number": "11060000", + "account_type": "Tax", + "tax_rate": 13.0 + }, + "IVA PERCIBIDO": { + "account_number": "IVA PERCIBIDO", + "account_type": "Tax", + "is_group": 1, + "tax_rate": 1.0 + }, + "IVA RETENIDO": { + "account_number": "11070000", + "account_type": "Tax", + "is_group": 1, + "tax_rate": 1.0 + }, + "account_number": "11000000" + }, + "12000000 - ACTIVOS NO CORRIENTES - xmC": { + "ACTIVOS INTANGIBLES": { + "Concesiones y franquicias": { + "account_number": "12080300", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Derechos de llave": { + "account_number": "12080100", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Patentes y marcas de fabrica": { + "account_number": "12080200", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Software": { + "account_number": "12080400", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "account_number": "12080000", + "account_type": "Fixed Asset" + }, + "CUENTAS POR COBRAR ARRENDAMIENTOS FINANCIEROS A LARGO PLAZO": { + "Arrendamientos financieros por cobrar a largo plazo": { + "account_number": "12060100", + "account_type": "Receivable", + "is_group": 1 + }, + "Estimaci\u00f3n para cuentas de cobro dudoso a largo plazo (CR)": { + "account_number": "12060200", + "account_type": "Receivable", + "is_group": 1 + }, + "account_number": "12060000", + "account_type": "Receivable" + }, + "DEPRECIACION ACUMULUDA (CR)": { + "12030100 - Deprec. acumulada de propiedades, planta y equipo propio al costo - xmC": { + "account_number": "12030100", + "account_type": "Accumulated Depreciation" + }, + "Deprec. acumulada de prop., planta y equipo bajo arrend. Financiero": { + "account_number": "12030200", + "account_type": "Accumulated Depreciation", + "is_group": 1 + }, + "Deprec. acumulada de revaluaos de propiedades, planta y equipo": { + "account_number": "12030300", + "account_type": "Accumulated Depreciation", + "is_group": 1 + }, + "account_number": "12030000", + "account_type": "Accumulated Depreciation" + }, + "DEUDORES COMERCIALES Y OTRAS CUENTAS POR COBRAR A LARGO PLAZO": { + "12050100 - Deudores comerciales a largo plazo - xmC": { + "account_number": "12050100", + "account_type": "Receivable", + "is_group": 1 + }, + "Cuentas por cobrar no comerciales a largo plazo": { + "account_number": "12050300", + "account_type": "Receivable", + "is_group": 1 + }, + "Estimaci\u00f3n para cuentas de cobro dudoso a largo plazo (CR)": { + "account_number": "12050200", + "account_type": "Receivable", + "is_group": 1 + }, + "account_number": "12050000", + "account_type": "Receivable" + }, + "IMPUESTO SOBRE LA RENTA DIFERIDO-ACTIVO": { + "12070200 - Pago anticipados de impuestos sobre la renta - xmC": { + "account_number": "12070200", + "account_type": "Temporary", + "is_group": 1 + }, + "Cr\u00e9dito impuestos sobre la renta de a\u00f1os anteriores": { + "account_number": "12070100", + "account_type": "Tax", + "is_group": 1 + }, + "account_number": "12070000", + "account_type": "Tax" + }, + "INVERSIONES PERMANENTES": { + "Inversiones en asociadas": { + "account_number": "12040200", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Inversiones en negocios conjuntos": { + "account_number": "12040300", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Inversiones en subsidiarias": { + "account_number": "12040100", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "account_number": "12040000", + "account_type": "Fixed Asset" + }, + "PROPIEDADES, PLANTA Y EQUIPO": { + "12010300 - Maquinarias y equipos - xmC": { + "account_number": "12010300", + "account_type": "Fixed Asset" + }, + "Edificios": { + "account_number": "12010200", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Mobiliario y equipo": { + "account_number": "12010400", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Terrenos": { + "account_number": "12010100", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Veh\u00edculos": { + "account_number": "12010500", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "account_number": "12010000", + "account_type": "Fixed Asset" + }, + "REVALUACIONES DE PROPIEDADES, PLANTA Y EQUIPO": { + "Revaluaci\u00f3n de edificios": { + "account_number": "12020200", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Revaluaci\u00f3n de maquinarias y equipo": { + "account_number": "12020300", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Revaluaci\u00f3n de mobiliario y equipo": { + "account_number": "12020400", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Revaluaci\u00f3n de terrenos": { + "account_number": "12020100", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "Revaluaci\u00f3n de veh\u00edculos": { + "account_number": "12020500", + "account_type": "Fixed Asset", + "is_group": 1 + }, + "account_number": "12020000", + "account_type": "Fixed Asset" + }, + "account_number": "12000000", + "account_type": "Fixed Asset" + }, + "account_number": "100000", + "root_type": "Asset" + }, + "20000000 - PASIVOS - xmC": { + "PASIVOS CORRIENTES": { + "ACREEDORES COMERCIALES Y OTRAS CUENTAS POR PAGAR": { + "21020100 - Cuentas por pagar comerciales - xmC": { + "account_number": "21020100", + "account_type": "Payable" + }, + "Documentos por pagar comerciales": { + "account_number": "21020200", + "account_type": "Payable", + "is_group": 1 + }, + "account_number": "21020000", + "account_type": "Payable" + }, + "BENEFICIOS A EMPLEADOS POR PAGAR": { + "Beneficios a corto plazo por pagar": { + "account_number": "21050100", + "account_type": "Payable", + "is_group": 1 + }, + "Beneficios post empleo por pagar": { + "account_number": "21050200", + "account_type": "Payable", + "is_group": 1 + }, + "account_number": "21050000", + "account_type": "Payable" + }, + "DIVIDENDOS POR PAGAR": { + "account_number": "21080000", + "account_type": "Payable", + "is_group": 1 + }, + "IMPUESTO SOBRE LA RENTA CORRIENTE POR PAGAR": { + "account_number": "21070000", + "account_type": "Tax", + "is_group": 1 + }, + "IVA DEBITOS FISCALES": { + "Por ventas a consumidores": { + "account_number": "21060200", + "account_type": "Tax", + "is_group": 1 + }, + "Por ventas a contribuyentes": { + "account_number": "21060100", + "account_type": "Tax", + "is_group": 1 + }, + "account_number": "21060000", + "account_type": "Tax" + }, + "OBLIGACIONES BAJO ARRENDAMIENTOS FINANCIEROS PORCION CORRIENTE": { + "Contratos bajo arrendamientos financieros": { + "account_number": "21030100", + "account_type": "Payable", + "is_group": 1 + }, + "account_number": "21030000", + "account_type": "Payable" + }, + "OTROS ACREEDORES, RETENCIONES Y DESCUENTOS": { + "Cuentas por pagar a accionistas": { + "account_number": "21040400", + "account_type": "Payable", + "is_group": 1 + }, + "Descuentos": { + "account_number": "21040300", + "account_type": "Payable", + "is_group": 1 + }, + "Otros acreedores": { + "account_number": "21040100", + "account_type": "Payable", + "is_group": 1 + }, + "Retenciones": { + "account_number": "21040200", + "account_type": "Payable", + "is_group": 1 + }, + "account_number": "21040000", + "account_type": "Payable" + }, + "PRESTAMOS Y SOBREGIROS BANCARIOS": { + "Porci\u00f3n corriente de prestamos bancarios a largo plazo": { + "account_number": "21010300", + "is_group": 1 + }, + "Prestamos bancarios a corto plazo": { + "account_number": "21010100", + "is_group": 1 + }, + "Sobregiros bancarios": { + "account_number": "21010200", + "is_group": 1 + }, + "account_number": "21010000" + }, + "account_number": "21000000" + }, + "PASIVOS NO CORRIENTES": { + "ANTICIPOS Y GARANTIAS DE CLIENTES": { + "Anticipos de clientes": { + "account_number": "22040100", + "account_type": "Temporary", + "is_group": 1 + }, + "Garant\u00edas de clientes": { + "account_number": "22040200", + "account_type": "Temporary", + "is_group": 1 + }, + "account_number": "22040000", + "account_type": "Temporary" + }, + "INTERES MINOTARIO": { + "Inter\u00e9s de accionista minotarios": { + "account_number": "22050100", + "is_group": 1 + }, + "account_number": "22050000" + }, + "OBLIGACIONES BAJO ARRENDAMIENTOS FINANCIEROS A LARGO PLAZO": { + "Contratos bajo arrendamientos financieros": { + "account_number": "22030100", + "is_group": 1 + }, + "account_number": "22030000" + }, + "OTROS PRESTAMOS A LARGO PLAZO": { + "account_number": "22020000", + "is_group": 1 + }, + "PRESTAMOS BANCARIOS A LARGO PLAZO": { + "account_number": "22010000", + "is_group": 1 + }, + "account_number": "22000000" + }, + "PROVISIONES": { + "IMPUESTOS SOBRE LA RENTA COMPLEMENTARIO": { + "Ejercicios anteriores": { + "account_number": "23010100", + "account_type": "Tax", + "is_group": 1 + }, + "account_number": "23010000", + "account_type": "Tax" + }, + "PROVISION PARA OBLIGACIONES LABORALES": { + "Indemnizaci\u00f3n": { + "account_number": "23020100", + "is_group": 1 + }, + "account_number": "23020000" + }, + "account_number": "23000000" + }, + "account_number": "20000000", + "root_type": "Liability" + }, + "30000000 - PATRIMONIO - xmC": { + "CAPITAL, RESERVAS Y RESULTADOS": { + "CAPITAL SOCIAL": { + "Capital Social M\u00ednimo": { + "Capital Social M\u00ednimo NO Pagado": { + "account_number": "31010102", + "account_type": "Equity", + "is_group": 1 + }, + "Capital Social M\u00ednimo Suscrito": { + "account_number": "31010101", + "account_type": "Equity", + "is_group": 1 + }, + "account_number": "31010100", + "account_type": "Equity" + }, + "Capital Social Variable": { + "Capital Social Variable NO Pagado": { + "account_number": "31010202", + "account_type": "Equity", + "is_group": 1 + }, + "Capital Social Variable Suscrito": { + "account_number": "31010201", + "account_type": "Equity", + "is_group": 1 + }, + "account_number": "31010200", + "account_type": "Equity" + }, + "account_number": "31010000", + "account_type": "Equity" + }, + "DIVIDENDOS PAGADOS": { + "account_number": "31060000", + "account_type": "Equity", + "is_group": 1 + }, + "GANANCIAS NO DISTRIBUIDAS": { + "De ejercicios anteriores": { + "account_number": "31020100", + "account_type": "Equity", + "is_group": 1 + }, + "Del presente ejercicio": { + "account_number": "31020200", + "account_type": "Equity", + "is_group": 1 + }, + "account_number": "31020000", + "account_type": "Equity" + }, + "GANANCIAS RESTRINGIDAS": { + "Reserva legal": { + "account_number": "31030100", + "account_type": "Equity", + "is_group": 1 + }, + "account_number": "31030000", + "account_type": "Equity" + }, + "PERDIDAS ACUMULADAS (CR)": { + "De ejercicios anteriores": { + "account_number": "31050100", + "account_type": "Equity", + "is_group": 1 + }, + "Del presente ejercicio": { + "account_number": "31050200", + "account_type": "Equity", + "is_group": 1 + }, + "account_number": "31050000", + "account_type": "Equity" + }, + "SUPERAVIT POR REVALUACIONES": { + "Super\u00e1vit por revaluaci\u00f3n de activos": { + "account_number": "31040100", + "account_type": "Equity", + "is_group": 1 + }, + "account_number": "31040000", + "account_type": "Equity" + }, + "account_number": "31000000", + "account_type": "Equity" + }, + "account_number": "30000000", + "root_type": "Equity" + }, + "40000000 - CUENTAS DE RESULTADO DEUDORAS - xmC": { + "COSTOS Y GASTOS DE OPERACI\u00d3N": { + "41010000 - COSTO DE LAS VENTAS - xmC": { + "account_number": "41010000", + "account_type": "Cost of Goods Sold" + }, + "GASTOS DE DEPARTAMENTO DE OPERACIONES": { + "41020600 - Depreciaciones y amortizaciones - xmC": { + "account_number": "41020600", + "account_type": "Depreciation" + }, + "41020900 - Redondeos - xmC": { + "account_number": "41020900", + "account_type": "Round Off" + }, + "Gastos operativos": { + "account_number": "41020700", + "account_type": "Chargeable", + "is_group": 1 + }, + "Mantenimientos": { + "account_number": "41020400", + "account_type": "Chargeable", + "is_group": 1 + }, + "Materiales y suministros": { + "Ajustes de Inventario": { + "account_number": "41020201", + "account_type": "Stock Adjustment" + }, + "account_number": "41020200", + "account_type": "Chargeable" + }, + "Seguros": { + "account_number": "41020500", + "account_type": "Chargeable", + "is_group": 1 + }, + "Servicios b\u00e1sicos": { + "account_number": "41020300", + "account_type": "Chargeable", + "is_group": 1 + }, + "Servicios y honorarios profesionales": { + "account_number": "41020800", + "account_type": "Chargeable", + "is_group": 1 + }, + "Sueldos y prestaciones laborales": { + "account_number": "41020100", + "account_type": "Chargeable", + "is_group": 1 + }, + "account_number": "41020000", + "account_type": "Expense Account" + }, + "GASTOS DE VENTAS Y DISTRIBUCION": { + "Depreciaciones y amortizaciones": { + "account_number": "41030600", + "account_type": "Chargeable", + "is_group": 1 + }, + "Gastos operativos": { + "account_number": "41030700", + "account_type": "Chargeable", + "is_group": 1 + }, + "Mantenimientos": { + "account_number": "41030400", + "account_type": "Chargeable", + "is_group": 1 + }, + "Materiales y suministros": { + "account_number": "41030200", + "account_type": "Chargeable", + "is_group": 1 + }, + "Seguros": { + "account_number": "41030500", + "account_type": "Chargeable", + "is_group": 1 + }, + "Servicios b\u00e1sicos": { + "account_number": "41030300", + "account_type": "Chargeable", + "is_group": 1 + }, + "Servicios y honorarios profesionales": { + "account_number": "41030800", + "account_type": "Chargeable", + "is_group": 1 + }, + "Sueldos y prestaciones laborales": { + "account_number": "41030100", + "account_type": "Chargeable", + "is_group": 1 + }, + "account_number": "41030000", + "account_type": "Expense Account" + }, + "account_number": "41000000", + "account_type": "Expense Account" + }, + "GASTOS DE IMPUESTO SOBRE LA RENTA": { + "GASTOS DE IMPUESTO SOBRE LA RENTA CORRIENTE": { + "account_number": "43010000", + "account_type": "Expense Account", + "is_group": 1 + }, + "account_number": "43000000", + "account_type": "Expense Account" + }, + "GASTOS DE NO OPERACI\u00d3N": { + "42020000 - GASTOS NO DEDUCIBLES - xmC": { + "Garant\u00eda por venta de productos": { + "account_number": "42020200", + "account_type": "Expense Account", + "is_group": 1 + }, + "Impuesto sobre la renta complementario": { + "account_number": "42020100", + "account_type": "Tax", + "is_group": 1 + }, + "account_number": "42020000", + "account_type": "Expense Account" + }, + "GASTOS FINANCIEROS": { + "42010100 - Intereses - xmC": { + "account_number": "42010100", + "account_type": "Expense Account", + "is_group": 1 + }, + "42010300 - Diferenciales cambiarios - xmC": { + "account_number": "42010300", + "account_type": "Expense Account", + "is_group": 1 + }, + "Comisiones bancarias": { + "account_number": "42010200", + "account_type": "Expense Account", + "is_group": 1 + }, + "account_number": "42010000", + "account_type": "Expense Account" + }, + "account_number": "42000000", + "account_type": "Expense Account" + }, + "account_number": "40000000", + "root_type": "Expense" + }, + "50000000 - CUENTAS DE RESULTADO ACREEDORAS - xmC": { + "INGRESOS DE NO OPERACI\u00d3N": { + "DIVIDENDOS GANADOS": { + "Dividendos devengados por inversiones": { + "account_number": "52020100", + "account_type": "Income Account", + "is_group": 1 + }, + "account_number": "52020000", + "account_type": "Income Account" + }, + "INGRESOS FINANCIEROS": { + "Comisiones": { + "account_number": "52010200", + "account_type": "Income Account", + "is_group": 1 + }, + "Diferenciales cambiarios": { + "account_number": "52010300", + "account_type": "Income Account", + "is_group": 1 + }, + "Intereses": { + "account_number": "52010100", + "account_type": "Income Account", + "is_group": 1 + }, + "account_number": "52010000", + "account_type": "Income Account" + }, + "OTROS INGRESOS": { + "Ingresos por activos dados en arrendamientos financieros": { + "account_number": "52030200", + "account_type": "Income Account", + "is_group": 1 + }, + "Ingresos por conversi\u00f3n": { + "account_number": "52030100", + "account_type": "Income Account", + "is_group": 1 + }, + "Reintegros de seguros": { + "account_number": "52030300", + "account_type": "Income Account", + "is_group": 1 + }, + "account_number": "52030000", + "account_type": "Income Account" + }, + "account_number": "52000000", + "account_type": "Income Account" + }, + "INGRESOS POR OPERACIONES CONTINUAS": { + "51010000 - VENTAS DE BIENES - xmC": { + "account_number": "51010000", + "account_type": "Income Account" + }, + "VENTAS DE SERVICIOS": { + "account_number": "51020000", + "account_type": "Income Account", + "is_group": 1 + }, + "account_number": "51000000", + "account_type": "Income Account" + }, + "account_number": "50000000", + "root_type": "Income" + }, + "60000000 - CUENTA LIQUIDADORA DE RESULTADOS - xmC": { + "CUENTA DE CIERRE": { + "PERDIDAS Y GANANCIAS": { + "account_number": "61010000", + "is_group": 1 + }, + "account_number": "61000000" + }, + "account_number": "60000000", + "root_type": "Income" + } + } +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.json b/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.json index 04d6303774a..5c3519a1592 100644 --- a/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.json +++ b/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.json @@ -38,13 +38,13 @@ "read_only": 1 }, { - "fetch_from": "sales_invoice.grand_total", + "fetch_from": "sales_invoice.outstanding_amount", + "fetch_if_empty": 1, "fieldname": "outstanding_amount", "fieldtype": "Currency", "in_list_view": 1, "label": "Outstanding Amount", - "options": "Company:company:default_currency", - "read_only": 1 + "options": "Company:company:default_currency" }, { "fieldname": "column_break_3", @@ -60,7 +60,7 @@ } ], "istable": 1, - "modified": "2019-08-07 15:13:55.808349", + "modified": "2019-09-26 11:05:36.016772", "modified_by": "Administrator", "module": "Accounts", "name": "Discounted Invoice", diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.js b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.js index f1f88a8d649..0fab8b70f43 100644 --- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.js +++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.js @@ -97,7 +97,6 @@ frappe.ui.form.on('Invoice Discounting', { } frm.set_value("total_amount", total_amount); }, - get_invoices: (frm) => { var d = new frappe.ui.Dialog({ title: __('Get Invoices based on Filters'), diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py index 36c29113eaa..39fc203d53f 100644 --- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py @@ -26,14 +26,20 @@ class InvoiceDiscounting(AccountsController): frappe.throw(_("Loan Start Date and Loan Period are mandatory to save the Invoice Discounting")) def validate_invoices(self): - discounted_invoices = [record.sales_invoice for record in - frappe.get_all("Discounted Invoice",fields = ["sales_invoice"], filters= {"docstatus":1})] + discounted_invoices = [record.sales_invoice for record in + frappe.get_all("Discounted Invoice",fields=["sales_invoice"], filters={"docstatus":1})] for record in self.invoices: if record.sales_invoice in discounted_invoices: - frappe.throw("Row({0}): {1} is already discounted in {2}" + frappe.throw(_("Row({0}): {1} is already discounted in {2}") .format(record.idx, frappe.bold(record.sales_invoice), frappe.bold(record.parent))) + actual_outstanding = frappe.db.get_value("Sales Invoice", record.sales_invoice,"outstanding_amount") + if record.outstanding_amount > actual_outstanding : + frappe.throw(_ + ("Row({0}): Outstanding Amount cannot be greater than actual Outstanding Amount {1} in {2}").format( + record.idx, frappe.bold(actual_outstanding), frappe.bold(record.sales_invoice))) + def calculate_total_amount(self): self.total_amount = sum([flt(d.outstanding_amount) for d in self.invoices]) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index eb75d0d2846..e25942ca34d 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -827,10 +827,10 @@ def get_opening_accounts(company): accounts = frappe.db.sql_list("""select name from tabAccount where - is_group=0 and report_type='Balance Sheet' and company=%s and - name not in(select distinct account from tabWarehouse where + is_group=0 and report_type='Balance Sheet' and company={0} and + name not in (select distinct account from tabWarehouse where account is not null and account != '') - order by name asc""", frappe.db.escape(company)) + order by name asc""".format(frappe.db.escape(company))) return [{"account": a, "balance": get_balance_on(a)} for a in accounts] diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 73c4bc14c31..6fe18115c04 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -1,1349 +1,1352 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-05-21 16:16:39", - "doctype": "DocType", - "document_type": "Document", - "field_order": [ - "title", - "naming_series", - "supplier", - "supplier_name", - "tax_id", - "due_date", - "is_paid", - "is_return", - "apply_tds", - "column_break1", - "company", - "posting_date", - "posting_time", - "set_posting_time", - "amended_from", - "accounting_dimensions_section", - "cost_center", - "dimension_col_break", - "sb_14", - "on_hold", - "release_date", - "cb_17", - "hold_comment", - "supplier_invoice_details", - "bill_no", - "column_break_15", - "bill_date", - "returns", - "return_against", - "section_addresses", - "supplier_address", - "address_display", - "contact_person", - "contact_display", - "contact_mobile", - "contact_email", - "col_break_address", - "shipping_address", - "shipping_address_display", - "currency_and_price_list", - "currency", - "conversion_rate", - "column_break2", - "buying_price_list", - "price_list_currency", - "plc_conversion_rate", - "ignore_pricing_rule", - "sec_warehouse", - "set_warehouse", - "rejected_warehouse", - "col_break_warehouse", - "is_subcontracted", - "supplier_warehouse", - "items_section", - "update_stock", - "scan_barcode", - "items", - "pricing_rule_details", - "pricing_rules", - "raw_materials_supplied", - "supplied_items", - "section_break_26", - "total_qty", - "base_total", - "base_net_total", - "column_break_28", - "total", - "net_total", - "total_net_weight", - "taxes_section", - "tax_category", - "column_break_49", - "shipping_rule", - "section_break_51", - "taxes_and_charges", - "taxes", - "sec_tax_breakup", - "other_charges_calculation", - "totals", - "base_taxes_and_charges_added", - "base_taxes_and_charges_deducted", - "base_total_taxes_and_charges", - "column_break_40", - "taxes_and_charges_added", - "taxes_and_charges_deducted", - "total_taxes_and_charges", - "section_break_44", - "apply_discount_on", - "base_discount_amount", - "column_break_46", - "additional_discount_percentage", - "discount_amount", - "section_break_49", - "base_grand_total", - "base_rounding_adjustment", - "base_rounded_total", - "base_in_words", - "column_break8", - "grand_total", - "rounding_adjustment", - "rounded_total", - "in_words", - "total_advance", - "outstanding_amount", - "disable_rounded_total", - "payments_section", - "mode_of_payment", - "cash_bank_account", - "clearance_date", - "col_br_payments", - "paid_amount", - "base_paid_amount", - "write_off", - "write_off_amount", - "base_write_off_amount", - "column_break_61", - "write_off_account", - "write_off_cost_center", - "advances_section", - "allocate_advances_automatically", - "get_advances", - "advances", - "payment_schedule_section", - "payment_terms_template", - "payment_schedule", - "terms_section_break", - "tc_name", - "terms", - "printing_settings", - "letter_head", - "group_same_items", - "column_break_112", - "select_print_heading", - "language", - "more_info", - "credit_to", - "party_account_currency", - "is_opening", - "against_expense_account", - "column_break_63", - "status", - "inter_company_invoice_reference", - "remarks", - "subscription_section", - "from_date", - "to_date", - "column_break_114", - "auto_repeat", - "update_auto_repeat_reference" - ], - "fields": [ - { - "allow_on_submit": 1, - "default": "{supplier_name}", - "fieldname": "title", - "fieldtype": "Data", - "hidden": 1, - "label": "Title", - "no_copy": 1, - "print_hide": 1 - }, - { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "ACC-PINV-.YYYY.-", - "print_hide": 1, - "reqd": 1, - "set_only_once": 1 - }, - { - "fieldname": "supplier", - "fieldtype": "Link", - "in_standard_filter": 1, - "label": "Supplier", - "oldfieldname": "supplier", - "oldfieldtype": "Link", - "options": "Supplier", - "print_hide": 1, - "search_index": 1 - }, - { - "bold": 1, - "depends_on": "supplier", - "fetch_from": "supplier.supplier_name", - "fieldname": "supplier_name", - "fieldtype": "Data", - "in_global_search": 1, - "label": "Supplier Name", - "oldfieldname": "supplier_name", - "oldfieldtype": "Data", - "read_only": 1 - }, - { - "fetch_from": "supplier.tax_id", - "fieldname": "tax_id", - "fieldtype": "Read Only", - "label": "Tax Id", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "due_date", - "fieldtype": "Date", - "label": "Due Date", - "oldfieldname": "due_date", - "oldfieldtype": "Date" - }, - { - "default": "0", - "fieldname": "is_paid", - "fieldtype": "Check", - "label": "Is Paid", - "print_hide": 1 - }, - { - "default": "0", - "fieldname": "is_return", - "fieldtype": "Check", - "label": "Is Return (Debit Note)", - "no_copy": 1, - "print_hide": 1 - }, - { - "default": "0", - "fieldname": "apply_tds", - "fieldtype": "Check", - "label": "Apply Tax Withholding Amount", - "print_hide": 1 - }, - { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "width": "50%" - }, - { - "fieldname": "company", - "fieldtype": "Link", - "in_standard_filter": 1, - "label": "Company", - "options": "Company", - "print_hide": 1, - "remember_last_selected_value": 1 - }, - { - "fieldname": "cost_center", - "fieldtype": "Link", - "label": "Cost Center", - "options": "Cost Center" - }, - { - "default": "Today", - "fieldname": "posting_date", - "fieldtype": "Date", - "in_list_view": 1, - "label": "Date", - "oldfieldname": "posting_date", - "oldfieldtype": "Date", - "print_hide": 1, - "reqd": 1, - "search_index": 1 - }, - { - "fieldname": "posting_time", - "fieldtype": "Time", - "label": "Posting Time", - "no_copy": 1, - "print_hide": 1, - "print_width": "100px", - "width": "100px" - }, - { - "default": "0", - "depends_on": "eval:doc.docstatus==0", - "fieldname": "set_posting_time", - "fieldtype": "Check", - "label": "Edit Posting Date and Time", - "print_hide": 1 - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Link", - "options": "Purchase Invoice", - "print_hide": 1, - "read_only": 1 - }, - { - "collapsible": 1, - "collapsible_depends_on": "eval:doc.on_hold", - "fieldname": "sb_14", - "fieldtype": "Section Break", - "label": "Hold Invoice" - }, - { - "default": "0", - "fieldname": "on_hold", - "fieldtype": "Check", - "label": "Hold Invoice" - }, - { - "depends_on": "eval:doc.on_hold", - "description": "Once set, this invoice will be on hold till the set date", - "fieldname": "release_date", - "fieldtype": "Date", - "label": "Release Date" - }, - { - "fieldname": "cb_17", - "fieldtype": "Column Break" - }, - { - "depends_on": "eval:doc.on_hold", - "fieldname": "hold_comment", - "fieldtype": "Small Text", - "label": "Reason For Putting On Hold" - }, - { - "collapsible": 1, - "collapsible_depends_on": "bill_no", - "fieldname": "supplier_invoice_details", - "fieldtype": "Section Break", - "label": "Supplier Invoice Details" - }, - { - "fieldname": "bill_no", - "fieldtype": "Data", - "label": "Supplier Invoice No", - "oldfieldname": "bill_no", - "oldfieldtype": "Data", - "print_hide": 1 - }, - { - "fieldname": "column_break_15", - "fieldtype": "Column Break" - }, - { - "fieldname": "bill_date", - "fieldtype": "Date", - "label": "Supplier Invoice Date", - "oldfieldname": "bill_date", - "oldfieldtype": "Date", - "print_hide": 1 - }, - { - "depends_on": "return_against", - "fieldname": "returns", - "fieldtype": "Section Break", - "label": "Returns" - }, - { - "depends_on": "return_against", - "fieldname": "return_against", - "fieldtype": "Link", - "label": "Return Against Purchase Invoice", - "no_copy": 1, - "options": "Purchase Invoice", - "print_hide": 1, - "read_only": 1 - }, - { - "collapsible": 1, - "fieldname": "section_addresses", - "fieldtype": "Section Break", - "label": "Address and Contact" - }, - { - "fieldname": "supplier_address", - "fieldtype": "Link", - "label": "Select Supplier Address", - "options": "Address", - "print_hide": 1 - }, - { - "fieldname": "address_display", - "fieldtype": "Small Text", - "label": "Address", - "read_only": 1 - }, - { - "fieldname": "contact_person", - "fieldtype": "Link", - "in_global_search": 1, - "label": "Contact Person", - "options": "Contact", - "print_hide": 1 - }, - { - "fieldname": "contact_display", - "fieldtype": "Small Text", - "label": "Contact", - "read_only": 1 - }, - { - "fieldname": "contact_mobile", - "fieldtype": "Small Text", - "label": "Mobile No", - "read_only": 1 - }, - { - "fieldname": "contact_email", - "fieldtype": "Small Text", - "label": "Contact Email", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "col_break_address", - "fieldtype": "Column Break" - }, - { - "fieldname": "shipping_address", - "fieldtype": "Link", - "label": "Select Shipping Address", - "options": "Address", - "print_hide": 1 - }, - { - "fieldname": "shipping_address_display", - "fieldtype": "Small Text", - "label": "Shipping Address", - "print_hide": 1, - "read_only": 1 - }, - { - "collapsible": 1, - "fieldname": "currency_and_price_list", - "fieldtype": "Section Break", - "label": "Currency and Price List", - "options": "fa fa-tag" - }, - { - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "oldfieldname": "currency", - "oldfieldtype": "Select", - "options": "Currency", - "print_hide": 1 - }, - { - "fieldname": "conversion_rate", - "fieldtype": "Float", - "label": "Exchange Rate", - "oldfieldname": "conversion_rate", - "oldfieldtype": "Currency", - "precision": "9", - "print_hide": 1 - }, - { - "fieldname": "column_break2", - "fieldtype": "Column Break" - }, - { - "fieldname": "buying_price_list", - "fieldtype": "Link", - "label": "Price List", - "options": "Price List", - "print_hide": 1 - }, - { - "fieldname": "price_list_currency", - "fieldtype": "Link", - "label": "Price List Currency", - "options": "Currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "plc_conversion_rate", - "fieldtype": "Float", - "label": "Price List Exchange Rate", - "precision": "9", - "print_hide": 1 - }, - { - "default": "0", - "fieldname": "ignore_pricing_rule", - "fieldtype": "Check", - "label": "Ignore Pricing Rule", - "no_copy": 1, - "permlevel": 1, - "print_hide": 1 - }, - { - "fieldname": "sec_warehouse", - "fieldtype": "Section Break" - }, - { - "depends_on": "update_stock", - "fieldname": "set_warehouse", - "fieldtype": "Link", - "label": "Set Accepted Warehouse", - "options": "Warehouse", - "print_hide": 1 - }, - { - "depends_on": "update_stock", - "description": "Warehouse where you are maintaining stock of rejected items", - "fieldname": "rejected_warehouse", - "fieldtype": "Link", - "label": "Rejected Warehouse", - "no_copy": 1, - "options": "Warehouse", - "print_hide": 1 - }, - { - "fieldname": "col_break_warehouse", - "fieldtype": "Column Break" - }, - { - "default": "No", - "fieldname": "is_subcontracted", - "fieldtype": "Select", - "label": "Raw Materials Supplied", - "options": "No\nYes", - "print_hide": 1 - }, - { - "depends_on": "eval:doc.is_subcontracted==\"Yes\"", - "fieldname": "supplier_warehouse", - "fieldtype": "Link", - "label": "Supplier Warehouse", - "no_copy": 1, - "options": "Warehouse", - "print_hide": 1, - "print_width": "50px", - "width": "50px" - }, - { - "fieldname": "items_section", - "fieldtype": "Section Break", - "oldfieldtype": "Section Break", - "options": "fa fa-shopping-cart" - }, - { - "default": "0", - "fieldname": "update_stock", - "fieldtype": "Check", - "label": "Update Stock", - "print_hide": 1 - }, - { - "fieldname": "scan_barcode", - "fieldtype": "Data", - "label": "Scan Barcode" - }, - { - "allow_bulk_edit": 1, - "fieldname": "items", - "fieldtype": "Table", - "label": "Items", - "oldfieldname": "entries", - "oldfieldtype": "Table", - "options": "Purchase Invoice Item", - "reqd": 1 - }, - { - "fieldname": "pricing_rule_details", - "fieldtype": "Section Break", - "label": "Pricing Rules" - }, - { - "fieldname": "pricing_rules", - "fieldtype": "Table", - "label": "Pricing Rule Detail", - "options": "Pricing Rule Detail", - "read_only": 1 - }, - { - "collapsible_depends_on": "supplied_items", - "fieldname": "raw_materials_supplied", - "fieldtype": "Section Break", - "label": "Raw Materials Supplied" - }, - { - "fieldname": "supplied_items", - "fieldtype": "Table", - "label": "Supplied Items", - "options": "Purchase Receipt Item Supplied", - "read_only": 1 - }, - { - "fieldname": "section_break_26", - "fieldtype": "Section Break" - }, - { - "fieldname": "total_qty", - "fieldtype": "Float", - "label": "Total Quantity", - "read_only": 1 - }, - { - "fieldname": "base_total", - "fieldtype": "Currency", - "label": "Total (Company Currency)", - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "base_net_total", - "fieldtype": "Currency", - "label": "Net Total (Company Currency)", - "oldfieldname": "net_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break_28", - "fieldtype": "Column Break" - }, - { - "fieldname": "total", - "fieldtype": "Currency", - "label": "Total", - "options": "currency", - "read_only": 1 - }, - { - "fieldname": "net_total", - "fieldtype": "Currency", - "label": "Net Total", - "oldfieldname": "net_total_import", - "oldfieldtype": "Currency", - "options": "currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "total_net_weight", - "fieldtype": "Float", - "label": "Total Net Weight", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "taxes_section", - "fieldtype": "Section Break", - "oldfieldtype": "Section Break", - "options": "fa fa-money" - }, - { - "fieldname": "tax_category", - "fieldtype": "Link", - "label": "Tax Category", - "options": "Tax Category", - "print_hide": 1 - }, - { - "fieldname": "column_break_49", - "fieldtype": "Column Break" - }, - { - "fieldname": "shipping_rule", - "fieldtype": "Link", - "label": "Shipping Rule", - "options": "Shipping Rule", - "print_hide": 1 - }, - { - "fieldname": "section_break_51", - "fieldtype": "Section Break" - }, - { - "fieldname": "taxes_and_charges", - "fieldtype": "Link", - "label": "Purchase Taxes and Charges Template", - "oldfieldname": "purchase_other_charges", - "oldfieldtype": "Link", - "options": "Purchase Taxes and Charges Template", - "print_hide": 1 - }, - { - "fieldname": "taxes", - "fieldtype": "Table", - "label": "Purchase Taxes and Charges", - "oldfieldname": "purchase_tax_details", - "oldfieldtype": "Table", - "options": "Purchase Taxes and Charges" - }, - { - "collapsible": 1, - "fieldname": "sec_tax_breakup", - "fieldtype": "Section Break", - "label": "Tax Breakup" - }, - { - "fieldname": "other_charges_calculation", - "fieldtype": "Text", - "label": "Taxes and Charges Calculation", - "no_copy": 1, - "oldfieldtype": "HTML", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "totals", - "fieldtype": "Section Break", - "oldfieldtype": "Section Break", - "options": "fa fa-money" - }, - { - "fieldname": "base_taxes_and_charges_added", - "fieldtype": "Currency", - "label": "Taxes and Charges Added (Company Currency)", - "oldfieldname": "other_charges_added", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "base_taxes_and_charges_deducted", - "fieldtype": "Currency", - "label": "Taxes and Charges Deducted (Company Currency)", - "oldfieldname": "other_charges_deducted", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "base_total_taxes_and_charges", - "fieldtype": "Currency", - "label": "Total Taxes and Charges (Company Currency)", - "oldfieldname": "total_tax", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break_40", - "fieldtype": "Column Break" - }, - { - "fieldname": "taxes_and_charges_added", - "fieldtype": "Currency", - "label": "Taxes and Charges Added", - "oldfieldname": "other_charges_added_import", - "oldfieldtype": "Currency", - "options": "currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "taxes_and_charges_deducted", - "fieldtype": "Currency", - "label": "Taxes and Charges Deducted", - "oldfieldname": "other_charges_deducted_import", - "oldfieldtype": "Currency", - "options": "currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "total_taxes_and_charges", - "fieldtype": "Currency", - "label": "Total Taxes and Charges", - "options": "currency", - "print_hide": 1, - "read_only": 1 - }, - { - "collapsible": 1, - "collapsible_depends_on": "discount_amount", - "fieldname": "section_break_44", - "fieldtype": "Section Break", - "label": "Additional Discount" - }, - { - "default": "Grand Total", - "fieldname": "apply_discount_on", - "fieldtype": "Select", - "label": "Apply Additional Discount On", - "options": "\nGrand Total\nNet Total", - "print_hide": 1 - }, - { - "fieldname": "base_discount_amount", - "fieldtype": "Currency", - "label": "Additional Discount Amount (Company Currency)", - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break_46", - "fieldtype": "Column Break" - }, - { - "fieldname": "additional_discount_percentage", - "fieldtype": "Float", - "label": "Additional Discount Percentage", - "print_hide": 1 - }, - { - "fieldname": "discount_amount", - "fieldtype": "Currency", - "label": "Additional Discount Amount", - "options": "currency", - "print_hide": 1 - }, - { - "fieldname": "section_break_49", - "fieldtype": "Section Break" - }, - { - "fieldname": "base_grand_total", - "fieldtype": "Currency", - "label": "Grand Total (Company Currency)", - "oldfieldname": "grand_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "base_rounding_adjustment", - "fieldtype": "Currency", - "label": "Rounding Adjustment (Company Currency)", - "no_copy": 1, - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "depends_on": "eval:!doc.disable_rounded_total", - "fieldname": "base_rounded_total", - "fieldtype": "Currency", - "label": "Rounded Total (Company Currency)", - "no_copy": 1, - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "base_in_words", - "fieldtype": "Data", - "label": "In Words (Company Currency)", - "oldfieldname": "in_words", - "oldfieldtype": "Data", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break8", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "print_hide": 1, - "width": "50%" - }, - { - "fieldname": "grand_total", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Grand Total", - "oldfieldname": "grand_total_import", - "oldfieldtype": "Currency", - "options": "currency", - "read_only": 1 - }, - { - "fieldname": "rounding_adjustment", - "fieldtype": "Currency", - "label": "Rounding Adjustment", - "no_copy": 1, - "options": "currency", - "print_hide": 1, - "read_only": 1 - }, - { - "depends_on": "eval:!doc.disable_rounded_total", - "fieldname": "rounded_total", - "fieldtype": "Currency", - "label": "Rounded Total", - "no_copy": 1, - "options": "currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "in_words", - "fieldtype": "Data", - "label": "In Words", - "oldfieldname": "in_words_import", - "oldfieldtype": "Data", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "total_advance", - "fieldtype": "Currency", - "label": "Total Advance", - "no_copy": 1, - "oldfieldname": "total_advance", - "oldfieldtype": "Currency", - "options": "party_account_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "outstanding_amount", - "fieldtype": "Currency", - "label": "Outstanding Amount", - "no_copy": 1, - "oldfieldname": "outstanding_amount", - "oldfieldtype": "Currency", - "options": "party_account_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "default": "0", - "depends_on": "grand_total", - "fieldname": "disable_rounded_total", - "fieldtype": "Check", - "label": "Disable Rounded Total" - }, - { - "collapsible": 1, - "collapsible_depends_on": "paid_amount", - "depends_on": "eval:doc.is_paid===1||(doc.advances && doc.advances.length>0)", - "fieldname": "payments_section", - "fieldtype": "Section Break", - "label": "Payments" - }, - { - "fieldname": "mode_of_payment", - "fieldtype": "Link", - "label": "Mode of Payment", - "options": "Mode of Payment", - "print_hide": 1 - }, - { - "fieldname": "cash_bank_account", - "fieldtype": "Link", - "label": "Cash/Bank Account", - "options": "Account" - }, - { - "fieldname": "clearance_date", - "fieldtype": "Date", - "hidden": 1, - "label": "Clearance Date" - }, - { - "fieldname": "col_br_payments", - "fieldtype": "Column Break" - }, - { - "depends_on": "is_paid", - "fieldname": "paid_amount", - "fieldtype": "Currency", - "label": "Paid Amount", - "no_copy": 1, - "options": "currency", - "print_hide": 1 - }, - { - "fieldname": "base_paid_amount", - "fieldtype": "Currency", - "label": "Paid Amount (Company Currency)", - "no_copy": 1, - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "collapsible": 1, - "collapsible_depends_on": "write_off_amount", - "depends_on": "grand_total", - "fieldname": "write_off", - "fieldtype": "Section Break", - "label": "Write Off" - }, - { - "fieldname": "write_off_amount", - "fieldtype": "Currency", - "label": "Write Off Amount", - "no_copy": 1, - "options": "currency", - "print_hide": 1 - }, - { - "fieldname": "base_write_off_amount", - "fieldtype": "Currency", - "label": "Write Off Amount (Company Currency)", - "no_copy": 1, - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break_61", - "fieldtype": "Column Break" - }, - { - "depends_on": "eval:flt(doc.write_off_amount)!=0", - "fieldname": "write_off_account", - "fieldtype": "Link", - "label": "Write Off Account", - "options": "Account", - "print_hide": 1 - }, - { - "depends_on": "eval:flt(doc.write_off_amount)!=0", - "fieldname": "write_off_cost_center", - "fieldtype": "Link", - "label": "Write Off Cost Center", - "options": "Cost Center", - "print_hide": 1 - }, - { - "collapsible": 1, - "collapsible_depends_on": "advances", - "fieldname": "advances_section", - "fieldtype": "Section Break", - "label": "Advance Payments", - "oldfieldtype": "Section Break", - "options": "fa fa-money", - "print_hide": 1 - }, - { - "default": "0", - "fieldname": "allocate_advances_automatically", - "fieldtype": "Check", - "label": "Set Advances and Allocate (FIFO)" - }, - { - "depends_on": "eval:!doc.allocate_advances_automatically", - "fieldname": "get_advances", - "fieldtype": "Button", - "label": "Get Advances Paid", - "oldfieldtype": "Button", - "print_hide": 1 - }, - { - "fieldname": "advances", - "fieldtype": "Table", - "label": "Advances", - "no_copy": 1, - "oldfieldname": "advance_allocation_details", - "oldfieldtype": "Table", - "options": "Purchase Invoice Advance", - "print_hide": 1 - }, - { - "collapsible": 1, - "collapsible_depends_on": "eval:(!doc.is_return)", - "fieldname": "payment_schedule_section", - "fieldtype": "Section Break", - "label": "Payment Terms" - }, - { - "fieldname": "payment_terms_template", - "fieldtype": "Link", - "label": "Payment Terms Template", - "options": "Payment Terms Template" - }, - { - "fieldname": "payment_schedule", - "fieldtype": "Table", - "label": "Payment Schedule", - "no_copy": 1, - "options": "Payment Schedule", - "print_hide": 1 - }, - { - "collapsible": 1, - "collapsible_depends_on": "terms", - "fieldname": "terms_section_break", - "fieldtype": "Section Break", - "label": "Terms and Conditions", - "options": "fa fa-legal" - }, - { - "fieldname": "tc_name", - "fieldtype": "Link", - "label": "Terms", - "options": "Terms and Conditions", - "print_hide": 1 - }, - { - "fieldname": "terms", - "fieldtype": "Text Editor", - "label": "Terms and Conditions1" - }, - { - "collapsible": 1, - "fieldname": "printing_settings", - "fieldtype": "Section Break", - "label": "Printing Settings" - }, - { - "allow_on_submit": 1, - "fieldname": "letter_head", - "fieldtype": "Link", - "label": "Letter Head", - "options": "Letter Head", - "print_hide": 1 - }, - { - "allow_on_submit": 1, - "default": "0", - "fieldname": "group_same_items", - "fieldtype": "Check", - "label": "Group same items", - "print_hide": 1 - }, - { - "fieldname": "column_break_112", - "fieldtype": "Column Break" - }, - { - "allow_on_submit": 1, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "label": "Print Heading", - "no_copy": 1, - "oldfieldname": "select_print_heading", - "oldfieldtype": "Link", - "options": "Print Heading", - "print_hide": 1, - "report_hide": 1 - }, - { - "fieldname": "language", - "fieldtype": "Data", - "label": "Print Language", - "read_only": 1 - }, - { - "collapsible": 1, - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Information", - "oldfieldtype": "Section Break", - "options": "fa fa-file-text", - "print_hide": 1 - }, - { - "fieldname": "credit_to", - "fieldtype": "Link", - "label": "Credit To", - "oldfieldname": "credit_to", - "oldfieldtype": "Link", - "options": "Account", - "print_hide": 1, - "reqd": 1, - "search_index": 1 - }, - { - "fieldname": "party_account_currency", - "fieldtype": "Link", - "hidden": 1, - "label": "Party Account Currency", - "no_copy": 1, - "options": "Currency", - "print_hide": 1, - "read_only": 1 - }, - { - "default": "No", - "fieldname": "is_opening", - "fieldtype": "Select", - "label": "Is Opening", - "oldfieldname": "is_opening", - "oldfieldtype": "Select", - "options": "No\nYes", - "print_hide": 1 - }, - { - "fieldname": "against_expense_account", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Against Expense Account", - "no_copy": 1, - "oldfieldname": "against_expense_account", - "oldfieldtype": "Small Text", - "print_hide": 1 - }, - { - "fieldname": "column_break_63", - "fieldtype": "Column Break" - }, - { - "default": "Draft", - "fieldname": "status", - "fieldtype": "Select", - "in_standard_filter": 1, - "label": "Status", - "options": "\nDraft\nReturn\nDebit Note Issued\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled" - }, - { - "fieldname": "inter_company_invoice_reference", - "fieldtype": "Link", - "label": "Inter Company Invoice Reference", - "options": "Sales Invoice", - "read_only": 1 - }, - { - "fieldname": "remarks", - "fieldtype": "Small Text", - "label": "Remarks", - "no_copy": 1, - "oldfieldname": "remarks", - "oldfieldtype": "Text", - "print_hide": 1 - }, - { - "fieldname": "subscription_section", - "fieldtype": "Section Break", - "label": "Subscription Section", - "print_hide": 1 - }, - { - "allow_on_submit": 1, - "description": "Start date of current invoice's period", - "fieldname": "from_date", - "fieldtype": "Date", - "label": "From Date", - "no_copy": 1, - "print_hide": 1 - }, - { - "allow_on_submit": 1, - "description": "End date of current invoice's period", - "fieldname": "to_date", - "fieldtype": "Date", - "label": "To Date", - "no_copy": 1, - "print_hide": 1 - }, - { - "fieldname": "column_break_114", - "fieldtype": "Column Break" - }, - { - "fieldname": "auto_repeat", - "fieldtype": "Link", - "label": "Auto Repeat", - "no_copy": 1, - "options": "Auto Repeat", - "print_hide": 1, - "read_only": 1 - }, - { - "allow_on_submit": 1, - "depends_on": "eval: doc.auto_repeat", - "fieldname": "update_auto_repeat_reference", - "fieldtype": "Button", - "label": "Update Auto Repeat Reference" - }, - { - "collapsible": 1, - "fieldname": "accounting_dimensions_section", - "fieldtype": "Section Break", - "label": "Accounting Dimensions " - }, - { - "fieldname": "dimension_col_break", - "fieldtype": "Column Break" - } - ], - "icon": "fa fa-file-text", - "idx": 204, - "is_submittable": 1, - "modified": "2019-06-18 22:04:28.889159", - "modified_by": "Administrator", - "module": "Accounts", - "name": "Purchase Invoice", - "name_case": "Title Case", - "owner": "Administrator", - "permissions": [ - { - "amend": 1, - "cancel": 1, - "create": 1, - "email": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts User", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "email": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase User" - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "email": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Auditor" - }, - { - "permlevel": 1, - "read": 1, - "role": "Accounts Manager", - "write": 1 - } - ], - "search_fields": "posting_date, supplier, bill_no, base_grand_total, outstanding_amount", - "show_name_in_global_search": 1, - "sort_field": "modified", - "sort_order": "DESC", - "timeline_field": "supplier", - "title_field": "title", - "track_changes": 1 - } \ No newline at end of file + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-05-21 16:16:39", + "doctype": "DocType", + "document_type": "Document", + "engine": "InnoDB", + "field_order": [ + "title", + "naming_series", + "supplier", + "supplier_name", + "tax_id", + "due_date", + "is_paid", + "is_return", + "apply_tds", + "column_break1", + "company", + "posting_date", + "posting_time", + "set_posting_time", + "amended_from", + "accounting_dimensions_section", + "cost_center", + "dimension_col_break", + "sb_14", + "on_hold", + "release_date", + "cb_17", + "hold_comment", + "supplier_invoice_details", + "bill_no", + "column_break_15", + "bill_date", + "returns", + "return_against", + "section_addresses", + "supplier_address", + "address_display", + "contact_person", + "contact_display", + "contact_mobile", + "contact_email", + "col_break_address", + "shipping_address", + "shipping_address_display", + "currency_and_price_list", + "currency", + "conversion_rate", + "column_break2", + "buying_price_list", + "price_list_currency", + "plc_conversion_rate", + "ignore_pricing_rule", + "sec_warehouse", + "set_warehouse", + "rejected_warehouse", + "col_break_warehouse", + "is_subcontracted", + "supplier_warehouse", + "items_section", + "update_stock", + "scan_barcode", + "items", + "pricing_rule_details", + "pricing_rules", + "raw_materials_supplied", + "supplied_items", + "section_break_26", + "total_qty", + "base_total", + "base_net_total", + "column_break_28", + "total", + "net_total", + "total_net_weight", + "taxes_section", + "tax_category", + "column_break_49", + "shipping_rule", + "section_break_51", + "taxes_and_charges", + "taxes", + "sec_tax_breakup", + "other_charges_calculation", + "totals", + "base_taxes_and_charges_added", + "base_taxes_and_charges_deducted", + "base_total_taxes_and_charges", + "column_break_40", + "taxes_and_charges_added", + "taxes_and_charges_deducted", + "total_taxes_and_charges", + "section_break_44", + "apply_discount_on", + "base_discount_amount", + "column_break_46", + "additional_discount_percentage", + "discount_amount", + "section_break_49", + "base_grand_total", + "base_rounding_adjustment", + "base_rounded_total", + "base_in_words", + "column_break8", + "grand_total", + "rounding_adjustment", + "rounded_total", + "in_words", + "total_advance", + "outstanding_amount", + "disable_rounded_total", + "payments_section", + "mode_of_payment", + "cash_bank_account", + "clearance_date", + "col_br_payments", + "paid_amount", + "base_paid_amount", + "write_off", + "write_off_amount", + "base_write_off_amount", + "column_break_61", + "write_off_account", + "write_off_cost_center", + "advances_section", + "allocate_advances_automatically", + "get_advances", + "advances", + "payment_schedule_section", + "payment_terms_template", + "payment_schedule", + "terms_section_break", + "tc_name", + "terms", + "printing_settings", + "letter_head", + "group_same_items", + "column_break_112", + "select_print_heading", + "language", + "more_info", + "credit_to", + "party_account_currency", + "is_opening", + "against_expense_account", + "column_break_63", + "status", + "inter_company_invoice_reference", + "remarks", + "subscription_section", + "from_date", + "to_date", + "column_break_114", + "auto_repeat", + "update_auto_repeat_reference" + ], + "fields": [ + { + "allow_on_submit": 1, + "default": "{supplier_name}", + "fieldname": "title", + "fieldtype": "Data", + "hidden": 1, + "label": "Title", + "no_copy": 1, + "print_hide": 1 + }, + { + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "ACC-PINV-.YYYY.-", + "print_hide": 1, + "reqd": 1, + "set_only_once": 1 + }, + { + "fieldname": "supplier", + "fieldtype": "Link", + "in_standard_filter": 1, + "label": "Supplier", + "oldfieldname": "supplier", + "oldfieldtype": "Link", + "options": "Supplier", + "print_hide": 1, + "search_index": 1 + }, + { + "bold": 1, + "depends_on": "supplier", + "fetch_from": "supplier.supplier_name", + "fieldname": "supplier_name", + "fieldtype": "Data", + "in_global_search": 1, + "label": "Supplier Name", + "oldfieldname": "supplier_name", + "oldfieldtype": "Data", + "read_only": 1 + }, + { + "fetch_from": "supplier.tax_id", + "fieldname": "tax_id", + "fieldtype": "Read Only", + "label": "Tax Id", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "due_date", + "fieldtype": "Date", + "label": "Due Date", + "oldfieldname": "due_date", + "oldfieldtype": "Date" + }, + { + "default": "0", + "fieldname": "is_paid", + "fieldtype": "Check", + "label": "Is Paid", + "print_hide": 1 + }, + { + "default": "0", + "fieldname": "is_return", + "fieldtype": "Check", + "label": "Is Return (Debit Note)", + "no_copy": 1, + "print_hide": 1 + }, + { + "default": "0", + "fieldname": "apply_tds", + "fieldtype": "Check", + "label": "Apply Tax Withholding Amount", + "print_hide": 1 + }, + { + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "width": "50%" + }, + { + "fieldname": "company", + "fieldtype": "Link", + "in_standard_filter": 1, + "label": "Company", + "options": "Company", + "print_hide": 1, + "remember_last_selected_value": 1 + }, + { + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "options": "Cost Center" + }, + { + "default": "Today", + "fieldname": "posting_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Date", + "oldfieldname": "posting_date", + "oldfieldtype": "Date", + "print_hide": 1, + "reqd": 1, + "search_index": 1 + }, + { + "fieldname": "posting_time", + "fieldtype": "Time", + "label": "Posting Time", + "no_copy": 1, + "print_hide": 1, + "print_width": "100px", + "width": "100px" + }, + { + "default": "0", + "depends_on": "eval:doc.docstatus==0", + "fieldname": "set_posting_time", + "fieldtype": "Check", + "label": "Edit Posting Date and Time", + "print_hide": 1 + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Link", + "options": "Purchase Invoice", + "print_hide": 1, + "read_only": 1 + }, + { + "collapsible": 1, + "collapsible_depends_on": "eval:doc.on_hold", + "fieldname": "sb_14", + "fieldtype": "Section Break", + "label": "Hold Invoice" + }, + { + "default": "0", + "fieldname": "on_hold", + "fieldtype": "Check", + "label": "Hold Invoice" + }, + { + "depends_on": "eval:doc.on_hold", + "description": "Once set, this invoice will be on hold till the set date", + "fieldname": "release_date", + "fieldtype": "Date", + "label": "Release Date" + }, + { + "fieldname": "cb_17", + "fieldtype": "Column Break" + }, + { + "depends_on": "eval:doc.on_hold", + "fieldname": "hold_comment", + "fieldtype": "Small Text", + "label": "Reason For Putting On Hold" + }, + { + "collapsible": 1, + "collapsible_depends_on": "bill_no", + "fieldname": "supplier_invoice_details", + "fieldtype": "Section Break", + "label": "Supplier Invoice Details" + }, + { + "fieldname": "bill_no", + "fieldtype": "Data", + "label": "Supplier Invoice No", + "oldfieldname": "bill_no", + "oldfieldtype": "Data", + "print_hide": 1 + }, + { + "fieldname": "column_break_15", + "fieldtype": "Column Break" + }, + { + "fieldname": "bill_date", + "fieldtype": "Date", + "label": "Supplier Invoice Date", + "oldfieldname": "bill_date", + "oldfieldtype": "Date", + "print_hide": 1 + }, + { + "depends_on": "return_against", + "fieldname": "returns", + "fieldtype": "Section Break", + "label": "Returns" + }, + { + "depends_on": "return_against", + "fieldname": "return_against", + "fieldtype": "Link", + "label": "Return Against Purchase Invoice", + "no_copy": 1, + "options": "Purchase Invoice", + "print_hide": 1, + "read_only": 1 + }, + { + "collapsible": 1, + "fieldname": "section_addresses", + "fieldtype": "Section Break", + "label": "Address and Contact" + }, + { + "fieldname": "supplier_address", + "fieldtype": "Link", + "label": "Select Supplier Address", + "options": "Address", + "print_hide": 1 + }, + { + "fieldname": "address_display", + "fieldtype": "Small Text", + "label": "Address", + "read_only": 1 + }, + { + "fieldname": "contact_person", + "fieldtype": "Link", + "in_global_search": 1, + "label": "Contact Person", + "options": "Contact", + "print_hide": 1 + }, + { + "fieldname": "contact_display", + "fieldtype": "Small Text", + "label": "Contact", + "read_only": 1 + }, + { + "fieldname": "contact_mobile", + "fieldtype": "Small Text", + "label": "Mobile No", + "read_only": 1 + }, + { + "fieldname": "contact_email", + "fieldtype": "Small Text", + "label": "Contact Email", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "col_break_address", + "fieldtype": "Column Break" + }, + { + "fieldname": "shipping_address", + "fieldtype": "Link", + "label": "Select Shipping Address", + "options": "Address", + "print_hide": 1 + }, + { + "fieldname": "shipping_address_display", + "fieldtype": "Small Text", + "label": "Shipping Address", + "print_hide": 1, + "read_only": 1 + }, + { + "collapsible": 1, + "fieldname": "currency_and_price_list", + "fieldtype": "Section Break", + "label": "Currency and Price List", + "options": "fa fa-tag" + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "oldfieldname": "currency", + "oldfieldtype": "Select", + "options": "Currency", + "print_hide": 1 + }, + { + "fieldname": "conversion_rate", + "fieldtype": "Float", + "label": "Exchange Rate", + "oldfieldname": "conversion_rate", + "oldfieldtype": "Currency", + "precision": "9", + "print_hide": 1 + }, + { + "fieldname": "column_break2", + "fieldtype": "Column Break" + }, + { + "fieldname": "buying_price_list", + "fieldtype": "Link", + "label": "Price List", + "options": "Price List", + "print_hide": 1 + }, + { + "fieldname": "price_list_currency", + "fieldtype": "Link", + "label": "Price List Currency", + "options": "Currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "plc_conversion_rate", + "fieldtype": "Float", + "label": "Price List Exchange Rate", + "precision": "9", + "print_hide": 1 + }, + { + "default": "0", + "fieldname": "ignore_pricing_rule", + "fieldtype": "Check", + "label": "Ignore Pricing Rule", + "no_copy": 1, + "permlevel": 1, + "print_hide": 1 + }, + { + "fieldname": "sec_warehouse", + "fieldtype": "Section Break" + }, + { + "depends_on": "update_stock", + "fieldname": "set_warehouse", + "fieldtype": "Link", + "label": "Set Accepted Warehouse", + "options": "Warehouse", + "print_hide": 1 + }, + { + "depends_on": "update_stock", + "description": "Warehouse where you are maintaining stock of rejected items", + "fieldname": "rejected_warehouse", + "fieldtype": "Link", + "label": "Rejected Warehouse", + "no_copy": 1, + "options": "Warehouse", + "print_hide": 1 + }, + { + "fieldname": "col_break_warehouse", + "fieldtype": "Column Break" + }, + { + "default": "No", + "fieldname": "is_subcontracted", + "fieldtype": "Select", + "label": "Raw Materials Supplied", + "options": "No\nYes", + "print_hide": 1 + }, + { + "depends_on": "eval:doc.is_subcontracted==\"Yes\"", + "fieldname": "supplier_warehouse", + "fieldtype": "Link", + "label": "Supplier Warehouse", + "no_copy": 1, + "options": "Warehouse", + "print_hide": 1, + "print_width": "50px", + "width": "50px" + }, + { + "fieldname": "items_section", + "fieldtype": "Section Break", + "oldfieldtype": "Section Break", + "options": "fa fa-shopping-cart" + }, + { + "default": "0", + "fieldname": "update_stock", + "fieldtype": "Check", + "label": "Update Stock", + "print_hide": 1 + }, + { + "fieldname": "scan_barcode", + "fieldtype": "Data", + "label": "Scan Barcode" + }, + { + "allow_bulk_edit": 1, + "fieldname": "items", + "fieldtype": "Table", + "label": "Items", + "oldfieldname": "entries", + "oldfieldtype": "Table", + "options": "Purchase Invoice Item", + "reqd": 1 + }, + { + "fieldname": "pricing_rule_details", + "fieldtype": "Section Break", + "label": "Pricing Rules" + }, + { + "fieldname": "pricing_rules", + "fieldtype": "Table", + "label": "Pricing Rule Detail", + "options": "Pricing Rule Detail", + "read_only": 1 + }, + { + "collapsible_depends_on": "supplied_items", + "fieldname": "raw_materials_supplied", + "fieldtype": "Section Break", + "label": "Raw Materials Supplied" + }, + { + "fieldname": "supplied_items", + "fieldtype": "Table", + "label": "Supplied Items", + "options": "Purchase Receipt Item Supplied", + "read_only": 1 + }, + { + "fieldname": "section_break_26", + "fieldtype": "Section Break" + }, + { + "fieldname": "total_qty", + "fieldtype": "Float", + "label": "Total Quantity", + "read_only": 1 + }, + { + "fieldname": "base_total", + "fieldtype": "Currency", + "label": "Total (Company Currency)", + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "base_net_total", + "fieldtype": "Currency", + "label": "Net Total (Company Currency)", + "oldfieldname": "net_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_28", + "fieldtype": "Column Break" + }, + { + "fieldname": "total", + "fieldtype": "Currency", + "label": "Total", + "options": "currency", + "read_only": 1 + }, + { + "fieldname": "net_total", + "fieldtype": "Currency", + "label": "Net Total", + "oldfieldname": "net_total_import", + "oldfieldtype": "Currency", + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "total_net_weight", + "fieldtype": "Float", + "label": "Total Net Weight", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "taxes_section", + "fieldtype": "Section Break", + "oldfieldtype": "Section Break", + "options": "fa fa-money" + }, + { + "fieldname": "tax_category", + "fieldtype": "Link", + "label": "Tax Category", + "options": "Tax Category", + "print_hide": 1 + }, + { + "fieldname": "column_break_49", + "fieldtype": "Column Break" + }, + { + "fieldname": "shipping_rule", + "fieldtype": "Link", + "label": "Shipping Rule", + "options": "Shipping Rule", + "print_hide": 1 + }, + { + "fieldname": "section_break_51", + "fieldtype": "Section Break" + }, + { + "fieldname": "taxes_and_charges", + "fieldtype": "Link", + "label": "Purchase Taxes and Charges Template", + "oldfieldname": "purchase_other_charges", + "oldfieldtype": "Link", + "options": "Purchase Taxes and Charges Template", + "print_hide": 1 + }, + { + "fieldname": "taxes", + "fieldtype": "Table", + "label": "Purchase Taxes and Charges", + "oldfieldname": "purchase_tax_details", + "oldfieldtype": "Table", + "options": "Purchase Taxes and Charges" + }, + { + "collapsible": 1, + "fieldname": "sec_tax_breakup", + "fieldtype": "Section Break", + "label": "Tax Breakup" + }, + { + "fieldname": "other_charges_calculation", + "fieldtype": "Text", + "label": "Taxes and Charges Calculation", + "no_copy": 1, + "oldfieldtype": "HTML", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "totals", + "fieldtype": "Section Break", + "oldfieldtype": "Section Break", + "options": "fa fa-money" + }, + { + "fieldname": "base_taxes_and_charges_added", + "fieldtype": "Currency", + "label": "Taxes and Charges Added (Company Currency)", + "oldfieldname": "other_charges_added", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "base_taxes_and_charges_deducted", + "fieldtype": "Currency", + "label": "Taxes and Charges Deducted (Company Currency)", + "oldfieldname": "other_charges_deducted", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "base_total_taxes_and_charges", + "fieldtype": "Currency", + "label": "Total Taxes and Charges (Company Currency)", + "oldfieldname": "total_tax", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_40", + "fieldtype": "Column Break" + }, + { + "fieldname": "taxes_and_charges_added", + "fieldtype": "Currency", + "label": "Taxes and Charges Added", + "oldfieldname": "other_charges_added_import", + "oldfieldtype": "Currency", + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "taxes_and_charges_deducted", + "fieldtype": "Currency", + "label": "Taxes and Charges Deducted", + "oldfieldname": "other_charges_deducted_import", + "oldfieldtype": "Currency", + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "total_taxes_and_charges", + "fieldtype": "Currency", + "label": "Total Taxes and Charges", + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, + { + "collapsible": 1, + "collapsible_depends_on": "discount_amount", + "fieldname": "section_break_44", + "fieldtype": "Section Break", + "label": "Additional Discount" + }, + { + "default": "Grand Total", + "fieldname": "apply_discount_on", + "fieldtype": "Select", + "label": "Apply Additional Discount On", + "options": "\nGrand Total\nNet Total", + "print_hide": 1 + }, + { + "fieldname": "base_discount_amount", + "fieldtype": "Currency", + "label": "Additional Discount Amount (Company Currency)", + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_46", + "fieldtype": "Column Break" + }, + { + "fieldname": "additional_discount_percentage", + "fieldtype": "Float", + "label": "Additional Discount Percentage", + "print_hide": 1 + }, + { + "fieldname": "discount_amount", + "fieldtype": "Currency", + "label": "Additional Discount Amount", + "options": "currency", + "print_hide": 1 + }, + { + "fieldname": "section_break_49", + "fieldtype": "Section Break" + }, + { + "fieldname": "base_grand_total", + "fieldtype": "Currency", + "label": "Grand Total (Company Currency)", + "oldfieldname": "grand_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "base_rounding_adjustment", + "fieldtype": "Currency", + "label": "Rounding Adjustment (Company Currency)", + "no_copy": 1, + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "depends_on": "eval:!doc.disable_rounded_total", + "fieldname": "base_rounded_total", + "fieldtype": "Currency", + "label": "Rounded Total (Company Currency)", + "no_copy": 1, + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "base_in_words", + "fieldtype": "Data", + "label": "In Words (Company Currency)", + "oldfieldname": "in_words", + "oldfieldtype": "Data", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break8", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "print_hide": 1, + "width": "50%" + }, + { + "fieldname": "grand_total", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Grand Total", + "oldfieldname": "grand_total_import", + "oldfieldtype": "Currency", + "options": "currency", + "read_only": 1 + }, + { + "fieldname": "rounding_adjustment", + "fieldtype": "Currency", + "label": "Rounding Adjustment", + "no_copy": 1, + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, + { + "depends_on": "eval:!doc.disable_rounded_total", + "fieldname": "rounded_total", + "fieldtype": "Currency", + "label": "Rounded Total", + "no_copy": 1, + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "in_words", + "fieldtype": "Data", + "label": "In Words", + "oldfieldname": "in_words_import", + "oldfieldtype": "Data", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "total_advance", + "fieldtype": "Currency", + "label": "Total Advance", + "no_copy": 1, + "oldfieldname": "total_advance", + "oldfieldtype": "Currency", + "options": "party_account_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "outstanding_amount", + "fieldtype": "Currency", + "label": "Outstanding Amount", + "no_copy": 1, + "oldfieldname": "outstanding_amount", + "oldfieldtype": "Currency", + "options": "party_account_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "default": "0", + "depends_on": "grand_total", + "fieldname": "disable_rounded_total", + "fieldtype": "Check", + "label": "Disable Rounded Total" + }, + { + "collapsible": 1, + "collapsible_depends_on": "paid_amount", + "depends_on": "eval:doc.is_paid===1||(doc.advances && doc.advances.length>0)", + "fieldname": "payments_section", + "fieldtype": "Section Break", + "label": "Payments" + }, + { + "fieldname": "mode_of_payment", + "fieldtype": "Link", + "label": "Mode of Payment", + "options": "Mode of Payment", + "print_hide": 1 + }, + { + "fieldname": "cash_bank_account", + "fieldtype": "Link", + "label": "Cash/Bank Account", + "options": "Account" + }, + { + "fieldname": "clearance_date", + "fieldtype": "Date", + "hidden": 1, + "label": "Clearance Date" + }, + { + "fieldname": "col_br_payments", + "fieldtype": "Column Break" + }, + { + "depends_on": "is_paid", + "fieldname": "paid_amount", + "fieldtype": "Currency", + "label": "Paid Amount", + "no_copy": 1, + "options": "currency", + "print_hide": 1 + }, + { + "fieldname": "base_paid_amount", + "fieldtype": "Currency", + "label": "Paid Amount (Company Currency)", + "no_copy": 1, + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "collapsible": 1, + "collapsible_depends_on": "write_off_amount", + "depends_on": "grand_total", + "fieldname": "write_off", + "fieldtype": "Section Break", + "label": "Write Off" + }, + { + "fieldname": "write_off_amount", + "fieldtype": "Currency", + "label": "Write Off Amount", + "no_copy": 1, + "options": "currency", + "print_hide": 1 + }, + { + "fieldname": "base_write_off_amount", + "fieldtype": "Currency", + "label": "Write Off Amount (Company Currency)", + "no_copy": 1, + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_61", + "fieldtype": "Column Break" + }, + { + "depends_on": "eval:flt(doc.write_off_amount)!=0", + "fieldname": "write_off_account", + "fieldtype": "Link", + "label": "Write Off Account", + "options": "Account", + "print_hide": 1 + }, + { + "depends_on": "eval:flt(doc.write_off_amount)!=0", + "fieldname": "write_off_cost_center", + "fieldtype": "Link", + "label": "Write Off Cost Center", + "options": "Cost Center", + "print_hide": 1 + }, + { + "collapsible": 1, + "collapsible_depends_on": "advances", + "fieldname": "advances_section", + "fieldtype": "Section Break", + "label": "Advance Payments", + "oldfieldtype": "Section Break", + "options": "fa fa-money", + "print_hide": 1 + }, + { + "default": "0", + "fieldname": "allocate_advances_automatically", + "fieldtype": "Check", + "label": "Set Advances and Allocate (FIFO)" + }, + { + "depends_on": "eval:!doc.allocate_advances_automatically", + "fieldname": "get_advances", + "fieldtype": "Button", + "label": "Get Advances Paid", + "oldfieldtype": "Button", + "print_hide": 1 + }, + { + "fieldname": "advances", + "fieldtype": "Table", + "label": "Advances", + "no_copy": 1, + "oldfieldname": "advance_allocation_details", + "oldfieldtype": "Table", + "options": "Purchase Invoice Advance", + "print_hide": 1 + }, + { + "collapsible": 1, + "collapsible_depends_on": "eval:(!doc.is_return)", + "fieldname": "payment_schedule_section", + "fieldtype": "Section Break", + "label": "Payment Terms" + }, + { + "fieldname": "payment_terms_template", + "fieldtype": "Link", + "label": "Payment Terms Template", + "options": "Payment Terms Template" + }, + { + "fieldname": "payment_schedule", + "fieldtype": "Table", + "label": "Payment Schedule", + "no_copy": 1, + "options": "Payment Schedule", + "print_hide": 1 + }, + { + "collapsible": 1, + "collapsible_depends_on": "terms", + "fieldname": "terms_section_break", + "fieldtype": "Section Break", + "label": "Terms and Conditions", + "options": "fa fa-legal" + }, + { + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms", + "options": "Terms and Conditions", + "print_hide": 1 + }, + { + "fieldname": "terms", + "fieldtype": "Text Editor", + "label": "Terms and Conditions1" + }, + { + "collapsible": 1, + "fieldname": "printing_settings", + "fieldtype": "Section Break", + "label": "Printing Settings" + }, + { + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "options": "Letter Head", + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "default": "0", + "fieldname": "group_same_items", + "fieldtype": "Check", + "label": "Group same items", + "print_hide": 1 + }, + { + "fieldname": "column_break_112", + "fieldtype": "Column Break" + }, + { + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "label": "Print Heading", + "no_copy": 1, + "oldfieldname": "select_print_heading", + "oldfieldtype": "Link", + "options": "Print Heading", + "print_hide": 1, + "report_hide": 1 + }, + { + "fieldname": "language", + "fieldtype": "Data", + "label": "Print Language", + "print_hide": 1, + "read_only": 1 + }, + { + "collapsible": 1, + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Information", + "oldfieldtype": "Section Break", + "options": "fa fa-file-text", + "print_hide": 1 + }, + { + "fieldname": "credit_to", + "fieldtype": "Link", + "label": "Credit To", + "oldfieldname": "credit_to", + "oldfieldtype": "Link", + "options": "Account", + "print_hide": 1, + "reqd": 1, + "search_index": 1 + }, + { + "fieldname": "party_account_currency", + "fieldtype": "Link", + "hidden": 1, + "label": "Party Account Currency", + "no_copy": 1, + "options": "Currency", + "print_hide": 1, + "read_only": 1 + }, + { + "default": "No", + "fieldname": "is_opening", + "fieldtype": "Select", + "label": "Is Opening", + "oldfieldname": "is_opening", + "oldfieldtype": "Select", + "options": "No\nYes", + "print_hide": 1 + }, + { + "fieldname": "against_expense_account", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Against Expense Account", + "no_copy": 1, + "oldfieldname": "against_expense_account", + "oldfieldtype": "Small Text", + "print_hide": 1 + }, + { + "fieldname": "column_break_63", + "fieldtype": "Column Break" + }, + { + "default": "Draft", + "fieldname": "status", + "fieldtype": "Select", + "in_standard_filter": 1, + "label": "Status", + "options": "\nDraft\nReturn\nDebit Note Issued\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled", + "print_hide": 1 + }, + { + "fieldname": "inter_company_invoice_reference", + "fieldtype": "Link", + "label": "Inter Company Invoice Reference", + "options": "Sales Invoice", + "read_only": 1 + }, + { + "fieldname": "remarks", + "fieldtype": "Small Text", + "label": "Remarks", + "no_copy": 1, + "oldfieldname": "remarks", + "oldfieldtype": "Text", + "print_hide": 1 + }, + { + "fieldname": "subscription_section", + "fieldtype": "Section Break", + "label": "Subscription Section", + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "description": "Start date of current invoice's period", + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "no_copy": 1, + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "description": "End date of current invoice's period", + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To Date", + "no_copy": 1, + "print_hide": 1 + }, + { + "fieldname": "column_break_114", + "fieldtype": "Column Break" + }, + { + "fieldname": "auto_repeat", + "fieldtype": "Link", + "label": "Auto Repeat", + "no_copy": 1, + "options": "Auto Repeat", + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval: doc.auto_repeat", + "fieldname": "update_auto_repeat_reference", + "fieldtype": "Button", + "label": "Update Auto Repeat Reference" + }, + { + "collapsible": 1, + "fieldname": "accounting_dimensions_section", + "fieldtype": "Section Break", + "label": "Accounting Dimensions " + }, + { + "fieldname": "dimension_col_break", + "fieldtype": "Column Break" + } + ], + "icon": "fa fa-file-text", + "idx": 204, + "is_submittable": 1, + "modified": "2019-09-17 22:31:42.666601", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Purchase Invoice", + "name_case": "Title Case", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "cancel": 1, + "create": 1, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User" + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Auditor" + }, + { + "permlevel": 1, + "read": 1, + "role": "Accounts Manager", + "write": 1 + } + ], + "search_fields": "posting_date, supplier, bill_no, base_grand_total, outstanding_amount", + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "DESC", + "timeline_field": "supplier", + "title_field": "title", + "track_changes": 1 +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index bc2ddffbcf3..bc9c1783ef2 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -364,7 +364,7 @@ class PurchaseInvoice(BuyingController): update_outstanding = "No" if (cint(self.is_paid) or self.write_off_account) else "Yes" make_gl_entries(gl_entries, cancel=(self.docstatus == 2), - update_outstanding=update_outstanding, merge_entries=False) + update_outstanding=update_outstanding, merge_entries=False, from_repost=from_repost) if update_outstanding == "No": update_outstanding_amt(self.credit_to, "Supplier", self.supplier, diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json index 0923a5b6172..3a19bb1b6bf 100644 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -591,7 +591,6 @@ "oldfieldname": "purchase_order", "oldfieldtype": "Link", "options": "Purchase Order", - "print_hide": 1, "read_only": 1, "search_index": 1 }, @@ -607,6 +606,7 @@ "fieldname": "include_exploded_items", "fieldtype": "Check", "label": "Include Exploded Items", + "print_hide": 1, "read_only": 1 }, { @@ -758,7 +758,7 @@ ], "idx": 1, "istable": 1, - "modified": "2019-06-02 06:36:17.078419", + "modified": "2019-09-17 22:32:05.984240", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice Item", diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index 261363c4937..7d4fc639554 100755 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -238,7 +238,7 @@ def get_contacts(customers): customers = [frappe._dict({'name': customers})] for data in customers: - contact = frappe.db.sql(""" select email_id, phone from `tabContact` + contact = frappe.db.sql(""" select email_id, phone, mobile_no from `tabContact` where is_primary_contact=1 and name in (select parent from `tabDynamic Link` where link_doctype = 'Customer' and link_name = %s and parenttype = 'Contact')""", data.name, as_dict=1) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index abbac77783b..e1256a78d95 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -698,7 +698,7 @@ class SalesInvoice(SellingController): cint(self.redeem_loyalty_points)) else "Yes" make_gl_entries(gl_entries, cancel=(self.docstatus == 2), - update_outstanding=update_outstanding, merge_entries=False) + update_outstanding=update_outstanding, merge_entries=False, from_repost=from_repost) if update_outstanding == "No": from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index ff0c265a42d..8dc00f3f218 100755 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -817,6 +817,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ if(reg.test(data.name.toLowerCase()) || reg.test(data.customer_name.toLowerCase()) || (contact && reg.test(contact["phone"])) + || (contact && reg.test(contact["mobile_no"])) || (data.customer_group && reg.test(data.customer_group.toLowerCase()))){ return data; } @@ -833,6 +834,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ if(contact && !c['phone']) { c["phone"] = contact["phone"]; c["email_id"] = contact["email_id"]; + c["mobile_no"] = contact["mobile_no"]; } me.customers_mapper.push({ @@ -842,9 +844,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ customer_group: c.customer_group, territory: c.territory, phone: contact ? contact["phone"] : '', + mobile_no: contact ? contact["mobile_no"] : '', email_id: contact ? contact["email_id"] : '', searchtext: ['customer_name', 'customer_group', 'name', 'value', - 'label', 'email_id', 'phone'] + 'label', 'email_id', 'phone', 'mobile_no'] .map(key => c[key]).join(' ') .toLowerCase() }); diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 8cbf845863d..bcbd427186c 100755 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -59,7 +59,6 @@ class ReceivablePayableReport(object): self.invoices = set() def get_data(self): - t1 = now() self.get_gl_entries() self.voucher_balance = OrderedDict() self.init_voucher_balance() # invoiced, paid, credit_note, outstanding @@ -73,6 +72,9 @@ class ReceivablePayableReport(object): # fetch future payments against invoices self.get_future_payments() + # Get return entries + self.get_return_entries() + self.data = [] for gle in self.gl_entries: self.update_voucher_balance(gle) @@ -91,6 +93,7 @@ class ReceivablePayableReport(object): party = gle.party, posting_date = gle.posting_date, remarks = gle.remarks, + account_currency = gle.account_currency, invoiced = 0.0, paid = 0.0, credit_note = 0.0, @@ -106,7 +109,6 @@ class ReceivablePayableReport(object): # get the row where this balance needs to be updated # if its a payment, it will return the linked invoice or will be considered as advance row = self.get_voucher_balance(gle) - # gle_balance will be the total "debit - credit" for receivable type reports and # and vice-versa for payable type reports gle_balance = self.get_gle_balance(gle) @@ -131,7 +133,18 @@ class ReceivablePayableReport(object): if gle.against_voucher: # find invoice - voucher_balance = self.voucher_balance.get((gle.against_voucher_type, gle.against_voucher, gle.party)) + against_voucher = gle.against_voucher + + # If payment is made against credit note + # and credit note is made against a Sales Invoice + # then consider the payment against original sales invoice. + if gle.against_voucher_type in ('Sales Invoice', 'Purchase Invoice'): + if gle.against_voucher in self.return_entries: + return_against = self.return_entries.get(gle.against_voucher) + if return_against: + against_voucher = return_against + + voucher_balance = self.voucher_balance.get((gle.against_voucher_type, against_voucher, gle.party)) if not voucher_balance: # no invoice, this is an invoice / stand-alone payment / credit note @@ -258,7 +271,6 @@ class ReceivablePayableReport(object): # customer / supplier name party_details = self.get_party_details(row.party) row.update(party_details) - if self.filters.get(scrub(self.filters.party_type)): row.currency = row.account_currency else: @@ -423,6 +435,19 @@ class ReceivablePayableReport(object): if row.future_ref: row.future_ref = ', '.join(row.future_ref) + def get_return_entries(self): + doctype = "Sales Invoice" if self.party_type == "Customer" else "Purchase Invoice" + filters={ + 'is_return': 1, + 'docstatus': 1 + } + party_field = scrub(self.filters.party_type) + if self.filters.get(party_field): + filters.update({party_field: self.filters.get(party_field)}) + self.return_entries = frappe._dict( + frappe.get_all(doctype, filters, ['name', 'return_against'], as_list=1) + ) + def set_ageing(self, row): if self.filters.ageing_based_on == "Due Date": entry_date = row.due_date @@ -689,11 +714,11 @@ class ReceivablePayableReport(object): def get_chart_data(self): rows = [] for row in self.data: - rows.append( - { - 'values': [row.range1, row.range2, row.range3, row.range4, row.range5] - } - ) + values = [row.range1, row.range2, row.range3, row.range4, row.range5] + precision = cint(frappe.db.get_default("float_precision")) or 2 + rows.append({ + 'values': [flt(val, precision) for val in values] + }) self.chart = { "data": { diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py index 350e0819577..b90a7a9501b 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe -from frappe import _ +from frappe import _, scrub from frappe.utils import flt, cint from erpnext.accounts.party import get_partywise_advanced_payment_amount from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport @@ -40,7 +40,7 @@ class AccountsReceivableSummary(ReceivablePayableReport): row.party = party if self.party_naming_by == "Naming Series": - row.party_name = frappe.get_cached_value(self.party_type, party, [self.party_type + "_name"]) + row.party_name = frappe.get_cached_value(self.party_type, party, scrub(self.party_type) + "_name") row.update(party_dict) diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.json b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.json index 0490119ad47..557a62d8fea 100644 --- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.json +++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.json @@ -1,6 +1,7 @@ { - "add_total_row": 0, + "add_total_row": 1, "creation": "2018-08-21 11:32:30.874923", + "disable_prepared_report": 0, "disabled": 0, "docstatus": 0, "doctype": "Report", diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py index 8ca466e4b88..4ac0f656119 100644 --- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py @@ -70,7 +70,7 @@ def get_result(filters): rate = [i.tax_withholding_rate for i in tds_doc.rates if i.fiscal_year == gle_map[d][0].fiscal_year] - if rate and len(rate) > 0: + if rate and len(rate) > 0 and tds_deducted: rate = rate[0] if getdate(filters.from_date) <= gle_map[d][0].posting_date \ @@ -164,7 +164,7 @@ def get_columns(filters): { "label": _("TDS Rate %"), "fieldname": "tds_rate", - "fieldtype": "Float", + "fieldtype": "Percent", "width": 90 }, { diff --git a/erpnext/utilities/page/__init__.py b/erpnext/assets/report/fixed_asset_register/__init__.py similarity index 100% rename from erpnext/utilities/page/__init__.py rename to erpnext/assets/report/fixed_asset_register/__init__.py diff --git a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js new file mode 100644 index 00000000000..5e994b5c9cc --- /dev/null +++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js @@ -0,0 +1,30 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Fixed Asset Register"] = { + "filters": [ + { + fieldname:"company", + label: __("Company"), + fieldtype: "Link", + options: "Company", + default: frappe.defaults.get_user_default("Company"), + reqd: 1 + }, + { + fieldname:"status", + label: __("Status"), + fieldtype: "Select", + options: "In Store\nDisposed", + default: 'In Store', + reqd: 1 + }, + { + fieldname:"finance_book", + label: __("Finance Book"), + fieldtype: "Link", + options: "Finance Book" + }, + ] +}; diff --git a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.json b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.json new file mode 100644 index 00000000000..ae2aa542f54 --- /dev/null +++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.json @@ -0,0 +1,27 @@ +{ + "add_total_row": 0, + "creation": "2019-09-23 16:35:02.836134", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-09-23 16:35:02.836134", + "modified_by": "Administrator", + "module": "Assets", + "name": "Fixed Asset Register", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Asset", + "report_name": "Fixed Asset Register", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Quality Manager" + } + ] +} \ No newline at end of file diff --git a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py new file mode 100644 index 00000000000..eac0e2a0bfe --- /dev/null +++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py @@ -0,0 +1,172 @@ +# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + +def execute(filters=None): + filters = frappe._dict(filters or {}) + columns = get_columns(filters) + data = get_data(filters) + return columns, data + +def get_columns(filters): + return [ + { + "label": _("Asset Id"), + "fieldtype": "Link", + "fieldname": "asset_id", + "options": "Asset", + "width": 100 + }, + { + "label": _("Asset Name"), + "fieldtype": "Data", + "fieldname": "asset_name", + "width": 140 + }, + { + "label": _("Asset Category"), + "fieldtype": "Link", + "fieldname": "asset_category", + "options": "Asset Category", + "width": 100 + }, + { + "label": _("Status"), + "fieldtype": "Data", + "fieldname": "status", + "width": 90 + }, + { + "label": _("Cost Center"), + "fieldtype": "Link", + "fieldname": "cost_center", + "options": "Cost Center", + "width": 100 + }, + { + "label": _("Department"), + "fieldtype": "Link", + "fieldname": "department", + "options": "Department", + "width": 100 + }, + { + "label": _("Location"), + "fieldtype": "Link", + "fieldname": "location", + "options": "Location", + "width": 100 + }, + { + "label": _("Purchase Date"), + "fieldtype": "Date", + "fieldname": "purchase_date", + "width": 90 + }, + { + "label": _("Gross Purchase Amount"), + "fieldname": "gross_purchase_amount", + "options": "Currency", + "width": 90 + }, + { + "label": _("Vendor Name"), + "fieldtype": "Data", + "fieldname": "vendor_name", + "width": 100 + }, + { + "label": _("Available For Use Date"), + "fieldtype": "Date", + "fieldname": "available_for_use_date", + "width": 90 + }, + { + "label": _("Current Value"), + "fieldname": "current_value", + "options": "Currency", + "width": 90 + }, + ] + +def get_conditions(filters): + conditions = {'docstatus': 1} + status = filters.status + + if filters.company: + conditions["company"] = filters.company + + # In Store assets are those that are not sold or scrapped + operand = 'not in' + if status not in 'In Store': + operand = 'in' + + conditions['status'] = (operand, ['Sold', 'Scrapped']) + + return conditions + +def get_data(filters): + + data = [] + + conditions = get_conditions(filters) + current_value_map = get_finance_book_value_map(filters.finance_book) + pr_supplier_map = get_purchase_receipt_supplier_map() + pi_supplier_map = get_purchase_invoice_supplier_map() + + assets_record = frappe.db.get_all("Asset", + filters=conditions, + fields=["name", "asset_name", "department", "cost_center", "purchase_receipt", + "asset_category", "purchase_date", "gross_purchase_amount", "location", + "available_for_use_date", "status", "purchase_invoice"]) + + for asset in assets_record: + if current_value_map.get(asset.name) is not None: + row = { + "asset_id": asset.name, + "asset_name": asset.asset_name, + "status": asset.status, + "department": asset.department, + "cost_center": asset.cost_center, + "vendor_name": pr_supplier_map.get(asset.purchase_receipt) or pi_supplier_map.get(asset.purchase_invoice), + "gross_purchase_amount": asset.gross_purchase_amount, + "available_for_use_date": asset.available_for_use_date, + "location": asset.location, + "asset_category": asset.asset_category, + "purchase_date": asset.purchase_date, + "current_value": current_value_map.get(asset.name) + } + data.append(row) + + return data + +def get_finance_book_value_map(finance_book=''): + return frappe._dict(frappe.db.sql(''' Select + parent, value_after_depreciation + FROM `tabAsset Finance Book` + WHERE + parentfield='finance_books' + AND finance_book=%s''', (finance_book))) + +def get_purchase_receipt_supplier_map(): + return frappe._dict(frappe.db.sql(''' Select + pr.name, pr.supplier + FROM `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pri + WHERE + pri.parent = pr.name + AND pri.is_fixed_asset=1 + AND pr.docstatus=1 + AND pr.is_return=0''')) + +def get_purchase_invoice_supplier_map(): + return frappe._dict(frappe.db.sql(''' Select + pi.name, pi.supplier + FROM `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pii + WHERE + pii.parent = pi.name + AND pii.is_fixed_asset=1 + AND pi.docstatus=1 + AND pi.is_return=0''')) diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json index 05c4926fabb..66ad97ac09e 100644 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -267,6 +267,7 @@ "fieldtype": "Currency", "label": "Last Purchase Rate", "options": "currency", + "print_hide": 1, "read_only": 1 }, { @@ -561,7 +562,8 @@ "depends_on": "eval:parent.is_subcontracted == 'Yes'", "fieldname": "include_exploded_items", "fieldtype": "Check", - "label": "Include Exploded Items" + "label": "Include Exploded Items", + "print_hide": 1 }, { "fieldname": "section_break_56", @@ -701,7 +703,7 @@ ], "idx": 1, "istable": 1, - "modified": "2019-06-23 20:03:13.818917", + "modified": "2019-09-17 22:32:34.703923", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order Item", @@ -712,4 +714,4 @@ "sort_field": "modified", "sort_order": "DESC", "track_changes": 1 -} +} \ No newline at end of file diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json index 671c14b6d54..97aa9221e2f 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json @@ -1,1004 +1,316 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 1, - "allow_rename": 0, - "autoname": "naming_series:", - "beta": 0, - "creation": "2016-02-25 01:24:07.224790", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Document", - "editable_grid": 0, + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2016-02-25 01:24:07.224790", + "doctype": "DocType", + "document_type": "Document", + "engine": "InnoDB", + "field_order": [ + "naming_series", + "company", + "vendor", + "column_break1", + "transaction_date", + "suppliers_section", + "suppliers", + "get_suppliers_button", + "items_section", + "items", + "link_to_mrs", + "supplier_response_section", + "email_template", + "message_for_supplier", + "terms_section_break", + "tc_name", + "terms", + "printing_settings", + "select_print_heading", + "letter_head", + "more_info", + "status", + "fiscal_year", + "column_break3", + "amended_from" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "fieldname": "naming_series", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Series", - "length": 0, - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "PUR-RFQ-.YYYY.-", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 1, - "translatable": 0, - "unique": 0 - }, + "fieldname": "naming_series", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "PUR-RFQ-.YYYY.-", + "print_hide": 1, + "reqd": 1, + "set_only_once": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "", - "fieldname": "company", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Company", - "length": 0, - "no_copy": 0, - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 1, - "report_hide": 0, - "reqd": 1, - "search_index": 1, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "print_hide": 1, + "remember_last_selected_value": 1, + "reqd": 1, + "search_index": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "For individual supplier", - "fieldname": "vendor", - "fieldtype": "Link", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 1, - "label": "Supplier", - "length": 0, - "no_copy": 1, - "options": "Supplier", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "description": "For individual supplier", + "fieldname": "vendor", + "fieldtype": "Link", + "hidden": 1, + "in_standard_filter": 1, + "label": "Supplier", + "no_copy": 1, + "options": "Supplier", + "read_only": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break1", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "oldfieldtype": "Column Break", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": "50%", - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "print_width": "50%", "width": "50%" - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "transaction_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Date", - "length": 0, - "no_copy": 0, - "oldfieldname": "transaction_date", - "oldfieldtype": "Date", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 1, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "transaction_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Date", + "oldfieldname": "transaction_date", + "oldfieldtype": "Date", + "reqd": 1, + "search_index": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "suppliers_section", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "suppliers_section", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "suppliers", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Supplier Detail", - "length": 0, - "no_copy": 0, - "options": "Request for Quotation Supplier", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "suppliers", + "fieldtype": "Table", + "label": "Supplier Detail", + "options": "Request for Quotation Supplier", + "print_hide": 1, + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "get_suppliers_button", - "fieldtype": "Button", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Get Suppliers", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "get_suppliers_button", + "fieldtype": "Button", + "label": "Get Suppliers" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "items_section", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "fa fa-shopping-cart", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "items_section", + "fieldtype": "Section Break", + "oldfieldtype": "Section Break", + "options": "fa fa-shopping-cart" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "items", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Items", - "length": 0, - "no_copy": 0, - "oldfieldname": "po_details", - "oldfieldtype": "Table", - "options": "Request for Quotation Item", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "items", + "fieldtype": "Table", + "label": "Items", + "oldfieldname": "po_details", + "oldfieldtype": "Table", + "options": "Request for Quotation Item", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.docstatus===0 && (doc.items && doc.items.length)", - "fieldname": "link_to_mrs", - "fieldtype": "Button", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Link to material requests", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "depends_on": "eval:doc.docstatus===0 && (doc.items && doc.items.length)", + "fieldname": "link_to_mrs", + "fieldtype": "Button", + "label": "Link to Material Requests" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "supplier_response_section", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "supplier_response_section", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "email_template", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Email Template", - "length": 0, - "no_copy": 0, - "options": "Email Template", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "email_template", + "fieldtype": "Link", + "label": "Email Template", + "options": "Email Template", + "print_hide": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "message_for_supplier", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Message for Supplier", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "message_for_supplier", + "fieldtype": "Text Editor", + "in_list_view": 1, + "label": "Message for Supplier", + "print_hide": 1, + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "collapsible_depends_on": "terms", - "columns": 0, - "fieldname": "terms_section_break", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Terms and Conditions", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "fa fa-legal", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "collapsible": 1, + "collapsible_depends_on": "terms", + "fieldname": "terms_section_break", + "fieldtype": "Section Break", + "label": "Terms and Conditions", + "oldfieldtype": "Section Break", + "options": "fa fa-legal" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "tc_name", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Terms", - "length": 0, - "no_copy": 0, - "oldfieldname": "tc_name", - "oldfieldtype": "Link", - "options": "Terms and Conditions", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms", + "oldfieldname": "tc_name", + "oldfieldtype": "Link", + "options": "Terms and Conditions", + "print_hide": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "terms", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Terms and Conditions", - "length": 0, - "no_copy": 0, - "oldfieldname": "terms", - "oldfieldtype": "Text Editor", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "terms", + "fieldtype": "Text Editor", + "label": "Terms and Conditions", + "oldfieldname": "terms", + "oldfieldtype": "Text Editor" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "printing_settings", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Printing Settings", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "collapsible": 1, + "fieldname": "printing_settings", + "fieldtype": "Section Break", + "label": "Printing Settings" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Print Heading", - "length": 0, - "no_copy": 1, - "oldfieldname": "select_print_heading", - "oldfieldtype": "Link", - "options": "Print Heading", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 1, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "label": "Print Heading", + "no_copy": 1, + "oldfieldname": "select_print_heading", + "oldfieldtype": "Link", + "options": "Print Heading", + "print_hide": 1, + "report_hide": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "letter_head", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Letter Head", - "length": 0, - "no_copy": 0, - "oldfieldname": "letter_head", - "oldfieldtype": "Select", - "options": "Letter Head", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "oldfieldname": "letter_head", + "oldfieldtype": "Select", + "options": "Letter Head", + "print_hide": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "more_info", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "More Information", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "fa fa-file-text", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "collapsible": 1, + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Information", + "oldfieldtype": "Section Break", + "options": "fa fa-file-text" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "status", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Status", - "length": 0, - "no_copy": 1, - "oldfieldname": "status", - "oldfieldtype": "Select", - "options": "\nDraft\nSubmitted\nCancelled", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 1, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "status", + "fieldtype": "Select", + "label": "Status", + "no_copy": 1, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "\nDraft\nSubmitted\nCancelled", + "print_hide": 1, + "read_only": 1, + "reqd": 1, + "search_index": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "fiscal_year", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Fiscal Year", - "length": 0, - "no_copy": 0, - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 1, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "fiscal_year", + "fieldtype": "Link", + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", + "print_hide": 1, + "reqd": 1, + "search_index": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break3", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break3", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Amended From", - "length": 0, - "no_copy": 1, - "options": "Request for Quotation", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Request for Quotation", + "print_hide": 1, + "read_only": 1 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "fa fa-shopping-cart", - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 1, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2018-08-21 14:44:22.102552", - "modified_by": "Administrator", - "module": "Buying", - "name": "Request for Quotation", - "name_case": "", - "owner": "Administrator", + ], + "icon": "fa fa-shopping-cart", + "is_submittable": 1, + "modified": "2019-09-24 15:08:32.750661", + "modified_by": "Administrator", + "module": "Buying", + "name": "Request for Quotation", + "owner": "Administrator", "permissions": [ { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Manufacturing Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Manufacturing Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 0, - "create": 1, - "delete": 0, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase User", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "amend": 1, + "create": 1, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User", + "share": 1, "write": 1 - }, + }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Stock User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 - }, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock User" + }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 1, - "print": 0, - "read": 1, - "report": 0, - "role": "Purchase Manager", - "set_user_permissions": 0, - "share": 0, - "submit": 0, + "permlevel": 1, + "read": 1, + "role": "Purchase Manager", "write": 1 - }, + }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 1, - "print": 0, - "read": 1, - "report": 0, - "role": "All", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 + "permlevel": 1, + "read": 1, + "role": "All" } - ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 1, - "search_fields": "status, transaction_date", - "show_name_in_global_search": 1, - "sort_field": "modified", - "sort_order": "DESC", - "timeline_field": "", - "title_field": "", - "track_changes": 0, - "track_seen": 0, - "track_views": 0 + ], + "search_fields": "status, transaction_date", + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "DESC" } \ No newline at end of file diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 37548ea9b80..31a78c36257 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -143,7 +143,7 @@ class AccountsController(TransactionBase): if not self.cash_bank_account: # show message that the amount is not paid frappe.throw(_("Note: Payment Entry will not be created since 'Cash or Bank Account' was not specified")) - + if cint(self.is_return) and self.grand_total > self.paid_amount: self.paid_amount = flt(flt(self.grand_total), self.precision("paid_amount")) @@ -1195,8 +1195,10 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil child_item.rate = flt(d.get("rate")) if flt(child_item.price_list_rate): - child_item.discount_percentage = flt((1 - flt(child_item.rate) / flt(child_item.price_list_rate)) * 100.0, \ + discount = flt((1 - flt(child_item.rate) / flt(child_item.price_list_rate)) * 100.0, child_item.precision("discount_percentage")) + if discount > 0: + child_item.discount_percentage = discount child_item.flags.ignore_validate_update_after_submit = True if new_child_flag: @@ -1220,7 +1222,6 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil parent.update_status_updater() else: parent.check_credit_limit() - parent.save() if parent_doctype == 'Purchase Order': diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 084f84b1f9b..9d37df0406b 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -598,6 +598,7 @@ class BuyingController(StockController): 'item_code': d.item_code, 'via_stock_ledger': False, 'company': self.company, + 'supplier': self.supplier, 'actual_qty': d.qty, 'purchase_document_type': self.doctype, 'purchase_document_no': self.name, @@ -625,6 +626,7 @@ class BuyingController(StockController): 'asset_category': item_data.get('asset_category'), 'location': row.asset_location, 'company': self.company, + 'supplier': self.supplier, 'purchase_date': self.posting_date, 'calculate_depreciation': 1, 'purchase_receipt_amount': purchase_amount, diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index dee71dc9448..29f8dd57026 100644 --- a/erpnext/controllers/item_variant.py +++ b/erpnext/controllers/item_variant.py @@ -283,7 +283,7 @@ def copy_attributes_to_variant(item, variant): if 'description' not in allow_fields: if not variant.description: variant.description = "" - + else: if item.variant_based_on=='Item Attribute': if variant.attributes: attributes_description = item.description + " " @@ -291,7 +291,7 @@ def copy_attributes_to_variant(item, variant): attributes_description += "
" + d.attribute + ": " + cstr(d.attribute_value) + "
" if attributes_description not in variant.description: - variant.description += attributes_description + variant.description = attributes_description def make_variant_item_code(template_item_code, template_item_name, variant): """Uses template's item code and abbreviations to make variant's item code""" diff --git a/erpnext/crm/doctype/contract/contract.json b/erpnext/crm/doctype/contract/contract.json index d48cc3762c8..e04ad30ea72 100755 --- a/erpnext/crm/doctype/contract/contract.json +++ b/erpnext/crm/doctype/contract/contract.json @@ -1,1034 +1,301 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 1, - "allow_rename": 1, - "autoname": "", - "beta": 0, - "creation": "2018-04-12 06:32:04.582486", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", + "allow_import": 1, + "allow_rename": 1, + "creation": "2018-04-12 06:32:04.582486", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "party_type", + "is_signed", + "cb_party", + "party_name", + "party_user", + "status", + "fulfilment_status", + "sb_terms", + "start_date", + "cb_date", + "end_date", + "sb_signee", + "signee", + "signed_on", + "cb_user", + "ip_address", + "sb_contract", + "contract_template", + "contract_terms", + "sb_fulfilment", + "requires_fulfilment", + "fulfilment_deadline", + "fulfilment_terms", + "sb_references", + "document_type", + "cb_links", + "document_name", + "amended_from" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "Customer", - "fieldname": "party_type", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Party Type", - "length": 0, - "no_copy": 0, - "options": "Customer\nSupplier\nEmployee", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "Customer", + "fieldname": "party_type", + "fieldtype": "Select", + "label": "Party Type", + "options": "Customer\nSupplier\nEmployee", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "is_signed", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Signed", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "allow_on_submit": 1, + "default": "0", + "fieldname": "is_signed", + "fieldtype": "Check", + "label": "Signed", + "no_copy": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "cb_party", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "cb_party", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "party_name", - "fieldtype": "Dynamic Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 1, - "label": "Party Name", - "length": 0, - "no_copy": 0, - "options": "party_type", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "party_name", + "fieldtype": "Dynamic Link", + "in_standard_filter": 1, + "label": "Party Name", + "options": "party_type", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "party_user", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Party User", - "length": 0, - "no_copy": 0, - "options": "User", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "party_user", + "fieldtype": "Link", + "label": "Party User", + "options": "User" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "status", - "fieldtype": "Select", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Status", - "length": 0, - "no_copy": 0, - "options": "Unsigned\nActive\nInactive", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "allow_on_submit": 1, + "fieldname": "status", + "fieldtype": "Select", + "hidden": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Status", + "no_copy": 1, + "options": "Unsigned\nActive\nInactive" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "fulfilment_status", - "fieldtype": "Select", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Fulfilment Status", - "length": 0, - "no_copy": 0, - "options": "N/A\nUnfulfilled\nPartially Fulfilled\nFulfilled\nLapsed", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "allow_on_submit": 1, + "fieldname": "fulfilment_status", + "fieldtype": "Select", + "hidden": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Fulfilment Status", + "no_copy": 1, + "options": "N/A\nUnfulfilled\nPartially Fulfilled\nFulfilled\nLapsed" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "sb_terms", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Contract Period", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "sb_terms", + "fieldtype": "Section Break", + "label": "Contract Period" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "start_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Start Date", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "start_date", + "fieldtype": "Date", + "label": "Start Date" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "cb_date", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "cb_date", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "end_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "End Date", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "end_date", + "fieldtype": "Date", + "label": "End Date" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": "", - "columns": 0, - "depends_on": "eval:doc.is_signed==1", - "fieldname": "sb_signee", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Signee Details", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "depends_on": "eval:doc.is_signed==1", + "fieldname": "sb_signee", + "fieldtype": "Section Break", + "label": "Signee Details" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "signee", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Signee", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "allow_on_submit": 1, + "fieldname": "signee", + "fieldtype": "Data", + "in_global_search": 1, + "label": "Signee", + "no_copy": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "signed_on", - "fieldtype": "Datetime", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Signed On", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "allow_on_submit": 1, + "fieldname": "signed_on", + "fieldtype": "Datetime", + "in_list_view": 1, + "label": "Signed On", + "no_copy": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "cb_user", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "cb_user", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "ip_address", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "IP Address", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "allow_on_submit": 1, + "fieldname": "ip_address", + "fieldtype": "Data", + "label": "IP Address", + "no_copy": 1, + "read_only": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "collapsible_depends_on": "eval:doc.docstatus==0", - "columns": 0, - "fieldname": "sb_contract", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Contract Details", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "collapsible": 1, + "collapsible_depends_on": "eval:doc.docstatus==0", + "fieldname": "sb_contract", + "fieldtype": "Section Break", + "label": "Contract Details" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "contract_template", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Contract Template", - "length": 0, - "no_copy": 0, - "options": "Contract Template", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "contract_template", + "fieldtype": "Link", + "label": "Contract Template", + "options": "Contract Template" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "contract_terms", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Contract Terms", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "contract_terms", + "fieldtype": "Text Editor", + "in_list_view": 1, + "label": "Contract Terms", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "sb_fulfilment", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Fulfilment Details", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "sb_fulfilment", + "fieldtype": "Section Break", + "label": "Fulfilment Details" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "requires_fulfilment", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Requires Fulfilment", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "0", + "fieldname": "requires_fulfilment", + "fieldtype": "Check", + "label": "Requires Fulfilment" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.requires_fulfilment==1", - "fieldname": "fulfilment_deadline", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Fulfilment Deadline", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "depends_on": "eval:doc.requires_fulfilment==1", + "fieldname": "fulfilment_deadline", + "fieldtype": "Date", + "label": "Fulfilment Deadline" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.requires_fulfilment==1", - "fieldname": "fulfilment_terms", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Fulfilment Terms", - "length": 0, - "no_copy": 0, - "options": "Contract Fulfilment Checklist", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "allow_on_submit": 1, + "depends_on": "eval:doc.requires_fulfilment==1", + "fieldname": "fulfilment_terms", + "fieldtype": "Table", + "label": "Fulfilment Terms", + "options": "Contract Fulfilment Checklist" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "sb_references", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "References", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "collapsible": 1, + "fieldname": "sb_references", + "fieldtype": "Section Break", + "label": "References" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "depends_on": "", - "fieldname": "document_type", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Document Type", - "length": 0, - "no_copy": 0, - "options": "\nQuotation\nProject\nSales Order\nPurchase Order\nSales Invoice\nPurchase Invoice", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "document_type", + "fieldtype": "Select", + "label": "Document Type", + "options": "\nQuotation\nProject\nSales Order\nPurchase Order\nSales Invoice\nPurchase Invoice" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "cb_links", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "cb_links", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "document_name", - "fieldtype": "Dynamic Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Document Name", - "length": 0, - "no_copy": 0, - "options": "document_type", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "document_name", + "fieldtype": "Dynamic Link", + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Document Name", + "options": "document_type" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Amended From", - "length": 0, - "no_copy": 1, - "options": "Contract", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Contract", + "print_hide": 1, + "read_only": 1 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 1, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2018-06-14 12:47:10.142988", - "modified_by": "Administrator", - "module": "CRM", - "name": "Contract", - "name_case": "", - "owner": "Administrator", + ], + "is_submittable": 1, + "modified": "2019-09-30 00:56:41.559681", + "modified_by": "Administrator", + "module": "CRM", + "name": "Contract", + "owner": "Administrator", "permissions": [ { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "HR Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "submit": 1, "write": 1 } - ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 1, - "sort_field": "modified", - "sort_order": "DESC", - "title_field": "", - "track_changes": 1, + ], + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, "track_seen": 1 } \ No newline at end of file diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json index 37f492ede65..66e3ca48dd2 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.json +++ b/erpnext/crm/doctype/opportunity/opportunity.json @@ -1,5 +1,6 @@ { "allow_import": 1, + "allow_rename": 1, "autoname": "naming_series:", "creation": "2013-03-07 18:50:30", "description": "Potential Sales Deal", @@ -411,7 +412,7 @@ ], "icon": "fa fa-info-sign", "idx": 195, - "modified": "2019-09-12 09:37:30.127901", + "modified": "2019-09-30 12:58:37.385400", "modified_by": "Administrator", "module": "CRM", "name": "Opportunity", diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index 8f61edf00eb..33d90076c4a 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -53,7 +53,7 @@ class TestOpportunity(unittest.TestCase): "link_name": customer.name }] }) - contact.add_email(new_lead_email_id) + contact.add_email(new_lead_email_id, is_primary=True) contact.insert(ignore_permissions=True) opp_doc = frappe.get_doc(args).insert(ignore_permissions=True) diff --git a/erpnext/erpnext_integrations/connectors/shopify_connection.py b/erpnext/erpnext_integrations/connectors/shopify_connection.py index 1d6e8917f50..bd980374b6e 100644 --- a/erpnext/erpnext_integrations/connectors/shopify_connection.py +++ b/erpnext/erpnext_integrations/connectors/shopify_connection.py @@ -19,6 +19,7 @@ def store_request_data(order=None, event=None): dump_request_data(order, event) def sync_sales_order(order, request_id=None): + frappe.set_user('Administrator') shopify_settings = frappe.get_doc("Shopify Settings") frappe.flags.request_id = request_id @@ -33,6 +34,7 @@ def sync_sales_order(order, request_id=None): make_shopify_log(status="Success") def prepare_sales_invoice(order, request_id=None): + frappe.set_user('Administrator') shopify_settings = frappe.get_doc("Shopify Settings") frappe.flags.request_id = request_id @@ -45,6 +47,7 @@ def prepare_sales_invoice(order, request_id=None): make_shopify_log(status="Error", exception=True) def prepare_delivery_note(order, request_id=None): + frappe.set_user('Administrator') shopify_settings = frappe.get_doc("Shopify Settings") frappe.flags.request_id = request_id @@ -137,6 +140,7 @@ def create_sales_invoice(shopify_order, shopify_settings, so): si.naming_series = shopify_settings.sales_invoice_series or "SI-Shopify-" si.flags.ignore_mandatory = True set_cost_center(si.items, shopify_settings.cost_center) + si.insert(ignore_mandatory=True) si.submit() make_payament_entry_against_sales_invoice(si, shopify_settings) frappe.db.commit() @@ -151,6 +155,7 @@ def make_payament_entry_against_sales_invoice(doc, shopify_settings): payemnt_entry.flags.ignore_mandatory = True payemnt_entry.reference_no = doc.name payemnt_entry.reference_date = nowdate() + payemnt_entry.insert(ignore_permissions=True) payemnt_entry.submit() def create_delivery_note(shopify_order, shopify_settings, so): @@ -168,6 +173,7 @@ def create_delivery_note(shopify_order, shopify_settings, so): dn.items = get_fulfillment_items(dn.items, fulfillment.get("line_items"), shopify_settings) dn.flags.ignore_mandatory = True dn.save() + dn.submit() frappe.db.commit() def get_fulfillment_items(dn_items, fulfillment_items, shopify_settings): @@ -200,7 +206,7 @@ def get_order_items(order_items, shopify_settings): "rate": shopify_item.get("price"), "delivery_date": nowdate(), "qty": shopify_item.get("quantity"), - "stock_uom": shopify_item.get("sku"), + "stock_uom": shopify_item.get("uom") or _("Nos"), "warehouse": shopify_settings.warehouse }) else: diff --git a/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json b/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json index a7040f2f276..8f1b746e5b6 100644 --- a/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json +++ b/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json @@ -1,1258 +1,280 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2015-05-18 05:21:07.270859", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "System", - "editable_grid": 0, + "creation": "2015-05-18 05:21:07.270859", + "doctype": "DocType", + "document_type": "System", + "field_order": [ + "status_html", + "enable_shopify", + "app_type", + "column_break_4", + "last_sync_datetime", + "section_break_2", + "shopify_url", + "api_key", + "column_break_3", + "password", + "shared_secret", + "access_token", + "section_break_38", + "webhooks", + "section_break_15", + "default_customer", + "column_break_19", + "customer_group", + "company_dependent_settings", + "company", + "cash_bank_account", + "column_break_20", + "cost_center", + "erp_settings", + "price_list", + "update_price_in_erpnext_price_list", + "column_break_26", + "warehouse", + "section_break_25", + "sales_order_series", + "column_break_27", + "sync_delivery_note", + "delivery_note_series", + "sync_sales_invoice", + "sales_invoice_series", + "section_break_22", + "html_16", + "taxes" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "status_html", - "fieldtype": "HTML", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "status html", - "length": 0, - "no_copy": 0, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "status_html", + "fieldtype": "HTML", + "label": "status html", + "read_only": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "fieldname": "enable_shopify", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Enable Shopify", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "0", + "fieldname": "enable_shopify", + "fieldtype": "Check", + "label": "Enable Shopify" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "Public", - "fieldname": "app_type", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "App Type", - "length": 0, - "no_copy": 0, - "options": "Public\nPrivate", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "Private", + "fieldname": "app_type", + "fieldtype": "Data", + "in_list_view": 1, + "label": "App Type", + "read_only": 1, + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_4", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_4", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "last_sync_datetime", - "fieldtype": "Datetime", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Last Sync Datetime", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "last_sync_datetime", + "fieldtype": "Datetime", + "label": "Last Sync Datetime", + "read_only": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_2", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "section_break_2", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "eg: frappe.myshopify.com", - "fieldname": "shopify_url", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Shop URL", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "description": "eg: frappe.myshopify.com", + "fieldname": "shopify_url", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Shop URL", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.app_type==\"Private\"", - "fieldname": "api_key", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "API Key", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "depends_on": "eval:doc.app_type==\"Private\"", + "fieldname": "api_key", + "fieldtype": "Data", + "label": "API Key" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_3", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.app_type==\"Private\"", - "fieldname": "password", - "fieldtype": "Password", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Password", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "depends_on": "eval:doc.app_type==\"Private\"", + "fieldname": "password", + "fieldtype": "Password", + "label": "Password" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "shared_secret", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Shared secret", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "shared_secret", + "fieldtype": "Data", + "label": "Shared secret" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "access_token", - "fieldtype": "Data", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Access Token", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "access_token", + "fieldtype": "Data", + "hidden": 1, + "label": "Access Token", + "read_only": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "section_break_38", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Webhooks Details", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "collapsible": 1, + "fieldname": "section_break_38", + "fieldtype": "Section Break", + "label": "Webhooks Details" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "webhooks", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Webhooks", - "length": 0, - "no_copy": 0, - "options": "Shopify Webhook Detail", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "webhooks", + "fieldtype": "Table", + "label": "Webhooks", + "options": "Shopify Webhook Detail", + "read_only": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_15", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Customer Settings", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "section_break_15", + "fieldtype": "Section Break", + "label": "Customer Settings" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "If Shopify not contains a customer in Order, then while syncing Orders, the system will consider default customer for order", - "fieldname": "default_customer", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Customer", - "length": 0, - "no_copy": 0, - "options": "Customer", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "description": "If Shopify not contains a customer in Order, then while syncing Orders, the system will consider default customer for order", + "fieldname": "default_customer", + "fieldtype": "Link", + "label": "Default Customer", + "options": "Customer" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_19", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_19", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "description": "Customer Group will set to selected group while syncing customers from Shopify", - "fieldname": "customer_group", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Customer Group", - "length": 0, - "no_copy": 0, - "options": "Customer Group", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "description": "Customer Group will set to selected group while syncing customers from Shopify", + "fieldname": "customer_group", + "fieldtype": "Link", + "label": "Customer Group", + "options": "Customer Group" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "company_dependent_settings", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "company_dependent_settings", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "company", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "For Company", - "length": 0, - "no_copy": 0, - "options": "Company", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "company", + "fieldtype": "Link", + "label": "For Company", + "options": "Company" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "Cash Account will used for Sales Invoice creation", - "fieldname": "cash_bank_account", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Cash/Bank Account", - "length": 0, - "no_copy": 0, - "options": "Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "description": "Cash Account will used for Sales Invoice creation", + "fieldname": "cash_bank_account", + "fieldtype": "Link", + "label": "Cash/Bank Account", + "options": "Account" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_20", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_20", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "cost_center", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Cost Center", - "length": 0, - "no_copy": 0, - "options": "Cost Center", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "options": "Cost Center" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "erp_settings", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "erp_settings", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "", - "fieldname": "price_list", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Price List", - "length": 0, - "no_copy": 0, - "options": "Price List", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "price_list", + "fieldtype": "Link", + "label": "Price List", + "options": "Price List" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "update_price_in_erpnext_price_list", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Update Price from Shopify To ERPNext Price List", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "0", + "fieldname": "update_price_in_erpnext_price_list", + "fieldtype": "Check", + "label": "Update Price from Shopify To ERPNext Price List" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_26", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_26", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "depends_on": "", - "description": "Default Warehouse to to create Sales Order and Delivery Note", - "fieldname": "warehouse", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Warehouse", - "length": 0, - "no_copy": 0, - "options": "Warehouse", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "description": "Default Warehouse to to create Sales Order and Delivery Note", + "fieldname": "warehouse", + "fieldtype": "Link", + "label": "Warehouse", + "options": "Warehouse" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_25", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "section_break_25", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "sales_order_series", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Sales Order Series", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "sales_order_series", + "fieldtype": "Select", + "label": "Sales Order Series" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_27", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_27", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "", - "fieldname": "sync_delivery_note", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Import Delivery Notes from Shopify on Shipment", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "0", + "fieldname": "sync_delivery_note", + "fieldtype": "Check", + "label": "Import Delivery Notes from Shopify on Shipment" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.sync_delivery_note==1", - "fieldname": "delivery_note_series", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Delivery Note Series", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "depends_on": "eval:doc.sync_delivery_note==1", + "fieldname": "delivery_note_series", + "fieldtype": "Select", + "label": "Delivery Note Series" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "", - "fieldname": "sync_sales_invoice", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Import Sales Invoice from Shopify if Payment is marked", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "0", + "fieldname": "sync_sales_invoice", + "fieldtype": "Check", + "label": "Import Sales Invoice from Shopify if Payment is marked" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.sync_sales_invoice==1", - "fieldname": "sales_invoice_series", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Sales Invoice Series", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "depends_on": "eval:doc.sync_sales_invoice==1", + "fieldname": "sales_invoice_series", + "fieldtype": "Select", + "label": "Sales Invoice Series" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_22", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "section_break_22", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "html_16", - "fieldtype": "HTML", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "options": "Map Shopify Taxes / Shipping Charges to ERPNext Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "html_16", + "fieldtype": "HTML", + "options": "Map Shopify Taxes / Shipping Charges to ERPNext Account" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "taxes", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Shopify Tax Account", - "length": 0, - "no_copy": 0, - "options": "Shopify Tax Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldname": "taxes", + "fieldtype": "Table", + "label": "Shopify Tax Account", + "options": "Shopify Tax Account" } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 1, - "istable": 0, - "max_attachments": 0, - "modified": "2018-09-07 09:11:49.403176", - "modified_by": "Administrator", - "module": "ERPNext Integrations", - "name": "Shopify Settings", - "name_case": "", - "owner": "Administrator", + ], + "issingle": 1, + "modified": "2019-09-13 12:32:11.384757", + "modified_by": "umair@erpnext.com", + "module": "ERPNext Integrations", + "name": "Shopify Settings", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 0, - "role": "System Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "role": "System Manager", + "share": 1, "write": 1 } - ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 0, - "track_seen": 0, - "track_views": 0 + ], + "sort_field": "modified", + "sort_order": "DESC" } \ No newline at end of file diff --git a/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.py b/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.py index 4943053663a..e2f6d497d23 100644 --- a/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.py +++ b/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.py @@ -21,33 +21,22 @@ class ShopifySettings(Document): else: self.unregister_webhooks() - self.validate_app_type() - def validate_access_credentials(self): - if self.app_type == "Private": - if not (self.get_password(raise_exception=False) and self.api_key and self.shopify_url): - frappe.msgprint(_("Missing value for Password, API Key or Shopify URL"), raise_exception=frappe.ValidationError) - - else: - if not (self.access_token and self.shopify_url): - frappe.msgprint(_("Access token or Shopify URL missing"), raise_exception=frappe.ValidationError) - - def validate_app_type(self): - if self.app_type == "Public": - frappe.throw(_("Support for public app is deprecated. Please setup private app, for more details refer user manual")) + if not (self.get_password(raise_exception=False) and self.api_key and self.shopify_url): + frappe.msgprint(_("Missing value for Password, API Key or Shopify URL"), raise_exception=frappe.ValidationError) def register_webhooks(self): webhooks = ["orders/create", "orders/paid", "orders/fulfilled"] - - url = get_shopify_url('admin/webhooks.json', self) + # url = get_shopify_url('admin/webhooks.json', self) created_webhooks = [d.method for d in self.webhooks] - + url = get_shopify_url('admin/api/2019-04/webhooks.json', self) + print('url', url) for method in webhooks: - if method in created_webhooks: - continue - + print('method', method) session = get_request_session() + print('session', session) try: + print(get_header(self)) d = session.post(url, data=json.dumps({ "webhook": { "topic": method, @@ -55,6 +44,7 @@ class ShopifySettings(Document): "format": "json" } }), headers=get_header(self)) + print('d', d.json()) d.raise_for_status() self.update_webhook_table(method, d.json()) except Exception as e: @@ -65,7 +55,7 @@ class ShopifySettings(Document): deleted_webhooks = [] for d in self.webhooks: - url = get_shopify_url('admin/webhooks/{0}.json'.format(d.webhook_id), self) + url = get_shopify_url('admin/api/2019-04/webhooks.json'.format(d.webhook_id), self) try: res = session.delete(url, headers=get_header(self)) res.raise_for_status() @@ -77,6 +67,7 @@ class ShopifySettings(Document): self.remove(d) def update_webhook_table(self, method, res): + print('update') self.append("webhooks", { "webhook_id": res['webhook']['id'], "method": method @@ -84,6 +75,7 @@ class ShopifySettings(Document): def get_shopify_url(path, settings): if settings.app_type == "Private": + print(settings.api_key, settings.get_password('password'), settings.shopify_url, path) return 'https://{}:{}@{}/{}'.format(settings.api_key, settings.get_password('password'), settings.shopify_url, path) else: return 'https://{}/{}'.format(settings.shopify_url, path) @@ -91,11 +83,7 @@ def get_shopify_url(path, settings): def get_header(settings): header = {'Content-Type': 'application/json'} - if settings.app_type == "Private": - return header - else: - header["X-Shopify-Access-Token"] = settings.access_token - return header + return header; @frappe.whitelist() def get_series(): diff --git a/erpnext/erpnext_integrations/doctype/shopify_settings/sync_customer.py b/erpnext/erpnext_integrations/doctype/shopify_settings/sync_customer.py index 4b284b2e9d5..7866fdea31a 100644 --- a/erpnext/erpnext_integrations/doctype/shopify_settings/sync_customer.py +++ b/erpnext/erpnext_integrations/doctype/shopify_settings/sync_customer.py @@ -21,7 +21,7 @@ def create_customer(shopify_customer, shopify_settings): "customer_type": _("Individual") }) customer.flags.ignore_mandatory = True - customer.insert() + customer.insert(ignore_permissions=True) if customer: create_customer_address(customer, shopify_customer) diff --git a/erpnext/erpnext_integrations/doctype/shopify_settings/sync_product.py b/erpnext/erpnext_integrations/doctype/shopify_settings/sync_product.py index 5570e6903a8..bde101123db 100644 --- a/erpnext/erpnext_integrations/doctype/shopify_settings/sync_product.py +++ b/erpnext/erpnext_integrations/doctype/shopify_settings/sync_product.py @@ -1,13 +1,14 @@ from __future__ import unicode_literals import frappe from frappe import _ +from erpnext import get_default_company from frappe.utils import cstr, cint, get_request_session from erpnext.erpnext_integrations.doctype.shopify_settings.shopify_settings import get_shopify_url, get_header shopify_variants_attr_list = ["option1", "option2", "option3"] def sync_item_from_shopify(shopify_settings, item): - url = get_shopify_url("/admin/products/{0}.json".format(item.get("product_id")), shopify_settings) + url = get_shopify_url("admin/api/2019-04/products/{0}.json".format(item.get("product_id")), shopify_settings) session = get_request_session() try: @@ -107,7 +108,12 @@ def create_item(shopify_item, warehouse, has_variant=0, attributes=None,variant_ "image": get_item_image(shopify_item), "weight_uom": shopify_item.get("weight_unit"), "weight_per_unit": shopify_item.get("weight"), - "default_supplier": get_supplier(shopify_item) + "default_supplier": get_supplier(shopify_item), + "item_defaults": [ + { + "company": get_default_company() + } + ] } if not is_item_exists(item_dict, attributes, variant_of=variant_of): @@ -116,7 +122,7 @@ def create_item(shopify_item, warehouse, has_variant=0, attributes=None,variant_ if not item_details: new_item = frappe.get_doc(item_dict) - new_item.insert() + new_item.insert(ignore_permissions=True, ignore_mandatory=True) name = new_item.name if not name: diff --git a/erpnext/erpnext_integrations/doctype/shopify_settings/test_shopify_settings.py b/erpnext/erpnext_integrations/doctype/shopify_settings/test_shopify_settings.py index b983407f7b7..64ef3dc0859 100644 --- a/erpnext/erpnext_integrations/doctype/shopify_settings/test_shopify_settings.py +++ b/erpnext/erpnext_integrations/doctype/shopify_settings/test_shopify_settings.py @@ -40,6 +40,7 @@ class ShopifySettings(unittest.TestCase): "price_list": "_Test Price List", "warehouse": "_Test Warehouse - _TC", "cash_bank_account": "Cash - _TC", + "account": "Cash - _TC", "customer_group": "_Test Customer Group", "cost_center": "Main - _TC", "taxes": [ diff --git a/erpnext/erpnext_integrations/utils.py b/erpnext/erpnext_integrations/utils.py index 90657790972..84f7f5a5d41 100644 --- a/erpnext/erpnext_integrations/utils.py +++ b/erpnext/erpnext_integrations/utils.py @@ -40,4 +40,4 @@ def get_webhook_address(connector_name, method, exclude_uri=False): server_url = '{uri.scheme}://{uri.netloc}/api/method/{endpoint}'.format(uri=urlparse(url), endpoint=endpoint) - return server_url \ No newline at end of file + return server_url diff --git a/erpnext/healthcare/doctype/patient/patient.json b/erpnext/healthcare/doctype/patient/patient.json index 1de4205ec23..0136f72f5be 100644 --- a/erpnext/healthcare/doctype/patient/patient.json +++ b/erpnext/healthcare/doctype/patient/patient.json @@ -347,13 +347,25 @@ "icon": "fa fa-user", "image_field": "image", "max_attachments": 50, - "modified": "2019-09-23 16:01:39.811633", + "modified": "2019-09-25 23:30:49.905893", "modified_by": "Administrator", "module": "Healthcare", "name": "Patient", "name_case": "Title Case", "owner": "Administrator", "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + }, { "create": 1, "delete": 1, diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 7e33a14d518..5e27e0256b0 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -42,6 +42,8 @@ notification_config = "erpnext.startup.notifications.get_notification_config" get_help_messages = "erpnext.utilities.activation.get_help_messages" get_user_progress_slides = "erpnext.utilities.user_progress.get_user_progress_slides" update_and_get_user_progress = "erpnext.utilities.user_progress_utils.update_default_domain_actions_and_get_state" +leaderboards = "erpnext.startup.leaderboard.get_leaderboards" + on_session_creation = "erpnext.shopping_cart.utils.set_cart_count" on_logout = "erpnext.shopping_cart.utils.clear_cart_count" @@ -352,3 +354,53 @@ user_privacy_documents = [ 'personal_fields': ['contact_mobile', 'contact_display', 'customer_name'], } ] + +global_search_doctypes = [ + {"doctype": "Customer", "index": 0}, + {"doctype": "Supplier", "index": 1}, + {"doctype": "Item", "index": 2}, + {"doctype": "Warehouse", "index": 3}, + {"doctype": "Account", "index": 4}, + {"doctype": "Employee", "index": 5}, + {"doctype": "BOM", "index": 6}, + {"doctype": "Sales Invoice", "index": 7}, + {"doctype": "Sales Order", "index": 8}, + {"doctype": "Quotation", "index": 9}, + {"doctype": "Work Order", "index": 10}, + {"doctype": "Purchase Receipt", "index": 11}, + {"doctype": "Purchase Invoice", "index": 12}, + {"doctype": "Delivery Note", "index": 13}, + {"doctype": "Stock Entry", "index": 14}, + {"doctype": "Material Request", "index": 15}, + {"doctype": "Delivery Trip", "index": 16}, + {"doctype": "Pick List", "index": 17}, + {"doctype": "Salary Slip", "index": 18}, + {"doctype": "Leave Application", "index": 19}, + {"doctype": "Expense Claim", "index": 20}, + {"doctype": "Payment Entry", "index": 21}, + {"doctype": "Lead", "index": 22}, + {"doctype": "Opportunity", "index": 23}, + {"doctype": "Item Price", "index": 24}, + {"doctype": "Purchase Taxes and Charges Template", "index": 25}, + {"doctype": "Sales Taxes and Charges", "index": 26}, + {"doctype": "Asset", "index": 27}, + {"doctype": "Project", "index": 28}, + {"doctype": "Task", "index": 29}, + {"doctype": "Timesheet", "index": 30}, + {"doctype": "Issue", "index": 31}, + {"doctype": "Serial No", "index": 32}, + {"doctype": "Batch", "index": 33}, + {"doctype": "Branch", "index": 34}, + {"doctype": "Department", "index": 35}, + {"doctype": "Employee Grade", "index": 36}, + {"doctype": "Designation", "index": 37}, + {"doctype": "Job Opening", "index": 38}, + {"doctype": "Job Applicant", "index": 39}, + {"doctype": "Job Offer", "index": 40}, + {"doctype": "Salary Structure Assignment", "index": 41}, + {"doctype": "Appraisal", "index": 42}, + {"doctype": "Loan", "index": 43}, + {"doctype": "Maintenance Schedule", "index": 44}, + {"doctype": "Maintenance Visit", "index": 45}, + {"doctype": "Warranty Claim", "index": 46}, +] \ No newline at end of file diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.json b/erpnext/hr/doctype/job_applicant/job_applicant.json index e9de393bc4e..b0cddc257e8 100644 --- a/erpnext/hr/doctype/job_applicant/job_applicant.json +++ b/erpnext/hr/doctype/job_applicant/job_applicant.json @@ -2,7 +2,7 @@ "allow_copy": 0, "allow_guest_to_view": 0, "allow_import": 0, - "allow_rename": 0, + "allow_rename": 1, "autoname": "HR-APP-.YYYY.-.#####", "beta": 0, "creation": "2013-01-29 19:25:37", @@ -346,7 +346,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-06-21 16:15:43.552049", + "modified": "2019-07-21 16:15:43.552049", "modified_by": "Administrator", "module": "HR", "name": "Job Applicant", diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py index 7717ba0e402..e967db87c4a 100644 --- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py +++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py @@ -60,7 +60,10 @@ def get_data(filters, leave_types): data = [] for employee in active_employees: - leave_approvers = department_approver_map.get(employee.department_name, []).append(employee.leave_approver) + leave_approvers = department_approver_map.get(employee.department_name, []) + if employee.leave_approver: + leave_approvers.append(employee.leave_approver) + if (len(leave_approvers) and user in leave_approvers) or (user in ["Administrator", employee.user_id]) or ("HR Manager" in frappe.get_roles(user)): row = [employee.name, employee.employee_name, employee.department] diff --git a/erpnext/hub_node/legacy.py b/erpnext/hub_node/legacy.py index 85eb1b2bb01..b61b88bf078 100644 --- a/erpnext/hub_node/legacy.py +++ b/erpnext/hub_node/legacy.py @@ -73,7 +73,7 @@ def make_contact(supplier): {'link_doctype': 'Supplier', 'link_name': supplier.supplier_name} ] }) - contact.add_email(supplier.supplier_email) + contact.add_email(supplier.supplier_email, is_primary=True) contact.insert() else: contact = frappe.get_doc('Contact', contact_name) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index b51420ffdbe..04359e3f5df 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -195,6 +195,7 @@ class ProductionPlan(Document): for data in self.po_items: if data.name == production_plan_item: data.produced_qty = produced_qty + data.pending_qty = data.planned_qty - data.produced_qty data.db_update() self.calculate_total_produced_qty() diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js index ce7b4f9425b..96e44c881b6 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.js +++ b/erpnext/manufacturing/doctype/work_order/work_order.js @@ -545,11 +545,14 @@ erpnext.work_order = { get_max_transferable_qty: (frm, purpose) => { let max = 0; - if (frm.doc.skip_transfer) return max; - if (purpose === 'Manufacture') { - max = flt(frm.doc.material_transferred_for_manufacturing) - flt(frm.doc.produced_qty); + if (frm.doc.skip_transfer) { + max = flt(frm.doc.qty) - flt(frm.doc.produced_qty); } else { - max = flt(frm.doc.qty) - flt(frm.doc.material_transferred_for_manufacturing); + if (purpose === 'Manufacture') { + max = flt(frm.doc.material_transferred_for_manufacturing) - flt(frm.doc.produced_qty); + } else { + max = flt(frm.doc.qty) - flt(frm.doc.material_transferred_for_manufacturing); + } } return flt(max, precision('qty')); }, diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index a636b871e2e..24b798b04c9 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -213,6 +213,9 @@ class WorkOrder(Document): self.db_set(fieldname, qty) + from erpnext.selling.doctype.sales_order.sales_order import update_produced_qty_in_so_item + update_produced_qty_in_so_item(self.sales_order_item) + if self.production_plan: self.update_production_plan_status() diff --git a/erpnext/patches.txt b/erpnext/patches.txt index a001d168be0..9f98099257d 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -636,4 +636,7 @@ erpnext.patches.v12_0.generate_leave_ledger_entries erpnext.patches.v12_0.move_credit_limit_to_customer_credit_limit erpnext.patches.v12_0.add_variant_of_in_item_attribute_table erpnext.patches.v12_0.rename_bank_account_field_in_journal_entry_account -erpnext.patches.v12_0.create_default_energy_point_rules \ No newline at end of file +erpnext.patches.v12_0.create_default_energy_point_rules +erpnext.patches.v12_0.set_produced_qty_field_in_sales_order_for_work_order +erpnext.patches.v12_0.generate_leave_ledger_entries +erpnext.patches.v12_0.set_default_shopify_app_type diff --git a/erpnext/patches/v12_0/set_default_shopify_app_type.py b/erpnext/patches/v12_0/set_default_shopify_app_type.py new file mode 100644 index 00000000000..d040ea7f71c --- /dev/null +++ b/erpnext/patches/v12_0/set_default_shopify_app_type.py @@ -0,0 +1,6 @@ +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.reload_doc('erpnext_integrations', 'doctype', 'shopify_settings') + frappe.db.set_value('Shopify Settings', None, 'app_type', 'Private') \ No newline at end of file diff --git a/erpnext/patches/v12_0/set_priority_for_support.py b/erpnext/patches/v12_0/set_priority_for_support.py index 5096ed4c3c2..a5490ef20d5 100644 --- a/erpnext/patches/v12_0/set_priority_for_support.py +++ b/erpnext/patches/v12_0/set_priority_for_support.py @@ -3,6 +3,7 @@ import frappe def execute(): frappe.reload_doc("support", "doctype", "issue_priority") frappe.reload_doc("support", "doctype", "service_level_priority") + frappe.reload_doc('support', 'doctype', 'issue') set_issue_priority() set_priority_for_issue() diff --git a/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py b/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py new file mode 100644 index 00000000000..44d8fa767af --- /dev/null +++ b/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py @@ -0,0 +1,10 @@ +import frappe +from frappe.utils import flt +from erpnext.selling.doctype.sales_order.sales_order import update_produced_qty_in_so_item + +def execute(): + frappe.reload_doctype('Sales Order Item') + frappe.reload_doctype('Sales Order') + sales_order_items = frappe.db.get_all('Sales Order Item', ['name']) + for so_item in sales_order_items: + update_produced_qty_in_so_item(so_item.get('name')) \ No newline at end of file diff --git a/erpnext/projects/doctype/project/project.json b/erpnext/projects/doctype/project/project.json index dc221bccbcb..7d47db371d5 100644 --- a/erpnext/projects/doctype/project/project.json +++ b/erpnext/projects/doctype/project/project.json @@ -108,7 +108,7 @@ "fieldname": "percent_complete_method", "fieldtype": "Select", "label": "% Complete Method", - "options": "Task Completion\nTask Progress\nTask Weight" + "options": "Manual\nTask Completion\nTask Progress\nTask Weight" }, { "bold": 1, @@ -123,6 +123,7 @@ "fieldtype": "Column Break" }, { + "allow_in_quick_entry": 1, "fieldname": "project_template", "fieldtype": "Link", "label": "From Template", @@ -443,7 +444,7 @@ "icon": "fa fa-puzzle-piece", "idx": 29, "max_attachments": 4, - "modified": "2019-07-16 11:11:12.343658", + "modified": "2019-09-24 15:02:50.208301", "modified_by": "Administrator", "module": "Projects", "name": "Project", diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 6176cf89b4f..783bcf3c383 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -87,6 +87,11 @@ class Project(Document): frappe.db.set_value("Sales Order", self.sales_order, "project", self.name) def update_percent_complete(self): + if self.percent_complete_method == "Manual": + if self.status == "Completed": + self.percent_complete = 100 + return + total = frappe.db.count('Task', dict(project=self.name)) if not total: diff --git a/erpnext/public/js/templates/contact_list.html b/erpnext/public/js/templates/contact_list.html index 50fbfd9f12e..7e6969163b7 100644 --- a/erpnext/public/js/templates/contact_list.html +++ b/erpnext/public/js/templates/contact_list.html @@ -19,6 +19,9 @@ {% if(contact_list[i].phone) { %} {%= __("Phone") %}: {%= contact_list[i].phone %} ({%= __("Primary") %})
{% endif %} + {% if(contact_list[i].mobile_no) { %} + {%= __("Mobile No") %}: {%= contact_list[i].mobile_no %} ({%= __("Primary") %})
+ {% endif %} {% if(contact_list[i].phone_nos) { %} {% for(var j=0, k=contact_list[i].phone_nos.length; j diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index d49b9a90622..a8e3ce4eae7 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -350,8 +350,10 @@ def make_contact(args, is_primary_contact=1): 'link_name': args.get('name') }] }) - contact.add_email(args.get('email_id')) - contact.add_phone(args.get('mobile_no')) + if args.get('email_id'): + contact.add_email(args.get('email_id'), is_primary=True) + if args.get('mobile_no'): + contact.add_phone(args.get('mobile_no'), is_primary_mobile_no=True) contact.insert() return contact diff --git a/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json b/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json index e26f7989788..c28021c524a 100644 --- a/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json +++ b/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json @@ -34,11 +34,11 @@ "fieldname": "bypass_credit_limit_check", "fieldtype": "Check", "in_list_view": 1, - "label": "Bypass credit limit_check" + "label": "Bypass Credit Limit Check" } ], "istable": 1, - "modified": "2019-08-29 20:46:36.073953", + "modified": "2019-09-24 15:05:26.069911", "modified_by": "Administrator", "module": "Selling", "name": "Customer Credit Limit", diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 12b9a8e96d2..e60be5a216c 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -1023,3 +1023,15 @@ def create_pick_list(source_name, target_doc=None): doc.set_item_locations() return doc + +def update_produced_qty_in_so_item(sales_order_item): + #for multiple work orders against same sales order item + linked_wo_with_so_item = frappe.db.get_all('Work Order', ['produced_qty'], { + 'sales_order_item': sales_order_item, + 'docstatus': 1 + }) + if len(linked_wo_with_so_item) > 0: + total_produced_qty = 0 + for wo in linked_wo_with_so_item: + total_produced_qty += flt(wo.get('produced_qty')) + frappe.db.set_value('Sales Order Item', sales_order_item, 'produced_qty', total_produced_qty) \ No newline at end of file diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json index 01dfc7d084c..b94dce15ab7 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json @@ -110,6 +110,7 @@ "read_only": 1 }, { + "default": "0", "fieldname": "ensure_delivery_based_on_produced_serial_no", "fieldtype": "Check", "label": "Ensure Delivery Based on Produced Serial No" @@ -381,6 +382,7 @@ "read_only": 1 }, { + "default": "0", "fieldname": "is_free_item", "fieldtype": "Check", "label": "Is Free Item", @@ -436,6 +438,7 @@ "print_hide": 1 }, { + "default": "0", "fieldname": "delivered_by_supplier", "fieldtype": "Check", "label": "Supplier delivers to Customer", @@ -662,6 +665,7 @@ }, { "allow_on_submit": 1, + "default": "0", "fieldname": "page_break", "fieldtype": "Check", "label": "Page Break", @@ -689,7 +693,6 @@ "description": "For Production", "fieldname": "produced_qty", "fieldtype": "Float", - "hidden": 1, "label": "Produced Quantity", "oldfieldname": "produced_qty", "oldfieldtype": "Currency", @@ -740,7 +743,7 @@ ], "idx": 1, "istable": 1, - "modified": "2019-05-01 17:52:32.810797", + "modified": "2019-09-13 12:18:54.903107", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order Item", diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py index 289b045e1c1..bb6ba1ffce4 100644 --- a/erpnext/selling/doctype/sms_center/sms_center.py +++ b/erpnext/selling/doctype/sms_center/sms_center.py @@ -31,7 +31,7 @@ class SMSCenter(Document): self.sales_partner.replace("'", "\'") or " and ifnull(dl.link_name, '') != ''" if self.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']: rec = frappe.db.sql("""select CONCAT(ifnull(c.first_name,''), ' ', ifnull(c.last_name,'')), - c.phone from `tabContact` c, `tabDynamic Link` dl where ifnull(c.phone,'')!='' and + c.mobile_no from `tabContact` c, `tabDynamic Link` dl where ifnull(c.mobile_no,'')!='' and c.docstatus != 2 and dl.parent = c.name%s""" % where_clause) elif self.send_to == 'All Lead (Open)': diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 584391e1e01..9eb374824a7 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -64,16 +64,19 @@ class Company(NestedSet): }) def validate_default_accounts(self): - for field in ["default_bank_account", "default_cash_account", + accounts = [ + "default_bank_account", "default_cash_account", "default_receivable_account", "default_payable_account", "default_expense_account", "default_income_account", "stock_received_but_not_billed", "stock_adjustment_account", - "expenses_included_in_valuation", "default_payroll_payable_account"]: - if self.get(field): - for_company = frappe.db.get_value("Account", self.get(field), "company") - if for_company != self.name: - frappe.throw(_("Account {0} does not belong to company: {1}") - .format(self.get(field), self.name)) + "expenses_included_in_valuation", "default_payroll_payable_account" + ] + + for field in accounts: + if self.get(field): + for_company = frappe.db.get_value("Account", self.get(field), "company") + if for_company != self.name: + frappe.throw(_("Account {0} does not belong to company: {1}").format(self.get(field), self.name)) def validate_currency(self): if self.is_new(): @@ -180,21 +183,29 @@ class Company(NestedSet): self.existing_company = self.parent_company def set_default_accounts(self): - self._set_default_account("default_cash_account", "Cash") - self._set_default_account("default_bank_account", "Bank") - self._set_default_account("round_off_account", "Round Off") - self._set_default_account("accumulated_depreciation_account", "Accumulated Depreciation") - self._set_default_account("depreciation_expense_account", "Depreciation") - self._set_default_account("capital_work_in_progress_account", "Capital Work in Progress") - self._set_default_account("asset_received_but_not_billed", "Asset Received But Not Billed") - self._set_default_account("expenses_included_in_asset_valuation", "Expenses Included In Asset Valuation") + default_accounts = { + "default_cash_account": "Cash", + "default_bank_account": "Bank", + "round_off_account": "Round Off", + "accumulated_depreciation_account": "Accumulated Depreciation", + "depreciation_expense_account": "Depreciation", + "capital_work_in_progress_account": "Capital Work in Progress", + "asset_received_but_not_billed": "Asset Received But Not Billed", + "expenses_included_in_asset_valuation": "Expenses Included In Asset Valuation" + } if self.enable_perpetual_inventory: - self._set_default_account("stock_received_but_not_billed", "Stock Received But Not Billed") - self._set_default_account("default_inventory_account", "Stock") - self._set_default_account("stock_adjustment_account", "Stock Adjustment") - self._set_default_account("expenses_included_in_valuation", "Expenses Included In Valuation") - self._set_default_account("default_expense_account", "Cost of Goods Sold") + default_accounts.update({ + "stock_received_but_not_billed": "Stock Received But Not Billed", + "default_inventory_account": "Stock", + "stock_adjustment_account": "Stock Adjustment", + "expenses_included_in_valuation": "Expenses Included In Valuation", + "default_expense_account": "Cost of Goods Sold" + }) + + for default_account in default_accounts: + if self.is_new() or frappe.flags.in_test: + self._set_default_account(default_account, default_accounts.get(default_account)) if not self.default_income_account: income_account = frappe.db.get_value("Account", @@ -243,8 +254,7 @@ class Company(NestedSet): if self.get(fieldname): return - account = frappe.db.get_value("Account", {"account_type": account_type, - "is_group": 0, "company": self.name}) + account = frappe.db.get_value("Account", {"account_type": account_type, "is_group": 0, "company": self.name}) if account: self.db_set(fieldname, account) diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index b65716536d9..66598f40de5 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -9,6 +9,7 @@ from frappe import _ from frappe.desk.page.setup_wizard.setup_wizard import make_records from frappe.utils import cstr, getdate from erpnext.accounts.doctype.account.account import RootNotEditable +from frappe.desk.doctype.global_search_settings.global_search_settings import update_global_search_doctypes default_lead_sources = ["Existing Customer", "Reference", "Advertisement", "Cold Calling", "Exhibition", "Supplier Reference", "Mass Mailing", @@ -274,6 +275,8 @@ def install(country=None): set_more_defaults() + update_global_search_doctypes() + # path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(country)) # if os.path.exists(path.encode("utf-8")): # frappe.get_attr("erpnext.regional.{0}.setup.setup_company_independent_fixtures".format(frappe.scrub(country)))() diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index db2c3277d0f..40cb7c87004 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -55,8 +55,6 @@ def place_order(): cart_settings = frappe.db.get_value("Shopping Cart Settings", None, ["company", "allow_items_not_in_stock"], as_dict=1) quotation.company = cart_settings.company - if not quotation.get("customer_address"): - throw(_("{0} is required").format(_(quotation.meta.get_label("customer_address")))) quotation.flags.ignore_permissions = True quotation.submit() diff --git a/erpnext/startup/leaderboard.py b/erpnext/startup/leaderboard.py new file mode 100644 index 00000000000..90ecd462591 --- /dev/null +++ b/erpnext/startup/leaderboard.py @@ -0,0 +1,177 @@ + +from __future__ import unicode_literals, print_function +import frappe +from frappe.utils import cint + +def get_leaderboards(): + leaderboards = { + "Customer": { + "fields": [ + {'fieldname': 'total_sales_amount', 'fieldtype': 'Currency'}, + 'total_qty_sold', + {'fieldname': 'outstanding_amount', 'fieldtype': 'Currency'} + ], + "method": "erpnext.startup.leaderboard.get_all_customers", + }, + "Item": { + "fields": [ + {'fieldname': 'total_sales_amount', 'fieldtype': 'Currency'}, + 'total_qty_sold', + {'fieldname': 'total_purchase_amount', 'fieldtype': 'Currency'}, + 'total_qty_purchased', + 'available_stock_qty', + {'fieldname': 'available_stock_value', 'fieldtype': 'Currency'} + ], + "method": "erpnext.startup.leaderboard.get_all_items", + }, + "Supplier": { + "fields": [ + {'fieldname': 'total_purchase_amount', 'fieldtype': 'Currency'}, + 'total_qty_purchased', + {'fieldname': 'outstanding_amount', 'fieldtype': 'Currency'} + ], + "method": "erpnext.startup.leaderboard.get_all_suppliers", + }, + "Sales Partner": { + "fields": [ + {'fieldname': 'total_sales_amount', 'fieldtype': 'Currency'}, + {'fieldname': 'total_commission', 'fieldtype': 'Currency'} + ], + "method": "erpnext.startup.leaderboard.get_all_sales_partner", + }, + "Sales Person": { + "fields": [ + {'fieldname': 'total_sales_amount', 'fieldtype': 'Currency'} + ], + "method": "erpnext.startup.leaderboard.get_all_sales_person", + } + } + + return leaderboards + +@frappe.whitelist() +def get_all_customers(from_date, company, field, limit = None): + if field == "outstanding_amount": + filters = [['docstatus', '=', '1'], ['company', '=', company]] + if from_date: + filters.append(['posting_date', '>=', from_date]) + return frappe.db.get_all('Sales Invoice', + fields = ['customer as name', 'sum(outstanding_amount) as value'], + filters = filters, + group_by = 'customer', + order_by = 'value desc', + limit = limit + ) + else: + if field == "total_sales_amount": + select_field = "sum(so_item.base_net_amount)" + elif field == "total_qty_sold": + select_field = "sum(so_item.stock_qty)" + + return frappe.db.sql(""" + select so.customer as name, {0} as value + FROM `tabSales Order` as so JOIN `tabSales Order Item` as so_item + ON so.name = so_item.parent + where so.docstatus = 1 and so.transaction_date >= %s and so.company = %s + group by so.customer + order by value DESC + limit %s + """.format(select_field), (from_date, company, cint(limit)), as_dict=1) #nosec + +@frappe.whitelist() +def get_all_items(from_date, company, field, limit = None): + if field in ("available_stock_qty", "available_stock_value"): + select_field = "sum(actual_qty)" if field=="available_stock_qty" else "sum(stock_value)" + return frappe.db.get_all('Bin', + fields = ['item_code as name', '{0} as value'.format(select_field)], + group_by = 'item_code', + order_by = 'value desc', + limit = limit + ) + else: + if field == "total_sales_amount": + select_field = "sum(order_item.base_net_amount)" + select_doctype = "Sales Order" + elif field == "total_purchase_amount": + select_field = "sum(order_item.base_net_amount)" + select_doctype = "Purchase Order" + elif field == "total_qty_sold": + select_field = "sum(order_item.stock_qty)" + select_doctype = "Sales Order" + elif field == "total_qty_purchased": + select_field = "sum(order_item.stock_qty)" + select_doctype = "Purchase Order" + + return frappe.db.sql(""" + select order_item.item_code as name, {0} as value + from `tab{1}` sales_order join `tab{1} Item` as order_item + on sales_order.name = order_item.parent + where sales_order.docstatus = 1 + and sales_order.company = %s and sales_order.transaction_date >= %s + group by order_item.item_code + order by value desc + limit %s + """.format(select_field, select_doctype), (company, from_date, cint(limit)), as_dict=1) #nosec + +@frappe.whitelist() +def get_all_suppliers(from_date, company, field, limit = None): + if field == "outstanding_amount": + filters = [['docstatus', '=', '1'], ['company', '=', company]] + if from_date: + filters.append(['posting_date', '>=', from_date]) + return frappe.db.get_all('Purchase Invoice', + fields = ['supplier as name', 'sum(outstanding_amount) as value'], + filters = filters, + group_by = 'supplier', + order_by = 'value desc', + limit = limit + ) + else: + if field == "total_purchase_amount": + select_field = "sum(purchase_order_item.base_net_amount)" + elif field == "total_qty_purchased": + select_field = "sum(purchase_order_item.stock_qty)" + + return frappe.db.sql(""" + select purchase_order.supplier as name, {0} as value + FROM `tabPurchase Order` as purchase_order LEFT JOIN `tabPurchase Order Item` + as purchase_order_item ON purchase_order.name = purchase_order_item.parent + where purchase_order.docstatus = 1 and purchase_order.modified >= %s + and purchase_order.company = %s + group by purchase_order.supplier + order by value DESC + limit %s""".format(select_field), (from_date, company, cint(limit)), as_dict=1) #nosec + +@frappe.whitelist() +def get_all_sales_partner(from_date, company, field, limit = None): + if field == "total_sales_amount": + select_field = "sum(`base_net_total`)" + elif field == "total_commission": + select_field = "sum(`total_commission`)" + + filters = { + 'sales_partner': ['!=', ''], + 'docstatus': 1, + 'company': company + } + if from_date: + filters['transaction_date'] = ['>=', from_date] + + return frappe.get_list('Sales Order', fields=[ + '`sales_partner` as name', + '{} as value'.format(select_field), + ], filters=filters, group_by='sales_partner', order_by='value DESC', limit=limit) + +@frappe.whitelist() +def get_all_sales_person(from_date, company, field = None, limit = 0): + return frappe.db.sql(""" + select sales_team.sales_person as name, sum(sales_order.base_net_total) as value + from `tabSales Order` as sales_order join `tabSales Team` as sales_team + on sales_order.name = sales_team.parent and sales_team.parenttype = 'Sales Order' + where sales_order.docstatus = 1 + and sales_order.transaction_date >= %s + and sales_order.company = %s + group by sales_team.sales_person + order by value DESC + limit %s + """, (from_date, company, cint(limit)), as_dict=1) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index a88bb2ad1e0..2ee68723789 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -85,26 +85,13 @@ frappe.ui.form.on("Delivery Note", { refresh: function(frm) { if (frm.doc.docstatus === 1 && frm.doc.is_return === 1 && frm.doc.per_billed !== 100) { frm.add_custom_button(__('Credit Note'), function() { - frappe.confirm(__("Are you sure you want to make credit note?"), - function() { - frm.trigger("make_credit_note"); - } - ); + frappe.model.open_mapped_doc({ + method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice", + frm: cur_frm, + }) }, __('Create')); - frm.page.set_inner_btn_group_as_primary(__('Create')); } - }, - - make_credit_note: function(frm) { - frm.call({ - method: "make_return_invoice", - doc: frm.doc, - freeze: true, - callback: function() { - frm.reload_doc(); - } - }); } }); @@ -123,6 +110,9 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend( setup: function(doc) { this.setup_posting_date_time_check(); this._super(doc); + this.frm.make_methods = { + 'Delivery Trip': this.make_delivery_trip, + }; }, refresh: function(doc, dt, dn) { var me = this; @@ -239,7 +229,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend( make_delivery_trip: function() { frappe.model.open_mapped_doc({ method: "erpnext.stock.doctype.delivery_note.delivery_note.make_delivery_trip", - frm: this.frm + frm: cur_frm }) }, diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index bdb49e4919c..c98dfe35fb5 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -458,6 +458,9 @@ def make_sales_invoice(source_name, target_doc=None): doc = get_mapped_doc("Delivery Note", source_name, { "Delivery Note": { "doctype": "Sales Invoice", + "field_map": { + "is_return": "is_return" + }, "validation": { "docstatus": ["=", 1] } diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 8266055d699..aef53ed74ba 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -41,28 +41,15 @@ frappe.ui.form.on("Purchase Receipt", { if (frm.doc.docstatus === 1 && frm.doc.is_return === 1 && frm.doc.per_billed !== 100) { frm.add_custom_button(__('Debit Note'), function() { - frappe.confirm(__("Are you sure you want to make debit note?"), - function() { - frm.trigger("make_debit_note"); - } - ); + frappe.model.open_mapped_doc({ + method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice", + frm: cur_frm, + }) }, __('Create')); - frm.page.set_inner_btn_group_as_primary(__('Create')); } }, - make_debit_note: function(frm) { - frm.call({ - method: "make_return_invoice", - doc: frm.doc, - freeze: true, - callback: function() { - frm.reload_doc(); - } - }); - }, - company: function(frm) { frm.trigger("toggle_display_account_head"); }, @@ -128,12 +115,12 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend cur_frm.add_custom_button(__("Close"), this.close_purchase_receipt, __("Status")) } - cur_frm.add_custom_button(__('Return'), this.make_purchase_return, __('Create')); + cur_frm.add_custom_button(__('Purchase Return'), this.make_purchase_return, __('Create')); cur_frm.add_custom_button(__('Make Stock Entry'), cur_frm.cscript['Make Stock Entry'], __('Create')); if(flt(this.frm.doc.per_billed) < 100) { - cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice, __('Create')); + cur_frm.add_custom_button(__('Purchase Invoice'), this.make_purchase_invoice, __('Create')); } cur_frm.add_custom_button(__('Retention Stock Entry'), this.make_retention_stock_entry, __('Create')); diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 0c8e9a0aa89..fae4de36910 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -426,16 +426,6 @@ class PurchaseReceipt(BuyingController): self.load_from_db() - def make_return_invoice(self): - return_invoice = make_purchase_invoice(self.name) - return_invoice.is_return = True - return_invoice.save() - return_invoice.submit() - - debit_note_link = frappe.utils.get_link_to_form('Purchase Invoice', return_invoice.name) - - frappe.msgprint(_("Debit Note {0} has been created automatically").format(debit_note_link)) - def update_billed_amount_based_on_po(po_detail, update_modified=True): # Billed against Sales Order directly billed_against_po = frappe.db.sql("""select sum(amount) from `tabPurchase Invoice Item` @@ -510,7 +500,8 @@ def make_purchase_invoice(source_name, target_doc=None): "Purchase Receipt": { "doctype": "Purchase Invoice", "field_map": { - "supplier_warehouse":"supplier_warehouse" + "supplier_warehouse":"supplier_warehouse", + "is_return": "is_return" }, "validation": { "docstatus": ["=", 1], diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json index 70b62b06a1d..446a488a7e6 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -1,830 +1,830 @@ { - "autoname": "hash", - "creation": "2013-05-24 19:29:10", - "doctype": "DocType", - "document_type": "Document", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "barcode", - "section_break_2", - "item_code", - "supplier_part_no", - "column_break_2", - "item_name", - "section_break_4", - "description", - "item_group", - "brand", - "image_section", - "image", - "image_view", - "manufacture_details", - "manufacturer", - "column_break_16", - "manufacturer_part_no", - "received_and_accepted", - "received_qty", - "qty", - "rejected_qty", - "col_break2", - "uom", - "stock_uom", - "conversion_factor", - "retain_sample", - "sample_quantity", - "rate_and_amount", - "price_list_rate", - "discount_percentage", - "discount_amount", - "col_break3", - "base_price_list_rate", - "sec_break1", - "rate", - "amount", - "col_break4", - "base_rate", - "base_amount", - "pricing_rules", - "is_free_item", - "section_break_29", - "net_rate", - "net_amount", - "item_tax_template", - "column_break_32", - "base_net_rate", - "base_net_amount", - "valuation_rate", - "item_tax_amount", - "rm_supp_cost", - "landed_cost_voucher_amount", - "billed_amt", - "item_weight_details", - "weight_per_unit", - "total_weight", - "column_break_41", - "weight_uom", - "warehouse_and_reference", - "warehouse", - "rejected_warehouse", - "quality_inspection", - "purchase_order", - "material_request", - "purchase_order_item", - "material_request_item", - "column_break_40", - "is_fixed_asset", - "asset", - "asset_location", - "schedule_date", - "stock_qty", - "section_break_45", - "serial_no", - "batch_no", - "column_break_48", - "rejected_serial_no", - "expense_account", - "col_break5", - "allow_zero_valuation_rate", - "bom", - "include_exploded_items", - "item_tax_rate", - "accounting_dimensions_section", - "project", - "dimension_col_break", - "cost_center", - "section_break_80", - "page_break" - ], - "fields": [ - { - "fieldname": "barcode", - "fieldtype": "Data", - "label": "Barcode" - }, - { - "fieldname": "section_break_2", - "fieldtype": "Section Break" - }, - { - "bold": 1, - "columns": 3, - "fieldname": "item_code", - "fieldtype": "Link", - "in_global_search": 1, - "in_list_view": 1, - "label": "Item Code", - "oldfieldname": "item_code", - "oldfieldtype": "Link", - "options": "Item", - "print_width": "100px", - "reqd": 1, - "search_index": 1, - "width": "100px" - }, - { - "fieldname": "supplier_part_no", - "fieldtype": "Data", - "hidden": 1, - "label": "Supplier Part Number", - "read_only": 1 - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break" - }, - { - "fieldname": "item_name", - "fieldtype": "Data", - "in_global_search": 1, - "label": "Item Name", - "oldfieldname": "item_name", - "oldfieldtype": "Data", - "print_hide": 1, - "reqd": 1 - }, - { - "collapsible": 1, - "fieldname": "section_break_4", - "fieldtype": "Section Break", - "label": "Description" - }, - { - "fieldname": "description", - "fieldtype": "Text Editor", - "label": "Description", - "oldfieldname": "description", - "oldfieldtype": "Text", - "print_width": "300px", - "reqd": 1, - "width": "300px" - }, - { - "fieldname": "image", - "fieldtype": "Attach", - "hidden": 1, - "label": "Image" - }, - { - "fieldname": "image_view", - "fieldtype": "Image", - "label": "Image View", - "options": "image", - "print_hide": 1 - }, - { - "fieldname": "received_and_accepted", - "fieldtype": "Section Break", - "label": "Received and Accepted" - }, - { - "bold": 1, - "fieldname": "received_qty", - "fieldtype": "Float", - "label": "Received Quantity", - "oldfieldname": "received_qty", - "oldfieldtype": "Currency", - "print_hide": 1, - "print_width": "100px", - "reqd": 1, - "width": "100px" - }, - { - "columns": 2, - "fieldname": "qty", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Accepted Quantity", - "oldfieldname": "qty", - "oldfieldtype": "Currency", - "print_width": "100px", - "width": "100px" - }, - { - "fieldname": "rejected_qty", - "fieldtype": "Float", - "label": "Rejected Quantity", - "oldfieldname": "rejected_qty", - "oldfieldtype": "Currency", - "print_hide": 1, - "print_width": "100px", - "width": "100px" - }, - { - "fieldname": "col_break2", - "fieldtype": "Column Break", - "print_hide": 1 - }, - { - "fieldname": "uom", - "fieldtype": "Link", - "label": "UOM", - "oldfieldname": "uom", - "oldfieldtype": "Link", - "options": "UOM", - "print_hide": 1, - "print_width": "100px", - "reqd": 1, - "width": "100px" - }, - { - "fieldname": "stock_uom", - "fieldtype": "Link", - "label": "Stock UOM", - "oldfieldname": "stock_uom", - "oldfieldtype": "Data", - "options": "UOM", - "print_hide": 1, - "print_width": "100px", - "read_only": 1, - "reqd": 1, - "width": "100px" - }, - { - "fieldname": "conversion_factor", - "fieldtype": "Float", - "label": "Conversion Factor", - "oldfieldname": "conversion_factor", - "oldfieldtype": "Currency", - "print_hide": 1, - "print_width": "100px", - "reqd": 1, - "width": "100px" - }, - { - "default": "0", - "fetch_from": "item_code.retain_sample", - "fieldname": "retain_sample", - "fieldtype": "Check", - "label": "Retain Sample", - "read_only": 1 - }, - { - "depends_on": "retain_sample", - "fetch_from": "item_code.sample_quantity", - "fieldname": "sample_quantity", - "fieldtype": "Int", - "label": "Sample Quantity" - }, - { - "fieldname": "rate_and_amount", - "fieldtype": "Section Break", - "label": "Rate and Amount" - }, - { - "fieldname": "price_list_rate", - "fieldtype": "Currency", - "label": "Price List Rate", - "options": "currency", - "print_hide": 1 - }, - { - "depends_on": "price_list_rate", - "fieldname": "discount_percentage", - "fieldtype": "Percent", - "label": "Discount on Price List Rate (%)", - "print_hide": 1 - }, - { - "depends_on": "price_list_rate", - "fieldname": "discount_amount", - "fieldtype": "Currency", - "label": "Discount Amount", - "options": "currency" - }, - { - "fieldname": "col_break3", - "fieldtype": "Column Break" - }, - { - "fieldname": "base_price_list_rate", - "fieldtype": "Currency", - "label": "Price List Rate (Company Currency)", - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "sec_break1", - "fieldtype": "Section Break" - }, - { - "bold": 1, - "columns": 3, - "fieldname": "rate", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Rate", - "oldfieldname": "import_rate", - "oldfieldtype": "Currency", - "options": "currency", - "print_width": "100px", - "width": "100px" - }, - { - "fieldname": "amount", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Amount", - "oldfieldname": "import_amount", - "oldfieldtype": "Currency", - "options": "currency", - "read_only": 1 - }, - { - "fieldname": "col_break4", - "fieldtype": "Column Break" - }, - { - "fieldname": "base_rate", - "fieldtype": "Currency", - "label": "Rate (Company Currency)", - "oldfieldname": "purchase_rate", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1, - "print_width": "100px", - "read_only": 1, - "reqd": 1, - "width": "100px" - }, - { - "fieldname": "base_amount", - "fieldtype": "Currency", - "label": "Amount (Company Currency)", - "oldfieldname": "amount", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1, - "print_width": "100px", - "read_only": 1, - "width": "100px" - }, - { - "fieldname": "pricing_rules", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Pricing Rules", - "print_hide": 1, - "read_only": 1 - }, - { - "default": "0", - "fieldname": "is_free_item", - "fieldtype": "Check", - "label": "Is Free Item", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "section_break_29", - "fieldtype": "Section Break" - }, - { - "fieldname": "net_rate", - "fieldtype": "Currency", - "label": "Net Rate", - "options": "currency", - "print_hide": 1, - "read_only": 1 - }, - { - "columns": 2, - "fieldname": "net_amount", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Net Amount", - "options": "currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break_32", - "fieldtype": "Column Break" - }, - { - "fieldname": "base_net_rate", - "fieldtype": "Currency", - "label": "Net Rate (Company Currency)", - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "base_net_amount", - "fieldtype": "Currency", - "label": "Net Amount (Company Currency)", - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "collapsible": 1, - "fieldname": "item_weight_details", - "fieldtype": "Section Break", - "label": "Item Weight Details" - }, - { - "fieldname": "weight_per_unit", - "fieldtype": "Float", - "label": "Weight Per Unit" - }, - { - "fieldname": "total_weight", - "fieldtype": "Float", - "label": "Total Weight", - "read_only": 1 - }, - { - "fieldname": "column_break_41", - "fieldtype": "Column Break" - }, - { - "fieldname": "weight_uom", - "fieldtype": "Link", - "label": "Weight UOM", - "options": "UOM" - }, - { - "fieldname": "warehouse_and_reference", - "fieldtype": "Section Break", - "label": "Warehouse and Reference" - }, - { - "bold": 1, - "fieldname": "warehouse", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Accepted Warehouse", - "oldfieldname": "warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "print_hide": 1, - "print_width": "100px", - "width": "100px" - }, - { - "fieldname": "rejected_warehouse", - "fieldtype": "Link", - "label": "Rejected Warehouse", - "no_copy": 1, - "oldfieldname": "rejected_warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "print_hide": 1, - "print_width": "100px", - "width": "100px" - }, - { - "depends_on": "eval:!doc.__islocal", - "fieldname": "quality_inspection", - "fieldtype": "Link", - "label": "Quality Inspection", - "no_copy": 1, - "oldfieldname": "qa_no", - "oldfieldtype": "Link", - "options": "Quality Inspection", - "print_hide": 1 - }, - { - "fieldname": "column_break_40", - "fieldtype": "Column Break" - }, - { - "default": "0", - "fieldname": "is_fixed_asset", - "fieldtype": "Check", - "hidden": 1, - "label": "Is Fixed Asset", - "no_copy": 1, - "print_hide": 1, - "read_only": 1 - }, - { - "depends_on": "is_fixed_asset", - "fieldname": "asset", - "fieldtype": "Link", - "label": "Asset", - "no_copy": 1, - "options": "Asset" - }, - { - "depends_on": "is_fixed_asset", - "fieldname": "asset_location", - "fieldtype": "Link", - "label": "Asset Location", - "options": "Location" - }, - { - "fieldname": "purchase_order", - "fieldtype": "Link", - "label": "Purchase Order", - "no_copy": 1, - "oldfieldname": "prevdoc_docname", - "oldfieldtype": "Link", - "options": "Purchase Order", - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "search_index": 1, - "width": "150px" - }, - { - "fieldname": "schedule_date", - "fieldtype": "Date", - "label": "Required By", - "oldfieldname": "schedule_date", - "oldfieldtype": "Date", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "stock_qty", - "fieldtype": "Float", - "label": "Qty as per Stock UOM", - "oldfieldname": "stock_qty", - "oldfieldtype": "Currency", - "print_hide": 1, - "print_width": "100px", - "read_only": 1, - "width": "100px" - }, - { - "fieldname": "section_break_45", - "fieldtype": "Section Break" - }, - { - "fieldname": "serial_no", - "fieldtype": "Small Text", - "in_list_view": 1, - "label": "Serial No", - "no_copy": 1, - "oldfieldname": "serial_no", - "oldfieldtype": "Text" - }, - { - "fieldname": "batch_no", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Batch No", - "no_copy": 1, - "oldfieldname": "batch_no", - "oldfieldtype": "Link", - "options": "Batch", - "print_hide": 1 - }, - { - "fieldname": "column_break_48", - "fieldtype": "Column Break" - }, - { - "fieldname": "rejected_serial_no", - "fieldtype": "Small Text", - "label": "Rejected Serial No", - "no_copy": 1, - "print_hide": 1 - }, - { - "fieldname": "item_tax_template", - "fieldtype": "Link", - "label": "Item Tax Template", - "options": "Item Tax Template", - "print_hide": 1 - }, - { - "fieldname": "project", - "fieldtype": "Link", - "label": "Project", - "options": "Project", - "print_hide": 1 - }, - { - "default": ":Company", - "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))", - "fieldname": "cost_center", - "fieldtype": "Link", - "label": "Cost Center", - "options": "Cost Center", - "print_hide": 1 - }, - { - "fieldname": "purchase_order_item", - "fieldtype": "Data", - "hidden": 1, - "label": "Purchase Order Item", - "no_copy": 1, - "oldfieldname": "prevdoc_detail_docname", - "oldfieldtype": "Data", - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "search_index": 1, - "width": "150px" - }, - { - "fieldname": "col_break5", - "fieldtype": "Column Break" - }, - { - "default": "0", - "fieldname": "allow_zero_valuation_rate", - "fieldtype": "Check", - "label": "Allow Zero Valuation Rate", - "no_copy": 1, - "print_hide": 1 - }, - { - "fieldname": "bom", - "fieldtype": "Link", - "label": "BOM", - "no_copy": 1, - "options": "BOM", - "print_hide": 1 - }, - { - "default": "0", - "depends_on": "eval:parent.is_subcontracted == 'Yes'", - "fieldname": "include_exploded_items", - "fieldtype": "Check", - "label": "Include Exploded Items", - "read_only": 1 - }, - { - "fieldname": "billed_amt", - "fieldtype": "Currency", - "label": "Billed Amt", - "no_copy": 1, - "options": "currency", - "print_hide": 1, - "read_only": 1 - }, - { - "allow_on_submit": 1, - "fieldname": "landed_cost_voucher_amount", - "fieldtype": "Currency", - "label": "Landed Cost Voucher Amount", - "no_copy": 1, - "options": "Company:company:default_currency", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "brand", - "fieldtype": "Link", - "hidden": 1, - "label": "Brand", - "oldfieldname": "brand", - "oldfieldtype": "Link", - "options": "Brand", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "item_group", - "fieldtype": "Link", - "hidden": 1, - "label": "Item Group", - "oldfieldname": "item_group", - "oldfieldtype": "Link", - "options": "Item Group", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "rm_supp_cost", - "fieldtype": "Currency", - "hidden": 1, - "label": "Raw Materials Supplied Cost", - "no_copy": 1, - "oldfieldname": "rm_supp_cost", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "width": "150px" - }, - { - "fieldname": "item_tax_amount", - "fieldtype": "Currency", - "hidden": 1, - "label": "Item Tax Amount Included in Value", - "no_copy": 1, - "oldfieldname": "item_tax_amount", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "width": "150px" - }, - { - "allow_on_submit": 1, - "fieldname": "valuation_rate", - "fieldtype": "Currency", - "hidden": 1, - "label": "Valuation Rate", - "no_copy": 1, - "oldfieldname": "valuation_rate", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1, - "print_width": "80px", - "read_only": 1, - "width": "80px" - }, - { - "description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges", - "fieldname": "item_tax_rate", - "fieldtype": "Code", - "hidden": 1, - "label": "Item Tax Rate", - "oldfieldname": "item_tax_rate", - "oldfieldtype": "Small Text", - "print_hide": 1, - "read_only": 1, - "report_hide": 1 - }, - { - "allow_on_submit": 1, - "default": "0", - "fieldname": "page_break", - "fieldtype": "Check", - "label": "Page Break", - "oldfieldname": "page_break", - "oldfieldtype": "Check", - "print_hide": 1 - }, - { - "fieldname": "section_break_80", - "fieldtype": "Section Break" - }, - { - "collapsible": 1, - "fieldname": "image_section", - "fieldtype": "Section Break", - "label": "Image" - }, - { - "fieldname": "material_request", - "fieldtype": "Link", - "label": "Material Request", - "options": "Material Request" - }, - { - "fieldname": "material_request_item", - "fieldtype": "Data", - "label": "Material Request Item" - }, - { - "fieldname": "expense_account", - "fieldtype": "Link", - "hidden": 1, - "label": "Expense Account", - "options": "Account", - "read_only": 1 - }, - { - "fieldname": "accounting_dimensions_section", - "fieldtype": "Section Break", - "label": "Accounting Dimensions" - }, - { - "fieldname": "dimension_col_break", - "fieldtype": "Column Break" - }, - { - "collapsible": 1, - "fieldname": "manufacture_details", - "fieldtype": "Section Break", - "label": "Manufacture" - }, - { - "fieldname": "manufacturer", - "fieldtype": "Link", - "label": "Manufacturer", - "options": "Manufacturer" - }, - { - "fieldname": "column_break_16", - "fieldtype": "Column Break" - }, - { - "fieldname": "manufacturer_part_no", - "fieldtype": "Data", - "label": "Manufacturer Part Number", - "read_only": 1 - } - ], - "idx": 1, - "istable": 1, - "modified": "2019-06-02 06:37:48.198745", - "modified_by": "Administrator", - "module": "Stock", - "name": "Purchase Receipt Item", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC" - } \ No newline at end of file + "autoname": "hash", + "creation": "2013-05-24 19:29:10", + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "barcode", + "section_break_2", + "item_code", + "supplier_part_no", + "column_break_2", + "item_name", + "section_break_4", + "description", + "item_group", + "brand", + "image_section", + "image", + "image_view", + "manufacture_details", + "manufacturer", + "column_break_16", + "manufacturer_part_no", + "received_and_accepted", + "received_qty", + "qty", + "rejected_qty", + "col_break2", + "uom", + "stock_uom", + "conversion_factor", + "retain_sample", + "sample_quantity", + "rate_and_amount", + "price_list_rate", + "discount_percentage", + "discount_amount", + "col_break3", + "base_price_list_rate", + "sec_break1", + "rate", + "amount", + "col_break4", + "base_rate", + "base_amount", + "pricing_rules", + "is_free_item", + "section_break_29", + "net_rate", + "net_amount", + "item_tax_template", + "column_break_32", + "base_net_rate", + "base_net_amount", + "valuation_rate", + "item_tax_amount", + "rm_supp_cost", + "landed_cost_voucher_amount", + "billed_amt", + "item_weight_details", + "weight_per_unit", + "total_weight", + "column_break_41", + "weight_uom", + "warehouse_and_reference", + "warehouse", + "rejected_warehouse", + "quality_inspection", + "purchase_order", + "material_request", + "purchase_order_item", + "material_request_item", + "column_break_40", + "is_fixed_asset", + "asset", + "asset_location", + "schedule_date", + "stock_qty", + "section_break_45", + "serial_no", + "batch_no", + "column_break_48", + "rejected_serial_no", + "expense_account", + "col_break5", + "allow_zero_valuation_rate", + "bom", + "include_exploded_items", + "item_tax_rate", + "accounting_dimensions_section", + "project", + "dimension_col_break", + "cost_center", + "section_break_80", + "page_break" + ], + "fields": [ + { + "fieldname": "barcode", + "fieldtype": "Data", + "label": "Barcode" + }, + { + "fieldname": "section_break_2", + "fieldtype": "Section Break" + }, + { + "bold": 1, + "columns": 3, + "fieldname": "item_code", + "fieldtype": "Link", + "in_global_search": 1, + "in_list_view": 1, + "label": "Item Code", + "oldfieldname": "item_code", + "oldfieldtype": "Link", + "options": "Item", + "print_width": "100px", + "reqd": 1, + "search_index": 1, + "width": "100px" + }, + { + "fieldname": "supplier_part_no", + "fieldtype": "Data", + "hidden": 1, + "label": "Supplier Part Number", + "read_only": 1 + }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "item_name", + "fieldtype": "Data", + "in_global_search": 1, + "label": "Item Name", + "oldfieldname": "item_name", + "oldfieldtype": "Data", + "print_hide": 1, + "reqd": 1 + }, + { + "collapsible": 1, + "fieldname": "section_break_4", + "fieldtype": "Section Break", + "label": "Description" + }, + { + "fieldname": "description", + "fieldtype": "Text Editor", + "label": "Description", + "oldfieldname": "description", + "oldfieldtype": "Text", + "print_width": "300px", + "reqd": 1, + "width": "300px" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "print_hide": 1 + }, + { + "fieldname": "received_and_accepted", + "fieldtype": "Section Break", + "label": "Received and Accepted" + }, + { + "bold": 1, + "fieldname": "received_qty", + "fieldtype": "Float", + "label": "Received Quantity", + "oldfieldname": "received_qty", + "oldfieldtype": "Currency", + "print_hide": 1, + "print_width": "100px", + "reqd": 1, + "width": "100px" + }, + { + "columns": 2, + "fieldname": "qty", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Accepted Quantity", + "oldfieldname": "qty", + "oldfieldtype": "Currency", + "print_width": "100px", + "width": "100px" + }, + { + "fieldname": "rejected_qty", + "fieldtype": "Float", + "label": "Rejected Quantity", + "oldfieldname": "rejected_qty", + "oldfieldtype": "Currency", + "print_hide": 1, + "print_width": "100px", + "width": "100px" + }, + { + "fieldname": "col_break2", + "fieldtype": "Column Break", + "print_hide": 1 + }, + { + "fieldname": "uom", + "fieldtype": "Link", + "label": "UOM", + "oldfieldname": "uom", + "oldfieldtype": "Link", + "options": "UOM", + "print_hide": 1, + "print_width": "100px", + "reqd": 1, + "width": "100px" + }, + { + "fieldname": "stock_uom", + "fieldtype": "Link", + "label": "Stock UOM", + "oldfieldname": "stock_uom", + "oldfieldtype": "Data", + "options": "UOM", + "print_hide": 1, + "print_width": "100px", + "read_only": 1, + "reqd": 1, + "width": "100px" + }, + { + "fieldname": "conversion_factor", + "fieldtype": "Float", + "label": "Conversion Factor", + "oldfieldname": "conversion_factor", + "oldfieldtype": "Currency", + "print_hide": 1, + "print_width": "100px", + "reqd": 1, + "width": "100px" + }, + { + "default": "0", + "fetch_from": "item_code.retain_sample", + "fieldname": "retain_sample", + "fieldtype": "Check", + "label": "Retain Sample", + "read_only": 1 + }, + { + "depends_on": "retain_sample", + "fetch_from": "item_code.sample_quantity", + "fieldname": "sample_quantity", + "fieldtype": "Int", + "label": "Sample Quantity" + }, + { + "fieldname": "rate_and_amount", + "fieldtype": "Section Break", + "label": "Rate and Amount" + }, + { + "fieldname": "price_list_rate", + "fieldtype": "Currency", + "label": "Price List Rate", + "options": "currency", + "print_hide": 1 + }, + { + "depends_on": "price_list_rate", + "fieldname": "discount_percentage", + "fieldtype": "Percent", + "label": "Discount on Price List Rate (%)", + "print_hide": 1 + }, + { + "depends_on": "price_list_rate", + "fieldname": "discount_amount", + "fieldtype": "Currency", + "label": "Discount Amount", + "options": "currency" + }, + { + "fieldname": "col_break3", + "fieldtype": "Column Break" + }, + { + "fieldname": "base_price_list_rate", + "fieldtype": "Currency", + "label": "Price List Rate (Company Currency)", + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "sec_break1", + "fieldtype": "Section Break" + }, + { + "bold": 1, + "columns": 3, + "fieldname": "rate", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Rate", + "oldfieldname": "import_rate", + "oldfieldtype": "Currency", + "options": "currency", + "print_width": "100px", + "width": "100px" + }, + { + "fieldname": "amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amount", + "oldfieldname": "import_amount", + "oldfieldtype": "Currency", + "options": "currency", + "read_only": 1 + }, + { + "fieldname": "col_break4", + "fieldtype": "Column Break" + }, + { + "fieldname": "base_rate", + "fieldtype": "Currency", + "label": "Rate (Company Currency)", + "oldfieldname": "purchase_rate", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1, + "print_width": "100px", + "read_only": 1, + "reqd": 1, + "width": "100px" + }, + { + "fieldname": "base_amount", + "fieldtype": "Currency", + "label": "Amount (Company Currency)", + "oldfieldname": "amount", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1, + "print_width": "100px", + "read_only": 1, + "width": "100px" + }, + { + "fieldname": "pricing_rules", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Pricing Rules", + "print_hide": 1, + "read_only": 1 + }, + { + "default": "0", + "fieldname": "is_free_item", + "fieldtype": "Check", + "label": "Is Free Item", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "section_break_29", + "fieldtype": "Section Break" + }, + { + "fieldname": "net_rate", + "fieldtype": "Currency", + "label": "Net Rate", + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, + { + "columns": 2, + "fieldname": "net_amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Net Amount", + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_32", + "fieldtype": "Column Break" + }, + { + "fieldname": "base_net_rate", + "fieldtype": "Currency", + "label": "Net Rate (Company Currency)", + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "base_net_amount", + "fieldtype": "Currency", + "label": "Net Amount (Company Currency)", + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "collapsible": 1, + "fieldname": "item_weight_details", + "fieldtype": "Section Break", + "label": "Item Weight Details" + }, + { + "fieldname": "weight_per_unit", + "fieldtype": "Float", + "label": "Weight Per Unit" + }, + { + "fieldname": "total_weight", + "fieldtype": "Float", + "label": "Total Weight", + "read_only": 1 + }, + { + "fieldname": "column_break_41", + "fieldtype": "Column Break" + }, + { + "fieldname": "weight_uom", + "fieldtype": "Link", + "label": "Weight UOM", + "options": "UOM" + }, + { + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "label": "Warehouse and Reference" + }, + { + "bold": 1, + "fieldname": "warehouse", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Accepted Warehouse", + "oldfieldname": "warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "print_hide": 1, + "print_width": "100px", + "width": "100px" + }, + { + "fieldname": "rejected_warehouse", + "fieldtype": "Link", + "label": "Rejected Warehouse", + "no_copy": 1, + "oldfieldname": "rejected_warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "print_hide": 1, + "print_width": "100px", + "width": "100px" + }, + { + "depends_on": "eval:!doc.__islocal", + "fieldname": "quality_inspection", + "fieldtype": "Link", + "label": "Quality Inspection", + "no_copy": 1, + "oldfieldname": "qa_no", + "oldfieldtype": "Link", + "options": "Quality Inspection", + "print_hide": 1 + }, + { + "fieldname": "column_break_40", + "fieldtype": "Column Break" + }, + { + "default": "0", + "fieldname": "is_fixed_asset", + "fieldtype": "Check", + "hidden": 1, + "label": "Is Fixed Asset", + "no_copy": 1, + "print_hide": 1, + "read_only": 1 + }, + { + "depends_on": "is_fixed_asset", + "fieldname": "asset", + "fieldtype": "Link", + "label": "Asset", + "no_copy": 1, + "options": "Asset" + }, + { + "depends_on": "is_fixed_asset", + "fieldname": "asset_location", + "fieldtype": "Link", + "label": "Asset Location", + "options": "Location" + }, + { + "fieldname": "purchase_order", + "fieldtype": "Link", + "label": "Purchase Order", + "no_copy": 1, + "oldfieldname": "prevdoc_docname", + "oldfieldtype": "Link", + "options": "Purchase Order", + "print_width": "150px", + "read_only": 1, + "search_index": 1, + "width": "150px" + }, + { + "fieldname": "schedule_date", + "fieldtype": "Date", + "label": "Required By", + "oldfieldname": "schedule_date", + "oldfieldtype": "Date", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "stock_qty", + "fieldtype": "Float", + "label": "Qty as per Stock UOM", + "oldfieldname": "stock_qty", + "oldfieldtype": "Currency", + "print_hide": 1, + "print_width": "100px", + "read_only": 1, + "width": "100px" + }, + { + "fieldname": "section_break_45", + "fieldtype": "Section Break" + }, + { + "fieldname": "serial_no", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Serial No", + "no_copy": 1, + "oldfieldname": "serial_no", + "oldfieldtype": "Text" + }, + { + "fieldname": "batch_no", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Batch No", + "no_copy": 1, + "oldfieldname": "batch_no", + "oldfieldtype": "Link", + "options": "Batch", + "print_hide": 1 + }, + { + "fieldname": "column_break_48", + "fieldtype": "Column Break" + }, + { + "fieldname": "rejected_serial_no", + "fieldtype": "Small Text", + "label": "Rejected Serial No", + "no_copy": 1, + "print_hide": 1 + }, + { + "fieldname": "item_tax_template", + "fieldtype": "Link", + "label": "Item Tax Template", + "options": "Item Tax Template", + "print_hide": 1 + }, + { + "fieldname": "project", + "fieldtype": "Link", + "label": "Project", + "options": "Project", + "print_hide": 1 + }, + { + "default": ":Company", + "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))", + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "options": "Cost Center", + "print_hide": 1 + }, + { + "fieldname": "purchase_order_item", + "fieldtype": "Data", + "hidden": 1, + "label": "Purchase Order Item", + "no_copy": 1, + "oldfieldname": "prevdoc_detail_docname", + "oldfieldtype": "Data", + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "search_index": 1, + "width": "150px" + }, + { + "fieldname": "col_break5", + "fieldtype": "Column Break" + }, + { + "default": "0", + "fieldname": "allow_zero_valuation_rate", + "fieldtype": "Check", + "label": "Allow Zero Valuation Rate", + "no_copy": 1, + "print_hide": 1 + }, + { + "fieldname": "bom", + "fieldtype": "Link", + "label": "BOM", + "no_copy": 1, + "options": "BOM", + "print_hide": 1 + }, + { + "default": "0", + "depends_on": "eval:parent.is_subcontracted == 'Yes'", + "fieldname": "include_exploded_items", + "fieldtype": "Check", + "label": "Include Exploded Items", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "billed_amt", + "fieldtype": "Currency", + "label": "Billed Amt", + "no_copy": 1, + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "fieldname": "landed_cost_voucher_amount", + "fieldtype": "Currency", + "label": "Landed Cost Voucher Amount", + "no_copy": 1, + "options": "Company:company:default_currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "brand", + "fieldtype": "Link", + "hidden": 1, + "label": "Brand", + "oldfieldname": "brand", + "oldfieldtype": "Link", + "options": "Brand", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "item_group", + "fieldtype": "Link", + "hidden": 1, + "label": "Item Group", + "oldfieldname": "item_group", + "oldfieldtype": "Link", + "options": "Item Group", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "rm_supp_cost", + "fieldtype": "Currency", + "hidden": 1, + "label": "Raw Materials Supplied Cost", + "no_copy": 1, + "oldfieldname": "rm_supp_cost", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "width": "150px" + }, + { + "fieldname": "item_tax_amount", + "fieldtype": "Currency", + "hidden": 1, + "label": "Item Tax Amount Included in Value", + "no_copy": 1, + "oldfieldname": "item_tax_amount", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "width": "150px" + }, + { + "allow_on_submit": 1, + "fieldname": "valuation_rate", + "fieldtype": "Currency", + "hidden": 1, + "label": "Valuation Rate", + "no_copy": 1, + "oldfieldname": "valuation_rate", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1, + "print_width": "80px", + "read_only": 1, + "width": "80px" + }, + { + "description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges", + "fieldname": "item_tax_rate", + "fieldtype": "Code", + "hidden": 1, + "label": "Item Tax Rate", + "oldfieldname": "item_tax_rate", + "oldfieldtype": "Small Text", + "print_hide": 1, + "read_only": 1, + "report_hide": 1 + }, + { + "allow_on_submit": 1, + "default": "0", + "fieldname": "page_break", + "fieldtype": "Check", + "label": "Page Break", + "oldfieldname": "page_break", + "oldfieldtype": "Check", + "print_hide": 1 + }, + { + "fieldname": "section_break_80", + "fieldtype": "Section Break" + }, + { + "collapsible": 1, + "fieldname": "image_section", + "fieldtype": "Section Break", + "label": "Image" + }, + { + "fieldname": "material_request", + "fieldtype": "Link", + "label": "Material Request", + "options": "Material Request" + }, + { + "fieldname": "material_request_item", + "fieldtype": "Data", + "label": "Material Request Item" + }, + { + "fieldname": "expense_account", + "fieldtype": "Link", + "hidden": 1, + "label": "Expense Account", + "options": "Account", + "read_only": 1 + }, + { + "fieldname": "accounting_dimensions_section", + "fieldtype": "Section Break", + "label": "Accounting Dimensions" + }, + { + "fieldname": "dimension_col_break", + "fieldtype": "Column Break" + }, + { + "collapsible": 1, + "fieldname": "manufacture_details", + "fieldtype": "Section Break", + "label": "Manufacture" + }, + { + "fieldname": "manufacturer", + "fieldtype": "Link", + "label": "Manufacturer", + "options": "Manufacturer" + }, + { + "fieldname": "column_break_16", + "fieldtype": "Column Break" + }, + { + "fieldname": "manufacturer_part_no", + "fieldtype": "Data", + "label": "Manufacturer Part Number", + "read_only": 1 + } + ], + "idx": 1, + "istable": 1, + "modified": "2019-09-17 22:33:01.109004", + "modified_by": "Administrator", + "module": "Stock", + "name": "Purchase Receipt Item", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index 409a864678f..19eb398130c 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -362,6 +362,7 @@ def auto_make_serial_nos(args): sr.batch_no = args.get('batch_no') sr.location = args.get('location') sr.company = args.get('company') + sr.supplier = args.get('supplier') if sr.sales_order and args.get('voucher_type') == "Stock Entry" \ and not args.get('actual_qty', 0) > 0: sr.sales_order = None @@ -396,10 +397,12 @@ def make_serial_no(serial_no, args): sr.via_stock_ledger = args.get('via_stock_ledger') or True sr.asset = args.get('asset') sr.location = args.get('location') + if args.get('purchase_document_type'): sr.purchase_document_type = args.get('purchase_document_type') sr.purchase_document_no = args.get('purchase_document_no') + sr.supplier = args.get('supplier') sr.insert() if args.get('warehouse'): diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index b810e3594cf..69c624b7a73 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -539,6 +539,21 @@ class StockEntry(StockController): total_allowed = required_qty + (required_qty * (qty_allowance/100)) + if not required_qty: + bom_no = frappe.db.get_value("Purchase Order Item", + {"parent": self.purchase_order, "item_code": se_item.subcontracted_item}, + "bom") + + allow_alternative_item = frappe.get_value("BOM", bom_no, "allow_alternative_item") + + if allow_alternative_item: + original_item_code = frappe.get_value("Item Alternative", {"alternative_item_code": item_code}, "item_code") + + required_qty = sum([flt(d.required_qty) for d in purchase_order.supplied_items \ + if d.rm_item_code == original_item_code]) + + total_allowed = required_qty + (required_qty * (qty_allowance/100)) + if not required_qty: frappe.throw(_("Item {0} not found in 'Raw Materials Supplied' table in Purchase Order {1}") .format(se_item.item_code, self.purchase_order)) diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py index d3862306874..5bdbca23d9f 100644 --- a/erpnext/stock/report/stock_ledger/stock_ledger.py +++ b/erpnext/stock/report/stock_ledger/stock_ledger.py @@ -107,7 +107,7 @@ def get_item_details(items, sl_entries, include_uom): if include_uom: cf_field = ", ucd.conversion_factor" cf_join = "left join `tabUOM Conversion Detail` ucd on ucd.parent=item.name and ucd.uom='%s'" \ - % frappe.db.escape(include_uom) + % (include_uom) res = frappe.db.sql(""" select diff --git a/erpnext/stock/stock_balance.py b/erpnext/stock/stock_balance.py index d68f97917ff..e5dc6b12df7 100644 --- a/erpnext/stock/stock_balance.py +++ b/erpnext/stock/stock_balance.py @@ -3,10 +3,10 @@ from __future__ import print_function, unicode_literals import frappe - from frappe.utils import flt, cstr, nowdate, nowtime from erpnext.stock.utils import update_bin from erpnext.stock.stock_ledger import update_entries_after +from erpnext.controllers.stock_controller import update_gl_entries_after def repost(only_actual=False, allow_negative_stock=False, allow_zero_rate=False, only_bin=False): """ @@ -18,23 +18,29 @@ def repost(only_actual=False, allow_negative_stock=False, allow_zero_rate=False, existing_allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock") frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1) - for d in frappe.db.sql("""select distinct item_code, warehouse from - (select item_code, warehouse from tabBin - union - select item_code, warehouse from `tabStock Ledger Entry`) a"""): - try: - repost_stock(d[0], d[1], allow_zero_rate, only_actual, only_bin) - frappe.db.commit() - except: - frappe.db.rollback() + item_warehouses = frappe.db.sql(""" + select distinct item_code, warehouse + from + (select item_code, warehouse from tabBin + union + select item_code, warehouse from `tabStock Ledger Entry`) a + """) + for d in item_warehouses: + try: + repost_stock(d[0], d[1], allow_zero_rate, only_actual, only_bin, allow_negative_stock) + frappe.db.commit() + except: + frappe.db.rollback() if allow_negative_stock: frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock) frappe.db.auto_commit_on_many_writes = 0 -def repost_stock(item_code, warehouse, allow_zero_rate=False, only_actual=False, only_bin=False): +def repost_stock(item_code, warehouse, allow_zero_rate=False, + only_actual=False, only_bin=False, allow_negative_stock=False): + if not only_bin: - repost_actual_qty(item_code, warehouse, allow_zero_rate) + repost_actual_qty(item_code, warehouse, allow_zero_rate, allow_negative_stock) if item_code and warehouse and not only_actual: qty_dict = { @@ -50,11 +56,8 @@ def repost_stock(item_code, warehouse, allow_zero_rate=False, only_actual=False, update_bin_qty(item_code, warehouse, qty_dict) -def repost_actual_qty(item_code, warehouse, allow_zero_rate=False): - try: - update_entries_after({ "item_code": item_code, "warehouse": warehouse }, allow_zero_rate) - except: - pass +def repost_actual_qty(item_code, warehouse, allow_zero_rate=False, allow_negative_stock=False): update_entries_after({ "item_code": item_code, "warehouse": warehouse }, + allow_zero_rate=allow_zero_rate, allow_negative_stock=allow_negative_stock) def get_balance_qty_from_sle(item_code, warehouse): balance_qty = frappe.db.sql("""select qty_after_transaction from `tabStock Ledger Entry` @@ -227,39 +230,14 @@ def reset_serial_no_status_and_warehouse(serial_nos=None): except: pass -def repost_all_stock_vouchers(): - warehouses_with_account = frappe.db.sql_list("""select warehouse from tabAccount - where ifnull(account_type, '') = 'Stock' and (warehouse is not null and warehouse != '') - and is_group=0""") +def repost_gle_for_stock_transactions(posting_date=None, posting_time=None, for_warehouses=None): + frappe.db.auto_commit_on_many_writes = 1 - vouchers = frappe.db.sql("""select distinct voucher_type, voucher_no - from `tabStock Ledger Entry` sle - where voucher_type != "Serial No" and sle.warehouse in (%s) - order by posting_date, posting_time, creation""" % - ', '.join(['%s']*len(warehouses_with_account)), tuple(warehouses_with_account)) + if not posting_date: + posting_date = "1900-01-01" + if not posting_time: + posting_time = "00:00" - rejected = [] - i = 0 - for voucher_type, voucher_no in vouchers: - i+=1 - print(i, "/", len(vouchers), voucher_type, voucher_no) - try: - for dt in ["Stock Ledger Entry", "GL Entry"]: - frappe.db.sql("""delete from `tab%s` where voucher_type=%s and voucher_no=%s"""% - (dt, '%s', '%s'), (voucher_type, voucher_no)) + update_gl_entries_after(posting_date, posting_time, for_warehouses=for_warehouses) - doc = frappe.get_doc(voucher_type, voucher_no) - if voucher_type=="Stock Entry" and doc.purpose in ["Manufacture", "Repack"]: - doc.calculate_rate_and_amount(force=1) - elif voucher_type=="Purchase Receipt" and doc.is_subcontracted == "Yes": - doc.validate() - - doc.update_stock_ledger() - doc.make_gl_entries(repost_future_gle=False) - frappe.db.commit() - except Exception: - print(frappe.get_traceback()) - rejected.append([voucher_type, voucher_no]) - frappe.db.rollback() - - print(rejected) + frappe.db.auto_commit_on_many_writes = 0 diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py index 4c663e393fb..2ac0bae6dac 100644 --- a/erpnext/stock/utils.py +++ b/erpnext/stock/utils.py @@ -253,31 +253,40 @@ def update_included_uom_in_report(columns, result, include_uom, conversion_facto return convertible_cols = {} - for col_idx in reversed(range(0, len(columns))): - col = columns[col_idx] - if isinstance(col, dict) and col.get("convertible") in ['rate', 'qty']: - convertible_cols[col_idx] = col['convertible'] - columns.insert(col_idx+1, col.copy()) - columns[col_idx+1]['fieldname'] += "_alt" - if convertible_cols[col_idx] == 'rate': - columns[col_idx+1]['label'] += " (per {})".format(include_uom) - else: - columns[col_idx+1]['label'] += " ({})".format(include_uom) + + is_dict_obj = False + if isinstance(result[0], dict): + is_dict_obj = True + + convertible_columns = {} + for idx, d in enumerate(columns): + key = d.get("fieldname") if is_dict_obj else idx + if d.get("convertible"): + convertible_columns.setdefault(key, d.get("convertible")) + + # Add new column to show qty/rate as per the selected UOM + columns.insert(idx+1, { + 'label': "{0} (per {1})".format(d.get("label"), include_uom), + 'fieldname': "{0}_{1}".format(d.get("fieldname"), frappe.scrub(include_uom)), + 'fieldtype': 'Currency' if d.get("convertible") == 'rate' else 'Float' + }) for row_idx, row in enumerate(result): - new_row = [] - for col_idx, d in enumerate(row): - new_row.append(d) - if col_idx in convertible_cols: - if conversion_factors[row_idx]: - if convertible_cols[col_idx] == 'rate': - new_row.append(flt(d) * conversion_factors[row_idx]) - else: - new_row.append(flt(d) / conversion_factors[row_idx]) - else: - new_row.append(None) + data = row.items() if is_dict_obj else enumerate(row) + for key, value in data: + if not key in convertible_columns or not conversion_factors[row_idx]: + continue - result[row_idx] = new_row + if convertible_columns.get(key) == 'rate': + new_value = flt(value) * conversion_factors[row_idx] + else: + new_value = flt(value) / conversion_factors[row_idx] + + if not is_dict_obj: + row.insert(key+1, new_value) + else: + new_key = "{0}_{1}".format(key, frappe.scrub(include_uom)) + row[new_key] = new_value def get_available_serial_nos(item_code, warehouse): return frappe.get_all("Serial No", filters = {'item_code': item_code, diff --git a/erpnext/templates/includes/footer/footer_powered.html b/erpnext/templates/includes/footer/footer_powered.html index d4deaaef688..cf7661ee3fa 100644 --- a/erpnext/templates/includes/footer/footer_powered.html +++ b/erpnext/templates/includes/footer/footer_powered.html @@ -1,3 +1,18 @@ {% set domains = frappe.get_doc("Domain Settings").active_domains %} +{% set links = { + 'Manufacturing': '/manufacturing', + 'Services': '/services', + 'Retail': '/retail', + 'Distribution': '/distribution', + 'Non Profit': '/non-profit', + 'Education': '/education', + 'Healthcare': '/healthcare', + 'Agriculture': '/agriculture', + 'Hospitality': '' +} %} +{% set link = '' %} +{% if domains %} + {% set link = links[domains[0].domain] %} +{% endif %} -Powered by ERPNext - ERP Software {{ ('for ' + domains[0].domain + ' Companies') if domains else '' }} +Powered by ERPNext - {{ '' if domains else 'Open Source' }} ERP Software {{ ('for ' + domains[0].domain + ' Companies') if domains else '' }} diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 7024b0db92a..dfd3ed76bcb 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -10,27 +10,32 @@ def create_test_contact_and_address(): frappe.db.sql('delete from tabAddress') frappe.db.sql('delete from `tabDynamic Link`') - frappe.get_doc(dict( - doctype='Address', - address_title='_Test Address for Customer', - address_type='Office', - address_line1='Station Road', - city='_Test City', - state='Test State', - country='India', - links = [dict( - link_doctype='Customer', - link_name='_Test Customer' - )] - )).insert() + frappe.get_doc({ + "doctype": "Address", + "address_title": "_Test Address for Customer", + "address_type": "Office", + "address_line1": "Station Road", + "city": "_Test City", + "state": "Test State", + "country": "India", + "links": [ + { + "link_doctype": "Customer", + "link_name": "_Test Customer" + } + ] + }).insert() - frappe.get_doc(dict( - doctype='Contact', - email_id='test_contact_customer@example.com', - phone='+91 0000000000', - first_name='_Test Contact for _Test Customer', - links = [dict( - link_doctype='Customer', - link_name='_Test Customer' - )] - )).insert() + contact = frappe.get_doc({ + "doctype": 'Contact', + "first_name": "_Test Contact for _Test Customer", + "links": [ + { + "link_doctype": "Customer", + "link_name": "_Test Customer" + } + ] + }) + contact.add_email("test_contact_customer@example.com", is_primary=True) + contact.add_phone("+91 0000000000", is_primary_phone=True) + contact.insert() diff --git a/erpnext/utilities/page/leaderboard/__init__.py b/erpnext/utilities/page/leaderboard/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/utilities/page/leaderboard/leaderboard.css b/erpnext/utilities/page/leaderboard/leaderboard.css deleted file mode 100644 index 1f4fc5159ae..00000000000 --- a/erpnext/utilities/page/leaderboard/leaderboard.css +++ /dev/null @@ -1,54 +0,0 @@ -.list-filters { - overflow-y: hidden; - padding: 5px -} - -.list-filter-item { - min-width: 150px; - float: left; - margin:5px; -} - -.list-item_content{ - flex: 1; - padding-right: 15px; - align-items: center; -} - -.select-time, .select-doctype, .select-filter, .select-sort { - background: #f0f4f7; -} - -.select-time:focus, .select-doctype:focus, .select-filter:focus, .select-sort:focus { - background: #f0f4f7; -} - -.header-btn-base{ - border:none; - outline:0; - vertical-align:middle; - overflow:hidden; - text-decoration:none; - color:inherit; - background-color:inherit; - cursor:pointer; - white-space:nowrap; -} - -.header-btn-grey,.header-btn-grey:hover{ - color:#000!important; - background-color:#bbb!important -} - -.header-btn-round{ - border-radius:4px -} - -.item-title-bold{ - font-weight: bold; -} - -/* -.header-btn-base:hover { - box-shadow:0 8px 16px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19) -}*/ diff --git a/erpnext/utilities/page/leaderboard/leaderboard.js b/erpnext/utilities/page/leaderboard/leaderboard.js deleted file mode 100644 index 43d0e6e948c..00000000000 --- a/erpnext/utilities/page/leaderboard/leaderboard.js +++ /dev/null @@ -1,307 +0,0 @@ -frappe.pages["leaderboard"].on_page_load = function (wrapper) { - frappe.leaderboard = new frappe.Leaderboard(wrapper); -} - -frappe.Leaderboard = Class.extend({ - - init: function (parent) { - frappe.ui.make_app_page({ - parent: parent, - title: "Leaderboard", - single_column: false - }); - - this.parent = parent; - this.page = this.parent.page; - this.page.sidebar.html(``); - this.$sidebar_list = this.page.sidebar.find('ul'); - - // const list of doctypes - this.doctypes = ["Customer", "Item", "Supplier", "Sales Partner","Sales Person"]; - this.timespans = ["Week", "Month", "Quarter", "Year"]; - this.filters = { - "Customer": ["total_sales_amount", "total_qty_sold", "outstanding_amount", ], - "Item": ["total_sales_amount", "total_qty_sold", "total_purchase_amount", - "total_qty_purchased", "available_stock_qty", "available_stock_value"], - "Supplier": ["total_purchase_amount", "total_qty_purchased", "outstanding_amount"], - "Sales Partner": ["total_sales_amount", "total_commission"], - "Sales Person": ["total_sales_amount"], - }; - - // for saving current selected filters - // TODO: revert to 0 index for doctype and timespan, and remove preset down - const _initial_doctype = this.doctypes[0]; - const _initial_timespan = this.timespans[0]; - const _initial_filter = this.filters[_initial_doctype]; - - this.options = { - selected_doctype: _initial_doctype, - selected_filter: _initial_filter, - selected_filter_item: _initial_filter[0], - selected_timespan: _initial_timespan, - }; - - this.message = null; - this.make(); - }, - - make: function () { - var me = this; - - var $container = $(`
-
-
-
`).appendTo(this.page.main); - - this.$graph_area = $container.find('.leaderboard-graph'); - - this.doctypes.map(doctype => { - this.get_sidebar_item(doctype).appendTo(this.$sidebar_list); - }); - - this.company_select = this.page.add_field({ - fieldname: 'company', - label: __('Company'), - fieldtype:'Link', - options:'Company', - default:frappe.defaults.get_default('company'), - reqd: 1, - change: function() { - me.options.selected_company = this.value; - me.make_request($container); - } - }); - this.timespan_select = this.page.add_select(__("Timespan"), - this.timespans.map(d => { - return {"label": __(d), value: d } - }) - ); - - this.type_select = this.page.add_select(__("Type"), - me.options.selected_filter.map(d => { - return {"label": __(frappe.model.unscrub(d)), value: d } - }) - ); - - this.$sidebar_list.on('click', 'li', function(e) { - let $li = $(this); - let doctype = $li.find('span').attr("doctype-value"); - - me.options.selected_company = frappe.defaults.get_default('company'); - me.options.selected_doctype = doctype; - me.options.selected_filter = me.filters[doctype]; - me.options.selected_filter_item = me.filters[doctype][0]; - - me.type_select.empty().add_options( - me.options.selected_filter.map(d => { - return {"label": __(frappe.model.unscrub(d)), value: d } - }) - ); - - me.$sidebar_list.find('li').removeClass('active'); - $li.addClass('active'); - - me.make_request($container); - }); - - this.timespan_select.on("change", function() { - me.options.selected_timespan = this.value; - me.make_request($container); - }); - - this.type_select.on("change", function() { - me.options.selected_filter_item = this.value - me.make_request($container); - }); - - // now get leaderboard - this.$sidebar_list.find('li:first').trigger('click'); - }, - - make_request: function ($container) { - var me = this; - - frappe.model.with_doctype(me.options.selected_doctype, function () { - me.get_leaderboard(me.get_leaderboard_data, $container); - }); - }, - - get_leaderboard: function (notify, $container) { - var me = this; - if(!me.options.selected_company) { - frappe.throw(__("Please select Company")); - } - frappe.call({ - method: "erpnext.utilities.page.leaderboard.leaderboard.get_leaderboard", - args: { - doctype: me.options.selected_doctype, - timespan: me.options.selected_timespan, - company: me.options.selected_company, - field: me.options.selected_filter_item, - }, - callback: function (r) { - let results = r.message || []; - - let graph_items = results.slice(0, 10); - - me.$graph_area.show().empty(); - let args = { - data: { - datasets: [ - { - values: graph_items.map(d=>d.value) - } - ], - labels: graph_items.map(d=>d.name) - }, - colors: ['light-green'], - format_tooltip_x: d=>d[me.options.selected_filter_item], - type: 'bar', - height: 140 - }; - new frappe.Chart('.leaderboard-graph', args); - - notify(me, r, $container); - } - }); - }, - - get_leaderboard_data: function (me, res, $container) { - if (res && res.message) { - me.message = null; - $container.find(".leaderboard-list").html(me.render_list_view(res.message)); - } else { - me.$graph_area.hide(); - me.message = __("No items found."); - $container.find(".leaderboard-list").html(me.render_list_view()); - } - }, - - render_list_view: function (items = []) { - var me = this; - - var html = - `${me.render_message()} -
- ${me.render_result(items)} -
`; - - return $(html); - }, - - render_result: function (items) { - var me = this; - - var html = - `${me.render_list_header()} - ${me.render_list_result(items)}`; - - return html; - }, - - render_list_header: function () { - var me = this; - const _selected_filter = me.options.selected_filter - .map(i => frappe.model.unscrub(i)); - const fields = ['name', me.options.selected_filter_item]; - - const html = - `
-
- ${ - fields.map(filter => { - const col = frappe.model.unscrub(filter); - return ( - `
- - ${col} - -
`); - }).join("") - } -
-
`; - return html; - }, - - render_list_result: function (items) { - var me = this; - - let _html = items.map((item, index) => { - const $value = $(me.get_item_html(item)); - - let item_class = ""; - if(index == 0) { - item_class = "first"; - } else if (index == 1) { - item_class = "second"; - } else if(index == 2) { - item_class = "third"; - } - const $item_container = $(`
`).append($value); - return $item_container[0].outerHTML; - }).join(""); - - let html = - `
-
- ${_html} -
-
`; - - return html; - }, - - render_message: function () { - var me = this; - - let html = - `
-
-

No Item found

-
-
`; - - return html; - }, - - get_item_html: function (item) { - var me = this; - const company = me.options.selected_company; - const currency = frappe.get_doc(":Company", company).default_currency; - const fields = ['name','value']; - - const html = - `
- ${ - fields.map(col => { - let val = item[col]; - if(col=="name") { - var formatted_value = ` ${val} ` - } else { - var formatted_value = ` - ${(me.options.selected_filter_item.indexOf('qty') == -1) ? format_currency(val, currency) : val}` - } - - return ( - `
- ${formatted_value} -
`); - }).join("") - } -
`; - - return html; - }, - - get_sidebar_item: function(item) { - return $(`
  • - - ${ __(item) } -
  • `); - } -}); diff --git a/erpnext/utilities/page/leaderboard/leaderboard.json b/erpnext/utilities/page/leaderboard/leaderboard.json deleted file mode 100644 index 8ccef7dcf68..00000000000 --- a/erpnext/utilities/page/leaderboard/leaderboard.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "content": null, - "creation": "2017-06-06 02:54:24.785360", - "docstatus": 0, - "doctype": "Page", - "idx": 0, - "modified": "2017-09-12 14:05:26.422064", - "modified_by": "Administrator", - "module": "Utilities", - "name": "leaderboard", - "owner": "Administrator", - "page_name": "leaderboard", - "roles": [], - "script": null, - "standard": "Yes", - "style": null, - "system_page": 0, - "title": "Leaderboard" -} \ No newline at end of file diff --git a/erpnext/utilities/page/leaderboard/leaderboard.py b/erpnext/utilities/page/leaderboard/leaderboard.py deleted file mode 100644 index 87cf2a43be3..00000000000 --- a/erpnext/utilities/page/leaderboard/leaderboard.py +++ /dev/null @@ -1,153 +0,0 @@ -# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors -# MIT License. See license.txt - -from __future__ import unicode_literals, print_function -import frappe -from frappe.utils import add_to_date - -@frappe.whitelist() -def get_leaderboard(doctype, timespan, company, field): - """return top 10 items for that doctype based on conditions""" - from_date = get_from_date(timespan) - records = [] - if doctype == "Customer": - records = get_all_customers(from_date, company, field) - elif doctype == "Item": - records = get_all_items(from_date, company, field) - elif doctype == "Supplier": - records = get_all_suppliers(from_date, company, field) - elif doctype == "Sales Partner": - records = get_all_sales_partner(from_date, company, field) - elif doctype == "Sales Person": - records = get_all_sales_person(from_date, company) - - return records - -def get_all_customers(from_date, company, field): - if field == "outstanding_amount": - return frappe.db.sql(""" - select customer as name, sum(outstanding_amount) as value - FROM `tabSales Invoice` - where docstatus = 1 and posting_date >= %s and company = %s - group by customer - order by value DESC - limit 20 - """, (from_date, company), as_dict=1) - else: - if field == "total_sales_amount": - select_field = "sum(so_item.base_net_amount)" - elif field == "total_qty_sold": - select_field = "sum(so_item.stock_qty)" - - return frappe.db.sql(""" - select so.customer as name, {0} as value - FROM `tabSales Order` as so JOIN `tabSales Order Item` as so_item - ON so.name = so_item.parent - where so.docstatus = 1 and so.transaction_date >= %s and so.company = %s - group by so.customer - order by value DESC - limit 20 - """.format(select_field), (from_date, company), as_dict=1) - -def get_all_items(from_date, company, field): - if field in ("available_stock_qty", "available_stock_value"): - return frappe.db.sql(""" - select item_code as name, {0} as value - from tabBin - group by item_code - order by value desc - limit 20 - """.format("sum(actual_qty)" if field=="available_stock_qty" else "sum(stock_value)"), as_dict=1) - else: - if field == "total_sales_amount": - select_field = "sum(order_item.base_net_amount)" - select_doctype = "Sales Order" - elif field == "total_purchase_amount": - select_field = "sum(order_item.base_net_amount)" - select_doctype = "Purchase Order" - elif field == "total_qty_sold": - select_field = "sum(order_item.stock_qty)" - select_doctype = "Sales Order" - elif field == "total_qty_purchased": - select_field = "sum(order_item.stock_qty)" - select_doctype = "Purchase Order" - - return frappe.db.sql(""" - select order_item.item_code as name, {0} as value - from `tab{1}` sales_order join `tab{1} Item` as order_item - on sales_order.name = order_item.parent - where sales_order.docstatus = 1 - and sales_order.company = %s and sales_order.transaction_date >= %s - group by order_item.item_code - order by value desc - limit 20 - """.format(select_field, select_doctype), (company, from_date), as_dict=1) - -def get_all_suppliers(from_date, company, field): - if field == "outstanding_amount": - return frappe.db.sql(""" - select supplier as name, sum(outstanding_amount) as value - FROM `tabPurchase Invoice` - where docstatus = 1 and posting_date >= %s and company = %s - group by supplier - order by value DESC - limit 20""", (from_date, company), as_dict=1) - else: - if field == "total_purchase_amount": - select_field = "sum(purchase_order_item.base_net_amount)" - elif field == "total_qty_purchased": - select_field = "sum(purchase_order_item.stock_qty)" - - return frappe.db.sql(""" - select purchase_order.supplier as name, {0} as value - FROM `tabPurchase Order` as purchase_order LEFT JOIN `tabPurchase Order Item` - as purchase_order_item ON purchase_order.name = purchase_order_item.parent - where purchase_order.docstatus = 1 and purchase_order.modified >= %s - and purchase_order.company = %s - group by purchase_order.supplier - order by value DESC - limit 20""".format(select_field), (from_date, company), as_dict=1) - -def get_all_sales_partner(from_date, company, field): - if field == "total_sales_amount": - select_field = "sum(base_net_total)" - elif field == "total_commission": - select_field = "sum(total_commission)" - - return frappe.db.sql(""" - select sales_partner as name, {0} as value - from `tabSales Order` - where ifnull(sales_partner, '') != '' and docstatus = 1 - and transaction_date >= %s and company = %s - group by sales_partner - order by value DESC - limit 20 - """.format(select_field), (from_date, company), as_dict=1) - -def get_all_sales_person(from_date, company): - return frappe.db.sql(""" - select sales_team.sales_person as name, sum(sales_order.base_net_total) as value - from `tabSales Order` as sales_order join `tabSales Team` as sales_team - on sales_order.name = sales_team.parent and sales_team.parenttype = 'Sales Order' - where sales_order.docstatus = 1 - and sales_order.transaction_date >= %s - and sales_order.company = %s - group by sales_team.sales_person - order by value DESC - limit 20 - """, (from_date, company), as_dict=1) - -def get_from_date(seleted_timespan): - """return string for ex:this week as date:string""" - days = months = years = 0 - if "month" == seleted_timespan.lower(): - months = -1 - elif "quarter" == seleted_timespan.lower(): - months = -3 - elif "year" == seleted_timespan.lower(): - years = -1 - else: - days = -7 - - return add_to_date(None, years=years, months=months, days=days, - as_string=True, as_datetime=True) \ No newline at end of file