chore: Remove code for Expense Claim from Project, Task, Delivery Trip

- Remove `total_expense_claim` field from Project and Task, will be installed with hrms setup

- Remove Expense Claim calculation from `update_costing` in project

- Remove `update_total_expense_claim` from task

- Remove Expense Claim references from employee form tour

- Remove 'Make Expense Claim' button from Delivery Trip, will only be available if hrms is installed

- Update delivery trip tests
This commit is contained in:
Rucha Mahabal
2022-06-23 19:48:42 +05:30
parent 1ff0e4519f
commit edb528ce41
8 changed files with 16 additions and 82 deletions

View File

@@ -38,7 +38,6 @@
"project_details",
"estimated_costing",
"total_costing_amount",
"total_expense_claim",
"total_purchase_cost",
"company",
"column_break_28",
@@ -279,12 +278,6 @@
"label": "Total Costing Amount (via Timesheets)",
"read_only": 1
},
{
"fieldname": "total_expense_claim",
"fieldtype": "Currency",
"label": "Total Expense Claim (via Expense Claims)",
"read_only": 1
},
{
"fieldname": "total_purchase_cost",
"fieldtype": "Currency",
@@ -458,7 +451,7 @@
"index_web_pages_for_search": 1,
"links": [],
"max_attachments": 4,
"modified": "2022-05-25 22:45:06.108499",
"modified": "2022-06-23 16:45:06.108499",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project",

View File

@@ -211,26 +211,20 @@ class Project(Document):
self.status = "Completed"
def update_costing(self):
from_time_sheet = frappe.db.sql(
"""select
sum(costing_amount) as costing_amount,
sum(billing_amount) as billing_amount,
min(from_time) as start_date,
max(to_time) as end_date,
sum(hours) as time
from `tabTimesheet Detail` where project = %s and docstatus = 1""",
self.name,
as_dict=1,
)[0]
from frappe.query_builder.functions import Max, Min, Sum
from_expense_claim = frappe.db.sql(
"""select
sum(total_sanctioned_amount) as total_sanctioned_amount
from `tabExpense Claim` where project = %s
and docstatus = 1""",
self.name,
as_dict=1,
)[0]
TimesheetDetail = frappe.qb.DocType("Timesheet Detail")
from_time_sheet = (
frappe.qb.from_(TimesheetDetail)
.select(
Sum(TimesheetDetail.costing_amount).as_("costing_amount"),
Sum(TimesheetDetail.billing_amount).as_("billing_amount"),
Min(TimesheetDetail.from_time).as_("start_date"),
Max(TimesheetDetail.to_time).as_("end_date"),
Sum(TimesheetDetail.hours).as_("time"),
)
.where((TimesheetDetail.project == self.name) & (TimesheetDetail.docstatus == 1))
).run(as_dict=True)[0]
self.actual_start_date = from_time_sheet.start_date
self.actual_end_date = from_time_sheet.end_date
@@ -239,7 +233,6 @@ class Project(Document):
self.total_billable_amount = from_time_sheet.billing_amount
self.actual_time = from_time_sheet.time
self.total_expense_claim = from_expense_claim.total_sanctioned_amount
self.update_purchase_costing()
self.update_sales_amount()
self.update_billed_amount()

View File

@@ -42,7 +42,6 @@
"act_end_date",
"sb_costing",
"total_costing_amount",
"total_expense_claim",
"column_break_20",
"total_billing_amount",
"sb_more_info",
@@ -279,13 +278,6 @@
"options": "Company:company:default_currency",
"read_only": 1
},
{
"fieldname": "total_expense_claim",
"fieldtype": "Currency",
"label": "Total Expense Claim (via Expense Claim)",
"options": "Company:company:default_currency",
"read_only": 1
},
{
"fieldname": "column_break_20",
"fieldtype": "Column Break"
@@ -397,7 +389,7 @@
"is_tree": 1,
"links": [],
"max_attachments": 5,
"modified": "2022-01-29 13:58:47.005241",
"modified": "2022-06-23 16:58:47.005241",
"modified_by": "Administrator",
"module": "Projects",
"name": "Task",

View File

@@ -156,13 +156,6 @@ class Task(NestedSet):
if self.status == "Cancelled":
clear(self.doctype, self.name)
def update_total_expense_claim(self):
self.total_expense_claim = frappe.db.sql(
"""select sum(total_sanctioned_amount) from `tabExpense Claim`
where project = %s and task = %s and docstatus=1""",
(self.project, self.name),
)[0][0]
def update_time_and_costing(self):
tl = frappe.db.sql(
"""select min(from_time) as start_date, max(to_time) as end_date,