commit
e3ac032696
@ -55,6 +55,13 @@
|
|||||||
"label": "Time Between Operations (in mins)",
|
"label": "Time Between Operations (in mins)",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": ""
|
"precision": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "over_production_allowance_percentage",
|
||||||
|
"fieldtype": "Percent",
|
||||||
|
"label": "Over Production Allowance Percentage",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"hide_heading": 0,
|
"hide_heading": 0,
|
||||||
@ -65,7 +72,7 @@
|
|||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"modified": "2015-04-21 07:57:40.260862",
|
"modified": "2015-06-15 05:52:22.986958",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "Manufacturing Settings",
|
"name": "Manufacturing Settings",
|
||||||
|
|||||||
@ -91,7 +91,8 @@ class ProductionOrder(Document):
|
|||||||
# total qty in SO
|
# total qty in SO
|
||||||
so_qty = flt(so_item_qty) + flt(dnpi_qty)
|
so_qty = flt(so_item_qty) + flt(dnpi_qty)
|
||||||
|
|
||||||
if total_qty > so_qty:
|
allowance_percentage = flt(frappe.db.get_single_value("Manufacturing Settings", "over_production_allowance_percentage"))
|
||||||
|
if total_qty > so_qty + (allowance_percentage/100 * so_qty):
|
||||||
frappe.throw(_("Cannot produce more Item {0} than Sales Order quantity {1}").format(self.production_item,
|
frappe.throw(_("Cannot produce more Item {0} than Sales Order quantity {1}").format(self.production_item,
|
||||||
so_qty), OverProductionError)
|
so_qty), OverProductionError)
|
||||||
|
|
||||||
|
|||||||
@ -9,41 +9,6 @@
|
|||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "Master",
|
"document_type": "Master",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"fieldname": "employee",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"label": "Employee",
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Employee",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "employee_name",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"label": "Employee Name",
|
|
||||||
"options": "",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"read_only": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "column_break_2",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": ""
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"fieldname": "activity_type",
|
"fieldname": "activity_type",
|
||||||
@ -64,6 +29,41 @@
|
|||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0
|
"set_only_once": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_2",
|
||||||
|
"fieldtype": "Column Break",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"fieldname": "employee",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "Employee",
|
||||||
|
"no_copy": 0,
|
||||||
|
"options": "Employee",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "employee_name",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Employee Name",
|
||||||
|
"options": "",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"read_only": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "section_break_4",
|
"fieldname": "section_break_4",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
@ -136,7 +136,7 @@
|
|||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"modified": "2015-06-11 06:50:47.999788",
|
"modified": "2015-06-16 03:12:25.644839",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Projects",
|
"module": "Projects",
|
||||||
"name": "Activity Cost",
|
"name": "Activity Cost",
|
||||||
|
|||||||
@ -15,12 +15,21 @@ class ActivityCost(Document):
|
|||||||
self.check_unique()
|
self.check_unique()
|
||||||
|
|
||||||
def set_title(self):
|
def set_title(self):
|
||||||
|
if self.employee:
|
||||||
if not self.employee_name:
|
if not self.employee_name:
|
||||||
self.employee_name = frappe.db.get_value("Employee", self.employee, "employee_name")
|
self.employee_name = frappe.db.get_value("Employee", self.employee, "employee_name")
|
||||||
self.title = _("{0} for {1}").format(self.employee_name, self.activity_type)
|
self.title = _("{0} for {1}").format(self.employee_name, self.activity_type)
|
||||||
|
else:
|
||||||
|
self.title = self.activity_type
|
||||||
|
|
||||||
def check_unique(self):
|
def check_unique(self):
|
||||||
|
if self.employee:
|
||||||
if frappe.db.sql("""select name from `tabActivity Cost` where employee_name= %s and activity_type= %s and name != %s""",
|
if frappe.db.sql("""select name from `tabActivity Cost` where employee_name= %s and activity_type= %s and name != %s""",
|
||||||
(self.employee_name, self.activity_type, self.name)):
|
(self.employee_name, self.activity_type, self.name)):
|
||||||
frappe.throw(_("Activity Cost exists for Employee {0} against Activity Type - {1}")
|
frappe.throw(_("Activity Cost exists for Employee {0} against Activity Type - {1}")
|
||||||
.format(self.employee, self.activity_type), DuplicationError)
|
.format(self.employee, self.activity_type), DuplicationError)
|
||||||
|
else:
|
||||||
|
if frappe.db.sql("""select name from `tabActivity Cost` where ifnull(employee, '')='' and activity_type= %s and name != %s""",
|
||||||
|
(self.activity_type, self.name)):
|
||||||
|
frappe.throw(_("Default Activity Cost exists for Activity Type - {0}")
|
||||||
|
.format(self.activity_type), DuplicationError)
|
||||||
|
|||||||
@ -272,4 +272,7 @@ def get_events(start, end, filters=None):
|
|||||||
def get_activity_cost(employee=None, activity_type=None):
|
def get_activity_cost(employee=None, activity_type=None):
|
||||||
rate = frappe.db.sql("""select costing_rate, billing_rate from `tabActivity Cost` where employee= %s
|
rate = frappe.db.sql("""select costing_rate, billing_rate from `tabActivity Cost` where employee= %s
|
||||||
and activity_type= %s""", (employee, activity_type), as_dict=1)
|
and activity_type= %s""", (employee, activity_type), as_dict=1)
|
||||||
|
if not rate:
|
||||||
|
rate = frappe.db.sql("""select costing_rate, billing_rate from `tabActivity Cost` where ifnull(employee, '')=''
|
||||||
|
and activity_type= %s""", (activity_type), as_dict=1)
|
||||||
return rate[0] if rate else {}
|
return rate[0] if rate else {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user