rename total_billing_amount to total_billable_amount in timesheet doctype

This commit is contained in:
Rohit Waghchaure
2016-09-12 19:06:41 +05:30
parent 4eb908fc76
commit 7b6fdb77d0
11 changed files with 33 additions and 23 deletions

View File

@@ -20,6 +20,7 @@ class TestTimesheet(unittest.TestCase):
self.assertEquals(timesheet.total_billing_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)
def test_salary_slip_from_timesheet(self):
salary_structure = make_salary_structure("_T-Employee-0001")

View File

@@ -25,7 +25,7 @@ frappe.ui.form.on("Timesheet", {
frm.fields_dict['time_logs'].grid.get_field('project').get_query = function() {
return{
filters: {
'status': frm.doc.company
'company': frm.doc.company
}
}
}
@@ -159,12 +159,12 @@ var calculate_time_and_amount = function(frm) {
var tl = frm.doc.time_logs || [];
total_working_hr = 0;
total_billing_hr = 0;
total_billing_amount = 0;
total_billable_amount = 0;
total_costing_amount = 0;
for(var i=0; i<tl.length; i++) {
if (tl[i].hours) {
total_working_hr += tl[i].hours;
total_billing_amount += tl[i].billing_amount;
total_billable_amount += tl[i].billing_amount;
total_costing_amount += tl[i].costing_amount;
if(tl[i].billable){
@@ -175,6 +175,6 @@ var calculate_time_and_amount = function(frm) {
cur_frm.set_value("total_billing_hours", total_billing_hr);
cur_frm.set_value("total_hours", total_working_hr);
cur_frm.set_value("total_billing_amount", total_billing_amount);
cur_frm.set_value("total_billable_amount", total_billable_amount);
cur_frm.set_value("total_costing_amount", total_costing_amount);
}

View File

@@ -655,14 +655,14 @@
"default": "0",
"depends_on": "",
"description": "",
"fieldname": "total_billing_amount",
"fieldname": "total_billable_amount",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Billing Amount",
"label": "Total Billable Amount",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -817,7 +817,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-09-09 03:53:17.544760",
"modified": "2016-09-12 18:35:01.578750",
"modified_by": "Administrator",
"module": "Projects",
"name": "Timesheet",

View File

@@ -31,7 +31,7 @@ class Timesheet(Document):
self.total_hours = 0.0
self.total_billing_hours = 0.0
self.total_billed_hours = 0.0
self.total_billing_amount = 0.0
self.total_billable_amount = 0.0
self.total_costing_amount = 0.0
self.total_billed_amount = 0.0
@@ -41,15 +41,15 @@ class Timesheet(Document):
self.total_hours += flt(d.hours)
if d.billable:
self.total_billing_hours += flt(d.billing_hours)
self.total_billing_amount += flt(d.billing_amount)
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
self.total_billed_hours += flt(d.billing_hours) if d.sales_invoice else 0.0
def calculate_percentage_billed(self):
self.per_billed = 0
if self.total_billed_amount > 0 and self.total_billing_amount > 0:
self.per_billed = (self.total_billed_amount * 100) / self.total_billing_amount
if self.total_billed_amount > 0 and self.total_billable_amount > 0:
self.per_billed = (self.total_billed_amount * 100) / self.total_billable_amount
def update_billing_hours(self, args):
if cint(args.billing_hours) == 0:
@@ -276,7 +276,7 @@ def get_timesheet(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select distinct tsd.parent from `tabTimesheet Detail` tsd,
`tabTimesheet` ts where
ts.status in ('Submitted', 'Payslip') and tsd.parent = ts.name and
tsd.docstatus = 1 and ts.total_billing_amount > 0
tsd.docstatus = 1 and ts.total_billable_amount > 0
and tsd.parent LIKE %(txt)s {condition}
order by tsd.parent limit %(start)s, %(page_len)s"""
.format(condition=condition), {
@@ -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_billing_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_billing_hours as billing_hours"], filters = {'name': name})
return {
'billing_hours': data[0].billing_hours,
@@ -306,10 +306,10 @@ 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_amount': flt(timesheet.total_billing_amount) - flt(timesheet.total_billed_amount)
'billing_amount': flt(timesheet.total_billable_amount) - flt(timesheet.total_billed_amount)
})
target.run_method("calculate_billing_amount_from_timesheet")
target.run_method("calculate_billing_amount_for_timesheet")
return target