mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 20:59:11 +00:00
Merge pull request #5630 from rohitwaghchaure/v7_time_log_batch_patch_fixes
[Fixes] Time log batch patch
This commit is contained in:
@@ -9,16 +9,18 @@ def execute():
|
|||||||
time_sheet.employee= ""
|
time_sheet.employee= ""
|
||||||
time_sheet.company = frappe.db.get_single_value('Global Defaults', 'default_company')
|
time_sheet.company = frappe.db.get_single_value('Global Defaults', 'default_company')
|
||||||
time_sheet.sales_invoice = tlb.sales_invoice
|
time_sheet.sales_invoice = tlb.sales_invoice
|
||||||
if tlb.get('time_logs'):
|
|
||||||
for data in tlb.time_logs:
|
|
||||||
args = get_timesheet_data(data)
|
|
||||||
add_timesheet_detail(time_sheet, args)
|
|
||||||
|
|
||||||
time_sheet.docstatus = tlb.docstatus
|
for data in frappe.get_all('Time Log Batch Detail', fields=["*"],
|
||||||
time_sheet.save(ignore_permissions=True)
|
filters = {'parent': tlb.name}):
|
||||||
|
args = get_timesheet_data(data)
|
||||||
|
add_timesheet_detail(time_sheet, args)
|
||||||
|
|
||||||
|
time_sheet.docstatus = tlb.docstatus
|
||||||
|
time_sheet.save(ignore_permissions=True)
|
||||||
|
|
||||||
def get_timesheet_data(data):
|
def get_timesheet_data(data):
|
||||||
time_log = frappe.get_doc('Time Log', data.time_log)
|
time_log = frappe.get_all('Time Log', fields=["*"],
|
||||||
|
filters = {'name': data.time_log})[0]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'billable': time_log.billable,
|
'billable': time_log.billable,
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
from erpnext.manufacturing.doctype.production_order.production_order import add_timesheet_detail
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
for si in frappe.db.sql(""" select sales_invoice as name from `tabTime Sheet`
|
for time_sheet in frappe.db.sql(""" select sales_invoice, name, total_billing_amount from `tabTime Sheet`
|
||||||
where sales_invoice is not null and docstatus < 2""", as_dict=True):
|
where sales_invoice is not null and docstatus < 2""", as_dict=True):
|
||||||
si_doc = frappe.get_doc('Sales Invoice', si.name)
|
si_doc = frappe.get_doc('Sales Invoice', time_sheet.sales_invoice)
|
||||||
for item in si_doc.items:
|
ts = si_doc.append('timesheets',{})
|
||||||
if item.time_log_batch:
|
ts.time_sheet = time_sheet.name
|
||||||
ts = si_doc.append('timesheets',{})
|
ts.billing_amount = time_sheet.total_billing_amount
|
||||||
ts.time_sheet = item.time_log_batch
|
si_doc.update_time_sheet(time_sheet.sales_invoice)
|
||||||
ts.billing_amount = frappe.db.get_value('Time Log Batch', item.time_log_batch, 'total_billing_amount')
|
si_doc.flags.ignore_validate_update_after_submit = True
|
||||||
si_doc.ignore_validate_update_after_submit = True
|
|
||||||
si_doc.update_time_sheet(ts.time_sheet)
|
|
||||||
si_doc.save()
|
si_doc.save()
|
||||||
@@ -9,6 +9,7 @@ from frappe.custom.doctype.property_setter.property_setter import make_property_
|
|||||||
def execute():
|
def execute():
|
||||||
frappe.reload_doc('projects', 'doctype','time_sheet')
|
frappe.reload_doc('projects', 'doctype','time_sheet')
|
||||||
frappe.reload_doc('projects', 'doctype', 'time_sheet_detail')
|
frappe.reload_doc('projects', 'doctype', 'time_sheet_detail')
|
||||||
|
frappe.reload_doc('accounts', 'doctype', 'sales_invoice_timesheet')
|
||||||
|
|
||||||
make_property_setter('Time Sheet', "naming_series", "options", 'TS-', "Text")
|
make_property_setter('Time Sheet', "naming_series", "options", 'TS-', "Text")
|
||||||
make_property_setter('Time Sheet', "naming_series", "default", 'TS-', "Text")
|
make_property_setter('Time Sheet', "naming_series", "default", 'TS-', "Text")
|
||||||
Reference in New Issue
Block a user