Update actual dates in Production Order from Timesheet
This commit is contained in:
parent
c9e96c15af
commit
c443c9f05d
@ -367,15 +367,11 @@ class ProductionOrder(Document):
|
||||
frappe.throw(_("Completed Qty can not be greater than 'Qty to Manufacture'"))
|
||||
|
||||
def set_actual_dates(self):
|
||||
self.actual_start_date = None
|
||||
self.actual_end_date = None
|
||||
if self.get("operations"):
|
||||
actual_date = frappe.db.sql("""select min(actual_start_time) as start_date,
|
||||
max(actual_end_time) as end_date from `tabProduction Order Operation`
|
||||
where parent = %s and docstatus=1""", self.name, as_dict=1)[0]
|
||||
self.actual_start_date = actual_date.start_date
|
||||
self.actual_end_date = actual_date.end_date
|
||||
else:
|
||||
self.actual_start_date = None
|
||||
self.actual_end_date = None
|
||||
self.actual_start_date = min([d.actual_start_time for d in self.get("operations")])
|
||||
self.actual_end_date = max([d.actual_end_time for d in self.get("operations")])
|
||||
|
||||
def delete_timesheet(self):
|
||||
for timesheet in frappe.get_all("Timesheet", ["name"], {"production_order": self.name}):
|
||||
|
Loading…
x
Reference in New Issue
Block a user