Time Log -

Project made compulsory for time logs with time_log_for selected as 'Project'
Activity Type Madetory criteria removed
Compleated Quantity hidden if time_log_for is not set as Manufacturing
This commit is contained in:
Neil Trini Lasrado
2015-01-30 19:55:26 +05:30
parent e7cf961eaa
commit 93638bd179
2 changed files with 8 additions and 1 deletions

View File

@@ -76,7 +76,7 @@
"options": "Activity Type", "options": "Activity Type",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"reqd": 1 "reqd": 0
}, },
{ {
"depends_on": "eval:doc.time_log_for != 'Manufacturing'", "depends_on": "eval:doc.time_log_for != 'Manufacturing'",
@@ -116,6 +116,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "eval:doc.time_log_for == 'Manufacturing'",
"description": "Operation completed for how many finished goods?", "description": "Operation completed for how many finished goods?",
"fieldname": "completed_qty", "fieldname": "completed_qty",
"fieldtype": "Float", "fieldtype": "Float",

View File

@@ -23,6 +23,7 @@ class TimeLog(Document):
self.validate_time_log_for() self.validate_time_log_for()
self.check_workstation_timings() self.check_workstation_timings()
self.validate_production_order() self.validate_production_order()
self.validate_project()
def on_submit(self): def on_submit(self):
self.update_production_order() self.update_production_order()
@@ -128,6 +129,11 @@ class TimeLog(Document):
where production_order = %s and operation = %s and docstatus=1""", where production_order = %s and operation = %s and docstatus=1""",
(self.production_order, self.operation), as_dict=1)[0] (self.production_order, self.operation), as_dict=1)[0]
def validate_project(self):
if self.time_log_for == 'Project':
if not self.project:
frappe.throw(_("Project is Mandatory."))
@frappe.whitelist() @frappe.whitelist()
def get_workstation(production_order, operation): def get_workstation(production_order, operation):
"""Returns workstation name from Production Order against an associated Operation. """Returns workstation name from Production Order against an associated Operation.