[fixes] to task test case and fix tree ui for mobile
This commit is contained in:
parent
4223d7c044
commit
be9edae961
@ -42,13 +42,13 @@ frappe.pages["Accounts Browser"].on_page_load = function(wrapper){
|
||||
wrapper.page.add_menu_item(__('New Company'), function() { newdoc('Company'); }, true);
|
||||
}
|
||||
|
||||
wrapper.page.set_secondary_action(__('Refresh'), function() {
|
||||
wrapper.page.add_menu_item(__('Refresh'), function() {
|
||||
wrapper.$company_select.change();
|
||||
});
|
||||
|
||||
wrapper.page.set_primary_action(__('New'), function() {
|
||||
erpnext.account_chart && erpnext.account_chart.make_new();
|
||||
});
|
||||
}, "octicon octicon-plus");
|
||||
|
||||
// company-select
|
||||
wrapper.$company_select = wrapper.page.add_select("Company", [])
|
||||
@ -121,7 +121,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
label: __("Add Child"),
|
||||
click: function() {
|
||||
me.make_new()
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
},
|
||||
{
|
||||
condition: function(node) {
|
||||
@ -137,8 +138,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
"company": me.company
|
||||
};
|
||||
frappe.set_route("query-report", "General Ledger");
|
||||
}
|
||||
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
},
|
||||
{
|
||||
condition: function(node) { return !node.root && me.can_write },
|
||||
@ -147,7 +148,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
frappe.model.rename_doc(me.ctype, node.label, function(new_name) {
|
||||
node.reload();
|
||||
});
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
},
|
||||
{
|
||||
condition: function(node) { return !node.root && me.can_delete },
|
||||
@ -156,7 +158,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
frappe.model.delete_doc(me.ctype, node.label, function() {
|
||||
node.parent.remove();
|
||||
});
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
}
|
||||
],
|
||||
onrender: function(node) {
|
||||
|
@ -536,12 +536,32 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-31 08:48:32.488942",
|
||||
"modified": "2015-09-01 07:11:25.759637",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Expense Claim",
|
||||
"owner": "harshada@webnotestech.com",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "HR Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
|
@ -22,6 +22,8 @@ class ExpenseClaim(Document):
|
||||
self.validate_expense_approver()
|
||||
self.calculate_total_amount()
|
||||
set_employee_name(self)
|
||||
if self.task and not self.project:
|
||||
self.project = frappe.db.get_value("Task", self.task, "project")
|
||||
|
||||
def on_submit(self):
|
||||
if self.approval_status=="Draft":
|
||||
|
@ -11,44 +11,47 @@ class TestExpenseClaim(unittest.TestCase):
|
||||
def test_total_expense_claim_for_project(self):
|
||||
frappe.db.sql("""delete from `tabTask` where project = "_Test Project 1" """)
|
||||
frappe.db.sql("""delete from `tabProject` where name = "_Test Project 1" """)
|
||||
|
||||
frappe.db.sql("""delete from `tabExpense Claim`""")
|
||||
frappe.db.sql("""delete from `tabExpense Claim Detail`""")
|
||||
|
||||
frappe.get_doc({
|
||||
"project_name": "_Test Project 1",
|
||||
"doctype": "Project",
|
||||
"tasks" :
|
||||
[{ "title": "_Test Project Task 1", "status": "Open" }]
|
||||
}).save()
|
||||
|
||||
task_name = frappe.db.get_value("Task",{"project": "_Test Project 1"})
|
||||
|
||||
task_name = frappe.db.get_value("Task", {"project": "_Test Project 1"})
|
||||
|
||||
expense_claim = frappe.get_doc({
|
||||
"doctype": "Expense Claim",
|
||||
"employee": "_T-Employee-0001",
|
||||
"approval_status": "Approved",
|
||||
"project": "_Test Project 1",
|
||||
"task": task_name,
|
||||
"expenses":
|
||||
"expenses":
|
||||
[{ "expense_type": "Food", "claim_amount": 300, "sanctioned_amount": 200 }]
|
||||
})
|
||||
expense_claim.submit()
|
||||
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_expense_claim"), 200)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_expense_claim"), 200)
|
||||
|
||||
|
||||
expense_claim2 = frappe.get_doc({
|
||||
"doctype": "Expense Claim",
|
||||
"employee": "_T-Employee-0001",
|
||||
"approval_status": "Approved",
|
||||
"project": "_Test Project 1",
|
||||
"task": task_name,
|
||||
"expenses":
|
||||
"expenses":
|
||||
[{ "expense_type": "Food", "claim_amount": 600, "sanctioned_amount": 500 }]
|
||||
})
|
||||
expense_claim2.submit()
|
||||
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_expense_claim"), 700)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_expense_claim"), 700)
|
||||
|
||||
|
||||
expense_claim2.cancel()
|
||||
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_expense_claim"), 200)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_expense_claim"), 200)
|
||||
|
@ -97,8 +97,11 @@ class Project(Document):
|
||||
sum(hours) as time
|
||||
from `tabTime Log` where project = %s and docstatus = 1""", self.name, as_dict=1)[0]
|
||||
|
||||
from_expense_claim = frappe.db.sql("""select sum(ifnull(total_sanctioned_amount, 0))
|
||||
from `tabExpense Claim` where project = %s""", self.name, as_dict=1)[0]
|
||||
from_expense_claim = frappe.db.sql("""select
|
||||
sum(ifnull(total_sanctioned_amount, 0)) as total_sanctioned_amount
|
||||
from `tabExpense Claim` where project = %s and approval_status='Approved'
|
||||
and docstatus = 1""",
|
||||
self.name, as_dict=1)[0]
|
||||
|
||||
self.actual_start_date = from_time_log.start_date
|
||||
self.actual_end_date = from_time_log.end_date
|
||||
|
@ -7,7 +7,7 @@ frappe.pages["Sales Browser"].on_page_load = function(wrapper){
|
||||
single_column: true,
|
||||
});
|
||||
|
||||
wrapper.page.set_secondary_action(__('Refresh'), function() {
|
||||
wrapper.page.add_menu_item(__('Refresh'), function() {
|
||||
wrapper.make_tree();
|
||||
});
|
||||
|
||||
@ -57,7 +57,7 @@ erpnext.SalesChart = Class.extend({
|
||||
|
||||
me.page.set_primary_action(__("New"), function() {
|
||||
me.new_node();
|
||||
});
|
||||
}, "octicon octicon-plus");
|
||||
|
||||
this.tree = new frappe.ui.Tree({
|
||||
parent: $(parent),
|
||||
@ -80,7 +80,8 @@ erpnext.SalesChart = Class.extend({
|
||||
condition: function(node) { return me.can_create && node.expandable; },
|
||||
click: function(node) {
|
||||
me.new_node();
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
},
|
||||
{
|
||||
label:__("Rename"),
|
||||
@ -89,7 +90,8 @@ erpnext.SalesChart = Class.extend({
|
||||
frappe.model.rename_doc(me.ctype, node.label, function(new_name) {
|
||||
node.$a.html(new_name);
|
||||
});
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
},
|
||||
{
|
||||
label:__("Delete"),
|
||||
@ -98,7 +100,8 @@ erpnext.SalesChart = Class.extend({
|
||||
frappe.model.delete_doc(me.ctype, node.label, function() {
|
||||
node.parent.remove();
|
||||
});
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
}
|
||||
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user