From d93750a8684902112d508f340e4bd4bbce50973f Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 21 Apr 2015 17:38:33 +0530 Subject: [PATCH] Manufacturing Settings - Datatype of capacity_planning_for_days and mins_between_operations changed to Int --- .../manufacturing_settings.json | 158 +++++++++--------- .../production_order/production_order.py | 8 +- 2 files changed, 83 insertions(+), 83 deletions(-) diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json index 08891e037a..4149046cce 100644 --- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json +++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json @@ -1,99 +1,99 @@ { - "allow_copy": 0, - "allow_import": 0, - "allow_rename": 0, - "creation": "2014-11-27 14:12:07.542534", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "creation": "2014-11-27 14:12:07.542534", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "capacity_planning", - "fieldtype": "Section Break", - "label": "Capacity Planning", - "permlevel": 0, + "fieldname": "capacity_planning", + "fieldtype": "Section Break", + "label": "Capacity Planning", + "permlevel": 0, "precision": "" - }, + }, { - "description": "Plan time logs outside Workstation Working Hours.", - "fieldname": "allow_overtime", - "fieldtype": "Check", - "label": "Allow Overtime", - "permlevel": 0, + "description": "Plan time logs outside Workstation Working Hours.", + "fieldname": "allow_overtime", + "fieldtype": "Check", + "label": "Allow Overtime", + "permlevel": 0, "precision": "" - }, + }, { - "default": "", - "fieldname": "allow_production_on_holidays", - "fieldtype": "Check", - "in_list_view": 1, - "label": "Allow Production on Holidays", - "options": "", - "permlevel": 0, + "default": "", + "fieldname": "allow_production_on_holidays", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Allow Production on Holidays", + "options": "", + "permlevel": 0, "precision": "" - }, + }, { - "fieldname": "column_break_3", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "permlevel": 0, "precision": "" - }, + }, { - "default": "30", - "description": "Try planning operations for X days in advance.", - "fieldname": "capacity_planning_for_days", - "fieldtype": "Data", - "label": "Capacity Planning For (Days)", - "permlevel": 0, + "default": "30", + "description": "Try planning operations for X days in advance.", + "fieldname": "capacity_planning_for_days", + "fieldtype": "Int", + "label": "Capacity Planning For (Days)", + "permlevel": 0, "precision": "" - }, + }, { - "description": "Default 10 mins", - "fieldname": "mins_between_operations", - "fieldtype": "Data", - "label": "Time Between Operations (in mins)", - "permlevel": 0, + "description": "Default 10 mins", + "fieldname": "mins_between_operations", + "fieldtype": "Int", + "label": "Time Between Operations (in mins)", + "permlevel": 0, "precision": "" } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "icon-wrench", - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 1, - "istable": 0, - "modified": "2015-03-05 23:44:45.917027", - "modified_by": "Administrator", - "module": "Manufacturing", - "name": "Manufacturing Settings", - "name_case": "", - "owner": "Administrator", + ], + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "icon-wrench", + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "modified": "2015-04-21 07:57:40.260862", + "modified_by": "Administrator", + "module": "Manufacturing", + "name": "Manufacturing Settings", + "name_case": "", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 0, - "email": 0, - "export": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "Manufacturing Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Manufacturing Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, "write": 1 } - ], - "read_only": 0, - "read_only_onload": 0, - "sort_field": "modified", + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", "sort_order": "DESC" -} +} \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index fa27e9533d..9d17cf6475 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals 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.model.document import Document from erpnext.manufacturing.doctype.bom.bom import validate_bom_no @@ -269,9 +269,9 @@ class ProductionOrder(Document): def get_mins_between_operations(self): if not hasattr(self, "_mins_between_operations"): - self._mins_between_operations = frappe.db.get_single_value("Manufacturing Settings", - "mins_between_operations") or 10 - return relativedelta(minutes = self._mins_between_operations) + self._mins_between_operations = cint(frappe.db.get_single_value("Manufacturing Settings", + "mins_between_operations")) or 10 + return relativedelta(minutes=self._mins_between_operations) def check_operation_fits_in_working_hours(self, d): """Raises expection if operation is longer than working hours in the given workstation."""