Merge branch 'global_search_modules' of https://github.com/hrwx/erpnext into global_search_modules

This commit is contained in:
Himanshu Warekar 2019-10-02 16:34:19 +05:30
commit 2935751f75
27 changed files with 3114 additions and 2273 deletions

View File

@ -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"
}
}
}

View File

@ -38,13 +38,13 @@
"read_only": 1 "read_only": 1
}, },
{ {
"fetch_from": "sales_invoice.grand_total", "fetch_from": "sales_invoice.outstanding_amount",
"fetch_if_empty": 1,
"fieldname": "outstanding_amount", "fieldname": "outstanding_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Outstanding Amount", "label": "Outstanding Amount",
"options": "Company:company:default_currency", "options": "Company:company:default_currency"
"read_only": 1
}, },
{ {
"fieldname": "column_break_3", "fieldname": "column_break_3",
@ -60,7 +60,7 @@
} }
], ],
"istable": 1, "istable": 1,
"modified": "2019-08-07 15:13:55.808349", "modified": "2019-09-26 11:05:36.016772",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Discounted Invoice", "name": "Discounted Invoice",

View File

@ -97,7 +97,6 @@ frappe.ui.form.on('Invoice Discounting', {
} }
frm.set_value("total_amount", total_amount); frm.set_value("total_amount", total_amount);
}, },
get_invoices: (frm) => { get_invoices: (frm) => {
var d = new frappe.ui.Dialog({ var d = new frappe.ui.Dialog({
title: __('Get Invoices based on Filters'), title: __('Get Invoices based on Filters'),

View File

@ -27,13 +27,19 @@ class InvoiceDiscounting(AccountsController):
def validate_invoices(self): def validate_invoices(self):
discounted_invoices = [record.sales_invoice for record in discounted_invoices = [record.sales_invoice for record in
frappe.get_all("Discounted Invoice",fields = ["sales_invoice"], filters= {"docstatus":1})] frappe.get_all("Discounted Invoice",fields=["sales_invoice"], filters={"docstatus":1})]
for record in self.invoices: for record in self.invoices:
if record.sales_invoice in discounted_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))) .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): def calculate_total_amount(self):
self.total_amount = sum([flt(d.outstanding_amount) for d in self.invoices]) self.total_amount = sum([flt(d.outstanding_amount) for d in self.invoices])

View File

@ -4,6 +4,7 @@
"creation": "2013-05-21 16:16:39", "creation": "2013-05-21 16:16:39",
"doctype": "DocType", "doctype": "DocType",
"document_type": "Document", "document_type": "Document",
"engine": "InnoDB",
"field_order": [ "field_order": [
"title", "title",
"naming_series", "naming_series",
@ -1146,6 +1147,7 @@
"fieldname": "language", "fieldname": "language",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Print Language", "label": "Print Language",
"print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{ {
@ -1208,7 +1210,8 @@
"fieldtype": "Select", "fieldtype": "Select",
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Status", "label": "Status",
"options": "\nDraft\nReturn\nDebit Note Issued\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled" "options": "\nDraft\nReturn\nDebit Note Issued\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled",
"print_hide": 1
}, },
{ {
"fieldname": "inter_company_invoice_reference", "fieldname": "inter_company_invoice_reference",
@ -1284,7 +1287,7 @@
"icon": "fa fa-file-text", "icon": "fa fa-file-text",
"idx": 204, "idx": 204,
"is_submittable": 1, "is_submittable": 1,
"modified": "2019-06-18 22:04:28.889159", "modified": "2019-09-17 22:31:42.666601",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice", "name": "Purchase Invoice",
@ -1346,4 +1349,4 @@
"timeline_field": "supplier", "timeline_field": "supplier",
"title_field": "title", "title_field": "title",
"track_changes": 1 "track_changes": 1
} }

View File

@ -591,7 +591,6 @@
"oldfieldname": "purchase_order", "oldfieldname": "purchase_order",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Purchase Order", "options": "Purchase Order",
"print_hide": 1,
"read_only": 1, "read_only": 1,
"search_index": 1 "search_index": 1
}, },
@ -607,6 +606,7 @@
"fieldname": "include_exploded_items", "fieldname": "include_exploded_items",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Include Exploded Items", "label": "Include Exploded Items",
"print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{ {
@ -758,7 +758,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2019-06-02 06:36:17.078419", "modified": "2019-09-17 22:32:05.984240",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice Item", "name": "Purchase Invoice Item",

View File

@ -238,7 +238,7 @@ def get_contacts(customers):
customers = [frappe._dict({'name': customers})] customers = [frappe._dict({'name': customers})]
for data in 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 where is_primary_contact=1 and name in
(select parent from `tabDynamic Link` where link_doctype = 'Customer' and link_name = %s (select parent from `tabDynamic Link` where link_doctype = 'Customer' and link_name = %s
and parenttype = 'Contact')""", data.name, as_dict=1) and parenttype = 'Contact')""", data.name, as_dict=1)

View File

@ -817,6 +817,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
if(reg.test(data.name.toLowerCase()) if(reg.test(data.name.toLowerCase())
|| reg.test(data.customer_name.toLowerCase()) || reg.test(data.customer_name.toLowerCase())
|| (contact && reg.test(contact["phone"])) || (contact && reg.test(contact["phone"]))
|| (contact && reg.test(contact["mobile_no"]))
|| (data.customer_group && reg.test(data.customer_group.toLowerCase()))){ || (data.customer_group && reg.test(data.customer_group.toLowerCase()))){
return data; return data;
} }
@ -833,6 +834,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
if(contact && !c['phone']) { if(contact && !c['phone']) {
c["phone"] = contact["phone"]; c["phone"] = contact["phone"];
c["email_id"] = contact["email_id"]; c["email_id"] = contact["email_id"];
c["mobile_no"] = contact["mobile_no"];
} }
me.customers_mapper.push({ me.customers_mapper.push({
@ -842,9 +844,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
customer_group: c.customer_group, customer_group: c.customer_group,
territory: c.territory, territory: c.territory,
phone: contact ? contact["phone"] : '', phone: contact ? contact["phone"] : '',
mobile_no: contact ? contact["mobile_no"] : '',
email_id: contact ? contact["email_id"] : '', email_id: contact ? contact["email_id"] : '',
searchtext: ['customer_name', 'customer_group', 'name', 'value', searchtext: ['customer_name', 'customer_group', 'name', 'value',
'label', 'email_id', 'phone'] 'label', 'email_id', 'phone', 'mobile_no']
.map(key => c[key]).join(' ') .map(key => c[key]).join(' ')
.toLowerCase() .toLowerCase()
}); });

View File

@ -267,6 +267,7 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Last Purchase Rate", "label": "Last Purchase Rate",
"options": "currency", "options": "currency",
"print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{ {
@ -561,7 +562,8 @@
"depends_on": "eval:parent.is_subcontracted == 'Yes'", "depends_on": "eval:parent.is_subcontracted == 'Yes'",
"fieldname": "include_exploded_items", "fieldname": "include_exploded_items",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Include Exploded Items" "label": "Include Exploded Items",
"print_hide": 1
}, },
{ {
"fieldname": "section_break_56", "fieldname": "section_break_56",
@ -701,7 +703,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2019-06-23 20:03:13.818917", "modified": "2019-09-17 22:32:34.703923",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Purchase Order Item", "name": "Purchase Order Item",

View File

@ -53,7 +53,7 @@ class TestOpportunity(unittest.TestCase):
"link_name": customer.name "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) contact.insert(ignore_permissions=True)
opp_doc = frappe.get_doc(args).insert(ignore_permissions=True) opp_doc = frappe.get_doc(args).insert(ignore_permissions=True)

View File

@ -73,7 +73,7 @@ def make_contact(supplier):
{'link_doctype': 'Supplier', 'link_name': supplier.supplier_name} {'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() contact.insert()
else: else:
contact = frappe.get_doc('Contact', contact_name) contact = frappe.get_doc('Contact', contact_name)

View File

@ -213,6 +213,9 @@ class WorkOrder(Document):
self.db_set(fieldname, qty) 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: if self.production_plan:
self.update_production_plan_status() self.update_production_plan_status()

View File

@ -637,3 +637,4 @@ 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.add_variant_of_in_item_attribute_table
erpnext.patches.v12_0.rename_bank_account_field_in_journal_entry_account erpnext.patches.v12_0.rename_bank_account_field_in_journal_entry_account
erpnext.patches.v12_0.create_default_energy_point_rules erpnext.patches.v12_0.create_default_energy_point_rules
erpnext.patches.v12_0.set_produced_qty_field_in_sales_order_for_work_order

View File

@ -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'))

View File

@ -350,8 +350,10 @@ def make_contact(args, is_primary_contact=1):
'link_name': args.get('name') 'link_name': args.get('name')
}] }]
}) })
contact.add_email(args.get('email_id')) if args.get('email_id'):
contact.add_phone(args.get('mobile_no')) 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() contact.insert()
return contact return contact

View File

@ -1023,3 +1023,15 @@ def create_pick_list(source_name, target_doc=None):
doc.set_item_locations() doc.set_item_locations()
return doc 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)

View File

@ -110,6 +110,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"default": "0",
"fieldname": "ensure_delivery_based_on_produced_serial_no", "fieldname": "ensure_delivery_based_on_produced_serial_no",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Ensure Delivery Based on Produced Serial No" "label": "Ensure Delivery Based on Produced Serial No"
@ -381,6 +382,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"default": "0",
"fieldname": "is_free_item", "fieldname": "is_free_item",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Is Free Item", "label": "Is Free Item",
@ -436,6 +438,7 @@
"print_hide": 1 "print_hide": 1
}, },
{ {
"default": "0",
"fieldname": "delivered_by_supplier", "fieldname": "delivered_by_supplier",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Supplier delivers to Customer", "label": "Supplier delivers to Customer",
@ -662,6 +665,7 @@
}, },
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"default": "0",
"fieldname": "page_break", "fieldname": "page_break",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Page Break", "label": "Page Break",
@ -689,7 +693,6 @@
"description": "For Production", "description": "For Production",
"fieldname": "produced_qty", "fieldname": "produced_qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 1,
"label": "Produced Quantity", "label": "Produced Quantity",
"oldfieldname": "produced_qty", "oldfieldname": "produced_qty",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
@ -740,7 +743,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2019-05-01 17:52:32.810797", "modified": "2019-09-13 12:18:54.903107",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Sales Order Item", "name": "Sales Order Item",

View File

@ -31,7 +31,7 @@ class SMSCenter(Document):
self.sales_partner.replace("'", "\'") or " and ifnull(dl.link_name, '') != ''" 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']: 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,'')), 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) c.docstatus != 2 and dl.parent = c.name%s""" % where_clause)
elif self.send_to == 'All Lead (Open)': elif self.send_to == 'All Lead (Open)':

View File

@ -7,7 +7,6 @@ import frappe
from frappe import _ from frappe import _
from .operations import install_fixtures as fixtures, company_setup, sample_data from .operations import install_fixtures as fixtures, company_setup, sample_data
from erpnext.setup.setup_wizard.operations.install_fixtures import setup_global_search
def get_setup_stages(args=None): def get_setup_stages(args=None):
if frappe.db.sql("select name from tabCompany"): if frappe.db.sql("select name from tabCompany"):

View File

@ -55,8 +55,6 @@ def place_order():
cart_settings = frappe.db.get_value("Shopping Cart Settings", None, cart_settings = frappe.db.get_value("Shopping Cart Settings", None,
["company", "allow_items_not_in_stock"], as_dict=1) ["company", "allow_items_not_in_stock"], as_dict=1)
quotation.company = cart_settings.company 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.flags.ignore_permissions = True
quotation.submit() quotation.submit()

View File

@ -85,26 +85,13 @@ frappe.ui.form.on("Delivery Note", {
refresh: function(frm) { refresh: function(frm) {
if (frm.doc.docstatus === 1 && frm.doc.is_return === 1 && frm.doc.per_billed !== 100) { if (frm.doc.docstatus === 1 && frm.doc.is_return === 1 && frm.doc.per_billed !== 100) {
frm.add_custom_button(__('Credit Note'), function() { frm.add_custom_button(__('Credit Note'), function() {
frappe.confirm(__("Are you sure you want to make credit note?"), frappe.model.open_mapped_doc({
function() { method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
frm.trigger("make_credit_note"); frm: cur_frm,
} })
);
}, __('Create')); }, __('Create'));
frm.page.set_inner_btn_group_as_primary(__('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) { setup: function(doc) {
this.setup_posting_date_time_check(); this.setup_posting_date_time_check();
this._super(doc); this._super(doc);
this.frm.make_methods = {
'Delivery Trip': this.make_delivery_trip,
};
}, },
refresh: function(doc, dt, dn) { refresh: function(doc, dt, dn) {
var me = this; var me = this;
@ -239,7 +229,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
make_delivery_trip: function() { make_delivery_trip: function() {
frappe.model.open_mapped_doc({ frappe.model.open_mapped_doc({
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_delivery_trip", method: "erpnext.stock.doctype.delivery_note.delivery_note.make_delivery_trip",
frm: this.frm frm: cur_frm
}) })
}, },

View File

@ -458,6 +458,9 @@ def make_sales_invoice(source_name, target_doc=None):
doc = get_mapped_doc("Delivery Note", source_name, { doc = get_mapped_doc("Delivery Note", source_name, {
"Delivery Note": { "Delivery Note": {
"doctype": "Sales Invoice", "doctype": "Sales Invoice",
"field_map": {
"is_return": "is_return"
},
"validation": { "validation": {
"docstatus": ["=", 1] "docstatus": ["=", 1]
} }

View File

@ -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) { if (frm.doc.docstatus === 1 && frm.doc.is_return === 1 && frm.doc.per_billed !== 100) {
frm.add_custom_button(__('Debit Note'), function() { frm.add_custom_button(__('Debit Note'), function() {
frappe.confirm(__("Are you sure you want to make debit note?"), frappe.model.open_mapped_doc({
function() { method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
frm.trigger("make_debit_note"); frm: cur_frm,
} })
);
}, __('Create')); }, __('Create'));
frm.page.set_inner_btn_group_as_primary(__('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) { company: function(frm) {
frm.trigger("toggle_display_account_head"); frm.trigger("toggle_display_account_head");
}, },

View File

@ -426,16 +426,6 @@ class PurchaseReceipt(BuyingController):
self.load_from_db() 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): def update_billed_amount_based_on_po(po_detail, update_modified=True):
# Billed against Sales Order directly # Billed against Sales Order directly
billed_against_po = frappe.db.sql("""select sum(amount) from `tabPurchase Invoice Item` 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": { "Purchase Receipt": {
"doctype": "Purchase Invoice", "doctype": "Purchase Invoice",
"field_map": { "field_map": {
"supplier_warehouse":"supplier_warehouse" "supplier_warehouse":"supplier_warehouse",
"is_return": "is_return"
}, },
"validation": { "validation": {
"docstatus": ["=", 1], "docstatus": ["=", 1],

View File

@ -523,7 +523,6 @@
"oldfieldname": "prevdoc_docname", "oldfieldname": "prevdoc_docname",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Purchase Order", "options": "Purchase Order",
"print_hide": 1,
"print_width": "150px", "print_width": "150px",
"read_only": 1, "read_only": 1,
"search_index": 1, "search_index": 1,
@ -647,6 +646,7 @@
"fieldname": "include_exploded_items", "fieldname": "include_exploded_items",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Include Exploded Items", "label": "Include Exploded Items",
"print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{ {
@ -818,7 +818,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2019-06-02 06:37:48.198745", "modified": "2019-09-17 22:33:01.109004",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Purchase Receipt Item", "name": "Purchase Receipt Item",
@ -827,4 +827,4 @@
"quick_entry": 1, "quick_entry": 1,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC" "sort_order": "DESC"
} }

View File

@ -539,6 +539,21 @@ class StockEntry(StockController):
total_allowed = required_qty + (required_qty * (qty_allowance/100)) 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: if not required_qty:
frappe.throw(_("Item {0} not found in 'Raw Materials Supplied' table in Purchase Order {1}") frappe.throw(_("Item {0} not found in 'Raw Materials Supplied' table in Purchase Order {1}")
.format(se_item.item_code, self.purchase_order)) .format(se_item.item_code, self.purchase_order))

View File

@ -10,27 +10,32 @@ def create_test_contact_and_address():
frappe.db.sql('delete from tabAddress') frappe.db.sql('delete from tabAddress')
frappe.db.sql('delete from `tabDynamic Link`') frappe.db.sql('delete from `tabDynamic Link`')
frappe.get_doc(dict( frappe.get_doc({
doctype='Address', "doctype": "Address",
address_title='_Test Address for Customer', "address_title": "_Test Address for Customer",
address_type='Office', "address_type": "Office",
address_line1='Station Road', "address_line1": "Station Road",
city='_Test City', "city": "_Test City",
state='Test State', "state": "Test State",
country='India', "country": "India",
links = [dict( "links": [
link_doctype='Customer', {
link_name='_Test Customer' "link_doctype": "Customer",
)] "link_name": "_Test Customer"
)).insert() }
]
}).insert()
frappe.get_doc(dict( contact = frappe.get_doc({
doctype='Contact', "doctype": 'Contact',
email_id='test_contact_customer@example.com', "first_name": "_Test Contact for _Test Customer",
phone='+91 0000000000', "links": [
first_name='_Test Contact for _Test Customer', {
links = [dict( "link_doctype": "Customer",
link_doctype='Customer', "link_name": "_Test Customer"
link_name='_Test Customer' }
)] ]
)).insert() })
contact.add_email("test_contact_customer@example.com", is_primary=True)
contact.add_phone("+91 0000000000", is_primary_phone=True)
contact.insert()