time log activity type made mandatory, new activity type manufacturing created
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 396ec98..a962248 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -291,6 +291,7 @@
time_log.project = project
time_log.operation= operation
time_log.workstation= workstation
+ time_log.activity_type= "Manufacturing"
time_log.completed_qty = flt(qty)
if from_time and to_time :
time_log.calculate_total_hours()
diff --git a/erpnext/projects/doctype/time_log/time_log.js b/erpnext/projects/doctype/time_log/time_log.js
index cfcd35c..3e28e70 100644
--- a/erpnext/projects/doctype/time_log/time_log.js
+++ b/erpnext/projects/doctype/time_log/time_log.js
@@ -68,5 +68,11 @@
}
}
});
+ },
+
+ time_log_for: function(doc) {
+ if (doc.time_log_for == 'Manufacturing') {
+ cur_frm.set_value("activity_type", "Manufacturing")
+ }
}
});
diff --git a/erpnext/projects/doctype/time_log/time_log.json b/erpnext/projects/doctype/time_log/time_log.json
index 16102d7..9dc2d59 100644
--- a/erpnext/projects/doctype/time_log/time_log.json
+++ b/erpnext/projects/doctype/time_log/time_log.json
@@ -68,7 +68,7 @@
"reqd": 0
},
{
- "depends_on": "eval:doc.time_log_for != 'Manufacturing'",
+ "depends_on": "",
"fieldname": "activity_type",
"fieldtype": "Link",
"in_list_view": 0,
@@ -76,7 +76,7 @@
"options": "Activity Type",
"permlevel": 0,
"read_only": 0,
- "reqd": 0
+ "reqd": 1
},
{
"depends_on": "eval:doc.time_log_for != 'Manufacturing'",
@@ -116,7 +116,6 @@
"read_only": 1
},
{
- "depends_on": "eval:doc.time_log_for == 'Manufacturing'",
"description": "Operation completed for how many finished goods?",
"fieldname": "completed_qty",
"fieldtype": "Float",
@@ -237,5 +236,5 @@
"write": 1
}
],
- "title_field": ""
+ "title_field": "activity_type"
}
\ No newline at end of file
diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py
index b1d4b8a..a7401b4 100644
--- a/erpnext/projects/doctype/time_log/time_log.py
+++ b/erpnext/projects/doctype/time_log/time_log.py
@@ -24,7 +24,6 @@
self.check_workstation_timings()
self.validate_production_order()
self.validate_project()
- self.validate_activity()
self.validate_manufacturing()
def on_submit(self):
@@ -136,15 +135,7 @@
if not self.project:
frappe.throw(_("Project is Mandatory."))
if self.time_log_for == "":
- 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
+ self.project = None
def validate_manufacturing(self):
if self.time_log_for == 'Manufacturing':
@@ -154,7 +145,10 @@
frappe.throw(_("Operation is Mandatory"))
if not self.completed_qty:
self.completed_qty=0
- self.activity_type = None
+ else:
+ self.production_order = None
+ self.operation = None
+ self.quantity = None
@frappe.whitelist()
def get_workstation(production_order, operation):
diff --git a/erpnext/setup/page/setup_wizard/install_fixtures.py b/erpnext/setup/page/setup_wizard/install_fixtures.py
index 5312192..f83ab35 100644
--- a/erpnext/setup/page/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/page/setup_wizard/install_fixtures.py
@@ -135,7 +135,8 @@
{'doctype': 'Activity Type', 'activity_type': _('Proposal Writing')},
{'doctype': 'Activity Type', 'activity_type': _('Execution')},
{'doctype': 'Activity Type', 'activity_type': _('Communication')},
-
+ {'doctype': 'Activity Type', 'activity_type': _('Manufacturing')},
+
# Industry Type
{'doctype': 'Industry Type', 'industry': _('Accounting')},
{'doctype': 'Industry Type', 'industry': _('Advertising')},