rename total_billing_amount to total_billable_amount in timesheet doctype
This commit is contained in:
parent
4eb908fc76
commit
7b6fdb77d0
@ -464,8 +464,8 @@ class SalesInvoice(SellingController):
|
||||
if not timesheet.billing_hours and ts_doc.total_billing_hours:
|
||||
timesheet.billing_hours = ts_doc.total_billing_hours
|
||||
|
||||
if not timesheet.billing_amount and ts_doc.total_billing_amount:
|
||||
timesheet.billing_amount = ts_doc.total_billing_amount
|
||||
if not timesheet.billing_amount and ts_doc.total_billable_amount:
|
||||
timesheet.billing_amount = ts_doc.total_billable_amount
|
||||
|
||||
def update_timesheet_billing_for_project(self):
|
||||
if not self.timesheets and self.project:
|
||||
|
@ -22,7 +22,7 @@ def make_timesheet_for_projects(current_date ):
|
||||
ts = make_timesheet(employee, simulate = True, billable = 1,
|
||||
activity_type=get_random("Activity Type"), project=data.project, task =data.name)
|
||||
|
||||
if flt(ts.total_billing_amount) > 0.0:
|
||||
if flt(ts.total_billable_amount) > 0.0:
|
||||
make_sales_invoice_for_timesheet(ts.name)
|
||||
frappe.db.commit()
|
||||
|
||||
|
@ -295,7 +295,8 @@ erpnext.patches.v7_0.rename_prevdoc_fields
|
||||
erpnext.patches.v7_0.rename_time_sheet_doctype
|
||||
execute:frappe.delete_doc_if_exists("Report", "Customers Not Buying Since Long Time")
|
||||
erpnext.patches.v7_0.make_is_group_fieldtype_as_check
|
||||
execute:frappe.reload_doc('projects', 'doctype', 'timesheet') #2016-09-09
|
||||
execute:frappe.reload_doc('projects', 'doctype', 'timesheet') #2016-09-12
|
||||
erpnext.patches.v7_1.rename_field_timesheet
|
||||
execute:frappe.delete_doc_if_exists("Report", "Employee Holiday Attendance")
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Payment Tool")
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Payment Tool Detail")
|
||||
|
@ -3,12 +3,12 @@ import frappe
|
||||
def execute():
|
||||
frappe.reload_doc('accounts', 'doctype', 'sales_invoice')
|
||||
frappe.reload_doc('accounts', 'doctype', 'sales_invoice_payment')
|
||||
for time_sheet in frappe.db.sql(""" select sales_invoice, name, total_billing_amount from `tabTimesheet`
|
||||
for time_sheet in frappe.db.sql(""" select sales_invoice, name, total_billable_amount from `tabTimesheet`
|
||||
where sales_invoice is not null and docstatus < 2""", as_dict=True):
|
||||
si_doc = frappe.get_doc('Sales Invoice', time_sheet.sales_invoice)
|
||||
ts = si_doc.append('timesheets',{})
|
||||
ts.time_sheet = time_sheet.name
|
||||
ts.billing_amount = time_sheet.total_billing_amount
|
||||
ts.billing_amount = time_sheet.total_billable_amount
|
||||
si_doc.update_time_sheet(time_sheet.sales_invoice)
|
||||
si_doc.flags.ignore_validate_update_after_submit = True
|
||||
si_doc.save()
|
@ -13,7 +13,7 @@ def execute():
|
||||
) as sit
|
||||
set
|
||||
ts.total_billed_amount = sit.billing_amount, ts.total_billed_hours = sit.billing_hours,
|
||||
ts.per_billed = ((sit.billing_amount * 100)/ts.total_billing_amount)
|
||||
ts.per_billed = ((sit.billing_amount * 100)/ts.total_billable_amount)
|
||||
where ts.name = sit.time_sheet and ts.docstatus = 1""")
|
||||
|
||||
frappe.db.sql(""" update `tabTimesheet Detail` tsd, `tabTimesheet` ts set tsd.sales_invoice = ts.sales_invoice
|
||||
|
8
erpnext/patches/v7_1/rename_field_timesheet.py
Normal file
8
erpnext/patches/v7_1/rename_field_timesheet.py
Normal file
@ -0,0 +1,8 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
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')
|
@ -6,7 +6,7 @@ def execute():
|
||||
frappe.reload_doc('accounts', 'doctype', 'sales_invoice_timesheet')
|
||||
|
||||
frappe.db.sql("""update tabTimesheet set total_billing_hours=total_hours
|
||||
where total_billing_amount>0 and docstatus = 1""")
|
||||
where total_billable_amount>0 and docstatus = 1""")
|
||||
|
||||
frappe.db.sql("""update `tabTimesheet Detail` set billing_hours=hours where docstatus < 2""")
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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);
|
||||
}
|
@ -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",
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user