Merge pull request #3142 from neilLasrado/production-planning

Manufacturing Settings
This commit is contained in:
Rushabh Mehta 2015-04-21 19:13:13 +05:30
commit 3c77b332ae
2 changed files with 83 additions and 83 deletions

View File

@ -1,99 +1,99 @@
{ {
"allow_copy": 0, "allow_copy": 0,
"allow_import": 0, "allow_import": 0,
"allow_rename": 0, "allow_rename": 0,
"creation": "2014-11-27 14:12:07.542534", "creation": "2014-11-27 14:12:07.542534",
"custom": 0, "custom": 0,
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Master", "document_type": "Master",
"fields": [ "fields": [
{ {
"fieldname": "capacity_planning", "fieldname": "capacity_planning",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Capacity Planning", "label": "Capacity Planning",
"permlevel": 0, "permlevel": 0,
"precision": "" "precision": ""
}, },
{ {
"description": "Plan time logs outside Workstation Working Hours.", "description": "Plan time logs outside Workstation Working Hours.",
"fieldname": "allow_overtime", "fieldname": "allow_overtime",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Allow Overtime", "label": "Allow Overtime",
"permlevel": 0, "permlevel": 0,
"precision": "" "precision": ""
}, },
{ {
"default": "", "default": "",
"fieldname": "allow_production_on_holidays", "fieldname": "allow_production_on_holidays",
"fieldtype": "Check", "fieldtype": "Check",
"in_list_view": 1, "in_list_view": 1,
"label": "Allow Production on Holidays", "label": "Allow Production on Holidays",
"options": "", "options": "",
"permlevel": 0, "permlevel": 0,
"precision": "" "precision": ""
}, },
{ {
"fieldname": "column_break_3", "fieldname": "column_break_3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"precision": "" "precision": ""
}, },
{ {
"default": "30", "default": "30",
"description": "Try planning operations for X days in advance.", "description": "Try planning operations for X days in advance.",
"fieldname": "capacity_planning_for_days", "fieldname": "capacity_planning_for_days",
"fieldtype": "Data", "fieldtype": "Int",
"label": "Capacity Planning For (Days)", "label": "Capacity Planning For (Days)",
"permlevel": 0, "permlevel": 0,
"precision": "" "precision": ""
}, },
{ {
"description": "Default 10 mins", "description": "Default 10 mins",
"fieldname": "mins_between_operations", "fieldname": "mins_between_operations",
"fieldtype": "Data", "fieldtype": "Int",
"label": "Time Between Operations (in mins)", "label": "Time Between Operations (in mins)",
"permlevel": 0, "permlevel": 0,
"precision": "" "precision": ""
} }
], ],
"hide_heading": 0, "hide_heading": 0,
"hide_toolbar": 0, "hide_toolbar": 0,
"icon": "icon-wrench", "icon": "icon-wrench",
"in_create": 0, "in_create": 0,
"in_dialog": 0, "in_dialog": 0,
"is_submittable": 0, "is_submittable": 0,
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"modified": "2015-03-05 23:44:45.917027", "modified": "2015-04-21 07:57:40.260862",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Manufacturing Settings", "name": "Manufacturing Settings",
"name_case": "", "name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,
"cancel": 0, "cancel": 0,
"create": 1, "create": 1,
"delete": 0, "delete": 0,
"email": 0, "email": 0,
"export": 0, "export": 0,
"import": 0, "import": 0,
"permlevel": 0, "permlevel": 0,
"print": 0, "print": 0,
"read": 1, "read": 1,
"report": 0, "report": 0,
"role": "Manufacturing Manager", "role": "Manufacturing Manager",
"set_user_permissions": 0, "set_user_permissions": 0,
"share": 1, "share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }
], ],
"read_only": 0, "read_only": 0,
"read_only_onload": 0, "read_only_onload": 0,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC" "sort_order": "DESC"
} }

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, json import frappe, json
from frappe.utils import flt, nowdate, get_datetime, getdate, date_diff from frappe.utils import flt, nowdate, get_datetime, getdate, date_diff, cint
from frappe import _ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from erpnext.manufacturing.doctype.bom.bom import validate_bom_no from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
@ -269,9 +269,9 @@ class ProductionOrder(Document):
def get_mins_between_operations(self): def get_mins_between_operations(self):
if not hasattr(self, "_mins_between_operations"): if not hasattr(self, "_mins_between_operations"):
self._mins_between_operations = frappe.db.get_single_value("Manufacturing Settings", self._mins_between_operations = cint(frappe.db.get_single_value("Manufacturing Settings",
"mins_between_operations") or 10 "mins_between_operations")) or 10
return relativedelta(minutes = self._mins_between_operations) return relativedelta(minutes=self._mins_between_operations)
def check_operation_fits_in_working_hours(self, d): def check_operation_fits_in_working_hours(self, d):
"""Raises expection if operation is longer than working hours in the given workstation.""" """Raises expection if operation is longer than working hours in the given workstation."""