[minor] [fixes] can rename program and disable role on domainify
This commit is contained in:
parent
bdc8a88b4d
commit
1aac956306
@ -175,7 +175,7 @@ class ProductionPlanningTool(Document):
|
|||||||
and bom.is_active = 1) %s""" % \
|
and bom.is_active = 1) %s""" % \
|
||||||
(", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1)
|
(", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1)
|
||||||
|
|
||||||
self.add_items(items)
|
self.add_items(items)
|
||||||
|
|
||||||
|
|
||||||
def add_items(self, items):
|
def add_items(self, items):
|
||||||
@ -314,7 +314,7 @@ class ProductionPlanningTool(Document):
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
item_list = []
|
item_list = []
|
||||||
|
|
||||||
for bom, so_wise_qty in bom_dict.items():
|
for bom, so_wise_qty in bom_dict.items():
|
||||||
bom_wise_item_details = {}
|
bom_wise_item_details = {}
|
||||||
if self.use_multi_level_bom and self.only_raw_materials and self.include_subcontracted:
|
if self.use_multi_level_bom and self.only_raw_materials and self.include_subcontracted:
|
||||||
@ -335,19 +335,19 @@ class ProductionPlanningTool(Document):
|
|||||||
# so no childs of SA items
|
# so no childs of SA items
|
||||||
bom_wise_item_details = self.get_subitems(bom_wise_item_details, bom,1, \
|
bom_wise_item_details = self.get_subitems(bom_wise_item_details, bom,1, \
|
||||||
self.use_multi_level_bom,self.only_raw_materials, self.include_subcontracted,non_stock_item)
|
self.use_multi_level_bom,self.only_raw_materials, self.include_subcontracted,non_stock_item)
|
||||||
|
|
||||||
for item, item_details in bom_wise_item_details.items():
|
for item, item_details in bom_wise_item_details.items():
|
||||||
for so_qty in so_wise_qty:
|
for so_qty in so_wise_qty:
|
||||||
item_list.append([item, flt(item_details.qty) * so_qty[1], item_details.description,
|
item_list.append([item, flt(item_details.qty) * so_qty[1], item_details.description,
|
||||||
item_details.stock_uom, item_details.min_order_qty, so_qty[0]])
|
item_details.stock_uom, item_details.min_order_qty, so_qty[0]])
|
||||||
|
|
||||||
self.make_items_dict(item_list)
|
self.make_items_dict(item_list)
|
||||||
|
|
||||||
def get_subitems(self,bom_wise_item_details, bom, parent_qty, include_sublevel, only_raw, supply_subs,non_stock_item=0):
|
def get_subitems(self,bom_wise_item_details, bom, parent_qty, include_sublevel, only_raw, supply_subs,non_stock_item=0):
|
||||||
for d in frappe.db.sql("""SELECT bom_item.item_code, default_material_request_type,
|
for d in frappe.db.sql("""SELECT bom_item.item_code, default_material_request_type,
|
||||||
ifnull(%(parent_qty)s * sum(bom_item.qty/ifnull(bom.quantity, 1)), 0) as qty,
|
ifnull(%(parent_qty)s * sum(bom_item.qty/ifnull(bom.quantity, 1)), 0) as qty,
|
||||||
item.is_sub_contracted_item as is_sub_contracted, item.default_bom as default_bom,
|
item.is_sub_contracted_item as is_sub_contracted, item.default_bom as default_bom,
|
||||||
bom_item.description as description, bom_item.stock_uom as stock_uom, item.min_order_qty
|
bom_item.description as description, bom_item.stock_uom as stock_uom, item.min_order_qty
|
||||||
as min_order_qty FROM `tabBOM Item` bom_item, `tabBOM` bom, tabItem item
|
as min_order_qty FROM `tabBOM Item` bom_item, `tabBOM` bom, tabItem item
|
||||||
where bom.name = bom_item.parent and bom.name = %(bom)s and bom_item.docstatus < 2
|
where bom.name = bom_item.parent and bom.name = %(bom)s and bom_item.docstatus < 2
|
||||||
and bom_item.item_code = item.name
|
and bom_item.item_code = item.name
|
||||||
@ -364,7 +364,7 @@ class ProductionPlanningTool(Document):
|
|||||||
if include_sublevel:
|
if include_sublevel:
|
||||||
if (d.default_material_request_type == "Purchase" and d.is_sub_contracted \
|
if (d.default_material_request_type == "Purchase" and d.is_sub_contracted \
|
||||||
and supply_subs) or (d.default_material_request_type == "Manufacture"):
|
and supply_subs) or (d.default_material_request_type == "Manufacture"):
|
||||||
child_details = self.get_subitems(bom_wise_item_details,d.default_bom, \
|
self.get_subitems(bom_wise_item_details,d.default_bom, \
|
||||||
d.qty, include_sublevel, only_raw, supply_subs)
|
d.qty, include_sublevel, only_raw, supply_subs)
|
||||||
return bom_wise_item_details
|
return bom_wise_item_details
|
||||||
|
|
||||||
@ -409,12 +409,12 @@ class ProductionPlanningTool(Document):
|
|||||||
items_to_be_requested = frappe._dict()
|
items_to_be_requested = frappe._dict()
|
||||||
|
|
||||||
if not self.create_material_requests_for_all_required_qty:
|
if not self.create_material_requests_for_all_required_qty:
|
||||||
item_projected_qty = self.get_projected_qty()
|
item_projected_qty = self.get_projected_qty()
|
||||||
|
|
||||||
for item, so_item_qty in self.item_dict.items():
|
for item, so_item_qty in self.item_dict.items():
|
||||||
total_qty = sum([flt(d[0]) for d in so_item_qty])
|
total_qty = sum([flt(d[0]) for d in so_item_qty])
|
||||||
requested_qty = 0
|
requested_qty = 0
|
||||||
|
|
||||||
if self.create_material_requests_for_all_required_qty:
|
if self.create_material_requests_for_all_required_qty:
|
||||||
requested_qty = total_qty
|
requested_qty = total_qty
|
||||||
elif total_qty > item_projected_qty.get(item, 0):
|
elif total_qty > item_projected_qty.get(item, 0):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 0,
|
"allow_rename": 1,
|
||||||
"autoname": "field:program_name",
|
"autoname": "field:program_name",
|
||||||
"beta": 0,
|
"beta": 0,
|
||||||
"creation": "2015-09-07 12:54:03.609282",
|
"creation": "2015-09-07 12:54:03.609282",
|
||||||
@ -10,11 +10,13 @@
|
|||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "",
|
"document_type": "",
|
||||||
"editable_grid": 0,
|
"editable_grid": 0,
|
||||||
|
"engine": "InnoDB",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
"fieldname": "program_name",
|
"fieldname": "program_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -40,6 +42,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
"fieldname": "program_code",
|
"fieldname": "program_code",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -65,6 +68,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
"fieldname": "program_abbreviation",
|
"fieldname": "program_abbreviation",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -90,6 +94,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
"fieldname": "column_break_3",
|
"fieldname": "column_break_3",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -114,6 +119,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
"fieldname": "department",
|
"fieldname": "department",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -140,6 +146,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
"fieldname": "section_break_5",
|
"fieldname": "section_break_5",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -165,6 +172,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
"fieldname": "courses",
|
"fieldname": "courses",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -191,6 +199,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
"fieldname": "fee_schedule",
|
"fieldname": "fee_schedule",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -216,6 +225,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
"fieldname": "fees",
|
"fieldname": "fees",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -250,7 +260,7 @@
|
|||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"menu_index": 0,
|
||||||
"modified": "2016-08-27 03:21:35.806511",
|
"modified": "2016-10-18 12:17:05.479801",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Schools",
|
"module": "Schools",
|
||||||
"name": "Program",
|
"name": "Program",
|
||||||
@ -267,6 +277,7 @@
|
|||||||
"export": 1,
|
"export": 1,
|
||||||
"if_owner": 0,
|
"if_owner": 0,
|
||||||
"import": 0,
|
"import": 0,
|
||||||
|
"is_custom": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print": 1,
|
"print": 1,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
|
@ -97,6 +97,7 @@ def setup_roles(data):
|
|||||||
'''Add, remove roles from `data.allow_roles` or `data.remove_roles`'''
|
'''Add, remove roles from `data.allow_roles` or `data.remove_roles`'''
|
||||||
def remove_role(role):
|
def remove_role(role):
|
||||||
frappe.db.sql('delete from tabUserRole where role=%s', role)
|
frappe.db.sql('delete from tabUserRole where role=%s', role)
|
||||||
|
frappe.set_value('Role', role, 'disabled', 1)
|
||||||
|
|
||||||
if data.remove_roles:
|
if data.remove_roles:
|
||||||
for role in data.remove_roles:
|
for role in data.remove_roles:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user