Merge branch 'develop' into datev_report_headers
This commit is contained in:
commit
dcb9c2031b
@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '12.1.2'
|
__version__ = '12.1.6'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -100,7 +100,10 @@ class Account(NestedSet):
|
|||||||
if ancestors:
|
if ancestors:
|
||||||
if frappe.get_value("Company", self.company, "allow_account_creation_against_child_company"):
|
if frappe.get_value("Company", self.company, "allow_account_creation_against_child_company"):
|
||||||
return
|
return
|
||||||
frappe.throw(_("Please add the account to root level Company - %s" % ancestors[0]))
|
|
||||||
|
if not frappe.db.get_value("Account",
|
||||||
|
{'account_name': self.account_name, 'company': ancestors[0]}, 'name'):
|
||||||
|
frappe.throw(_("Please add the account to root level Company - %s" % ancestors[0]))
|
||||||
else:
|
else:
|
||||||
descendants = get_descendants_of('Company', self.company)
|
descendants = get_descendants_of('Company', self.company)
|
||||||
if not descendants: return
|
if not descendants: return
|
||||||
@ -114,24 +117,7 @@ class Account(NestedSet):
|
|||||||
|
|
||||||
if not parent_acc_name_map: return
|
if not parent_acc_name_map: return
|
||||||
|
|
||||||
for company in descendants:
|
self.create_account_for_child_company(parent_acc_name_map, descendants)
|
||||||
if not parent_acc_name_map.get(company):
|
|
||||||
frappe.throw(_("While creating account for child Company {0}, parent account {1} not found. Please create the parent account in corresponding COA")
|
|
||||||
.format(company, parent_acc_name))
|
|
||||||
|
|
||||||
doc = frappe.copy_doc(self)
|
|
||||||
doc.flags.ignore_root_company_validation = True
|
|
||||||
doc.update({
|
|
||||||
"company": company,
|
|
||||||
# parent account's currency should be passed down to child account's curreny
|
|
||||||
# if it is None, it picks it up from default company currency, which might be unintended
|
|
||||||
"account_currency": self.account_currency,
|
|
||||||
"parent_account": parent_acc_name_map[company]
|
|
||||||
})
|
|
||||||
if not self.check_if_child_acc_exists(doc):
|
|
||||||
doc.save()
|
|
||||||
frappe.msgprint(_("Account {0} is added in the child company {1}")
|
|
||||||
.format(doc.name, company))
|
|
||||||
|
|
||||||
def validate_group_or_ledger(self):
|
def validate_group_or_ledger(self):
|
||||||
if self.get("__islocal"):
|
if self.get("__islocal"):
|
||||||
@ -173,23 +159,48 @@ class Account(NestedSet):
|
|||||||
if frappe.db.get_value("GL Entry", {"account": self.name}):
|
if frappe.db.get_value("GL Entry", {"account": self.name}):
|
||||||
frappe.throw(_("Currency can not be changed after making entries using some other currency"))
|
frappe.throw(_("Currency can not be changed after making entries using some other currency"))
|
||||||
|
|
||||||
def check_if_child_acc_exists(self, doc):
|
def create_account_for_child_company(self, parent_acc_name_map, descendants):
|
||||||
''' Checks if a account in parent company exists in the '''
|
for company in descendants:
|
||||||
info = frappe.db.get_value("Account", {
|
if not parent_acc_name_map.get(company):
|
||||||
"account_name": doc.account_name,
|
frappe.throw(_("While creating account for child Company {0}, parent account {1} not found. Please create the parent account in corresponding COA")
|
||||||
"account_number": doc.account_number
|
.format(company, parent_acc_name))
|
||||||
}, ['company', 'account_currency', 'is_group', 'root_type', 'account_type', 'balance_must_be', 'account_name'], as_dict=1)
|
|
||||||
|
|
||||||
if not info:
|
filters = {
|
||||||
return
|
"account_name": self.account_name,
|
||||||
|
"company": company
|
||||||
|
}
|
||||||
|
|
||||||
doc = vars(doc)
|
if self.account_number:
|
||||||
dict_diff = [k for k in info if k in doc and info[k] != doc[k] and k != "company"]
|
filters["account_number"] = self.account_number
|
||||||
if dict_diff:
|
|
||||||
frappe.throw(_("Account {0} already exists in child company {1}. The following fields have different values, they should be same:<ul><li>{2}</li></ul>")
|
child_account = frappe.db.get_value("Account", filters, 'name')
|
||||||
.format(info.account_name, info.company, '</li><li>'.join(dict_diff)))
|
|
||||||
else:
|
if not child_account:
|
||||||
return True
|
doc = frappe.copy_doc(self)
|
||||||
|
doc.flags.ignore_root_company_validation = True
|
||||||
|
doc.update({
|
||||||
|
"company": company,
|
||||||
|
# parent account's currency should be passed down to child account's curreny
|
||||||
|
# if it is None, it picks it up from default company currency, which might be unintended
|
||||||
|
"account_currency": self.account_currency,
|
||||||
|
"parent_account": parent_acc_name_map[company]
|
||||||
|
})
|
||||||
|
|
||||||
|
doc.save()
|
||||||
|
frappe.msgprint(_("Account {0} is added in the child company {1}")
|
||||||
|
.format(doc.name, company))
|
||||||
|
elif child_account:
|
||||||
|
# update the parent company's value in child companies
|
||||||
|
doc = frappe.get_doc("Account", child_account)
|
||||||
|
parent_value_changed = False
|
||||||
|
for field in ['account_type', 'account_currency',
|
||||||
|
'freeze_account', 'balance_must_be']:
|
||||||
|
if doc.get(field) != self.get(field):
|
||||||
|
parent_value_changed = True
|
||||||
|
doc.set(field, self.get(field))
|
||||||
|
|
||||||
|
if parent_value_changed:
|
||||||
|
doc.save()
|
||||||
|
|
||||||
def convert_group_to_ledger(self):
|
def convert_group_to_ledger(self):
|
||||||
if self.check_if_child_exists():
|
if self.check_if_child_exists():
|
||||||
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,9 +5,13 @@ frappe.ui.form.on('Accounting Dimension', {
|
|||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.set_query('document_type', () => {
|
frm.set_query('document_type', () => {
|
||||||
|
let invalid_doctypes = frappe.model.core_doctypes_list;
|
||||||
|
invalid_doctypes.push('Accounting Dimension', 'Project',
|
||||||
|
'Cost Center', 'Accounting Dimension Detail');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
name: ['not in', ['Accounting Dimension', 'Project', 'Cost Center', 'Accounting Dimension Detail']]
|
name: ['not in', invalid_doctypes]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -11,10 +11,20 @@ from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
|||||||
from frappe import scrub
|
from frappe import scrub
|
||||||
from frappe.utils import cstr
|
from frappe.utils import cstr
|
||||||
from frappe.utils.background_jobs import enqueue
|
from frappe.utils.background_jobs import enqueue
|
||||||
|
from frappe.model import core_doctypes_list
|
||||||
|
|
||||||
class AccountingDimension(Document):
|
class AccountingDimension(Document):
|
||||||
def before_insert(self):
|
def before_insert(self):
|
||||||
self.set_fieldname_and_label()
|
self.set_fieldname_and_label()
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
if self.document_type in core_doctypes_list + ('Accounting Dimension', 'Project',
|
||||||
|
'Cost Center', 'Accounting Dimension Detail') :
|
||||||
|
|
||||||
|
msg = _("Not allowed to create accounting dimension for {0}").format(self.document_type)
|
||||||
|
frappe.throw(msg)
|
||||||
|
|
||||||
|
def after_insert(self):
|
||||||
if frappe.flags.in_test:
|
if frappe.flags.in_test:
|
||||||
make_dimension_in_accounting_doctypes(doc=self)
|
make_dimension_in_accounting_doctypes(doc=self)
|
||||||
else:
|
else:
|
||||||
@ -164,7 +174,7 @@ def get_accounting_dimensions(as_list=True):
|
|||||||
return accounting_dimensions
|
return accounting_dimensions
|
||||||
|
|
||||||
def get_checks_for_pl_and_bs_accounts():
|
def get_checks_for_pl_and_bs_accounts():
|
||||||
dimensions = frappe.db.sql("""SELECT p.label, p.disabled, p.fieldname, c.company, c.mandatory_for_pl, c.mandatory_for_bs
|
dimensions = frappe.db.sql("""SELECT p.label, p.disabled, p.fieldname, c.default_dimension, c.company, c.mandatory_for_pl, c.mandatory_for_bs
|
||||||
FROM `tabAccounting Dimension`p ,`tabAccounting Dimension Detail` c
|
FROM `tabAccounting Dimension`p ,`tabAccounting Dimension Detail` c
|
||||||
WHERE p.name = c.parent""", as_dict=1)
|
WHERE p.name = c.parent""", as_dict=1)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ frappe.ui.form.on('Bank Account', {
|
|||||||
},
|
},
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frappe.dynamic_link = { doc: frm.doc, fieldname: 'name', doctype: 'Bank Account' }
|
frappe.dynamic_link = { doc: frm.doc, fieldname: 'name', doctype: 'Bank Account' }
|
||||||
|
|
||||||
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
|
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
|
||||||
|
|
||||||
if (frm.doc.__islocal) {
|
if (frm.doc.__islocal) {
|
||||||
@ -37,5 +37,9 @@ frappe.ui.form.on('Bank Account', {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
is_company_account: function(frm) {
|
||||||
|
frm.set_df_property('account', 'reqd', frm.doc.is_company_account);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -9,12 +9,11 @@ def get_data():
|
|||||||
'non_standard_fieldnames': {
|
'non_standard_fieldnames': {
|
||||||
'Customer': 'default_bank_account',
|
'Customer': 'default_bank_account',
|
||||||
'Supplier': 'default_bank_account',
|
'Supplier': 'default_bank_account',
|
||||||
'Journal Entry': 'bank_account_no'
|
|
||||||
},
|
},
|
||||||
'transactions': [
|
'transactions': [
|
||||||
{
|
{
|
||||||
'label': _('Payments'),
|
'label': _('Payments'),
|
||||||
'items': ['Payment Entry', 'Payment Request', 'Payment Order']
|
'items': ['Payment Entry', 'Payment Request', 'Payment Order', 'Payroll Entry']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': _('Party'),
|
'label': _('Party'),
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
"allow_copy": 1,
|
"allow_copy": 1,
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
"autoname": "field:cost_center_name",
|
|
||||||
"creation": "2013-01-23 19:57:17",
|
"creation": "2013-01-23 19:57:17",
|
||||||
"description": "Track separate Income and Expense for product verticals or divisions.",
|
"description": "Track separate Income and Expense for product verticals or divisions.",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
@ -16,7 +15,7 @@
|
|||||||
"company",
|
"company",
|
||||||
"cb0",
|
"cb0",
|
||||||
"is_group",
|
"is_group",
|
||||||
"enabled",
|
"disabled",
|
||||||
"lft",
|
"lft",
|
||||||
"rgt",
|
"rgt",
|
||||||
"old_parent"
|
"old_parent"
|
||||||
@ -117,15 +116,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "enabled",
|
"fieldname": "disabled",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Enabled"
|
"label": "Disabled"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-money",
|
"icon": "fa fa-money",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"modified": "2019-08-22 15:05:05.559862",
|
"modified": "2019-09-16 14:44:17.103548",
|
||||||
"modified_by": "sammish.thundiyil@gmail.com",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Cost Center",
|
"name": "Cost Center",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
@ -168,4 +167,4 @@
|
|||||||
"show_name_in_global_search": 1,
|
"show_name_in_global_search": 1,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "ASC"
|
"sort_order": "ASC"
|
||||||
}
|
}
|
35
erpnext/accounts/doctype/coupon_code/coupon_code.js
Normal file
35
erpnext/accounts/doctype/coupon_code/coupon_code.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
// For license information, please see license.txt
|
||||||
|
|
||||||
|
frappe.ui.form.on('Coupon Code', {
|
||||||
|
coupon_name:function(frm){
|
||||||
|
if (frm.doc.__islocal===1) {
|
||||||
|
frm.trigger("make_coupon_code");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
coupon_type:function(frm){
|
||||||
|
if (frm.doc.__islocal===1) {
|
||||||
|
frm.trigger("make_coupon_code");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
make_coupon_code: function(frm) {
|
||||||
|
var coupon_name=frm.doc.coupon_name;
|
||||||
|
var coupon_code;
|
||||||
|
if (frm.doc.coupon_type=='Gift Card') {
|
||||||
|
coupon_code=Math.random().toString(12).substring(2, 12).toUpperCase();
|
||||||
|
}
|
||||||
|
else if(frm.doc.coupon_type=='Promotional'){
|
||||||
|
coupon_name=coupon_name.replace(/\s/g,'');
|
||||||
|
coupon_code=coupon_name.toUpperCase().slice(0,8);
|
||||||
|
}
|
||||||
|
frm.doc.coupon_code=coupon_code;
|
||||||
|
frm.refresh_field('coupon_code');
|
||||||
|
},
|
||||||
|
refresh: function(frm) {
|
||||||
|
if (frm.doc.pricing_rule) {
|
||||||
|
frm.add_custom_button(__("Add/Edit Coupon Conditions"), function(){
|
||||||
|
frappe.set_route("Form", "Pricing Rule", frm.doc.pricing_rule);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
175
erpnext/accounts/doctype/coupon_code/coupon_code.json
Normal file
175
erpnext/accounts/doctype/coupon_code/coupon_code.json
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
{
|
||||||
|
"allow_import": 1,
|
||||||
|
"autoname": "field:coupon_name",
|
||||||
|
"creation": "2018-01-22 14:34:39.701832",
|
||||||
|
"doctype": "DocType",
|
||||||
|
"document_type": "Other",
|
||||||
|
"editable_grid": 1,
|
||||||
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"coupon_name",
|
||||||
|
"coupon_type",
|
||||||
|
"customer",
|
||||||
|
"column_break_4",
|
||||||
|
"coupon_code",
|
||||||
|
"pricing_rule",
|
||||||
|
"uses",
|
||||||
|
"valid_from",
|
||||||
|
"valid_upto",
|
||||||
|
"maximum_use",
|
||||||
|
"used",
|
||||||
|
"column_break_11",
|
||||||
|
"description",
|
||||||
|
"amended_from"
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldname": "coupon_name",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Coupon Name",
|
||||||
|
"reqd": 1,
|
||||||
|
"unique": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "coupon_type",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Coupon Type",
|
||||||
|
"options": "Promotional\nGift Card",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "eval: doc.coupon_type == \"Gift Card\"",
|
||||||
|
"fieldname": "customer",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Customer",
|
||||||
|
"options": "Customer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_4",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "To be used to get discount",
|
||||||
|
"fieldname": "coupon_code",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Coupon Code",
|
||||||
|
"no_copy": 1,
|
||||||
|
"set_only_once": 1,
|
||||||
|
"unique": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "pricing_rule",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Pricing Rule",
|
||||||
|
"options": "Pricing Rule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "uses",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Uses"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "valid_from",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Valid From"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "valid_upto",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"label": "Valid Upto"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "eval: doc.coupon_type == \"Promotional\"",
|
||||||
|
"fieldname": "maximum_use",
|
||||||
|
"fieldtype": "Int",
|
||||||
|
"label": "Maximum Use"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "used",
|
||||||
|
"fieldtype": "Int",
|
||||||
|
"label": "Used",
|
||||||
|
"no_copy": 1,
|
||||||
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_11",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "description",
|
||||||
|
"fieldtype": "Text Editor",
|
||||||
|
"label": "Coupon Description"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "amended_from",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Amended From",
|
||||||
|
"no_copy": 1,
|
||||||
|
"options": "Coupon Code",
|
||||||
|
"print_hide": 1,
|
||||||
|
"read_only": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"modified": "2019-10-15 14:12:22.686986",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Accounts",
|
||||||
|
"name": "Coupon Code",
|
||||||
|
"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,
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "Accounts User",
|
||||||
|
"share": 1,
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"create": 1,
|
||||||
|
"delete": 1,
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "Sales Manager",
|
||||||
|
"share": 1,
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"create": 1,
|
||||||
|
"delete": 1,
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "Website Manager",
|
||||||
|
"share": 1,
|
||||||
|
"write": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sort_field": "modified",
|
||||||
|
"sort_order": "DESC",
|
||||||
|
"title_field": "coupon_name",
|
||||||
|
"track_changes": 1
|
||||||
|
}
|
25
erpnext/accounts/doctype/coupon_code/coupon_code.py
Normal file
25
erpnext/accounts/doctype/coupon_code/coupon_code.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
from frappe import _
|
||||||
|
from frappe.model.document import Document
|
||||||
|
from frappe.utils import (strip)
|
||||||
|
class CouponCode(Document):
|
||||||
|
def autoname(self):
|
||||||
|
self.coupon_name = strip(self.coupon_name)
|
||||||
|
self.name = self.coupon_name
|
||||||
|
|
||||||
|
if not self.coupon_code:
|
||||||
|
if self.coupon_type == "Promotional":
|
||||||
|
self.coupon_code =''.join([i for i in self.coupon_name if not i.isdigit()])[0:8].upper()
|
||||||
|
elif self.coupon_type == "Gift Card":
|
||||||
|
self.coupon_code = frappe.generate_hash()[:10].upper()
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
if self.coupon_type == "Gift Card":
|
||||||
|
self.maximum_use = 1
|
||||||
|
if not self.customer:
|
||||||
|
frappe.throw(_("Please select the customer."))
|
23
erpnext/accounts/doctype/coupon_code/test_coupon_code.js
Normal file
23
erpnext/accounts/doctype/coupon_code/test_coupon_code.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
// rename this file from _test_[name] to test_[name] to activate
|
||||||
|
// and remove above this line
|
||||||
|
|
||||||
|
QUnit.test("test: Coupon Code", function (assert) {
|
||||||
|
let done = assert.async();
|
||||||
|
|
||||||
|
// number of asserts
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
frappe.run_serially([
|
||||||
|
// insert a new Coupon Code
|
||||||
|
() => frappe.tests.make('Coupon Code', [
|
||||||
|
// values to be set
|
||||||
|
{key: 'value'}
|
||||||
|
]),
|
||||||
|
() => {
|
||||||
|
assert.equal(cur_frm.doc.key, 'value');
|
||||||
|
},
|
||||||
|
() => done()
|
||||||
|
]);
|
||||||
|
|
||||||
|
});
|
132
erpnext/accounts/doctype/coupon_code/test_coupon_code.py
Normal file
132
erpnext/accounts/doctype/coupon_code/test_coupon_code.py
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
|
# See license.txt
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
import unittest
|
||||||
|
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
|
||||||
|
from erpnext.stock.get_item_details import get_item_details
|
||||||
|
from frappe.test_runner import make_test_objects
|
||||||
|
|
||||||
|
def test_create_test_data():
|
||||||
|
frappe.set_user("Administrator")
|
||||||
|
# create test item
|
||||||
|
if not frappe.db.exists("Item","_Test Tesla Car"):
|
||||||
|
item = frappe.get_doc({
|
||||||
|
"description": "_Test Tesla Car",
|
||||||
|
"doctype": "Item",
|
||||||
|
"has_batch_no": 0,
|
||||||
|
"has_serial_no": 0,
|
||||||
|
"inspection_required": 0,
|
||||||
|
"is_stock_item": 1,
|
||||||
|
"opening_stock":100,
|
||||||
|
"is_sub_contracted_item": 0,
|
||||||
|
"item_code": "_Test Tesla Car",
|
||||||
|
"item_group": "_Test Item Group",
|
||||||
|
"item_name": "_Test Tesla Car",
|
||||||
|
"apply_warehouse_wise_reorder_level": 0,
|
||||||
|
"warehouse":"_Test Warehouse - _TC",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
|
"valuation_rate": 5000,
|
||||||
|
"standard_rate":5000,
|
||||||
|
"item_defaults": [{
|
||||||
|
"company": "_Test Company",
|
||||||
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
|
"default_price_list":"_Test Price List",
|
||||||
|
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||||
|
"buying_cost_center": "_Test Cost Center - _TC",
|
||||||
|
"selling_cost_center": "_Test Cost Center - _TC",
|
||||||
|
"income_account": "Sales - _TC"
|
||||||
|
}],
|
||||||
|
"show_in_website": 1,
|
||||||
|
"route":"-test-tesla-car",
|
||||||
|
"website_warehouse": "_Test Warehouse - _TC"
|
||||||
|
})
|
||||||
|
item.insert()
|
||||||
|
# create test item price
|
||||||
|
item_price = frappe.get_list('Item Price', filters={'item_code': '_Test Tesla Car', 'price_list': '_Test Price List'}, fields=['name'])
|
||||||
|
if len(item_price)==0:
|
||||||
|
item_price = frappe.get_doc({
|
||||||
|
"doctype": "Item Price",
|
||||||
|
"item_code": "_Test Tesla Car",
|
||||||
|
"price_list": "_Test Price List",
|
||||||
|
"price_list_rate": 5000
|
||||||
|
})
|
||||||
|
item_price.insert()
|
||||||
|
# create test item pricing rule
|
||||||
|
if not frappe.db.exists("Pricing Rule","_Test Pricing Rule for _Test Item"):
|
||||||
|
item_pricing_rule = frappe.get_doc({
|
||||||
|
"doctype": "Pricing Rule",
|
||||||
|
"title": "_Test Pricing Rule for _Test Item",
|
||||||
|
"apply_on": "Item Code",
|
||||||
|
"items": [{
|
||||||
|
"item_code": "_Test Tesla Car"
|
||||||
|
}],
|
||||||
|
"warehouse":"_Test Warehouse - _TC",
|
||||||
|
"coupon_code_based":1,
|
||||||
|
"selling": 1,
|
||||||
|
"rate_or_discount": "Discount Percentage",
|
||||||
|
"discount_percentage": 30,
|
||||||
|
"company": "_Test Company",
|
||||||
|
"currency":"INR",
|
||||||
|
"for_price_list":"_Test Price List"
|
||||||
|
})
|
||||||
|
item_pricing_rule.insert()
|
||||||
|
# create test item sales partner
|
||||||
|
if not frappe.db.exists("Sales Partner","_Test Coupon Partner"):
|
||||||
|
sales_partner = frappe.get_doc({
|
||||||
|
"doctype": "Sales Partner",
|
||||||
|
"partner_name":"_Test Coupon Partner",
|
||||||
|
"commission_rate":2,
|
||||||
|
"referral_code": "COPART"
|
||||||
|
})
|
||||||
|
sales_partner.insert()
|
||||||
|
# create test item coupon code
|
||||||
|
if not frappe.db.exists("Coupon Code","SAVE30"):
|
||||||
|
coupon_code = frappe.get_doc({
|
||||||
|
"doctype": "Coupon Code",
|
||||||
|
"coupon_name":"SAVE30",
|
||||||
|
"coupon_code":"SAVE30",
|
||||||
|
"pricing_rule": "_Test Pricing Rule for _Test Item",
|
||||||
|
"valid_from": "2014-01-01",
|
||||||
|
"maximum_use":1,
|
||||||
|
"used":0
|
||||||
|
})
|
||||||
|
coupon_code.insert()
|
||||||
|
|
||||||
|
|
||||||
|
class TestCouponCode(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
test_create_test_data()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
frappe.set_user("Administrator")
|
||||||
|
|
||||||
|
def test_1_check_coupon_code_used_before_so(self):
|
||||||
|
coupon_code = frappe.get_doc("Coupon Code", frappe.db.get_value("Coupon Code", {"coupon_name":"SAVE30"}))
|
||||||
|
# reset used coupon code count
|
||||||
|
coupon_code.used=0
|
||||||
|
coupon_code.save()
|
||||||
|
# check no coupon code is used before sales order is made
|
||||||
|
self.assertEqual(coupon_code.get("used"),0)
|
||||||
|
|
||||||
|
def test_2_sales_order_with_coupon_code(self):
|
||||||
|
so = make_sales_order(customer="_Test Customer",selling_price_list="_Test Price List",item_code="_Test Tesla Car", rate=5000,qty=1, do_not_submit=True)
|
||||||
|
so = frappe.get_doc('Sales Order', so.name)
|
||||||
|
# check item price before coupon code is applied
|
||||||
|
self.assertEqual(so.items[0].rate, 5000)
|
||||||
|
so.coupon_code='SAVE30'
|
||||||
|
so.sales_partner='_Test Coupon Partner'
|
||||||
|
so.save()
|
||||||
|
# check item price after coupon code is applied
|
||||||
|
self.assertEqual(so.items[0].rate, 3500)
|
||||||
|
so.submit()
|
||||||
|
|
||||||
|
def test_3_check_coupon_code_used_after_so(self):
|
||||||
|
doc = frappe.get_doc("Coupon Code", frappe.db.get_value("Coupon Code", {"coupon_name":"SAVE30"}))
|
||||||
|
# check no coupon code is used before sales order is made
|
||||||
|
self.assertEqual(doc.get("used"),1)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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",
|
||||||
|
@ -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'),
|
||||||
|
@ -26,14 +26,20 @@ class InvoiceDiscounting(AccountsController):
|
|||||||
frappe.throw(_("Loan Start Date and Loan Period are mandatory to save the Invoice Discounting"))
|
frappe.throw(_("Loan Start Date and Loan Period are mandatory to save the Invoice Discounting"))
|
||||||
|
|
||||||
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])
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ frappe.provide("erpnext.journal_entry");
|
|||||||
|
|
||||||
frappe.ui.form.on("Journal Entry", {
|
frappe.ui.form.on("Journal Entry", {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
frm.add_fetch("bank_account_no", "account", "account");
|
frm.add_fetch("bank_account", "account", "account");
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
|
@ -827,10 +827,10 @@ def get_opening_accounts(company):
|
|||||||
accounts = frappe.db.sql_list("""select
|
accounts = frappe.db.sql_list("""select
|
||||||
name from tabAccount
|
name from tabAccount
|
||||||
where
|
where
|
||||||
is_group=0 and report_type='Balance Sheet' and company=%s and
|
is_group=0 and report_type='Balance Sheet' and company={0} and
|
||||||
name not in(select distinct account from tabWarehouse where
|
name not in (select distinct account from tabWarehouse where
|
||||||
account is not null and account != '')
|
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]
|
return [{"account": a, "balance": get_balance_on(a)} for a in accounts]
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"account_type",
|
"account_type",
|
||||||
"balance",
|
"balance",
|
||||||
"col_break1",
|
"col_break1",
|
||||||
"bank_account_no",
|
"bank_account",
|
||||||
"party_type",
|
"party_type",
|
||||||
"party",
|
"party",
|
||||||
"party_balance",
|
"party_balance",
|
||||||
@ -40,7 +40,7 @@
|
|||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"bold": 1,
|
"bold": 1,
|
||||||
"columns": 3,
|
"columns": 2,
|
||||||
"fieldname": "account",
|
"fieldname": "account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_global_search": 1,
|
"in_global_search": 1,
|
||||||
@ -90,20 +90,16 @@
|
|||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "bank_account_no",
|
"default": "Customer",
|
||||||
"fieldtype": "Link",
|
|
||||||
"label": "Bank Account No",
|
|
||||||
"options": "Bank Account"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "party_type",
|
"fieldname": "party_type",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Party Type",
|
"label": "Party Type",
|
||||||
"options": "DocType",
|
"options": "DocType",
|
||||||
"search_index": 1
|
"search_index": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"columns": 3,
|
"columns": 2,
|
||||||
"fieldname": "party",
|
"fieldname": "party",
|
||||||
"fieldtype": "Dynamic Link",
|
"fieldtype": "Dynamic Link",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
@ -266,11 +262,17 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "dimension_col_break",
|
"fieldname": "dimension_col_break",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "bank_account",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Bank Account",
|
||||||
|
"options": "Bank Account"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2019-07-16 17:12:08.238334",
|
"modified": "2019-10-02 12:23:21.693443",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Journal Entry Account",
|
"name": "Journal Entry Account",
|
||||||
|
@ -940,6 +940,10 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
|
|||||||
bank = get_default_bank_cash_account(doc.company, "Bank", mode_of_payment=doc.get("mode_of_payment"),
|
bank = get_default_bank_cash_account(doc.company, "Bank", mode_of_payment=doc.get("mode_of_payment"),
|
||||||
account=bank_account)
|
account=bank_account)
|
||||||
|
|
||||||
|
if not bank:
|
||||||
|
bank = get_default_bank_cash_account(doc.company, "Cash", mode_of_payment=doc.get("mode_of_payment"),
|
||||||
|
account=bank_account)
|
||||||
|
|
||||||
paid_amount = received_amount = 0
|
paid_amount = received_amount = 0
|
||||||
if party_account_currency == bank.account_currency:
|
if party_account_currency == bank.account_currency:
|
||||||
paid_amount = received_amount = abs(outstanding_amount)
|
paid_amount = received_amount = abs(outstanding_amount)
|
||||||
@ -1041,7 +1045,7 @@ def make_payment_order(source_name, target_doc=None):
|
|||||||
|
|
||||||
def update_item(source_doc, target_doc, source_parent):
|
def update_item(source_doc, target_doc, source_parent):
|
||||||
target_doc.bank_account = source_parent.party_bank_account
|
target_doc.bank_account = source_parent.party_bank_account
|
||||||
target_doc.amount = source_parent.base_paid_amount
|
target_doc.amount = source_doc.allocated_amount
|
||||||
target_doc.account = source_parent.paid_to
|
target_doc.account = source_parent.paid_to
|
||||||
target_doc.payment_entry = source_parent.name
|
target_doc.payment_entry = source_parent.name
|
||||||
target_doc.supplier = source_parent.party
|
target_doc.supplier = source_parent.party
|
||||||
|
@ -66,10 +66,10 @@ frappe.ui.form.on('Payment Order', {
|
|||||||
get_query_filters: {
|
get_query_filters: {
|
||||||
bank: frm.doc.bank,
|
bank: frm.doc.bank,
|
||||||
docstatus: 1,
|
docstatus: 1,
|
||||||
payment_type: ("!=", "Receive"),
|
payment_type: ["!=", "Receive"],
|
||||||
bank_account: frm.doc.company_bank_account,
|
bank_account: frm.doc.company_bank_account,
|
||||||
paid_from: frm.doc.account,
|
paid_from: frm.doc.account,
|
||||||
payment_order_status: ["=", "Initiated"],
|
payment_order_status: ["=", "Initiated"]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -249,6 +249,9 @@ def get_pricing_rule_for_item(args, price_list_rate=0, doc=None):
|
|||||||
if pricing_rule.mixed_conditions or pricing_rule.apply_rule_on_other:
|
if pricing_rule.mixed_conditions or pricing_rule.apply_rule_on_other:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if pricing_rule.coupon_code_based==1 and args.coupon_code==None:
|
||||||
|
return item_details
|
||||||
|
|
||||||
if (not pricing_rule.validate_applied_rule and
|
if (not pricing_rule.validate_applied_rule and
|
||||||
pricing_rule.price_or_product_discount == "Price"):
|
pricing_rule.price_or_product_discount == "Price"):
|
||||||
apply_price_discount_pricing_rule(pricing_rule, item_details, args)
|
apply_price_discount_pricing_rule(pricing_rule, item_details, args)
|
||||||
|
@ -531,4 +531,32 @@ def validate_pricing_rule_for_different_cond(doc):
|
|||||||
for d in doc.get("items"):
|
for d in doc.get("items"):
|
||||||
validate_pricing_rule_on_items(doc, d, True)
|
validate_pricing_rule_on_items(doc, d, True)
|
||||||
|
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
|
def validate_coupon_code(coupon_name):
|
||||||
|
from frappe.utils import today,getdate
|
||||||
|
coupon=frappe.get_doc("Coupon Code",coupon_name)
|
||||||
|
if coupon.valid_from:
|
||||||
|
if coupon.valid_from > getdate(today()) :
|
||||||
|
frappe.throw(_("Sorry,coupon code validity has not started"))
|
||||||
|
elif coupon.valid_upto:
|
||||||
|
if coupon.valid_upto < getdate(today()) :
|
||||||
|
frappe.throw(_("Sorry,coupon code validity has expired"))
|
||||||
|
elif coupon.used>=coupon.maximum_use:
|
||||||
|
frappe.throw(_("Sorry,coupon code are exhausted"))
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
def update_coupon_code_count(coupon_name,transaction_type):
|
||||||
|
coupon=frappe.get_doc("Coupon Code",coupon_name)
|
||||||
|
if coupon:
|
||||||
|
if transaction_type=='used':
|
||||||
|
if coupon.used<coupon.maximum_use:
|
||||||
|
coupon.used=coupon.used+1
|
||||||
|
coupon.save(ignore_permissions=True)
|
||||||
|
else:
|
||||||
|
frappe.throw(_("{0} Coupon used are {1}. Allowed quantity is exhausted").format(coupon.coupon_code,coupon.used))
|
||||||
|
elif transaction_type=='cancelled':
|
||||||
|
if coupon.used>0:
|
||||||
|
coupon.used=coupon.used-1
|
||||||
|
coupon.save(ignore_permissions=True)
|
File diff suppressed because it is too large
Load Diff
@ -364,7 +364,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
update_outstanding = "No" if (cint(self.is_paid) or self.write_off_account) else "Yes"
|
update_outstanding = "No" if (cint(self.is_paid) or self.write_off_account) else "Yes"
|
||||||
|
|
||||||
make_gl_entries(gl_entries, cancel=(self.docstatus == 2),
|
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":
|
if update_outstanding == "No":
|
||||||
update_outstanding_amt(self.credit_to, "Supplier", self.supplier,
|
update_outstanding_amt(self.credit_to, "Supplier", self.supplier,
|
||||||
@ -880,6 +880,17 @@ class PurchaseInvoice(BuyingController):
|
|||||||
# calculate totals again after applying TDS
|
# calculate totals again after applying TDS
|
||||||
self.calculate_taxes_and_totals()
|
self.calculate_taxes_and_totals()
|
||||||
|
|
||||||
|
def get_list_context(context=None):
|
||||||
|
from erpnext.controllers.website_list_for_contact import get_list_context
|
||||||
|
list_context = get_list_context(context)
|
||||||
|
list_context.update({
|
||||||
|
'show_sidebar': True,
|
||||||
|
'show_search': True,
|
||||||
|
'no_breadcrumbs': True,
|
||||||
|
'title': _('Purchase Invoices'),
|
||||||
|
})
|
||||||
|
return list_context
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_debit_note(source_name, target_doc=None):
|
def make_debit_note(source_name, target_doc=None):
|
||||||
from erpnext.controllers.sales_and_purchase_return import make_return_doc
|
from erpnext.controllers.sales_and_purchase_return import make_return_doc
|
||||||
|
@ -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",
|
||||||
|
@ -41,6 +41,8 @@ def get_pos_data():
|
|||||||
items_list = get_items_list(pos_profile, doc.company)
|
items_list = get_items_list(pos_profile, doc.company)
|
||||||
customers = get_customers_list(pos_profile)
|
customers = get_customers_list(pos_profile)
|
||||||
|
|
||||||
|
doc.plc_conversion_rate = update_plc_conversion_rate(doc, pos_profile)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'doc': doc,
|
'doc': doc,
|
||||||
'default_customer': pos_profile.get('customer'),
|
'default_customer': pos_profile.get('customer'),
|
||||||
@ -53,7 +55,7 @@ def get_pos_data():
|
|||||||
'batch_no_data': get_batch_no_data(),
|
'batch_no_data': get_batch_no_data(),
|
||||||
'barcode_data': get_barcode_data(items_list),
|
'barcode_data': get_barcode_data(items_list),
|
||||||
'tax_data': get_item_tax_data(),
|
'tax_data': get_item_tax_data(),
|
||||||
'price_list_data': get_price_list_data(doc.selling_price_list),
|
'price_list_data': get_price_list_data(doc.selling_price_list, doc.plc_conversion_rate),
|
||||||
'customer_wise_price_list': get_customer_wise_price_list(),
|
'customer_wise_price_list': get_customer_wise_price_list(),
|
||||||
'bin_data': get_bin_data(pos_profile),
|
'bin_data': get_bin_data(pos_profile),
|
||||||
'pricing_rules': get_pricing_rule_data(doc),
|
'pricing_rules': get_pricing_rule_data(doc),
|
||||||
@ -62,6 +64,15 @@ def get_pos_data():
|
|||||||
'meta': get_meta()
|
'meta': get_meta()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def update_plc_conversion_rate(doc, pos_profile):
|
||||||
|
conversion_rate = 1.0
|
||||||
|
|
||||||
|
price_list_currency = frappe.get_cached_value("Price List", doc.selling_price_list, "currency")
|
||||||
|
if pos_profile.get("currency") != price_list_currency:
|
||||||
|
conversion_rate = get_exchange_rate(price_list_currency,
|
||||||
|
pos_profile.get("currency"), nowdate(), args="for_selling") or 1.0
|
||||||
|
|
||||||
|
return conversion_rate
|
||||||
|
|
||||||
def get_meta():
|
def get_meta():
|
||||||
doctype_meta = {
|
doctype_meta = {
|
||||||
@ -227,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)
|
||||||
@ -317,14 +328,14 @@ def get_item_tax_data():
|
|||||||
return itemwise_tax
|
return itemwise_tax
|
||||||
|
|
||||||
|
|
||||||
def get_price_list_data(selling_price_list):
|
def get_price_list_data(selling_price_list, conversion_rate):
|
||||||
itemwise_price_list = {}
|
itemwise_price_list = {}
|
||||||
price_lists = frappe.db.sql("""Select ifnull(price_list_rate, 0) as price_list_rate,
|
price_lists = frappe.db.sql("""Select ifnull(price_list_rate, 0) as price_list_rate,
|
||||||
item_code from `tabItem Price` ip where price_list = %(price_list)s""",
|
item_code from `tabItem Price` ip where price_list = %(price_list)s""",
|
||||||
{'price_list': selling_price_list}, as_dict=1)
|
{'price_list': selling_price_list}, as_dict=1)
|
||||||
|
|
||||||
for item in price_lists:
|
for item in price_lists:
|
||||||
itemwise_price_list[item.item_code] = item.price_list_rate
|
itemwise_price_list[item.item_code] = item.price_list_rate * conversion_rate
|
||||||
|
|
||||||
return itemwise_price_list
|
return itemwise_price_list
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -698,7 +698,7 @@ class SalesInvoice(SellingController):
|
|||||||
cint(self.redeem_loyalty_points)) else "Yes"
|
cint(self.redeem_loyalty_points)) else "Yes"
|
||||||
|
|
||||||
make_gl_entries(gl_entries, cancel=(self.docstatus == 2),
|
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":
|
if update_outstanding == "No":
|
||||||
from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
|
from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
|
||||||
|
@ -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()
|
||||||
});
|
});
|
||||||
@ -1624,7 +1627,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
w.print();
|
w.print();
|
||||||
w.close();
|
w.close();
|
||||||
}, 1000)
|
}, 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
submit_invoice: function () {
|
submit_invoice: function () {
|
||||||
@ -1681,6 +1684,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
$(this.wrapper).find('.pos-bill').css('pointer-events', pointer_events);
|
$(this.wrapper).find('.pos-bill').css('pointer-events', pointer_events);
|
||||||
$(this.wrapper).find('.pos-items-section').css('pointer-events', pointer_events);
|
$(this.wrapper).find('.pos-items-section').css('pointer-events', pointer_events);
|
||||||
this.set_primary_action();
|
this.set_primary_action();
|
||||||
|
|
||||||
|
$(this.wrapper).find('#pos-item-disc').prop('disabled',
|
||||||
|
this.pos_profile_data.allow_user_to_edit_discount ? false : true);
|
||||||
|
|
||||||
|
$(this.wrapper).find('#pos-item-price').prop('disabled',
|
||||||
|
this.pos_profile_data.allow_user_to_edit_rate ? false : true);
|
||||||
},
|
},
|
||||||
|
|
||||||
create_invoice: function () {
|
create_invoice: function () {
|
||||||
@ -1891,7 +1900,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
serial_no = me.item_serial_no[key][0];
|
serial_no = me.item_serial_no[key][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.items[0].has_serial_no && serial_no == "") {
|
if (this.items && this.items[0].has_serial_no && serial_no == "") {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
frappe.throw(__(repl("Error: Serial no is mandatory for item %(item)s", {
|
frappe.throw(__(repl("Error: Serial no is mandatory for item %(item)s", {
|
||||||
'item': this.items[0].item_code
|
'item': this.items[0].item_code
|
||||||
|
@ -12,7 +12,7 @@ from frappe.utils import (add_days, getdate, formatdate, date_diff,
|
|||||||
from frappe.contacts.doctype.address.address import (get_address_display,
|
from frappe.contacts.doctype.address.address import (get_address_display,
|
||||||
get_default_address, get_company_address)
|
get_default_address, get_company_address)
|
||||||
from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact
|
from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact
|
||||||
from erpnext.exceptions import PartyFrozen, PartyDisabled, InvalidAccountCurrency
|
from erpnext.exceptions import PartyFrozen, InvalidAccountCurrency
|
||||||
from erpnext.accounts.utils import get_fiscal_year
|
from erpnext.accounts.utils import get_fiscal_year
|
||||||
from erpnext import get_company_currency
|
from erpnext import get_company_currency
|
||||||
|
|
||||||
@ -446,9 +446,7 @@ def validate_party_frozen_disabled(party_type, party_name):
|
|||||||
if party_type and party_name:
|
if party_type and party_name:
|
||||||
if party_type in ("Customer", "Supplier"):
|
if party_type in ("Customer", "Supplier"):
|
||||||
party = frappe.get_cached_value(party_type, party_name, ["is_frozen", "disabled"], as_dict=True)
|
party = frappe.get_cached_value(party_type, party_name, ["is_frozen", "disabled"], as_dict=True)
|
||||||
if party.disabled:
|
if party.get("is_frozen"):
|
||||||
frappe.throw(_("{0} {1} is disabled").format(party_type, party_name), PartyDisabled)
|
|
||||||
elif party.get("is_frozen"):
|
|
||||||
frozen_accounts_modifier = frappe.db.get_single_value( 'Accounts Settings', 'frozen_accounts_modifier')
|
frozen_accounts_modifier = frappe.db.get_single_value( 'Accounts Settings', 'frozen_accounts_modifier')
|
||||||
if not frozen_accounts_modifier in frappe.get_roles():
|
if not frozen_accounts_modifier in frappe.get_roles():
|
||||||
frappe.throw(_("{0} {1} is frozen").format(party_type, party_name), PartyFrozen)
|
frappe.throw(_("{0} {1} is frozen").format(party_type, party_name), PartyFrozen)
|
||||||
|
@ -59,7 +59,6 @@ class ReceivablePayableReport(object):
|
|||||||
self.invoices = set()
|
self.invoices = set()
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
t1 = now()
|
|
||||||
self.get_gl_entries()
|
self.get_gl_entries()
|
||||||
self.voucher_balance = OrderedDict()
|
self.voucher_balance = OrderedDict()
|
||||||
self.init_voucher_balance() # invoiced, paid, credit_note, outstanding
|
self.init_voucher_balance() # invoiced, paid, credit_note, outstanding
|
||||||
@ -73,6 +72,9 @@ class ReceivablePayableReport(object):
|
|||||||
# fetch future payments against invoices
|
# fetch future payments against invoices
|
||||||
self.get_future_payments()
|
self.get_future_payments()
|
||||||
|
|
||||||
|
# Get return entries
|
||||||
|
self.get_return_entries()
|
||||||
|
|
||||||
self.data = []
|
self.data = []
|
||||||
for gle in self.gl_entries:
|
for gle in self.gl_entries:
|
||||||
self.update_voucher_balance(gle)
|
self.update_voucher_balance(gle)
|
||||||
@ -91,6 +93,7 @@ class ReceivablePayableReport(object):
|
|||||||
party = gle.party,
|
party = gle.party,
|
||||||
posting_date = gle.posting_date,
|
posting_date = gle.posting_date,
|
||||||
remarks = gle.remarks,
|
remarks = gle.remarks,
|
||||||
|
account_currency = gle.account_currency,
|
||||||
invoiced = 0.0,
|
invoiced = 0.0,
|
||||||
paid = 0.0,
|
paid = 0.0,
|
||||||
credit_note = 0.0,
|
credit_note = 0.0,
|
||||||
@ -106,7 +109,6 @@ class ReceivablePayableReport(object):
|
|||||||
# get the row where this balance needs to be updated
|
# 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
|
# if its a payment, it will return the linked invoice or will be considered as advance
|
||||||
row = self.get_voucher_balance(gle)
|
row = self.get_voucher_balance(gle)
|
||||||
|
|
||||||
# gle_balance will be the total "debit - credit" for receivable type reports and
|
# gle_balance will be the total "debit - credit" for receivable type reports and
|
||||||
# and vice-versa for payable type reports
|
# and vice-versa for payable type reports
|
||||||
gle_balance = self.get_gle_balance(gle)
|
gle_balance = self.get_gle_balance(gle)
|
||||||
@ -131,7 +133,18 @@ class ReceivablePayableReport(object):
|
|||||||
|
|
||||||
if gle.against_voucher:
|
if gle.against_voucher:
|
||||||
# find invoice
|
# 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:
|
if not voucher_balance:
|
||||||
# no invoice, this is an invoice / stand-alone payment / credit note
|
# no invoice, this is an invoice / stand-alone payment / credit note
|
||||||
@ -258,7 +271,6 @@ class ReceivablePayableReport(object):
|
|||||||
# customer / supplier name
|
# customer / supplier name
|
||||||
party_details = self.get_party_details(row.party)
|
party_details = self.get_party_details(row.party)
|
||||||
row.update(party_details)
|
row.update(party_details)
|
||||||
|
|
||||||
if self.filters.get(scrub(self.filters.party_type)):
|
if self.filters.get(scrub(self.filters.party_type)):
|
||||||
row.currency = row.account_currency
|
row.currency = row.account_currency
|
||||||
else:
|
else:
|
||||||
@ -423,6 +435,19 @@ class ReceivablePayableReport(object):
|
|||||||
if row.future_ref:
|
if row.future_ref:
|
||||||
row.future_ref = ', '.join(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):
|
def set_ageing(self, row):
|
||||||
if self.filters.ageing_based_on == "Due Date":
|
if self.filters.ageing_based_on == "Due Date":
|
||||||
entry_date = row.due_date
|
entry_date = row.due_date
|
||||||
@ -446,6 +471,10 @@ class ReceivablePayableReport(object):
|
|||||||
|
|
||||||
row.age = (getdate(self.age_as_on) - getdate(entry_date)).days or 0
|
row.age = (getdate(self.age_as_on) - getdate(entry_date)).days or 0
|
||||||
index = None
|
index = None
|
||||||
|
|
||||||
|
if not (self.filters.range1 and self.filters.range2 and self.filters.range3 and self.filters.range4):
|
||||||
|
self.filters.range1, self.filters.range2, self.filters.range3, self.filters.range4 = 30, 60, 90, 120
|
||||||
|
|
||||||
for i, days in enumerate([self.filters.range1, self.filters.range2, self.filters.range3, self.filters.range4]):
|
for i, days in enumerate([self.filters.range1, self.filters.range2, self.filters.range3, self.filters.range4]):
|
||||||
if row.age <= days:
|
if row.age <= days:
|
||||||
index = i
|
index = i
|
||||||
@ -685,11 +714,11 @@ class ReceivablePayableReport(object):
|
|||||||
def get_chart_data(self):
|
def get_chart_data(self):
|
||||||
rows = []
|
rows = []
|
||||||
for row in self.data:
|
for row in self.data:
|
||||||
rows.append(
|
values = [row.range1, row.range2, row.range3, row.range4, row.range5]
|
||||||
{
|
precision = cint(frappe.db.get_default("float_precision")) or 2
|
||||||
'values': [row.range1, row.range2, row.range3, row.range4, row.range5]
|
rows.append({
|
||||||
}
|
'values': [flt(val, precision) for val in values]
|
||||||
)
|
})
|
||||||
|
|
||||||
self.chart = {
|
self.chart = {
|
||||||
"data": {
|
"data": {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _, scrub
|
||||||
from frappe.utils import flt, cint
|
from frappe.utils import flt, cint
|
||||||
from erpnext.accounts.party import get_partywise_advanced_payment_amount
|
from erpnext.accounts.party import get_partywise_advanced_payment_amount
|
||||||
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
||||||
@ -40,7 +40,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
|||||||
|
|
||||||
row.party = party
|
row.party = party
|
||||||
if self.party_naming_by == "Naming Series":
|
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)
|
row.update(party_dict)
|
||||||
|
|
||||||
|
@ -286,14 +286,14 @@ class PartyLedgerSummaryReport(object):
|
|||||||
|
|
||||||
if parties and accounts:
|
if parties and accounts:
|
||||||
if len(parties) == 1:
|
if len(parties) == 1:
|
||||||
party = parties.keys()[0]
|
party = list(parties.keys())[0]
|
||||||
for account, amount in iteritems(accounts):
|
for account, amount in iteritems(accounts):
|
||||||
self.party_adjustment_accounts.add(account)
|
self.party_adjustment_accounts.add(account)
|
||||||
self.party_adjustment_details.setdefault(party, {})
|
self.party_adjustment_details.setdefault(party, {})
|
||||||
self.party_adjustment_details[party].setdefault(account, 0)
|
self.party_adjustment_details[party].setdefault(account, 0)
|
||||||
self.party_adjustment_details[party][account] += amount
|
self.party_adjustment_details[party][account] += amount
|
||||||
elif len(accounts) == 1 and not has_irrelevant_entry:
|
elif len(accounts) == 1 and not has_irrelevant_entry:
|
||||||
account = accounts.keys()[0]
|
account = list(accounts.keys())[0]
|
||||||
self.party_adjustment_accounts.add(account)
|
self.party_adjustment_accounts.add(account)
|
||||||
for party, amount in iteritems(parties):
|
for party, amount in iteritems(parties):
|
||||||
self.party_adjustment_details.setdefault(party, {})
|
self.party_adjustment_details.setdefault(party, {})
|
||||||
|
@ -17,7 +17,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
|||||||
filters.update({"from_date": filters.get("date_range") and filters.get("date_range")[0], "to_date": filters.get("date_range") and filters.get("date_range")[1]})
|
filters.update({"from_date": filters.get("date_range") and filters.get("date_range")[0], "to_date": filters.get("date_range") and filters.get("date_range")[1]})
|
||||||
columns = get_columns(additional_table_columns)
|
columns = get_columns(additional_table_columns)
|
||||||
|
|
||||||
company_currency = erpnext.get_company_currency(filters.get('company'))
|
company_currency = frappe.get_cached_value('Company', filters.get("company"), "default_currency")
|
||||||
|
|
||||||
item_list = get_items(filters, additional_query_columns)
|
item_list = get_items(filters, additional_query_columns)
|
||||||
if item_list:
|
if item_list:
|
||||||
|
@ -4,11 +4,14 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from erpnext.accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
|
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
||||||
from frappe.utils import getdate, flt
|
from frappe.utils import getdate, flt
|
||||||
|
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
if not filters: filters = {}
|
if not filters:
|
||||||
|
filters = {}
|
||||||
|
|
||||||
validate_filters(filters)
|
validate_filters(filters)
|
||||||
|
|
||||||
columns = get_columns(filters)
|
columns = get_columns(filters)
|
||||||
@ -19,18 +22,28 @@ def execute(filters=None):
|
|||||||
for d in entries:
|
for d in entries:
|
||||||
invoice = invoice_details.get(d.against_voucher) or frappe._dict()
|
invoice = invoice_details.get(d.against_voucher) or frappe._dict()
|
||||||
|
|
||||||
if d.reference_type=="Purchase Invoice":
|
if d.reference_type == "Purchase Invoice":
|
||||||
payment_amount = flt(d.debit) or -1 * flt(d.credit)
|
payment_amount = flt(d.debit) or -1 * flt(d.credit)
|
||||||
else:
|
else:
|
||||||
payment_amount = flt(d.credit) or -1 * flt(d.debit)
|
payment_amount = flt(d.credit) or -1 * flt(d.debit)
|
||||||
|
|
||||||
row = [d.voucher_type, d.voucher_no, d.party_type, d.party, d.posting_date, d.against_voucher,
|
d.update({
|
||||||
invoice.posting_date, invoice.due_date, d.debit, d.credit, d.remarks]
|
"range1": 0,
|
||||||
|
"range2": 0,
|
||||||
|
"range3": 0,
|
||||||
|
"range4": 0,
|
||||||
|
"outstanding": payment_amount
|
||||||
|
})
|
||||||
|
|
||||||
if d.against_voucher:
|
if d.against_voucher:
|
||||||
row += get_ageing_data(30, 60, 90, 120, d.posting_date, invoice.posting_date, payment_amount)
|
ReceivablePayableReport(filters).get_ageing_data(invoice.posting_date, d)
|
||||||
else:
|
|
||||||
row += ["", "", "", "", ""]
|
row = [
|
||||||
|
d.voucher_type, d.voucher_no, d.party_type, d.party, d.posting_date, d.against_voucher,
|
||||||
|
invoice.posting_date, invoice.due_date, d.debit, d.credit, d.remarks,
|
||||||
|
d.age, d.range1, d.range2, d.range3, d.range4
|
||||||
|
]
|
||||||
|
|
||||||
if invoice.due_date:
|
if invoice.due_date:
|
||||||
row.append((getdate(d.posting_date) - getdate(invoice.due_date)).days or 0)
|
row.append((getdate(d.posting_date) - getdate(invoice.due_date)).days or 0)
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import flt
|
from frappe.utils import flt
|
||||||
from frappe import msgprint, _
|
from frappe import msgprint, _
|
||||||
|
from frappe.model.meta import get_field_precision
|
||||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
|
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
@ -68,7 +69,8 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
|||||||
total_tax = 0
|
total_tax = 0
|
||||||
for tax_acc in tax_accounts:
|
for tax_acc in tax_accounts:
|
||||||
if tax_acc not in income_accounts:
|
if tax_acc not in income_accounts:
|
||||||
tax_amount = flt(invoice_tax_map.get(inv.name, {}).get(tax_acc))
|
tax_amount_precision = get_field_precision(frappe.get_meta("Sales Taxes and Charges").get_field("tax_amount"), currency=company_currency) or 2
|
||||||
|
tax_amount = flt(invoice_tax_map.get(inv.name, {}).get(tax_acc), tax_amount_precision)
|
||||||
total_tax += tax_amount
|
total_tax += tax_amount
|
||||||
row.append(tax_amount)
|
row.append(tax_amount)
|
||||||
|
|
||||||
@ -272,4 +274,4 @@ def get_mode_of_payments(invoice_list):
|
|||||||
for d in inv_mop:
|
for d in inv_mop:
|
||||||
mode_of_payments.setdefault(d.parent, []).append(d.mode_of_payment)
|
mode_of_payments.setdefault(d.parent, []).append(d.mode_of_payment)
|
||||||
|
|
||||||
return mode_of_payments
|
return mode_of_payments
|
||||||
|
@ -5,9 +5,8 @@
|
|||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"letter_head": "Capital Traders",
|
"modified": "2019-02-12 05:10:02.987274",
|
||||||
"modified": "2018-12-12 05:10:02.987274",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Supplier Ledger Summary",
|
"name": "Supplier Ledger Summary",
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"letter_head": "Gadgets International",
|
"modified": "2018-09-21 11:25:00.551823",
|
||||||
"modified": "2018-08-21 11:25:00.551823",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "TDS Computation Summary",
|
"name": "TDS Computation Summary",
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"add_total_row": 0,
|
"add_total_row": 1,
|
||||||
"creation": "2018-08-21 11:32:30.874923",
|
"creation": "2018-08-21 11:32:30.874923",
|
||||||
|
"disable_prepared_report": 0,
|
||||||
"disabled": 0,
|
"disabled": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"letter_head": "Gadgets International",
|
"modified": "2019-09-24 13:46:16.473711",
|
||||||
"modified": "2018-08-21 11:33:40.804532",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "TDS Payable Monthly",
|
"name": "TDS Payable Monthly",
|
||||||
|
@ -70,7 +70,7 @@ def get_result(filters):
|
|||||||
rate = [i.tax_withholding_rate for i in tds_doc.rates
|
rate = [i.tax_withholding_rate for i in tds_doc.rates
|
||||||
if i.fiscal_year == gle_map[d][0].fiscal_year]
|
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]
|
rate = rate[0]
|
||||||
|
|
||||||
if getdate(filters.from_date) <= gle_map[d][0].posting_date \
|
if getdate(filters.from_date) <= gle_map[d][0].posting_date \
|
||||||
@ -164,7 +164,7 @@ def get_columns(filters):
|
|||||||
{
|
{
|
||||||
"label": _("TDS Rate %"),
|
"label": _("TDS Rate %"),
|
||||||
"fieldname": "tds_rate",
|
"fieldname": "tds_rate",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Percent",
|
||||||
"width": 90
|
"width": 90
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -345,6 +345,7 @@ class Asset(AccountsController):
|
|||||||
|
|
||||||
if asset_movement:
|
if asset_movement:
|
||||||
doc = frappe.get_doc('Asset Movement', asset_movement)
|
doc = frappe.get_doc('Asset Movement', asset_movement)
|
||||||
|
doc.naming_series = 'ACC-ASM-.YYYY.-'
|
||||||
doc.submit()
|
doc.submit()
|
||||||
|
|
||||||
def make_gl_entries(self):
|
def make_gl_entries(self):
|
||||||
|
@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import flt, today, getdate, cint
|
from frappe.utils import flt, today, getdate, cint
|
||||||
|
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_checks_for_pl_and_bs_accounts
|
||||||
|
|
||||||
def post_depreciation_entries(date=None):
|
def post_depreciation_entries(date=None):
|
||||||
# Return if automatic booking of asset depreciation is disabled
|
# Return if automatic booking of asset depreciation is disabled
|
||||||
@ -41,6 +42,8 @@ def make_depreciation_entry(asset_name, date=None):
|
|||||||
|
|
||||||
depreciation_cost_center = asset.cost_center or depreciation_cost_center
|
depreciation_cost_center = asset.cost_center or depreciation_cost_center
|
||||||
|
|
||||||
|
accounting_dimensions = get_checks_for_pl_and_bs_accounts()
|
||||||
|
|
||||||
for d in asset.get("schedules"):
|
for d in asset.get("schedules"):
|
||||||
if not d.journal_entry and getdate(d.schedule_date) <= getdate(date):
|
if not d.journal_entry and getdate(d.schedule_date) <= getdate(date):
|
||||||
je = frappe.new_doc("Journal Entry")
|
je = frappe.new_doc("Journal Entry")
|
||||||
@ -51,23 +54,40 @@ def make_depreciation_entry(asset_name, date=None):
|
|||||||
je.finance_book = d.finance_book
|
je.finance_book = d.finance_book
|
||||||
je.remark = "Depreciation Entry against {0} worth {1}".format(asset_name, d.depreciation_amount)
|
je.remark = "Depreciation Entry against {0} worth {1}".format(asset_name, d.depreciation_amount)
|
||||||
|
|
||||||
je.append("accounts", {
|
credit_entry = {
|
||||||
"account": accumulated_depreciation_account,
|
"account": accumulated_depreciation_account,
|
||||||
"credit_in_account_currency": d.depreciation_amount,
|
"credit_in_account_currency": d.depreciation_amount,
|
||||||
"reference_type": "Asset",
|
"reference_type": "Asset",
|
||||||
"reference_name": asset.name
|
"reference_name": asset.name
|
||||||
})
|
}
|
||||||
|
|
||||||
je.append("accounts", {
|
debit_entry = {
|
||||||
"account": depreciation_expense_account,
|
"account": depreciation_expense_account,
|
||||||
"debit_in_account_currency": d.depreciation_amount,
|
"debit_in_account_currency": d.depreciation_amount,
|
||||||
"reference_type": "Asset",
|
"reference_type": "Asset",
|
||||||
"reference_name": asset.name,
|
"reference_name": asset.name,
|
||||||
"cost_center": depreciation_cost_center
|
"cost_center": depreciation_cost_center
|
||||||
})
|
}
|
||||||
|
|
||||||
|
for dimension in accounting_dimensions:
|
||||||
|
if (asset.get(dimension['fieldname']) or dimension.get('mandatory_for_bs')):
|
||||||
|
credit_entry.update({
|
||||||
|
dimension['fieldname']: asset.get(dimension['fieldname']) or dimension.get('default_dimension')
|
||||||
|
})
|
||||||
|
|
||||||
|
if (asset.get(dimension['fieldname']) or dimension.get('mandatory_for_pl')):
|
||||||
|
debit_entry.update({
|
||||||
|
dimension['fieldname']: asset.get(dimension['fieldname']) or dimension.get('default_dimension')
|
||||||
|
})
|
||||||
|
|
||||||
|
je.append("accounts", credit_entry)
|
||||||
|
|
||||||
|
je.append("accounts", debit_entry)
|
||||||
|
|
||||||
je.flags.ignore_permissions = True
|
je.flags.ignore_permissions = True
|
||||||
je.submit()
|
je.save()
|
||||||
|
if not je.meta.get_workflow():
|
||||||
|
je.submit()
|
||||||
|
|
||||||
d.db_set("journal_entry", je.name)
|
d.db_set("journal_entry", je.name)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ def calculate_next_due_date(periodicity, start_date = None, end_date = None, las
|
|||||||
if not start_date and not last_completion_date:
|
if not start_date and not last_completion_date:
|
||||||
start_date = frappe.utils.now()
|
start_date = frappe.utils.now()
|
||||||
|
|
||||||
if last_completion_date and (last_completion_date > start_date or not start_date):
|
if last_completion_date and ((start_date and last_completion_date > start_date) or not start_date):
|
||||||
start_date = last_completion_date
|
start_date = last_completion_date
|
||||||
if periodicity == 'Daily':
|
if periodicity == 'Daily':
|
||||||
next_due_date = add_days(start_date, 1)
|
next_due_date = add_days(start_date, 1)
|
||||||
@ -71,10 +71,11 @@ def calculate_next_due_date(periodicity, start_date = None, end_date = None, las
|
|||||||
next_due_date = add_years(start_date, 2)
|
next_due_date = add_years(start_date, 2)
|
||||||
if periodicity == 'Quarterly':
|
if periodicity == 'Quarterly':
|
||||||
next_due_date = add_months(start_date, 3)
|
next_due_date = add_months(start_date, 3)
|
||||||
if end_date and (start_date >= end_date or last_completion_date >= end_date or next_due_date):
|
if end_date and ((start_date and start_date >= end_date) or (last_completion_date and last_completion_date >= end_date) or next_due_date):
|
||||||
next_due_date = ""
|
next_due_date = ""
|
||||||
return next_due_date
|
return next_due_date
|
||||||
|
|
||||||
|
|
||||||
def update_maintenance_log(asset_maintenance, item_code, item_name, task):
|
def update_maintenance_log(asset_maintenance, item_code, item_name, task):
|
||||||
asset_maintenance_log = frappe.get_value("Asset Maintenance Log", {"asset_maintenance": asset_maintenance,
|
asset_maintenance_log = frappe.get_value("Asset Maintenance Log", {"asset_maintenance": asset_maintenance,
|
||||||
"task": task.maintenance_task, "maintenance_status": ('in',['Planned','Overdue'])})
|
"task": task.maintenance_task, "maintenance_status": ('in',['Planned','Overdue'])})
|
||||||
|
@ -1,685 +1,211 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"allow_import": 1,
|
||||||
"allow_guest_to_view": 0,
|
"autoname": "naming_series:",
|
||||||
"allow_import": 1,
|
"creation": "2016-04-25 18:00:23.559973",
|
||||||
"allow_rename": 0,
|
"doctype": "DocType",
|
||||||
"autoname": "ACC-ASM-.YYYY.-.#####",
|
"field_order": [
|
||||||
"beta": 0,
|
"naming_series",
|
||||||
"creation": "2016-04-25 18:00:23.559973",
|
"company",
|
||||||
"custom": 0,
|
"purpose",
|
||||||
"docstatus": 0,
|
"asset",
|
||||||
"doctype": "DocType",
|
"transaction_date",
|
||||||
"document_type": "",
|
"column_break_4",
|
||||||
"editable_grid": 0,
|
"quantity",
|
||||||
|
"select_serial_no",
|
||||||
|
"serial_no",
|
||||||
|
"section_break_7",
|
||||||
|
"source_location",
|
||||||
|
"target_location",
|
||||||
|
"column_break_10",
|
||||||
|
"from_employee",
|
||||||
|
"to_employee",
|
||||||
|
"reference",
|
||||||
|
"reference_doctype",
|
||||||
|
"reference_name",
|
||||||
|
"amended_from"
|
||||||
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "company",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"in_list_view": 1,
|
||||||
"bold": 0,
|
"in_standard_filter": 1,
|
||||||
"collapsible": 0,
|
"label": "Company",
|
||||||
"columns": 0,
|
"options": "Company",
|
||||||
"fieldname": "company",
|
"remember_last_selected_value": 1,
|
||||||
"fieldtype": "Link",
|
"reqd": 1
|
||||||
"hidden": 0,
|
},
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
|
||||||
"in_standard_filter": 1,
|
|
||||||
"label": "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": 1,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"default": "Transfer",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldname": "purpose",
|
||||||
"allow_on_submit": 0,
|
"fieldtype": "Select",
|
||||||
"bold": 0,
|
"label": "Purpose",
|
||||||
"collapsible": 0,
|
"options": "\nIssue\nReceipt\nTransfer",
|
||||||
"columns": 0,
|
"reqd": 1
|
||||||
"default": "Transfer",
|
},
|
||||||
"fieldname": "purpose",
|
|
||||||
"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": "Purpose",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "\nIssue\nReceipt\nTransfer",
|
|
||||||
"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
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "asset",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"in_global_search": 1,
|
||||||
"bold": 0,
|
"in_list_view": 1,
|
||||||
"collapsible": 0,
|
"in_standard_filter": 1,
|
||||||
"columns": 0,
|
"label": "Asset",
|
||||||
"fieldname": "asset",
|
"options": "Asset",
|
||||||
"fieldtype": "Link",
|
"reqd": 1
|
||||||
"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": "Asset",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Asset",
|
|
||||||
"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
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "transaction_date",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Datetime",
|
||||||
"allow_on_submit": 0,
|
"in_list_view": 1,
|
||||||
"bold": 0,
|
"label": "Transaction Date",
|
||||||
"collapsible": 0,
|
"reqd": 1
|
||||||
"columns": 0,
|
},
|
||||||
"fieldname": "transaction_date",
|
|
||||||
"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": "Transaction 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": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "column_break_4",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Column Break"
|
||||||
"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
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "quantity",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Float",
|
||||||
"allow_on_submit": 0,
|
"label": "Quantity"
|
||||||
"bold": 0,
|
},
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "quantity",
|
|
||||||
"fieldtype": "Float",
|
|
||||||
"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": "Quantity",
|
|
||||||
"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_bulk_edit": 0,
|
"fieldname": "select_serial_no",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"label": "Select Serial No",
|
||||||
"bold": 0,
|
"options": "Serial No"
|
||||||
"collapsible": 0,
|
},
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "select_serial_no",
|
|
||||||
"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": "Select Serial No",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Serial No",
|
|
||||||
"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_bulk_edit": 0,
|
"fieldname": "serial_no",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Small Text",
|
||||||
"allow_on_submit": 0,
|
"label": "Serial No"
|
||||||
"bold": 0,
|
},
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "serial_no",
|
|
||||||
"fieldtype": "Small Text",
|
|
||||||
"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": "Serial No",
|
|
||||||
"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_bulk_edit": 0,
|
"fieldname": "section_break_7",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Section Break"
|
||||||
"allow_on_submit": 0,
|
},
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "section_break_7",
|
|
||||||
"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
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "source_location",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"label": "Source Location",
|
||||||
"bold": 0,
|
"options": "Location"
|
||||||
"collapsible": 0,
|
},
|
||||||
"columns": 0,
|
|
||||||
"fetch_from": "",
|
|
||||||
"fieldname": "source_location",
|
|
||||||
"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": "Source Location",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Location",
|
|
||||||
"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_bulk_edit": 0,
|
"fieldname": "target_location",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"label": "Target Location",
|
||||||
"bold": 0,
|
"options": "Location"
|
||||||
"collapsible": 0,
|
},
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "target_location",
|
|
||||||
"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": "Target Location",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Location",
|
|
||||||
"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_bulk_edit": 0,
|
"fieldname": "column_break_10",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Column Break"
|
||||||
"allow_on_submit": 0,
|
},
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "column_break_10",
|
|
||||||
"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
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "from_employee",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"ignore_user_permissions": 1,
|
||||||
"bold": 0,
|
"label": "From Employee",
|
||||||
"collapsible": 0,
|
"options": "Employee"
|
||||||
"columns": 0,
|
},
|
||||||
"fieldname": "from_employee",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 1,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "From Employee",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Employee",
|
|
||||||
"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_bulk_edit": 0,
|
"fieldname": "to_employee",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"ignore_user_permissions": 1,
|
||||||
"bold": 0,
|
"label": "To Employee",
|
||||||
"collapsible": 0,
|
"options": "Employee"
|
||||||
"columns": 0,
|
},
|
||||||
"fieldname": "to_employee",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 1,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "To Employee",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Employee",
|
|
||||||
"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_bulk_edit": 0,
|
"fieldname": "reference",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Section Break",
|
||||||
"allow_on_submit": 0,
|
"label": "Reference"
|
||||||
"bold": 0,
|
},
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "reference",
|
|
||||||
"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": "Reference",
|
|
||||||
"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_bulk_edit": 0,
|
"fieldname": "reference_doctype",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"label": "Reference DocType",
|
||||||
"bold": 0,
|
"no_copy": 1,
|
||||||
"collapsible": 0,
|
"options": "DocType",
|
||||||
"columns": 0,
|
"read_only": 1
|
||||||
"fieldname": "reference_doctype",
|
},
|
||||||
"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": "Reference DocType",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 1,
|
|
||||||
"options": "DocType",
|
|
||||||
"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_bulk_edit": 0,
|
"fieldname": "reference_name",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Dynamic Link",
|
||||||
"allow_on_submit": 0,
|
"label": "Reference Name",
|
||||||
"bold": 0,
|
"no_copy": 1,
|
||||||
"collapsible": 0,
|
"options": "reference_doctype",
|
||||||
"columns": 0,
|
"read_only": 1
|
||||||
"fieldname": "reference_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": 0,
|
|
||||||
"label": "Reference Name",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 1,
|
|
||||||
"options": "reference_doctype",
|
|
||||||
"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_bulk_edit": 0,
|
"fieldname": "amended_from",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"label": "Amended From",
|
||||||
"bold": 0,
|
"no_copy": 1,
|
||||||
"collapsible": 0,
|
"options": "Asset Movement",
|
||||||
"columns": 0,
|
"print_hide": 1,
|
||||||
"fieldname": "amended_from",
|
"read_only": 1
|
||||||
"fieldtype": "Link",
|
},
|
||||||
"hidden": 0,
|
{
|
||||||
"ignore_user_permissions": 0,
|
"default": "ACC-ASM-.YYYY.-",
|
||||||
"ignore_xss_filter": 0,
|
"fieldname": "naming_series",
|
||||||
"in_filter": 0,
|
"fieldtype": "Select",
|
||||||
"in_global_search": 0,
|
"label": "Series",
|
||||||
"in_list_view": 0,
|
"options": "ACC-ASM-.YYYY.-",
|
||||||
"in_standard_filter": 0,
|
"reqd": 1
|
||||||
"label": "Amended From",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 1,
|
|
||||||
"options": "Asset Movement",
|
|
||||||
"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
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"is_submittable": 1,
|
||||||
"hide_heading": 0,
|
"modified": "2019-09-16 16:27:53.887634",
|
||||||
"hide_toolbar": 0,
|
"modified_by": "Administrator",
|
||||||
"idx": 0,
|
"module": "Assets",
|
||||||
"image_view": 0,
|
"name": "Asset Movement",
|
||||||
"in_create": 0,
|
"owner": "Administrator",
|
||||||
"is_submittable": 1,
|
|
||||||
"issingle": 0,
|
|
||||||
"istable": 0,
|
|
||||||
"max_attachments": 0,
|
|
||||||
"modified": "2018-08-21 16:15:40.563655",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"module": "Assets",
|
|
||||||
"name": "Asset Movement",
|
|
||||||
"name_case": "",
|
|
||||||
"owner": "Administrator",
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 1,
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
"email": 1,
|
"email": 1,
|
||||||
"export": 1,
|
"export": 1,
|
||||||
"if_owner": 0,
|
"print": 1,
|
||||||
"import": 0,
|
"read": 1,
|
||||||
"permlevel": 0,
|
"report": 1,
|
||||||
"print": 1,
|
"role": "System Manager",
|
||||||
"read": 1,
|
"share": 1,
|
||||||
"report": 1,
|
"submit": 1,
|
||||||
"role": "System Manager",
|
|
||||||
"set_user_permissions": 0,
|
|
||||||
"share": 1,
|
|
||||||
"submit": 1,
|
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 1,
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
"email": 1,
|
"email": 1,
|
||||||
"export": 1,
|
"export": 1,
|
||||||
"if_owner": 0,
|
"print": 1,
|
||||||
"import": 0,
|
"read": 1,
|
||||||
"permlevel": 0,
|
"report": 1,
|
||||||
"print": 1,
|
"role": "Accounts Manager",
|
||||||
"read": 1,
|
"share": 1,
|
||||||
"report": 1,
|
"submit": 1,
|
||||||
"role": "Accounts Manager",
|
|
||||||
"set_user_permissions": 0,
|
|
||||||
"share": 1,
|
|
||||||
"submit": 1,
|
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 1,
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
"email": 1,
|
"email": 1,
|
||||||
"export": 1,
|
"export": 1,
|
||||||
"if_owner": 0,
|
"print": 1,
|
||||||
"import": 0,
|
"read": 1,
|
||||||
"permlevel": 0,
|
"report": 1,
|
||||||
"print": 1,
|
"role": "Stock Manager",
|
||||||
"read": 1,
|
"share": 1,
|
||||||
"report": 1,
|
"submit": 1,
|
||||||
"role": "Stock Manager",
|
|
||||||
"set_user_permissions": 0,
|
|
||||||
"share": 1,
|
|
||||||
"submit": 1,
|
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"quick_entry": 0,
|
"sort_field": "modified",
|
||||||
"read_only": 0,
|
"sort_order": "DESC"
|
||||||
"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
|
|
||||||
}
|
}
|
@ -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 Location\nDisposed",
|
||||||
|
default: 'In Location',
|
||||||
|
reqd: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname:"finance_book",
|
||||||
|
label: __("Finance Book"),
|
||||||
|
fieldtype: "Link",
|
||||||
|
options: "Finance Book"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
};
|
@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -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 Location':
|
||||||
|
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'''))
|
@ -10,7 +10,8 @@ frappe.ui.form.on("Purchase Order", {
|
|||||||
frm.custom_make_buttons = {
|
frm.custom_make_buttons = {
|
||||||
'Purchase Receipt': 'Receipt',
|
'Purchase Receipt': 'Receipt',
|
||||||
'Purchase Invoice': 'Invoice',
|
'Purchase Invoice': 'Invoice',
|
||||||
'Stock Entry': 'Material to Supplier'
|
'Stock Entry': 'Material to Supplier',
|
||||||
|
'Payment Entry': 'Payment'
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.set_query("reserve_warehouse", "supplied_items", function() {
|
frm.set_query("reserve_warehouse", "supplied_items", function() {
|
||||||
@ -196,10 +197,10 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
if(items.length >= 1){
|
if(items.length >= 1){
|
||||||
me.raw_material_data = [];
|
me.raw_material_data = [];
|
||||||
me.show_dialog = 1;
|
me.show_dialog = 1;
|
||||||
let title = "";
|
let title = __('Transfer Material to Supplier');
|
||||||
let fields = [
|
let fields = [
|
||||||
{fieldtype:'Section Break', label: __('Raw Materials')},
|
{fieldtype:'Section Break', label: __('Raw Materials')},
|
||||||
{fieldname: 'sub_con_rm_items', fieldtype: 'Table',
|
{fieldname: 'sub_con_rm_items', fieldtype: 'Table', label: __('Items'),
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
fieldtype:'Data',
|
fieldtype:'Data',
|
||||||
@ -271,7 +272,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
'item_code': item.main_item_code,
|
'item_code': item.main_item_code,
|
||||||
'rm_item_code': item.rm_item_code,
|
'rm_item_code': item.rm_item_code,
|
||||||
'item_name': item.rm_item_code,
|
'item_name': item.rm_item_code,
|
||||||
'qty': item.required_qty,
|
'qty': item.required_qty - item.supplied_qty,
|
||||||
'warehouse':item.reserve_warehouse,
|
'warehouse':item.reserve_warehouse,
|
||||||
'rate':item.rate,
|
'rate':item.rate,
|
||||||
'amount':item.amount,
|
'amount':item.amount,
|
||||||
|
@ -386,7 +386,21 @@ def make_purchase_receipt(source_name, target_doc=None):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_purchase_invoice(source_name, target_doc=None):
|
def make_purchase_invoice(source_name, target_doc=None):
|
||||||
|
return get_mapped_purchase_invoice(source_name, target_doc)
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def make_purchase_invoice_from_portal(purchase_order_name):
|
||||||
|
doc = get_mapped_purchase_invoice(purchase_order_name, ignore_permissions=True)
|
||||||
|
if doc.contact_email != frappe.session.user:
|
||||||
|
frappe.throw(_('Not Permitted'), frappe.PermissionError)
|
||||||
|
doc.save()
|
||||||
|
frappe.db.commit()
|
||||||
|
frappe.response['type'] = 'redirect'
|
||||||
|
frappe.response.location = '/purchase-invoices/' + doc.name
|
||||||
|
|
||||||
|
def get_mapped_purchase_invoice(source_name, target_doc=None, ignore_permissions=False):
|
||||||
def postprocess(source, target):
|
def postprocess(source, target):
|
||||||
|
target.flags.ignore_permissions = ignore_permissions
|
||||||
set_missing_values(source, target)
|
set_missing_values(source, target)
|
||||||
#Get the advance paid Journal Entries in Purchase Invoice Advance
|
#Get the advance paid Journal Entries in Purchase Invoice Advance
|
||||||
|
|
||||||
@ -437,7 +451,8 @@ def make_purchase_invoice(source_name, target_doc=None):
|
|||||||
"add_if_empty": True
|
"add_if_empty": True
|
||||||
}
|
}
|
||||||
|
|
||||||
doc = get_mapped_doc("Purchase Order", source_name, fields, target_doc, postprocess)
|
doc = get_mapped_doc("Purchase Order", source_name, fields,
|
||||||
|
target_doc, postprocess, ignore_permissions=ignore_permissions)
|
||||||
|
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
@ -501,6 +516,17 @@ def get_item_details(items):
|
|||||||
|
|
||||||
return item_details
|
return item_details
|
||||||
|
|
||||||
|
def get_list_context(context=None):
|
||||||
|
from erpnext.controllers.website_list_for_contact import get_list_context
|
||||||
|
list_context = get_list_context(context)
|
||||||
|
list_context.update({
|
||||||
|
'show_sidebar': True,
|
||||||
|
'show_search': True,
|
||||||
|
'no_breadcrumbs': True,
|
||||||
|
'title': _('Purchase Orders'),
|
||||||
|
})
|
||||||
|
return list_context
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def update_status(status, name):
|
def update_status(status, name):
|
||||||
po = frappe.get_doc("Purchase Order", name)
|
po = frappe.get_doc("Purchase Order", name)
|
||||||
|
@ -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",
|
||||||
@ -712,4 +714,4 @@
|
|||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,6 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import frappe, unittest
|
import frappe, unittest
|
||||||
from erpnext.accounts.party import get_due_date
|
from erpnext.accounts.party import get_due_date
|
||||||
from erpnext.exceptions import PartyDisabled
|
|
||||||
from frappe.test_runner import make_test_records
|
from frappe.test_runner import make_test_records
|
||||||
|
|
||||||
test_dependencies = ['Payment Term', 'Payment Terms Template']
|
test_dependencies = ['Payment Term', 'Payment Terms Template']
|
||||||
@ -71,7 +70,7 @@ class TestSupplier(unittest.TestCase):
|
|||||||
|
|
||||||
po = create_purchase_order(do_not_save=True)
|
po = create_purchase_order(do_not_save=True)
|
||||||
|
|
||||||
self.assertRaises(PartyDisabled, po.save)
|
self.assertRaises(frappe.ValidationError, po.save)
|
||||||
|
|
||||||
frappe.db.set_value("Supplier", "_Test Supplier", "disabled", 0)
|
frappe.db.set_value("Supplier", "_Test Supplier", "disabled", 0)
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ def get_employees_with_number(number):
|
|||||||
employee_emails = [employee.user_id for employee in employees]
|
employee_emails = [employee.user_id for employee in employees]
|
||||||
frappe.cache().hset('employees_with_number', number, employee_emails)
|
frappe.cache().hset('employees_with_number', number, employee_emails)
|
||||||
|
|
||||||
return employee
|
return employee_emails
|
||||||
|
|
||||||
def set_caller_information(doc, state):
|
def set_caller_information(doc, state):
|
||||||
'''Called from hooks on creation of Lead or Contact'''
|
'''Called from hooks on creation of Lead or Contact'''
|
||||||
|
@ -143,7 +143,7 @@ class AccountsController(TransactionBase):
|
|||||||
if not self.cash_bank_account:
|
if not self.cash_bank_account:
|
||||||
# show message that the amount is not paid
|
# 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"))
|
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:
|
if cint(self.is_return) and self.grand_total > self.paid_amount:
|
||||||
self.paid_amount = flt(flt(self.grand_total), self.precision("paid_amount"))
|
self.paid_amount = flt(flt(self.grand_total), self.precision("paid_amount"))
|
||||||
|
|
||||||
@ -606,8 +606,13 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
max_allowed_amt = flt(ref_amt * (100 + allowance) / 100)
|
max_allowed_amt = flt(ref_amt * (100 + allowance) / 100)
|
||||||
|
|
||||||
|
if total_billed_amt < 0 and max_allowed_amt < 0:
|
||||||
|
# while making debit note against purchase return entry(purchase receipt) getting overbill error
|
||||||
|
total_billed_amt = abs(total_billed_amt)
|
||||||
|
max_allowed_amt = abs(max_allowed_amt)
|
||||||
|
|
||||||
if total_billed_amt - max_allowed_amt > 0.01:
|
if total_billed_amt - max_allowed_amt > 0.01:
|
||||||
frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow over-billing, please set in Stock Settings")
|
frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow over-billing, please set allowance in Accounts Settings")
|
||||||
.format(item.item_code, item.idx, max_allowed_amt))
|
.format(item.item_code, item.idx, max_allowed_amt))
|
||||||
|
|
||||||
def get_company_default(self, fieldname):
|
def get_company_default(self, fieldname):
|
||||||
@ -1195,8 +1200,22 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
|||||||
child_item.rate = flt(d.get("rate"))
|
child_item.rate = flt(d.get("rate"))
|
||||||
|
|
||||||
if flt(child_item.price_list_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, \
|
if flt(child_item.rate) > flt(child_item.price_list_rate):
|
||||||
child_item.precision("discount_percentage"))
|
# if rate is greater than price_list_rate, set margin
|
||||||
|
# or set discount
|
||||||
|
child_item.discount_percentage = 0
|
||||||
|
child_item.margin_type = "Amount"
|
||||||
|
child_item.margin_rate_or_amount = flt(child_item.rate - child_item.price_list_rate,
|
||||||
|
child_item.precision("margin_rate_or_amount"))
|
||||||
|
child_item.rate_with_margin = child_item.rate
|
||||||
|
else:
|
||||||
|
child_item.discount_percentage = flt((1 - flt(child_item.rate) / flt(child_item.price_list_rate)) * 100.0,
|
||||||
|
child_item.precision("discount_percentage"))
|
||||||
|
child_item.discount_amount = flt(
|
||||||
|
child_item.price_list_rate) - flt(child_item.rate)
|
||||||
|
child_item.margin_type = ""
|
||||||
|
child_item.margin_rate_or_amount = 0
|
||||||
|
child_item.rate_with_margin = 0
|
||||||
|
|
||||||
child_item.flags.ignore_validate_update_after_submit = True
|
child_item.flags.ignore_validate_update_after_submit = True
|
||||||
if new_child_flag:
|
if new_child_flag:
|
||||||
@ -1220,7 +1239,6 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
|||||||
parent.update_status_updater()
|
parent.update_status_updater()
|
||||||
else:
|
else:
|
||||||
parent.check_credit_limit()
|
parent.check_credit_limit()
|
||||||
|
|
||||||
parent.save()
|
parent.save()
|
||||||
|
|
||||||
if parent_doctype == 'Purchase Order':
|
if parent_doctype == 'Purchase Order':
|
||||||
|
@ -598,6 +598,7 @@ class BuyingController(StockController):
|
|||||||
'item_code': d.item_code,
|
'item_code': d.item_code,
|
||||||
'via_stock_ledger': False,
|
'via_stock_ledger': False,
|
||||||
'company': self.company,
|
'company': self.company,
|
||||||
|
'supplier': self.supplier,
|
||||||
'actual_qty': d.qty,
|
'actual_qty': d.qty,
|
||||||
'purchase_document_type': self.doctype,
|
'purchase_document_type': self.doctype,
|
||||||
'purchase_document_no': self.name,
|
'purchase_document_no': self.name,
|
||||||
@ -625,6 +626,7 @@ class BuyingController(StockController):
|
|||||||
'asset_category': item_data.get('asset_category'),
|
'asset_category': item_data.get('asset_category'),
|
||||||
'location': row.asset_location,
|
'location': row.asset_location,
|
||||||
'company': self.company,
|
'company': self.company,
|
||||||
|
'supplier': self.supplier,
|
||||||
'purchase_date': self.posting_date,
|
'purchase_date': self.posting_date,
|
||||||
'calculate_depreciation': 1,
|
'calculate_depreciation': 1,
|
||||||
'purchase_receipt_amount': purchase_amount,
|
'purchase_receipt_amount': purchase_amount,
|
||||||
|
@ -283,7 +283,7 @@ def copy_attributes_to_variant(item, variant):
|
|||||||
if 'description' not in allow_fields:
|
if 'description' not in allow_fields:
|
||||||
if not variant.description:
|
if not variant.description:
|
||||||
variant.description = ""
|
variant.description = ""
|
||||||
|
else:
|
||||||
if item.variant_based_on=='Item Attribute':
|
if item.variant_based_on=='Item Attribute':
|
||||||
if variant.attributes:
|
if variant.attributes:
|
||||||
attributes_description = item.description + " "
|
attributes_description = item.description + " "
|
||||||
@ -291,7 +291,7 @@ def copy_attributes_to_variant(item, variant):
|
|||||||
attributes_description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
|
attributes_description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
|
||||||
|
|
||||||
if attributes_description not in variant.description:
|
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):
|
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"""
|
"""Uses template's item code and abbreviations to make variant's item code"""
|
||||||
|
@ -440,17 +440,17 @@ def get_batch_numbers(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def item_manufacturer_query(doctype, txt, searchfield, start, page_len, filters):
|
def item_manufacturer_query(doctype, txt, searchfield, start, page_len, filters):
|
||||||
search_txt = "{0}%".format(txt)
|
item_filters = [
|
||||||
|
['manufacturer', 'like', '%' + txt + '%'],
|
||||||
|
['item_code', '=', filters.get("item_code")]
|
||||||
|
]
|
||||||
|
|
||||||
item_filters = {
|
item_manufacturers = frappe.get_all(
|
||||||
'manufacturer': ('like', search_txt),
|
"Item Manufacturer",
|
||||||
'item_code': filters.get("item_code")
|
fields=["manufacturer", "manufacturer_part_no"],
|
||||||
}
|
filters=item_filters,
|
||||||
|
|
||||||
return frappe.get_all("Item Manufacturer",
|
|
||||||
fields = "manufacturer",
|
|
||||||
filters = item_filters,
|
|
||||||
limit_start=start,
|
limit_start=start,
|
||||||
limit_page_length=page_len,
|
limit_page_length=page_len,
|
||||||
as_list=1
|
as_list=1
|
||||||
)
|
)
|
||||||
|
return item_manufacturers
|
||||||
|
@ -37,9 +37,9 @@ status_map = {
|
|||||||
"Sales Order": [
|
"Sales Order": [
|
||||||
["Draft", None],
|
["Draft", None],
|
||||||
["To Deliver and Bill", "eval:self.per_delivered < 100 and self.per_billed < 100 and self.docstatus == 1"],
|
["To Deliver and Bill", "eval:self.per_delivered < 100 and self.per_billed < 100 and self.docstatus == 1"],
|
||||||
["To Bill", "eval:self.per_delivered == 100 and self.per_billed < 100 and self.docstatus == 1"],
|
["To Bill", "eval:(self.per_delivered == 100 or self.skip_delivery_note) and self.per_billed < 100 and self.docstatus == 1"],
|
||||||
["To Deliver", "eval:self.per_delivered < 100 and self.per_billed == 100 and self.docstatus == 1"],
|
["To Deliver", "eval:self.per_delivered < 100 and self.per_billed == 100 and self.docstatus == 1 and not self.skip_delivery_note"],
|
||||||
["Completed", "eval:self.per_delivered == 100 and self.per_billed == 100 and self.docstatus == 1"],
|
["Completed", "eval:(self.per_delivered == 100 or self.skip_delivery_note) and self.per_billed == 100 and self.docstatus == 1"],
|
||||||
["Cancelled", "eval:self.docstatus==2"],
|
["Cancelled", "eval:self.docstatus==2"],
|
||||||
["Closed", "eval:self.status=='Closed'"],
|
["Closed", "eval:self.status=='Closed'"],
|
||||||
["On Hold", "eval:self.status=='On Hold'"],
|
["On Hold", "eval:self.status=='On Hold'"],
|
||||||
|
@ -140,6 +140,8 @@ def period_wise_columns_query(filters, trans):
|
|||||||
|
|
||||||
if trans in ['Purchase Receipt', 'Delivery Note', 'Purchase Invoice', 'Sales Invoice']:
|
if trans in ['Purchase Receipt', 'Delivery Note', 'Purchase Invoice', 'Sales Invoice']:
|
||||||
trans_date = 'posting_date'
|
trans_date = 'posting_date'
|
||||||
|
if filters.period_based_on:
|
||||||
|
trans_date = filters.period_based_on
|
||||||
else:
|
else:
|
||||||
trans_date = 'transaction_date'
|
trans_date = 'transaction_date'
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ def get_transaction_list(doctype, txt=None, filters=None, limit_start=0, limit_p
|
|||||||
|
|
||||||
if not filters: filters = []
|
if not filters: filters = []
|
||||||
|
|
||||||
if doctype == 'Supplier Quotation':
|
if doctype in ['Supplier Quotation', 'Purchase Invoice']:
|
||||||
filters.append((doctype, 'docstatus', '<', 2))
|
filters.append((doctype, 'docstatus', '<', 2))
|
||||||
else:
|
else:
|
||||||
filters.append((doctype, 'docstatus', '=', 1))
|
filters.append((doctype, 'docstatus', '=', 1))
|
||||||
@ -175,4 +175,4 @@ def get_customer_field_name(doctype):
|
|||||||
if doctype == 'Quotation':
|
if doctype == 'Quotation':
|
||||||
return 'party_name'
|
return 'party_name'
|
||||||
else:
|
else:
|
||||||
return 'customer'
|
return 'customer'
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -100,6 +100,10 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frm.doc.opportunity_from && frm.doc.party_name && !frm.doc.contact_person) {
|
||||||
|
frm.trigger("party_name");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
set_contact_link: function(frm) {
|
set_contact_link: function(frm) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -18,12 +18,14 @@ frappe.listview_settings['Opportunity'] = {
|
|||||||
listview.call_for_selected_items(method, {"status": "Closed"});
|
listview.call_for_selected_items(method, {"status": "Closed"});
|
||||||
});
|
});
|
||||||
|
|
||||||
listview.page.fields_dict.opportunity_from.get_query = function() {
|
if(listview.page.fields_dict.opportunity_from) {
|
||||||
return {
|
listview.page.fields_dict.opportunity_from.get_query = function() {
|
||||||
"filters": {
|
return {
|
||||||
"name": ["in", ["Customer", "Lead"]],
|
"filters": {
|
||||||
}
|
"name": ["in", ["Customer", "Lead"]],
|
||||||
|
}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -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)
|
||||||
|
@ -17,7 +17,7 @@ def get_last_interaction(contact=None, lead=None):
|
|||||||
if link.link_doctype == 'Customer':
|
if link.link_doctype == 'Customer':
|
||||||
last_issue = get_last_issue_from_customer(link.link_name)
|
last_issue = get_last_issue_from_customer(link.link_name)
|
||||||
query_condition += "(`reference_doctype`=%s AND `reference_name`=%s) OR"
|
query_condition += "(`reference_doctype`=%s AND `reference_name`=%s) OR"
|
||||||
values += [link_link_doctype, link_link_name]
|
values += [link.link_doctype, link.link_name]
|
||||||
|
|
||||||
if query_condition:
|
if query_condition:
|
||||||
# remove extra appended 'OR'
|
# remove extra appended 'OR'
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"letter_head": "",
|
"modified": "2019-04-17 00:20:27.248275",
|
||||||
"modified": "2017-04-17 00:20:27.248275",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "CRM",
|
"module": "CRM",
|
||||||
"name": "Campaign Efficiency",
|
"name": "Campaign Efficiency",
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"letter_head": "",
|
"modified": "2019-09-19 14:40:52.035394",
|
||||||
"modified": "2018-09-17 14:40:52.035394",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "CRM",
|
"module": "CRM",
|
||||||
"name": "Lead Conversion Time",
|
"name": "Lead Conversion Time",
|
||||||
|
@ -67,7 +67,7 @@ def get_communication_details(filters):
|
|||||||
communication_count = None
|
communication_count = None
|
||||||
communication_list = []
|
communication_list = []
|
||||||
opportunities = frappe.db.get_values('Opportunity', {'opportunity_from': 'Lead'},\
|
opportunities = frappe.db.get_values('Opportunity', {'opportunity_from': 'Lead'},\
|
||||||
['name', 'customer_name', 'lead', 'contact_email'], as_dict=1)
|
['name', 'customer_name', 'contact_email'], as_dict=1)
|
||||||
|
|
||||||
for d in opportunities:
|
for d in opportunities:
|
||||||
invoice = frappe.db.sql('''
|
invoice = frappe.db.sql('''
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"letter_head": "Shishuvan Secondary School",
|
"modified": "2019-02-08 15:11:35.339434",
|
||||||
"modified": "2018-02-08 15:11:35.339434",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Education",
|
"module": "Education",
|
||||||
"name": "Final Assessment Grades",
|
"name": "Final Assessment Grades",
|
||||||
|
@ -19,6 +19,7 @@ def store_request_data(order=None, event=None):
|
|||||||
dump_request_data(order, event)
|
dump_request_data(order, event)
|
||||||
|
|
||||||
def sync_sales_order(order, request_id=None):
|
def sync_sales_order(order, request_id=None):
|
||||||
|
frappe.set_user('Administrator')
|
||||||
shopify_settings = frappe.get_doc("Shopify Settings")
|
shopify_settings = frappe.get_doc("Shopify Settings")
|
||||||
frappe.flags.request_id = request_id
|
frappe.flags.request_id = request_id
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ def sync_sales_order(order, request_id=None):
|
|||||||
make_shopify_log(status="Success")
|
make_shopify_log(status="Success")
|
||||||
|
|
||||||
def prepare_sales_invoice(order, request_id=None):
|
def prepare_sales_invoice(order, request_id=None):
|
||||||
|
frappe.set_user('Administrator')
|
||||||
shopify_settings = frappe.get_doc("Shopify Settings")
|
shopify_settings = frappe.get_doc("Shopify Settings")
|
||||||
frappe.flags.request_id = request_id
|
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)
|
make_shopify_log(status="Error", exception=True)
|
||||||
|
|
||||||
def prepare_delivery_note(order, request_id=None):
|
def prepare_delivery_note(order, request_id=None):
|
||||||
|
frappe.set_user('Administrator')
|
||||||
shopify_settings = frappe.get_doc("Shopify Settings")
|
shopify_settings = frappe.get_doc("Shopify Settings")
|
||||||
frappe.flags.request_id = request_id
|
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.naming_series = shopify_settings.sales_invoice_series or "SI-Shopify-"
|
||||||
si.flags.ignore_mandatory = True
|
si.flags.ignore_mandatory = True
|
||||||
set_cost_center(si.items, shopify_settings.cost_center)
|
set_cost_center(si.items, shopify_settings.cost_center)
|
||||||
|
si.insert(ignore_mandatory=True)
|
||||||
si.submit()
|
si.submit()
|
||||||
make_payament_entry_against_sales_invoice(si, shopify_settings)
|
make_payament_entry_against_sales_invoice(si, shopify_settings)
|
||||||
frappe.db.commit()
|
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.flags.ignore_mandatory = True
|
||||||
payemnt_entry.reference_no = doc.name
|
payemnt_entry.reference_no = doc.name
|
||||||
payemnt_entry.reference_date = nowdate()
|
payemnt_entry.reference_date = nowdate()
|
||||||
|
payemnt_entry.insert(ignore_permissions=True)
|
||||||
payemnt_entry.submit()
|
payemnt_entry.submit()
|
||||||
|
|
||||||
def create_delivery_note(shopify_order, shopify_settings, so):
|
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.items = get_fulfillment_items(dn.items, fulfillment.get("line_items"), shopify_settings)
|
||||||
dn.flags.ignore_mandatory = True
|
dn.flags.ignore_mandatory = True
|
||||||
dn.save()
|
dn.save()
|
||||||
|
dn.submit()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
def get_fulfillment_items(dn_items, fulfillment_items, shopify_settings):
|
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"),
|
"rate": shopify_item.get("price"),
|
||||||
"delivery_date": nowdate(),
|
"delivery_date": nowdate(),
|
||||||
"qty": shopify_item.get("quantity"),
|
"qty": shopify_item.get("quantity"),
|
||||||
"stock_uom": shopify_item.get("sku"),
|
"stock_uom": shopify_item.get("uom") or _("Nos"),
|
||||||
"warehouse": shopify_settings.warehouse
|
"warehouse": shopify_settings.warehouse
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
|
@ -4,10 +4,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe, time, dateutil, math, csv
|
import frappe, time, dateutil, math, csv
|
||||||
try:
|
from six import StringIO
|
||||||
from StringIO import StringIO
|
|
||||||
except ImportError:
|
|
||||||
from io import StringIO
|
|
||||||
import erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_mws_api as mws
|
import erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_mws_api as mws
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
|
||||||
@ -26,7 +23,7 @@ def get_products_details():
|
|||||||
listings_response = reports.get_report(report_id=report_id)
|
listings_response = reports.get_report(report_id=report_id)
|
||||||
|
|
||||||
#Get ASIN Codes
|
#Get ASIN Codes
|
||||||
string_io = StringIO(listings_response.original)
|
string_io = StringIO(frappe.safe_decode(listings_response.original))
|
||||||
csv_rows = list(csv.reader(string_io, delimiter=str('\t')))
|
csv_rows = list(csv.reader(string_io, delimiter=str('\t')))
|
||||||
asin_list = list(set([row[1] for row in csv_rows[1:]]))
|
asin_list = list(set([row[1] for row in csv_rows[1:]]))
|
||||||
#break into chunks of 10
|
#break into chunks of 10
|
||||||
@ -89,8 +86,6 @@ def request_and_fetch_report_id(report_type, start_date=None, end_date=None, mar
|
|||||||
end_date=end_date,
|
end_date=end_date,
|
||||||
marketplaceids=marketplaceids)
|
marketplaceids=marketplaceids)
|
||||||
|
|
||||||
#add time delay to wait for amazon to generate report
|
|
||||||
time.sleep(20)
|
|
||||||
report_request_id = report_response.parsed["ReportRequestInfo"]["ReportRequestId"]["value"]
|
report_request_id = report_response.parsed["ReportRequestInfo"]["ReportRequestId"]["value"]
|
||||||
generated_report_id = None
|
generated_report_id = None
|
||||||
#poll to get generated report
|
#poll to get generated report
|
||||||
@ -296,7 +291,8 @@ def create_sales_order(order_json,after_date):
|
|||||||
so.submit()
|
so.submit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
frappe.log_error(message=e, title="Create Sales Order")
|
import traceback
|
||||||
|
frappe.log_error(message=traceback.format_exc(), title="Create Sales Order")
|
||||||
|
|
||||||
def create_customer(order_json):
|
def create_customer(order_json):
|
||||||
order_customer_name = ""
|
order_customer_name = ""
|
||||||
@ -453,7 +449,7 @@ def get_charges_and_fees(market_place_order_id):
|
|||||||
shipment_item_list = return_as_list(shipment_event.ShipmentEvent.ShipmentItemList.ShipmentItem)
|
shipment_item_list = return_as_list(shipment_event.ShipmentEvent.ShipmentItemList.ShipmentItem)
|
||||||
|
|
||||||
for shipment_item in shipment_item_list:
|
for shipment_item in shipment_item_list:
|
||||||
charges, fees = []
|
charges, fees = [], []
|
||||||
|
|
||||||
if 'ItemChargeList' in shipment_item.keys():
|
if 'ItemChargeList' in shipment_item.keys():
|
||||||
charges = return_as_list(shipment_item.ItemChargeList.ChargeComponent)
|
charges = return_as_list(shipment_item.ItemChargeList.ChargeComponent)
|
||||||
|
@ -10,6 +10,7 @@ import urllib
|
|||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import base64
|
import base64
|
||||||
|
import six
|
||||||
from erpnext.erpnext_integrations.doctype.amazon_mws_settings import xml_utils
|
from erpnext.erpnext_integrations.doctype.amazon_mws_settings import xml_utils
|
||||||
import re
|
import re
|
||||||
try:
|
try:
|
||||||
@ -64,7 +65,8 @@ def calc_md5(string):
|
|||||||
"""
|
"""
|
||||||
md = hashlib.md5()
|
md = hashlib.md5()
|
||||||
md.update(string)
|
md.update(string)
|
||||||
return base64.encodestring(md.digest()).strip('\n')
|
return base64.encodestring(md.digest()).strip('\n') if six.PY2 \
|
||||||
|
else base64.encodebytes(md.digest()).decode().strip()
|
||||||
|
|
||||||
def remove_empty(d):
|
def remove_empty(d):
|
||||||
"""
|
"""
|
||||||
@ -77,6 +79,7 @@ def remove_empty(d):
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
def remove_namespace(xml):
|
def remove_namespace(xml):
|
||||||
|
xml = xml.decode('utf-8')
|
||||||
regex = re.compile(' xmlns(:ns2)?="[^"]+"|(ns2:)|(xml:)')
|
regex = re.compile(' xmlns(:ns2)?="[^"]+"|(ns2:)|(xml:)')
|
||||||
return regex.sub('', xml)
|
return regex.sub('', xml)
|
||||||
|
|
||||||
@ -85,8 +88,7 @@ class DictWrapper(object):
|
|||||||
self.original = xml
|
self.original = xml
|
||||||
self._rootkey = rootkey
|
self._rootkey = rootkey
|
||||||
self._mydict = xml_utils.xml2dict().fromstring(remove_namespace(xml))
|
self._mydict = xml_utils.xml2dict().fromstring(remove_namespace(xml))
|
||||||
self._response_dict = self._mydict.get(self._mydict.keys()[0],
|
self._response_dict = self._mydict.get(list(self._mydict)[0], self._mydict)
|
||||||
self._mydict)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def parsed(self):
|
def parsed(self):
|
||||||
@ -172,9 +174,10 @@ class MWS(object):
|
|||||||
'SignatureMethod': 'HmacSHA256',
|
'SignatureMethod': 'HmacSHA256',
|
||||||
}
|
}
|
||||||
params.update(extra_data)
|
params.update(extra_data)
|
||||||
request_description = '&'.join(['%s=%s' % (k, urllib.quote(params[k], safe='-_.~').encode('utf-8')) for k in sorted(params)])
|
quote = urllib.quote if six.PY2 else urllib.parse.quote
|
||||||
|
request_description = '&'.join(['%s=%s' % (k, quote(params[k], safe='-_.~')) for k in sorted(params)])
|
||||||
signature = self.calc_signature(method, request_description)
|
signature = self.calc_signature(method, request_description)
|
||||||
url = '%s%s?%s&Signature=%s' % (self.domain, self.uri, request_description, urllib.quote(signature))
|
url = '%s%s?%s&Signature=%s' % (self.domain, self.uri, request_description, quote(signature))
|
||||||
headers = {'User-Agent': 'python-amazon-mws/0.0.1 (Language=Python)'}
|
headers = {'User-Agent': 'python-amazon-mws/0.0.1 (Language=Python)'}
|
||||||
headers.update(kwargs.get('extra_headers', {}))
|
headers.update(kwargs.get('extra_headers', {}))
|
||||||
|
|
||||||
@ -218,7 +221,10 @@ class MWS(object):
|
|||||||
"""Calculate MWS signature to interface with Amazon
|
"""Calculate MWS signature to interface with Amazon
|
||||||
"""
|
"""
|
||||||
sig_data = method + '\n' + self.domain.replace('https://', '').lower() + '\n' + self.uri + '\n' + request_description
|
sig_data = method + '\n' + self.domain.replace('https://', '').lower() + '\n' + self.uri + '\n' + request_description
|
||||||
return base64.b64encode(hmac.new(str(self.secret_key), sig_data, hashlib.sha256).digest())
|
sig_data = sig_data.encode('utf-8')
|
||||||
|
secret_key = self.secret_key.encode('utf-8')
|
||||||
|
digest = hmac.new(secret_key, sig_data, hashlib.sha256).digest()
|
||||||
|
return base64.b64encode(digest).decode('utf-8')
|
||||||
|
|
||||||
def get_timestamp(self):
|
def get_timestamp(self):
|
||||||
"""
|
"""
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -21,33 +21,22 @@ class ShopifySettings(Document):
|
|||||||
else:
|
else:
|
||||||
self.unregister_webhooks()
|
self.unregister_webhooks()
|
||||||
|
|
||||||
self.validate_app_type()
|
|
||||||
|
|
||||||
def validate_access_credentials(self):
|
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):
|
||||||
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)
|
||||||
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"))
|
|
||||||
|
|
||||||
def register_webhooks(self):
|
def register_webhooks(self):
|
||||||
webhooks = ["orders/create", "orders/paid", "orders/fulfilled"]
|
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]
|
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:
|
for method in webhooks:
|
||||||
if method in created_webhooks:
|
print('method', method)
|
||||||
continue
|
|
||||||
|
|
||||||
session = get_request_session()
|
session = get_request_session()
|
||||||
|
print('session', session)
|
||||||
try:
|
try:
|
||||||
|
print(get_header(self))
|
||||||
d = session.post(url, data=json.dumps({
|
d = session.post(url, data=json.dumps({
|
||||||
"webhook": {
|
"webhook": {
|
||||||
"topic": method,
|
"topic": method,
|
||||||
@ -55,6 +44,7 @@ class ShopifySettings(Document):
|
|||||||
"format": "json"
|
"format": "json"
|
||||||
}
|
}
|
||||||
}), headers=get_header(self))
|
}), headers=get_header(self))
|
||||||
|
print('d', d.json())
|
||||||
d.raise_for_status()
|
d.raise_for_status()
|
||||||
self.update_webhook_table(method, d.json())
|
self.update_webhook_table(method, d.json())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -65,7 +55,7 @@ class ShopifySettings(Document):
|
|||||||
deleted_webhooks = []
|
deleted_webhooks = []
|
||||||
|
|
||||||
for d in self.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:
|
try:
|
||||||
res = session.delete(url, headers=get_header(self))
|
res = session.delete(url, headers=get_header(self))
|
||||||
res.raise_for_status()
|
res.raise_for_status()
|
||||||
@ -77,6 +67,7 @@ class ShopifySettings(Document):
|
|||||||
self.remove(d)
|
self.remove(d)
|
||||||
|
|
||||||
def update_webhook_table(self, method, res):
|
def update_webhook_table(self, method, res):
|
||||||
|
print('update')
|
||||||
self.append("webhooks", {
|
self.append("webhooks", {
|
||||||
"webhook_id": res['webhook']['id'],
|
"webhook_id": res['webhook']['id'],
|
||||||
"method": method
|
"method": method
|
||||||
@ -84,6 +75,7 @@ class ShopifySettings(Document):
|
|||||||
|
|
||||||
def get_shopify_url(path, settings):
|
def get_shopify_url(path, settings):
|
||||||
if settings.app_type == "Private":
|
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)
|
return 'https://{}:{}@{}/{}'.format(settings.api_key, settings.get_password('password'), settings.shopify_url, path)
|
||||||
else:
|
else:
|
||||||
return 'https://{}/{}'.format(settings.shopify_url, path)
|
return 'https://{}/{}'.format(settings.shopify_url, path)
|
||||||
@ -91,11 +83,7 @@ def get_shopify_url(path, settings):
|
|||||||
def get_header(settings):
|
def get_header(settings):
|
||||||
header = {'Content-Type': 'application/json'}
|
header = {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
if settings.app_type == "Private":
|
return header;
|
||||||
return header
|
|
||||||
else:
|
|
||||||
header["X-Shopify-Access-Token"] = settings.access_token
|
|
||||||
return header
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_series():
|
def get_series():
|
||||||
|
@ -21,7 +21,7 @@ def create_customer(shopify_customer, shopify_settings):
|
|||||||
"customer_type": _("Individual")
|
"customer_type": _("Individual")
|
||||||
})
|
})
|
||||||
customer.flags.ignore_mandatory = True
|
customer.flags.ignore_mandatory = True
|
||||||
customer.insert()
|
customer.insert(ignore_permissions=True)
|
||||||
|
|
||||||
if customer:
|
if customer:
|
||||||
create_customer_address(customer, shopify_customer)
|
create_customer_address(customer, shopify_customer)
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
from erpnext import get_default_company
|
||||||
from frappe.utils import cstr, cint, get_request_session
|
from frappe.utils import cstr, cint, get_request_session
|
||||||
from erpnext.erpnext_integrations.doctype.shopify_settings.shopify_settings import get_shopify_url, get_header
|
from erpnext.erpnext_integrations.doctype.shopify_settings.shopify_settings import get_shopify_url, get_header
|
||||||
|
|
||||||
shopify_variants_attr_list = ["option1", "option2", "option3"]
|
shopify_variants_attr_list = ["option1", "option2", "option3"]
|
||||||
|
|
||||||
def sync_item_from_shopify(shopify_settings, item):
|
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()
|
session = get_request_session()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -107,7 +108,12 @@ def create_item(shopify_item, warehouse, has_variant=0, attributes=None,variant_
|
|||||||
"image": get_item_image(shopify_item),
|
"image": get_item_image(shopify_item),
|
||||||
"weight_uom": shopify_item.get("weight_unit"),
|
"weight_uom": shopify_item.get("weight_unit"),
|
||||||
"weight_per_unit": shopify_item.get("weight"),
|
"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):
|
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:
|
if not item_details:
|
||||||
new_item = frappe.get_doc(item_dict)
|
new_item = frappe.get_doc(item_dict)
|
||||||
new_item.insert()
|
new_item.insert(ignore_permissions=True, ignore_mandatory=True)
|
||||||
name = new_item.name
|
name = new_item.name
|
||||||
|
|
||||||
if not name:
|
if not name:
|
||||||
|
@ -40,6 +40,7 @@ class ShopifySettings(unittest.TestCase):
|
|||||||
"price_list": "_Test Price List",
|
"price_list": "_Test Price List",
|
||||||
"warehouse": "_Test Warehouse - _TC",
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
"cash_bank_account": "Cash - _TC",
|
"cash_bank_account": "Cash - _TC",
|
||||||
|
"account": "Cash - _TC",
|
||||||
"customer_group": "_Test Customer Group",
|
"customer_group": "_Test Customer Group",
|
||||||
"cost_center": "Main - _TC",
|
"cost_center": "Main - _TC",
|
||||||
"taxes": [
|
"taxes": [
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import frappe
|
import frappe
|
||||||
import requests
|
import requests
|
||||||
|
from frappe import _
|
||||||
|
|
||||||
# api/method/erpnext.erpnext_integrations.exotel_integration.handle_incoming_call
|
# api/method/erpnext.erpnext_integrations.exotel_integration.handle_incoming_call
|
||||||
# api/method/erpnext.erpnext_integrations.exotel_integration.handle_end_call
|
# api/method/erpnext.erpnext_integrations.exotel_integration.handle_end_call
|
||||||
@ -7,19 +8,24 @@ import requests
|
|||||||
|
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def handle_incoming_call(**kwargs):
|
def handle_incoming_call(**kwargs):
|
||||||
exotel_settings = get_exotel_settings()
|
try:
|
||||||
if not exotel_settings.enabled: return
|
exotel_settings = get_exotel_settings()
|
||||||
|
if not exotel_settings.enabled: return
|
||||||
|
|
||||||
call_payload = kwargs
|
call_payload = kwargs
|
||||||
status = call_payload.get('Status')
|
status = call_payload.get('Status')
|
||||||
if status == 'free':
|
if status == 'free':
|
||||||
return
|
return
|
||||||
|
|
||||||
call_log = get_call_log(call_payload)
|
call_log = get_call_log(call_payload)
|
||||||
if not call_log:
|
if not call_log:
|
||||||
create_call_log(call_payload)
|
create_call_log(call_payload)
|
||||||
else:
|
else:
|
||||||
update_call_log(call_payload, call_log=call_log)
|
update_call_log(call_payload, call_log=call_log)
|
||||||
|
except Exception as e:
|
||||||
|
frappe.db.rollback()
|
||||||
|
frappe.log_error(title=_('Error in Exotel incoming call'))
|
||||||
|
frappe.db.commit()
|
||||||
|
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def handle_end_call(**kwargs):
|
def handle_end_call(**kwargs):
|
||||||
@ -101,4 +107,4 @@ def get_exotel_endpoint(action):
|
|||||||
api_token=settings.api_token,
|
api_token=settings.api_token,
|
||||||
sid=settings.account_sid,
|
sid=settings.account_sid,
|
||||||
action=action
|
action=action
|
||||||
)
|
)
|
||||||
|
@ -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)
|
server_url = '{uri.scheme}://{uri.netloc}/api/method/{endpoint}'.format(uri=urlparse(url), endpoint=endpoint)
|
||||||
|
|
||||||
return server_url
|
return server_url
|
||||||
|
@ -5,4 +5,3 @@ import frappe
|
|||||||
class PartyFrozen(frappe.ValidationError): pass
|
class PartyFrozen(frappe.ValidationError): pass
|
||||||
class InvalidAccountCurrency(frappe.ValidationError): pass
|
class InvalidAccountCurrency(frappe.ValidationError): pass
|
||||||
class InvalidCurrency(frappe.ValidationError): pass
|
class InvalidCurrency(frappe.ValidationError): pass
|
||||||
class PartyDisabled(frappe.ValidationError):pass
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
182
erpnext/hooks.py
182
erpnext/hooks.py
@ -42,8 +42,13 @@ notification_config = "erpnext.startup.notifications.get_notification_config"
|
|||||||
get_help_messages = "erpnext.utilities.activation.get_help_messages"
|
get_help_messages = "erpnext.utilities.activation.get_help_messages"
|
||||||
get_user_progress_slides = "erpnext.utilities.user_progress.get_user_progress_slides"
|
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"
|
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_session_creation = [
|
||||||
|
"erpnext.portal.utils.create_customer_or_supplier",
|
||||||
|
"erpnext.shopping_cart.utils.set_cart_count"
|
||||||
|
]
|
||||||
on_logout = "erpnext.shopping_cart.utils.clear_cart_count"
|
on_logout = "erpnext.shopping_cart.utils.clear_cart_count"
|
||||||
|
|
||||||
treeviews = ['Account', 'Cost Center', 'Warehouse', 'Item Group', 'Customer Group', 'Sales Person', 'Territory', 'Assessment Group', 'Department']
|
treeviews = ['Account', 'Cost Center', 'Warehouse', 'Item Group', 'Customer Group', 'Sales Person', 'Territory', 'Assessment Group', 'Department']
|
||||||
@ -100,6 +105,20 @@ website_route_rules = [
|
|||||||
"parents": [{"label": _("Supplier Quotation"), "route": "supplier-quotations"}]
|
"parents": [{"label": _("Supplier Quotation"), "route": "supplier-quotations"}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{"from_route": "/purchase-orders", "to_route": "Purchase Order"},
|
||||||
|
{"from_route": "/purchase-orders/<path:name>", "to_route": "order",
|
||||||
|
"defaults": {
|
||||||
|
"doctype": "Purchase Order",
|
||||||
|
"parents": [{"label": _("Purchase Order"), "route": "purchase-orders"}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{"from_route": "/purchase-invoices", "to_route": "Purchase Invoice"},
|
||||||
|
{"from_route": "/purchase-invoices/<path:name>", "to_route": "order",
|
||||||
|
"defaults": {
|
||||||
|
"doctype": "Purchase Invoice",
|
||||||
|
"parents": [{"label": _("Purchase Invoice"), "route": "purchase-invoices"}]
|
||||||
|
}
|
||||||
|
},
|
||||||
{"from_route": "/quotations", "to_route": "Quotation"},
|
{"from_route": "/quotations", "to_route": "Quotation"},
|
||||||
{"from_route": "/quotations/<path:name>", "to_route": "order",
|
{"from_route": "/quotations/<path:name>", "to_route": "order",
|
||||||
"defaults": {
|
"defaults": {
|
||||||
@ -146,6 +165,8 @@ standard_portal_menu_items = [
|
|||||||
{"title": _("Projects"), "route": "/project", "reference_doctype": "Project"},
|
{"title": _("Projects"), "route": "/project", "reference_doctype": "Project"},
|
||||||
{"title": _("Request for Quotations"), "route": "/rfq", "reference_doctype": "Request for Quotation", "role": "Supplier"},
|
{"title": _("Request for Quotations"), "route": "/rfq", "reference_doctype": "Request for Quotation", "role": "Supplier"},
|
||||||
{"title": _("Supplier Quotation"), "route": "/supplier-quotations", "reference_doctype": "Supplier Quotation", "role": "Supplier"},
|
{"title": _("Supplier Quotation"), "route": "/supplier-quotations", "reference_doctype": "Supplier Quotation", "role": "Supplier"},
|
||||||
|
{"title": _("Purchase Orders"), "route": "/purchase-orders", "reference_doctype": "Purchase Order", "role": "Supplier"},
|
||||||
|
{"title": _("Purchase Invoices"), "route": "/purchase-invoices", "reference_doctype": "Purchase Invoice", "role": "Supplier"},
|
||||||
{"title": _("Quotations"), "route": "/quotations", "reference_doctype": "Quotation", "role":"Customer"},
|
{"title": _("Quotations"), "route": "/quotations", "reference_doctype": "Quotation", "role":"Customer"},
|
||||||
{"title": _("Orders"), "route": "/orders", "reference_doctype": "Sales Order", "role":"Customer"},
|
{"title": _("Orders"), "route": "/orders", "reference_doctype": "Sales Order", "role":"Customer"},
|
||||||
{"title": _("Invoices"), "route": "/invoices", "reference_doctype": "Sales Invoice", "role":"Customer"},
|
{"title": _("Invoices"), "route": "/invoices", "reference_doctype": "Sales Invoice", "role":"Customer"},
|
||||||
@ -158,8 +179,8 @@ standard_portal_menu_items = [
|
|||||||
{"title": _("Patient Appointment"), "route": "/patient-appointments", "reference_doctype": "Patient Appointment", "role":"Patient"},
|
{"title": _("Patient Appointment"), "route": "/patient-appointments", "reference_doctype": "Patient Appointment", "role":"Patient"},
|
||||||
{"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees", "role":"Student"},
|
{"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees", "role":"Student"},
|
||||||
{"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"},
|
{"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"},
|
||||||
{"title": _("Admission"), "route": "/admissions", "reference_doctype": "Student Admission"},
|
{"title": _("Admission"), "route": "/admissions", "reference_doctype": "Student Admission", "role": "Student"},
|
||||||
{"title": _("Certification"), "route": "/certification", "reference_doctype": "Certification Application"},
|
{"title": _("Certification"), "route": "/certification", "reference_doctype": "Certification Application", "role": "Non Profit Portal User"},
|
||||||
{"title": _("Material Request"), "route": "/material-requests", "reference_doctype": "Material Request", "role": "Customer"},
|
{"title": _("Material Request"), "route": "/material-requests", "reference_doctype": "Material Request", "role": "Customer"},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -179,6 +200,8 @@ has_website_permission = {
|
|||||||
"Quotation": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
"Quotation": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
||||||
"Sales Invoice": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
"Sales Invoice": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
||||||
"Supplier Quotation": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
"Supplier Quotation": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
||||||
|
"Purchase Order": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
||||||
|
"Purchase Invoice": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
||||||
"Material Request": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
"Material Request": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
||||||
"Delivery Note": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
"Delivery Note": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
||||||
"Issue": "erpnext.support.doctype.issue.issue.has_website_permission",
|
"Issue": "erpnext.support.doctype.issue.issue.has_website_permission",
|
||||||
@ -352,3 +375,156 @@ user_privacy_documents = [
|
|||||||
'personal_fields': ['contact_mobile', 'contact_display', 'customer_name'],
|
'personal_fields': ['contact_mobile', 'contact_display', 'customer_name'],
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# ERPNext doctypes for Global Search
|
||||||
|
global_search_doctypes = {
|
||||||
|
"Default": [
|
||||||
|
{"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},
|
||||||
|
],
|
||||||
|
"Healthcare": [
|
||||||
|
{'doctype': 'Patient', 'index': 1},
|
||||||
|
{'doctype': 'Medical Department', 'index': 2},
|
||||||
|
{'doctype': 'Vital Signs', 'index': 3},
|
||||||
|
{'doctype': 'Healthcare Practitioner', 'index': 4},
|
||||||
|
{'doctype': 'Patient Appointment', 'index': 5},
|
||||||
|
{'doctype': 'Healthcare Service Unit', 'index': 6},
|
||||||
|
{'doctype': 'Patient Encounter', 'index': 7},
|
||||||
|
{'doctype': 'Antibiotic', 'index': 8},
|
||||||
|
{'doctype': 'Diagnosis', 'index': 9},
|
||||||
|
{'doctype': 'Lab Test', 'index': 10},
|
||||||
|
{'doctype': 'Clinical Procedure', 'index': 11},
|
||||||
|
{'doctype': 'Inpatient Record', 'index': 12},
|
||||||
|
{'doctype': 'Sample Collection', 'index': 13},
|
||||||
|
{'doctype': 'Patient Medical Record', 'index': 14},
|
||||||
|
{'doctype': 'Appointment Type', 'index': 15},
|
||||||
|
{'doctype': 'Fee Validity', 'index': 16},
|
||||||
|
{'doctype': 'Practitioner Schedule', 'index': 17},
|
||||||
|
{'doctype': 'Dosage Form', 'index': 18},
|
||||||
|
{'doctype': 'Lab Test Sample', 'index': 19},
|
||||||
|
{'doctype': 'Prescription Duration', 'index': 20},
|
||||||
|
{'doctype': 'Prescription Dosage', 'index': 21},
|
||||||
|
{'doctype': 'Sensitivity', 'index': 22},
|
||||||
|
{'doctype': 'Complaint', 'index': 23},
|
||||||
|
{'doctype': 'Medical Code', 'index': 24},
|
||||||
|
],
|
||||||
|
"Education": [
|
||||||
|
{'doctype': 'Article', 'index': 1},
|
||||||
|
{'doctype': 'Video', 'index': 2},
|
||||||
|
{'doctype': 'Topic', 'index': 3},
|
||||||
|
{'doctype': 'Course', 'index': 4},
|
||||||
|
{'doctype': 'Program', 'index': 5},
|
||||||
|
{'doctype': 'Quiz', 'index': 6},
|
||||||
|
{'doctype': 'Question', 'index': 7},
|
||||||
|
{'doctype': 'Fee Schedule', 'index': 8},
|
||||||
|
{'doctype': 'Fee Structure', 'index': 9},
|
||||||
|
{'doctype': 'Fees', 'index': 10},
|
||||||
|
{'doctype': 'Student Group', 'index': 11},
|
||||||
|
{'doctype': 'Student', 'index': 12},
|
||||||
|
{'doctype': 'Instructor', 'index': 13},
|
||||||
|
{'doctype': 'Course Activity', 'index': 14},
|
||||||
|
{'doctype': 'Quiz Activity', 'index': 15},
|
||||||
|
{'doctype': 'Course Enrollment', 'index': 16},
|
||||||
|
{'doctype': 'Program Enrollment', 'index': 17},
|
||||||
|
{'doctype': 'Student Language', 'index': 18},
|
||||||
|
{'doctype': 'Student Applicant', 'index': 19},
|
||||||
|
{'doctype': 'Assessment Result', 'index': 20},
|
||||||
|
{'doctype': 'Assessment Plan', 'index': 21},
|
||||||
|
{'doctype': 'Grading Scale', 'index': 22},
|
||||||
|
{'doctype': 'Guardian', 'index': 23},
|
||||||
|
{'doctype': 'Student Leave Application', 'index': 24},
|
||||||
|
{'doctype': 'Student Log', 'index': 25},
|
||||||
|
{'doctype': 'Room', 'index': 26},
|
||||||
|
{'doctype': 'Course Schedule', 'index': 27},
|
||||||
|
{'doctype': 'Student Attendance', 'index': 28},
|
||||||
|
{'doctype': 'Announcement', 'index': 29},
|
||||||
|
{'doctype': 'Student Category', 'index': 30},
|
||||||
|
{'doctype': 'Assessment Group', 'index': 31},
|
||||||
|
{'doctype': 'Student Batch Name', 'index': 32},
|
||||||
|
{'doctype': 'Assessment Criteria', 'index': 33},
|
||||||
|
{'doctype': 'Academic Year', 'index': 34},
|
||||||
|
{'doctype': 'Academic Term', 'index': 35},
|
||||||
|
{'doctype': 'School House', 'index': 36},
|
||||||
|
{'doctype': 'Student Admission', 'index': 37},
|
||||||
|
{'doctype': 'Fee Category', 'index': 38},
|
||||||
|
{'doctype': 'Assessment Code', 'index': 39},
|
||||||
|
{'doctype': 'Discussion', 'index': 40},
|
||||||
|
],
|
||||||
|
"Agriculture": [
|
||||||
|
{'doctype': 'Weather', 'index': 1},
|
||||||
|
{'doctype': 'Soil Texture', 'index': 2},
|
||||||
|
{'doctype': 'Water Analysis', 'index': 3},
|
||||||
|
{'doctype': 'Soil Analysis', 'index': 4},
|
||||||
|
{'doctype': 'Plant Analysis', 'index': 5},
|
||||||
|
{'doctype': 'Agriculture Analysis Criteria', 'index': 6},
|
||||||
|
{'doctype': 'Disease', 'index': 7},
|
||||||
|
{'doctype': 'Crop', 'index': 8},
|
||||||
|
{'doctype': 'Fertilizer', 'index': 9},
|
||||||
|
{'doctype': 'Crop Cycle', 'index': 10}
|
||||||
|
],
|
||||||
|
"Non Profit": [
|
||||||
|
{'doctype': 'Certified Consultant', 'index': 1},
|
||||||
|
{'doctype': 'Certification Application', 'index': 2},
|
||||||
|
{'doctype': 'Volunteer', 'index': 3},
|
||||||
|
{'doctype': 'Membership', 'index': 4},
|
||||||
|
{'doctype': 'Member', 'index': 5},
|
||||||
|
{'doctype': 'Donor', 'index': 6},
|
||||||
|
{'doctype': 'Chapter', 'index': 7},
|
||||||
|
{'doctype': 'Grant Application', 'index': 8},
|
||||||
|
{'doctype': 'Volunteer Type', 'index': 9},
|
||||||
|
{'doctype': 'Donor Type', 'index': 10},
|
||||||
|
{'doctype': 'Membership Type', 'index': 11}
|
||||||
|
],
|
||||||
|
"Hospitality": [
|
||||||
|
{'doctype': 'Hotel Room', 'index': 0},
|
||||||
|
{'doctype': 'Hotel Room Reservation', 'index': 1},
|
||||||
|
{'doctype': 'Hotel Room Pricing', 'index': 2},
|
||||||
|
{'doctype': 'Hotel Room Package', 'index': 3},
|
||||||
|
{'doctype': 'Hotel Room Type', 'index': 4}
|
||||||
|
]
|
||||||
|
}
|
@ -1,14 +1,36 @@
|
|||||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('Driver', {
|
frappe.ui.form.on("Driver", {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
frm.set_query('transporter', function(){
|
frm.set_query("transporter", function() {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
'is_transporter': 1
|
is_transporter: 1
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
refresh: function(frm) {
|
||||||
|
frm.set_query("address", function() {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
is_your_company_address: !frm.doc.transporter ? 1 : 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
transporter: function(frm, cdt, cdn) {
|
||||||
|
// this assumes that supplier's address has same title as supplier's name
|
||||||
|
frappe.db
|
||||||
|
.get_doc("Address", null, { address_title: frm.doc.transporter })
|
||||||
|
.then(r => {
|
||||||
|
frappe.model.set_value(cdt, cdn, "address", r.name);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
"allow_guest_to_view": 0,
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 1,
|
||||||
"autoname": "HR-APP-.YYYY.-.#####",
|
"autoname": "HR-APP-.YYYY.-.#####",
|
||||||
"beta": 0,
|
"beta": 0,
|
||||||
"creation": "2013-01-29 19:25:37",
|
"creation": "2013-01-29 19:25:37",
|
||||||
@ -346,7 +346,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2019-06-21 16:15:43.552049",
|
"modified": "2019-07-21 16:15:43.552049",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Job Applicant",
|
"name": "Job Applicant",
|
||||||
|
@ -439,7 +439,7 @@ def get_leave_details(employee, date):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_leave_balance_on(employee, leave_type, date, to_date=nowdate(), consider_all_leaves_in_the_allocation_period=False):
|
def get_leave_balance_on(employee, leave_type, date, to_date=None, consider_all_leaves_in_the_allocation_period=False):
|
||||||
'''
|
'''
|
||||||
Returns leave balance till date
|
Returns leave balance till date
|
||||||
:param employee: employee name
|
:param employee: employee name
|
||||||
@ -449,6 +449,9 @@ def get_leave_balance_on(employee, leave_type, date, to_date=nowdate(), consider
|
|||||||
:param consider_all_leaves_in_the_allocation_period: consider all leaves taken till the allocation end date
|
:param consider_all_leaves_in_the_allocation_period: consider all leaves taken till the allocation end date
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
if not to_date:
|
||||||
|
to_date = nowdate()
|
||||||
|
|
||||||
allocation_records = get_leave_allocation_records(employee, date, leave_type)
|
allocation_records = get_leave_allocation_records(employee, date, leave_type)
|
||||||
allocation = allocation_records.get(leave_type, frappe._dict())
|
allocation = allocation_records.get(leave_type, frappe._dict())
|
||||||
|
|
||||||
@ -753,4 +756,4 @@ def get_leave_approver(employee):
|
|||||||
leave_approver = frappe.db.get_value('Department Approver', {'parent': department,
|
leave_approver = frappe.db.get_value('Department Approver', {'parent': department,
|
||||||
'parentfield': 'leave_approvers', 'idx': 1}, 'approver')
|
'parentfield': 'leave_approvers', 'idx': 1}, 'approver')
|
||||||
|
|
||||||
return leave_approver
|
return leave_approver
|
||||||
|
@ -37,8 +37,9 @@
|
|||||||
"cost_center",
|
"cost_center",
|
||||||
"account",
|
"account",
|
||||||
"payment_account",
|
"payment_account",
|
||||||
"section_break2",
|
|
||||||
"amended_from",
|
"amended_from",
|
||||||
|
"column_break_33",
|
||||||
|
"bank_account",
|
||||||
"salary_slips_created",
|
"salary_slips_created",
|
||||||
"salary_slips_submitted"
|
"salary_slips_submitted"
|
||||||
],
|
],
|
||||||
@ -206,15 +207,12 @@
|
|||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"description": "Select Payment Account to make Bank Entry",
|
"description": "Select Payment Account to make Bank Entry",
|
||||||
|
"fetch_from": "bank_account.account",
|
||||||
"fieldname": "payment_account",
|
"fieldname": "payment_account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Payment Account",
|
"label": "Payment Account",
|
||||||
"options": "Account"
|
"options": "Account"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "section_break2",
|
|
||||||
"fieldtype": "Section Break"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "amended_from",
|
"fieldname": "amended_from",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
@ -248,11 +246,21 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "dimension_col_break",
|
"fieldname": "dimension_col_break",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "bank_account",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Bank Account",
|
||||||
|
"options": "Bank Account"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_33",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-cog",
|
"icon": "fa fa-cog",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2019-05-25 22:47:49.977955",
|
"modified": "2019-09-12 15:46:31.436381",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Payroll Entry",
|
"name": "Payroll Entry",
|
||||||
|
@ -39,7 +39,7 @@ class PayrollEntry(Document):
|
|||||||
and for which salary structure exists
|
and for which salary structure exists
|
||||||
"""
|
"""
|
||||||
cond = self.get_filter_condition()
|
cond = self.get_filter_condition()
|
||||||
cond += self.get_joining_releiving_condition()
|
cond += self.get_joining_relieving_condition()
|
||||||
|
|
||||||
condition = ''
|
condition = ''
|
||||||
if self.payroll_frequency:
|
if self.payroll_frequency:
|
||||||
@ -93,7 +93,7 @@ class PayrollEntry(Document):
|
|||||||
|
|
||||||
return cond
|
return cond
|
||||||
|
|
||||||
def get_joining_releiving_condition(self):
|
def get_joining_relieving_condition(self):
|
||||||
cond = """
|
cond = """
|
||||||
and ifnull(t1.date_of_joining, '0000-00-00') <= '%(end_date)s'
|
and ifnull(t1.date_of_joining, '0000-00-00') <= '%(end_date)s'
|
||||||
and ifnull(t1.relieving_date, '2199-12-31') >= '%(start_date)s'
|
and ifnull(t1.relieving_date, '2199-12-31') >= '%(start_date)s'
|
||||||
@ -341,6 +341,7 @@ class PayrollEntry(Document):
|
|||||||
journal_entry.set("accounts", [
|
journal_entry.set("accounts", [
|
||||||
{
|
{
|
||||||
"account": self.payment_account,
|
"account": self.payment_account,
|
||||||
|
"bank_account": self.bank_account,
|
||||||
"credit_in_account_currency": payment_amount
|
"credit_in_account_currency": payment_amount
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -255,16 +255,19 @@ class SalarySlip(TransactionBase):
|
|||||||
for d in range(working_days):
|
for d in range(working_days):
|
||||||
dt = add_days(cstr(getdate(self.start_date)), d)
|
dt = add_days(cstr(getdate(self.start_date)), d)
|
||||||
leave = frappe.db.sql("""
|
leave = frappe.db.sql("""
|
||||||
select t1.name, t1.half_day
|
SELECT t1.name,
|
||||||
from `tabLeave Application` t1, `tabLeave Type` t2
|
CASE WHEN t1.half_day_date = %(dt)s or t1.to_date = t1.from_date
|
||||||
where t2.name = t1.leave_type
|
THEN t1.half_day else 0 END
|
||||||
and t2.is_lwp = 1
|
FROM `tabLeave Application` t1, `tabLeave Type` t2
|
||||||
and t1.docstatus = 1
|
WHERE t2.name = t1.leave_type
|
||||||
and t1.employee = %(employee)s
|
AND t2.is_lwp = 1
|
||||||
and CASE WHEN t2.include_holiday != 1 THEN %(dt)s not in ('{0}') and %(dt)s between from_date and to_date and ifnull(t1.salary_slip, '') = ''
|
AND t1.docstatus = 1
|
||||||
|
AND t1.employee = %(employee)s
|
||||||
|
AND CASE WHEN t2.include_holiday != 1 THEN %(dt)s not in ('{0}') and %(dt)s between from_date and to_date and ifnull(t1.salary_slip, '') = ''
|
||||||
WHEN t2.include_holiday THEN %(dt)s between from_date and to_date and ifnull(t1.salary_slip, '') = ''
|
WHEN t2.include_holiday THEN %(dt)s between from_date and to_date and ifnull(t1.salary_slip, '') = ''
|
||||||
END
|
END
|
||||||
""".format(holidays), {"employee": self.employee, "dt": dt})
|
""".format(holidays), {"employee": self.employee, "dt": dt})
|
||||||
|
|
||||||
if leave:
|
if leave:
|
||||||
lwp = cint(leave[0][1]) and (lwp + 0.5) or (lwp + 1)
|
lwp = cint(leave[0][1]) and (lwp + 0.5) or (lwp + 1)
|
||||||
return lwp
|
return lwp
|
||||||
|
@ -60,8 +60,8 @@ def get_data(args):
|
|||||||
existing_attendance = {}
|
existing_attendance = {}
|
||||||
if existing_attendance_records \
|
if existing_attendance_records \
|
||||||
and tuple([getdate(date), employee.name]) in existing_attendance_records \
|
and tuple([getdate(date), employee.name]) in existing_attendance_records \
|
||||||
and getdate(employee.date_of_joining) >= getdate(date) \
|
and getdate(employee.date_of_joining) <= getdate(date) \
|
||||||
and getdate(employee.relieving_date) <= getdate(date):
|
and getdate(employee.relieving_date) >= getdate(date):
|
||||||
existing_attendance = existing_attendance_records[tuple([getdate(date), employee.name])]
|
existing_attendance = existing_attendance_records[tuple([getdate(date), employee.name])]
|
||||||
row = [
|
row = [
|
||||||
existing_attendance and existing_attendance.name or "",
|
existing_attendance and existing_attendance.name or "",
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"letter_head": "Gadgets International",
|
"modified": "2019-04-26 16:57:52.558895",
|
||||||
"modified": "2019-03-26 16:57:52.558895",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Bank Remittance",
|
"name": "Bank Remittance",
|
||||||
|
@ -60,7 +60,10 @@ def get_data(filters, leave_types):
|
|||||||
|
|
||||||
data = []
|
data = []
|
||||||
for employee in active_employees:
|
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)):
|
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]
|
row = [employee.name, employee.employee_name, employee.department]
|
||||||
|
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"letter_head": "sapcon-old",
|
"modified": "2019-09-06 11:18:06.209397",
|
||||||
"modified": "2019-09-05 11:18:06.209397",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Employee Leave Balance Summary",
|
"name": "Employee Leave Balance Summary",
|
||||||
|
@ -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)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user