rename total_billing_hours to total_billable_hours in timesheet doctype
This commit is contained in:
parent
7b6fdb77d0
commit
0568238786
@ -461,8 +461,8 @@ class SalesInvoice(SellingController):
|
||||
def set_billing_hours_and_amount(self):
|
||||
for timesheet in self.timesheets:
|
||||
ts_doc = frappe.get_doc('Timesheet', timesheet.time_sheet)
|
||||
if not timesheet.billing_hours and ts_doc.total_billing_hours:
|
||||
timesheet.billing_hours = ts_doc.total_billing_hours
|
||||
if not timesheet.billing_hours and ts_doc.total_billable_hours:
|
||||
timesheet.billing_hours = ts_doc.total_billable_hours
|
||||
|
||||
if not timesheet.billing_amount and ts_doc.total_billable_amount:
|
||||
timesheet.billing_amount = ts_doc.total_billable_amount
|
||||
|
@ -4,5 +4,8 @@ from frappe.model.utils.rename_field import rename_field
|
||||
|
||||
def execute():
|
||||
doctype = 'Timesheet'
|
||||
if "total_billing_amount" in frappe.db.get_table_columns(doctype):
|
||||
rename_field(doctype, 'total_billing_amount', 'total_billable_amount')
|
||||
fields_dict = {'total_billing_amount': 'total_billable_amount', 'total_billing_hours': 'total_billable_hours'}
|
||||
|
||||
for old_fieldname, new_fieldname in fields_dict.items():
|
||||
if old_fieldname in frappe.db.get_table_columns(doctype):
|
||||
rename_field(doctype, old_fieldname, new_fieldname)
|
||||
|
@ -5,10 +5,10 @@ def execute():
|
||||
frappe.reload_doc('projects', 'doctype', 'timesheet_detail')
|
||||
frappe.reload_doc('accounts', 'doctype', 'sales_invoice_timesheet')
|
||||
|
||||
frappe.db.sql("""update tabTimesheet set total_billing_hours=total_hours
|
||||
frappe.db.sql("""update tabTimesheet set total_billable_hours=total_hours
|
||||
where total_billable_amount>0 and docstatus = 1""")
|
||||
|
||||
frappe.db.sql("""update `tabTimesheet Detail` set billing_hours=hours where docstatus < 2""")
|
||||
|
||||
frappe.db.sql(""" update `tabSales Invoice Timesheet` set billing_hours = (select total_billing_hours from `tabTimesheet`
|
||||
frappe.db.sql(""" update `tabSales Invoice Timesheet` set billing_hours = (select total_billable_hours from `tabTimesheet`
|
||||
where name = time_sheet) where time_sheet is not null""")
|
@ -17,7 +17,7 @@ class TestTimesheet(unittest.TestCase):
|
||||
timesheet = make_timesheet("_T-Employee-0001", simulate = True, billable=1)
|
||||
|
||||
self.assertEquals(timesheet.total_hours, 2)
|
||||
self.assertEquals(timesheet.total_billing_hours, 2)
|
||||
self.assertEquals(timesheet.total_billable_hours, 2)
|
||||
self.assertEquals(timesheet.time_logs[0].billing_rate, 50)
|
||||
self.assertEquals(timesheet.time_logs[0].billing_amount, 100)
|
||||
self.assertEquals(timesheet.total_billable_amount, 100)
|
||||
|
@ -173,7 +173,7 @@ var calculate_time_and_amount = function(frm) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.set_value("total_billing_hours", total_billing_hr);
|
||||
cur_frm.set_value("total_billable_hours", total_billing_hr);
|
||||
cur_frm.set_value("total_hours", total_working_hr);
|
||||
cur_frm.set_value("total_billable_amount", total_billable_amount);
|
||||
cur_frm.set_value("total_costing_amount", total_costing_amount);
|
||||
|
@ -549,14 +549,14 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "total_billing_hours",
|
||||
"fieldname": "total_billable_hours",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Total Billing Hours",
|
||||
"label": "Total Billable Hours",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
@ -817,7 +817,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-09-12 18:35:01.578750",
|
||||
"modified": "2016-09-12 13:19:22.298036",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Timesheet",
|
||||
|
@ -29,7 +29,7 @@ class Timesheet(Document):
|
||||
|
||||
def calculate_total_amounts(self):
|
||||
self.total_hours = 0.0
|
||||
self.total_billing_hours = 0.0
|
||||
self.total_billable_hours = 0.0
|
||||
self.total_billed_hours = 0.0
|
||||
self.total_billable_amount = 0.0
|
||||
self.total_costing_amount = 0.0
|
||||
@ -40,7 +40,7 @@ class Timesheet(Document):
|
||||
|
||||
self.total_hours += flt(d.hours)
|
||||
if d.billable:
|
||||
self.total_billing_hours += flt(d.billing_hours)
|
||||
self.total_billable_hours += flt(d.billing_hours)
|
||||
self.total_billable_amount += flt(d.billing_amount)
|
||||
self.total_costing_amount += flt(d.costing_amount)
|
||||
self.total_billed_amount += flt(d.billing_amount) if d.sales_invoice else 0.0
|
||||
@ -290,7 +290,7 @@ def get_timesheet_data(name, project):
|
||||
data = get_projectwise_timesheet_data(project, name)
|
||||
else:
|
||||
data = frappe.get_all('Timesheet',
|
||||
fields = ["(total_billable_amount - total_billed_amount) as billing_amt", "total_billing_hours as billing_hours"], filters = {'name': name})
|
||||
fields = ["(total_billable_amount - total_billed_amount) as billing_amt", "total_billable_hours as billing_hours"], filters = {'name': name})
|
||||
|
||||
return {
|
||||
'billing_hours': data[0].billing_hours,
|
||||
@ -305,7 +305,7 @@ def make_sales_invoice(source_name, target=None):
|
||||
|
||||
target.append('timesheets', {
|
||||
'time_sheet': timesheet.name,
|
||||
'billing_hours': flt(timesheet.total_billing_hours) - flt(timesheet.total_billed_hours),
|
||||
'billing_hours': flt(timesheet.total_billable_hours) - flt(timesheet.total_billed_hours),
|
||||
'billing_amount': flt(timesheet.total_billable_amount) - flt(timesheet.total_billed_amount)
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user