mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-30 15:09:47 +00:00
[Enhancement] Booking of an employee's expense claim (#7267)
* [Enhancement] Auto book of an employee's expense claim * test cases * documentation * fixes and changes * removed payable from employee and added into the company * Added party in account, patch to update party type for customer and supplier accounts * added party type in erpnext, fix patch * fixed travis
This commit is contained in:
committed by
Rushabh Mehta
parent
99ce531beb
commit
ea092a7b24
@@ -4,6 +4,17 @@
|
||||
frappe.provide("erpnext.company");
|
||||
|
||||
frappe.ui.form.on("Company", {
|
||||
setup: function(frm) {
|
||||
frm.fields_dict['default_payable_account'].get_query = function() {
|
||||
return{
|
||||
filters: {
|
||||
"root_type": "Liability",
|
||||
"account_type": "Payable"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onload: function(frm) {
|
||||
erpnext.company.setup_queries(frm);
|
||||
},
|
||||
|
||||
@@ -153,6 +153,8 @@ class Company(Document):
|
||||
self.db_set("default_income_account", frappe.db.get_value("Account",
|
||||
{"account_name": _("Sales"), "company": self.name}))
|
||||
|
||||
if not self.default_payable_account:
|
||||
self.db_set("default_payable_account", self.default_payable_account)
|
||||
|
||||
def _set_default_account(self, fieldname, account_type):
|
||||
if self.get(fieldname):
|
||||
|
||||
0
erpnext/setup/doctype/party_type/__init__.py
Normal file
0
erpnext/setup/doctype/party_type/__init__.py
Normal file
15
erpnext/setup/doctype/party_type/party_type.js
Normal file
15
erpnext/setup/doctype/party_type/party_type.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright (c) 2016, Frappe Technologies and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Party Type', {
|
||||
setup: function(frm) {
|
||||
frm.fields_dict["party_type"].get_query = function(frm) {
|
||||
return {
|
||||
filters: {
|
||||
"istable": 0,
|
||||
"is_submittable": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
130
erpnext/setup/doctype/party_type/party_type.json
Normal file
130
erpnext/setup/doctype/party_type/party_type.json
Normal file
@@ -0,0 +1,130 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "field:party_type",
|
||||
"beta": 0,
|
||||
"creation": "2016-12-26 11:26:51.508286",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "party_type",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Party Type",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "DocType",
|
||||
"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,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-01-19 17:55:33.428335",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Party Type",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
20
erpnext/setup/doctype/party_type/party_type.py
Normal file
20
erpnext/setup/doctype/party_type/party_type.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class PartyType(Document):
|
||||
pass
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_party_type(doctype, txt, searchfield, start, page_len, filters):
|
||||
return frappe.db.sql("""select name from `tabParty Type`
|
||||
where `{key}` LIKE %(txt)s
|
||||
order by name limit %(start)s, %(page_len)s"""
|
||||
.format(key=searchfield), {
|
||||
'txt': "%%%s%%" % frappe.db.escape(txt),
|
||||
'start': start, 'page_len': page_len
|
||||
})
|
||||
12
erpnext/setup/doctype/party_type/test_party_type.py
Normal file
12
erpnext/setup/doctype/party_type/test_party_type.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Party Type')
|
||||
|
||||
class TestPartyType(unittest.TestCase):
|
||||
pass
|
||||
@@ -171,6 +171,10 @@ def install(country=None):
|
||||
{'doctype': "Email Account", "email_id": "support@example.com", "append_to": "Issue"},
|
||||
{'doctype': "Email Account", "email_id": "jobs@example.com", "append_to": "Job Applicant"},
|
||||
|
||||
{'doctype': "Party Type", "party_type": "Customer"},
|
||||
{'doctype': "Party Type", "party_type": "Supplier"},
|
||||
{'doctype': "Party Type", "party_type": "Employee"},
|
||||
|
||||
{"doctype": "Offer Term", "offer_term": _("Date of Joining")},
|
||||
{"doctype": "Offer Term", "offer_term": _("Annual Salary")},
|
||||
{"doctype": "Offer Term", "offer_term": _("Probationary Period")},
|
||||
|
||||
Reference in New Issue
Block a user