mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-29 14:48:26 +00:00
rename total_billing_amount to total_billable_amount in timesheet doctype
This commit is contained in:
@@ -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""")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user