time log activity type made mandatory, new activity type manufacturing created

This commit is contained in:
Neil Trini Lasrado 2015-02-04 12:31:11 +05:30
parent 07a0d250ed
commit 11cd4f6c30
5 changed files with 17 additions and 16 deletions

View File

@ -291,6 +291,7 @@ def make_time_log(name, operation, from_time, to_time, qty=None, project=None,
time_log.project = project time_log.project = project
time_log.operation= operation time_log.operation= operation
time_log.workstation= workstation time_log.workstation= workstation
time_log.activity_type= "Manufacturing"
time_log.completed_qty = flt(qty) time_log.completed_qty = flt(qty)
if from_time and to_time : if from_time and to_time :
time_log.calculate_total_hours() time_log.calculate_total_hours()

View File

@ -68,5 +68,11 @@ $.extend(cur_frm.cscript, {
} }
} }
}); });
},
time_log_for: function(doc) {
if (doc.time_log_for == 'Manufacturing') {
cur_frm.set_value("activity_type", "Manufacturing")
}
} }
}); });

View File

@ -68,7 +68,7 @@
"reqd": 0 "reqd": 0
}, },
{ {
"depends_on": "eval:doc.time_log_for != 'Manufacturing'", "depends_on": "",
"fieldname": "activity_type", "fieldname": "activity_type",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 0, "in_list_view": 0,
@ -76,7 +76,7 @@
"options": "Activity Type", "options": "Activity Type",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"reqd": 0 "reqd": 1
}, },
{ {
"depends_on": "eval:doc.time_log_for != 'Manufacturing'", "depends_on": "eval:doc.time_log_for != 'Manufacturing'",
@ -116,7 +116,6 @@
"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",
@ -237,5 +236,5 @@
"write": 1 "write": 1
} }
], ],
"title_field": "" "title_field": "activity_type"
} }

View File

@ -24,7 +24,6 @@ class TimeLog(Document):
self.check_workstation_timings() self.check_workstation_timings()
self.validate_production_order() self.validate_production_order()
self.validate_project() self.validate_project()
self.validate_activity()
self.validate_manufacturing() self.validate_manufacturing()
def on_submit(self): def on_submit(self):
@ -138,14 +137,6 @@ class TimeLog(Document):
if self.time_log_for == "": if self.time_log_for == "":
self.project = None self.project = None
def validate_activity(self):
if self.time_log_for != 'Manufacturing':
if not self.activity_type:
frappe.throw(_("Activity is Mandatory."))
self.production_order = None
self.operation = None
self.quantity = None
def validate_manufacturing(self): def validate_manufacturing(self):
if self.time_log_for == 'Manufacturing': if self.time_log_for == 'Manufacturing':
if not self.production_order: if not self.production_order:
@ -154,7 +145,10 @@ class TimeLog(Document):
frappe.throw(_("Operation is Mandatory")) frappe.throw(_("Operation is Mandatory"))
if not self.completed_qty: if not self.completed_qty:
self.completed_qty=0 self.completed_qty=0
self.activity_type = None else:
self.production_order = None
self.operation = None
self.quantity = None
@frappe.whitelist() @frappe.whitelist()
def get_workstation(production_order, operation): def get_workstation(production_order, operation):

View File

@ -135,6 +135,7 @@ def install(country=None):
{'doctype': 'Activity Type', 'activity_type': _('Proposal Writing')}, {'doctype': 'Activity Type', 'activity_type': _('Proposal Writing')},
{'doctype': 'Activity Type', 'activity_type': _('Execution')}, {'doctype': 'Activity Type', 'activity_type': _('Execution')},
{'doctype': 'Activity Type', 'activity_type': _('Communication')}, {'doctype': 'Activity Type', 'activity_type': _('Communication')},
{'doctype': 'Activity Type', 'activity_type': _('Manufacturing')},
# Industry Type # Industry Type
{'doctype': 'Industry Type', 'industry': _('Accounting')}, {'doctype': 'Industry Type', 'industry': _('Accounting')},