mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
first cut for lazy loading framework
This commit is contained in:
@@ -1,102 +0,0 @@
|
||||
# DocType Mapper, Production Forecast-Production Plan
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:35',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-01-27 16:03:20',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'name': '__common__',
|
||||
'parent': 'Production Forecast-Production Plan',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper'
|
||||
},
|
||||
|
||||
# These values are common for all Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'name': '__common__',
|
||||
'parent': 'Production Forecast-Production Plan',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper'
|
||||
},
|
||||
|
||||
# These values are common for all DocType Mapper
|
||||
{
|
||||
'doctype': 'DocType Mapper',
|
||||
'from_doctype': 'Production Forecast',
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'to_doctype': 'Production Plan'
|
||||
},
|
||||
|
||||
# DocType Mapper, Production Forecast-Production Plan
|
||||
{
|
||||
'doctype': 'DocType Mapper',
|
||||
'name': 'Production Forecast-Production Plan'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'eval:flt(obj.qty)-flt(obj.planned_qty)',
|
||||
'to_field': 'prevdoc_reqd_qty'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parenttype',
|
||||
'to_field': 'against_document'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parent',
|
||||
'to_field': 'document_no'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'start_date',
|
||||
'to_field': 'document_date'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'end_date',
|
||||
'to_field': 'confirmation_date'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_table': 'Production Forecast',
|
||||
'match_id': 0,
|
||||
'to_table': 'Production Plan',
|
||||
'validation_logic': 'docstatus =1'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': 'pf_details',
|
||||
'from_table': 'PF Detail',
|
||||
'match_id': 1,
|
||||
'to_field': 'pp_details',
|
||||
'to_table': 'PP Detail',
|
||||
'validation_logic': 'docstatus =1 and qty > planned_qty '
|
||||
}
|
||||
]
|
||||
@@ -1,95 +0,0 @@
|
||||
# DocType Mapper, Production Forecast-Production Planning Tool
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:35',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-02-12 12:41:03',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'name': '__common__',
|
||||
'parent': 'Production Forecast-Production Planning Tool',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper'
|
||||
},
|
||||
|
||||
# These values are common for all Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'name': '__common__',
|
||||
'parent': 'Production Forecast-Production Planning Tool',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper'
|
||||
},
|
||||
|
||||
# These values are common for all DocType Mapper
|
||||
{
|
||||
'doctype': 'DocType Mapper',
|
||||
'from_doctype': 'Production Forecast',
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'to_doctype': 'Production Planning Tool'
|
||||
},
|
||||
|
||||
# DocType Mapper, Production Forecast-Production Planning Tool
|
||||
{
|
||||
'doctype': 'DocType Mapper',
|
||||
'name': 'Production Forecast-Production Planning Tool'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'eval:flt(obj.qty)-flt(obj.planned_qty)',
|
||||
'to_field': 'prevdoc_reqd_qty'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parenttype',
|
||||
'to_field': 'source_doctype'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parent',
|
||||
'to_field': 'source_docname'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'end_date',
|
||||
'to_field': 'confirmation_date'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_table': 'Production Forecast',
|
||||
'match_id': 0,
|
||||
'to_table': 'Production Planning Tool',
|
||||
'validation_logic': 'docstatus =1'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': 'pf_details',
|
||||
'from_table': 'PF Detail',
|
||||
'match_id': 1,
|
||||
'to_field': 'pp_details',
|
||||
'to_table': 'PP Detail',
|
||||
'validation_logic': 'docstatus =1 and qty > planned_qty '
|
||||
}
|
||||
]
|
||||
@@ -1,103 +0,0 @@
|
||||
# DocType Mapper, Sales Order-Production Plan
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:36',
|
||||
'docstatus': 0,
|
||||
'modified': '2009-12-21 13:16:59',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'name': '__common__',
|
||||
'parent': 'Sales Order-Production Plan',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper'
|
||||
},
|
||||
|
||||
# These values are common for all Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'name': '__common__',
|
||||
'parent': 'Sales Order-Production Plan',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper'
|
||||
},
|
||||
|
||||
# These values are common for all DocType Mapper
|
||||
{
|
||||
'doctype': 'DocType Mapper',
|
||||
'from_doctype': 'Sales Order',
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'ref_doc_submitted': 1,
|
||||
'to_doctype': 'Production Plan'
|
||||
},
|
||||
|
||||
# DocType Mapper, Sales Order-Production Plan
|
||||
{
|
||||
'doctype': 'DocType Mapper',
|
||||
'name': 'Sales Order-Production Plan'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parenttype',
|
||||
'to_field': 'against_document'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parent',
|
||||
'to_field': 'document_no'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'uom',
|
||||
'to_field': 'stock_uom'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'eval:flt(obj.qty)-flt(obj.planned_qty)',
|
||||
'to_field': 'prevdoc_total_qty'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'transaction_date',
|
||||
'to_field': 'document_date'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_table': 'Sales Order',
|
||||
'match_id': 0,
|
||||
'to_table': 'Production Plan',
|
||||
'validation_logic': 'docstatus =1'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': 'packing_details',
|
||||
'from_table': 'Delivery Note Packing Detail',
|
||||
'match_id': 1,
|
||||
'to_field': 'pp_details',
|
||||
'to_table': 'PP Detail',
|
||||
'validation_logic': 'docstatus =1 and qty > planned_qty'
|
||||
}
|
||||
]
|
||||
@@ -1,519 +0,0 @@
|
||||
[
|
||||
{
|
||||
'_last_update': '1300959287',
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'disabled': 'No',
|
||||
'docstatus': 0,
|
||||
'doctype': u'Module Def',
|
||||
'doctype_list': None,
|
||||
'file_list': 'support.gif,FileData/00214',
|
||||
'idx': None,
|
||||
'is_hidden': 'No',
|
||||
'last_updated_date': '2010-11-29 12:02:02',
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'module_desc': '<p>Production Documents</p>',
|
||||
'module_icon': 'process.png',
|
||||
'module_label': 'Production',
|
||||
'module_name': 'Production',
|
||||
'module_page': None,
|
||||
'module_seq': 7,
|
||||
'name': 'Production',
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'trash_reason': None,
|
||||
'widget_code': None
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Bill of material master containing raw materials, operation and costs',
|
||||
'display_name': 'Bill Of Materials',
|
||||
'doc_name': 'Bill Of Materials',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'id\nitem\ndescription\noperating_cost\nmaintained_by',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00209',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Machinery in warehouse where operations are performed on raw materials',
|
||||
'display_name': 'Workstation',
|
||||
'doc_name': 'Workstation',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'id\nworkstation_name\nwarehouse\ndescription',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00210',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Explode Bill of Materials in a tree and calculate the cost',
|
||||
'display_name': 'Bill of Materials (Tree)',
|
||||
'doc_name': 'Bill of Materials',
|
||||
'doc_type': 'Pages',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00211',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Update confirmed delivery dates in Sales Orders included in Production Plan',
|
||||
'display_name': 'Update Delivery Dates',
|
||||
'doc_name': 'Update Delivery Date',
|
||||
'doc_type': 'Single DocType',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00212',
|
||||
'owner': 'jai@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Plan your production by including relevant Sales Orders in your plan',
|
||||
'display_name': 'Production Planning Tool',
|
||||
'doc_name': 'Production Planning Tool',
|
||||
'doc_type': 'Single DocType',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 5,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00213',
|
||||
'owner': 'saumil@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Change raw materials used in a Bill of Material through BOM replace utility',
|
||||
'display_name': 'BOM Replace Utility',
|
||||
'doc_name': 'BOM Replace Utility',
|
||||
'doc_type': 'Single DocType',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00214',
|
||||
'owner': 'jai@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Raise your Production Orders Manually',
|
||||
'display_name': 'Production Order',
|
||||
'doc_name': 'Production Order',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 7,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00215',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': None,
|
||||
'doc_name': 'Reports',
|
||||
'doc_type': 'Separator',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 8,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003093',
|
||||
'owner': 'saumil@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Delivery Plan',
|
||||
'doc_name': 'Sales Order Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 9,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003094',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Itemwise Production Report',
|
||||
'doc_name': 'Stock Entry Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 10,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003095',
|
||||
'owner': 'jai@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Production Orders In Process',
|
||||
'doc_name': 'Production Order',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 11,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003096',
|
||||
'owner': 'jai@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Bill of material master containing raw materials, operation and costs',
|
||||
'display_name': 'Bill Of Materials',
|
||||
'doc_name': 'Bill Of Materials',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'id\nitem\ndescription\noperating_cost\nmaintained_by',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00209',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Machinery in warehouse where operations are performed on raw materials',
|
||||
'display_name': 'Workstation',
|
||||
'doc_name': 'Workstation',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'id\nworkstation_name\nwarehouse\ndescription',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00210',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Explode Bill of Materials in a tree and calculate the cost',
|
||||
'display_name': 'Bill of Materials (Tree)',
|
||||
'doc_name': 'Bill of Materials',
|
||||
'doc_type': 'Pages',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00211',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Update confirmed delivery dates in Sales Orders included in Production Plan',
|
||||
'display_name': 'Update Delivery Dates',
|
||||
'doc_name': 'Update Delivery Date',
|
||||
'doc_type': 'Single DocType',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00212',
|
||||
'owner': 'jai@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Plan your production by including relevant Sales Orders in your plan',
|
||||
'display_name': 'Production Planning Tool',
|
||||
'doc_name': 'Production Planning Tool',
|
||||
'doc_type': 'Single DocType',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 5,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00213',
|
||||
'owner': 'saumil@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Change raw materials used in a Bill of Material through BOM replace utility',
|
||||
'display_name': 'BOM Replace Utility',
|
||||
'doc_name': 'BOM Replace Utility',
|
||||
'doc_type': 'Single DocType',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00214',
|
||||
'owner': 'jai@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'description': 'Raise your Production Orders Manually',
|
||||
'display_name': 'Production Order',
|
||||
'doc_name': 'Production Order',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 7,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI00215',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': None,
|
||||
'doc_name': 'Reports',
|
||||
'doc_type': 'Separator',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 8,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003093',
|
||||
'owner': 'saumil@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Delivery Plan',
|
||||
'doc_name': 'Sales Order Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 9,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003094',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Itemwise Production Report',
|
||||
'doc_name': 'Stock Entry Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 10,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003095',
|
||||
'owner': 'jai@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-03-24 15:04:47',
|
||||
'description': None,
|
||||
'display_name': 'Production Orders In Process',
|
||||
'doc_name': 'Production Order',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 11,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003096',
|
||||
'owner': 'jai@webnotestech.com',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 1,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00040',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'Production User'
|
||||
},
|
||||
{
|
||||
'creation': '2010-11-30 22:42:49',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 2,
|
||||
'modified': '2011-03-24 15:29:36',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00041',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Production',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'Production Manager'
|
||||
}
|
||||
]
|
||||
@@ -1,26 +0,0 @@
|
||||
# Role, Production Manager
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:51',
|
||||
'docstatus': 0,
|
||||
'modified': '2009-09-23 16:35:35',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Role
|
||||
{
|
||||
'doctype': 'Role',
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'role_name': 'Production Manager'
|
||||
},
|
||||
|
||||
# Role, Production Manager
|
||||
{
|
||||
'doctype': 'Role',
|
||||
'name': 'Production Manager'
|
||||
}
|
||||
]
|
||||
@@ -1,26 +0,0 @@
|
||||
# Role, Production User
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:51',
|
||||
'docstatus': 0,
|
||||
'modified': '2009-09-23 16:36:08',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Role
|
||||
{
|
||||
'doctype': 'Role',
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'role_name': 'Production User'
|
||||
},
|
||||
|
||||
# Role, Production User
|
||||
{
|
||||
'doctype': 'Role',
|
||||
'name': 'Production User'
|
||||
}
|
||||
]
|
||||
@@ -1,123 +0,0 @@
|
||||
//$import(Production Tips Common)
|
||||
|
||||
// ONLOAD
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
|
||||
|
||||
}
|
||||
|
||||
// On REFRESH
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
|
||||
|
||||
|
||||
// Hide - Un Hide Buttons
|
||||
if (!doc.is_default && doc.__islocal!=1) unhide_field('Set as Default BOM');
|
||||
else hide_field('Set as Default BOM');
|
||||
if (doc.is_default && doc.__islocal!=1) unhide_field('Unset as Default BOM');
|
||||
else hide_field('Unset as Default BOM');
|
||||
|
||||
if(doc.__islocal!=1){
|
||||
set_field_permlevel('item',1);
|
||||
}
|
||||
if (flt(doc.docstatus) == 1){
|
||||
if (doc.is_active == 'Yes') { unhide_field('Inactivate BOM'); hide_field('Activate BOM');}
|
||||
else { hide_field('Inactivate BOM'); unhide_field('Activate BOM');}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['item'].get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
|
||||
}
|
||||
|
||||
// ---------------------- Get project name --------------------------
|
||||
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = function(doc) {
|
||||
var d = locals[this.doctype][this.docname];
|
||||
return 'SELECT DISTINCT `tabBill Of Materials`.`name`, `tabBill Of Materials`.`remarks` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`item` = "' + d.item_code + '" AND `tabBill Of Materials`.`name` like "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.cscript.item = function(doc, cdt, cdn) {
|
||||
if (doc.item) {
|
||||
get_server_fields('get_item_detail',doc.item,'',doc,cdt,cdn,1);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.workstation = function(doc,cdt,cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.workstation) {
|
||||
get_server_fields('get_workstation_details',d.workstation,'bom_operations',doc,cdt,cdn,1);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.item_code =function(doc,cdt,cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
arg = "{'item_code' : '" + d.item_code + "', 'bom_no' : ''}";
|
||||
get_server_fields('get_bom_material_detail',arg,'bom_materials',doc,cdt,cdn,1);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.bom_no = function(doc,cdt,cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code && d.bom_no) {
|
||||
arg = "{'item_code' : '" + d.item_code + "', 'bom_no' : '" + d.bom_no + "'}";
|
||||
get_server_fields('get_bom_material_detail',arg,'bom_materials',doc,cdt,cdn,1);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Set as Default BOM'] = function(doc,cdt,cdn) {
|
||||
var check = confirm("Do you Really want to Set BOM " + doc.name + " as default for Item " + doc.item);
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'set_as_default_bom', 'docs': compress_doclist([doc])}, function(r,rt) {
|
||||
refresh_field('is_default');
|
||||
hide_field('Set as Default BOM');unhide_field('Unset as Default BOM');
|
||||
refresh_field('Set as Default BOM');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Unset as Default BOM'] = function(doc,cdt,cdn) {
|
||||
var check = confirm("Do you Really want to Unset BOM " + doc.name + " as default for Item " + doc.item);
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'unset_as_default_bom', 'docs': compress_doclist([doc])}, function(r,rt) {
|
||||
refresh_field('is_default');
|
||||
hide_field('Unset as Default BOM');unhide_field('Set as Default BOM');
|
||||
refresh_field('Unset as Default BOM');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Activate BOM'] = function(doc,cdt,cdn) {
|
||||
var check = confirm("DO YOU REALLY WANT TO ACTIVATE BOM : " + doc.name);
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'activate_inactivate_bom', 'arg': 'Activate', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Test Flat BOM'] = function(doc,cdt,cdn) {
|
||||
|
||||
$c('runserverobj', args={'method':'get_current_flat_bom_items', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript['Inactivate BOM'] = function(doc,cdt,cdn) {
|
||||
var check = confirm("DO YOU REALLY WANT TO INACTIVATE BOM : " + doc.name);
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'activate_inactivate_bom', 'arg': 'Inactivate', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,555 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def autoname(self):
|
||||
last_name = sql("select max(name) from `tabBill Of Materials` where name like 'BOM/%s/%%'" % self.doc.item)
|
||||
if last_name:
|
||||
idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1
|
||||
else:
|
||||
idx = 1
|
||||
self.doc.name = 'BOM/' + self.doc.item + ('/%.3i' % idx)
|
||||
|
||||
#----------- Client Trigger function ----------
|
||||
def get_item_detail(self, item_code):
|
||||
item = sql("select description from `tabItem` where (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now()) and name = %s",item_code , as_dict =1)
|
||||
ret={
|
||||
'description' : item and item[0]['description'] or ''
|
||||
}
|
||||
return ret
|
||||
|
||||
def get_workstation_details(self,workstation):
|
||||
ws = sql("select hour_rate, capacity from `tabWorkstation` where name = %s",workstation , as_dict = 1)
|
||||
ret = {
|
||||
'hour_rate' : ws and flt(ws[0]['hour_rate']) or '',
|
||||
'workstation_capacity' : ws and flt(ws[0]['capacity']) or ''
|
||||
}
|
||||
return ret
|
||||
|
||||
def get_bom_material_detail(self, arg):
|
||||
arg = eval(arg)
|
||||
if arg['item_code'] and arg['item_code'] == self.doc.item:
|
||||
msgprint(" Item_code: "+arg['item_code']+" in materials tab cannot be same as main Item in BOM := " +cstr(self.doc.name))
|
||||
raise Exception
|
||||
if arg['item_code']:
|
||||
item = sql("select is_asset_item, is_purchase_item, docstatus, is_sub_contracted_item, description, stock_uom, default_bom from `tabItem` where item_code = %s", (arg['item_code']), as_dict = 1)
|
||||
|
||||
# Check for Asset Item
|
||||
if item and item[0]['is_asset_item'] == 'Yes':
|
||||
msgprint("Sorry!!! Item " + arg['item_code'] + " is an Asset of the company. Entered in BOM := " + cstr(self.doc.name))
|
||||
raise Exception
|
||||
|
||||
if item and item[0]['docstatus'] == 2:
|
||||
msgprint("Item %s does not exist in system" % cstr(args['item_code']))
|
||||
|
||||
ret_item = {
|
||||
'description' : item and item[0]['description'] or '',
|
||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||
'bom_no' : item and item[0]['default_bom'] or ''
|
||||
}
|
||||
|
||||
# Check for Purchase Item
|
||||
if item and (item[0]['is_purchase_item'] == 'Yes' or item[0]['is_sub_contracted_item'] == 'Yes'):
|
||||
ret_item['moving_avg_rate'], ret_item['last_purchase_rate'], ret_item['standard_rate'] = self.get_mar_lpr_sr(arg['item_code'], mar = 1, lpr = 1, sr = 1)
|
||||
ret_item['operating_cost'], ret_item['dir_mat_as_per_mar'], ret_item['dir_mat_as_per_lpr'], ret_item['dir_mat_as_per_sr'] = 0, 0, 0, 0
|
||||
ret_item['value_as_per_mar'], ret_item['value_as_per_lpr'], ret_item['value_as_per_sr'] = 0, 0, 0
|
||||
ret_item['amount_as_per_mar'], ret_item['amount_as_per_lpr'], ret_item['amount_as_per_sr'] = 0, 0, 0
|
||||
|
||||
if arg['bom_no'] or not ret_item['bom_no'] =='':
|
||||
if arg['bom_no']:
|
||||
bom = sql("select name, dir_mat_as_per_mar,dir_mat_as_per_lpr,dir_mat_as_per_sr, operating_cost, quantity from `tabBill Of Materials` where is_active = 'Yes' and name = %s", (arg['bom_no']), as_dict=1)
|
||||
else:
|
||||
# get recent direct material cost, operating_cost, cost from Default BOM of Item
|
||||
bom = sql("select name, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, operating_cost, quantity from `tabBill Of Materials` where is_active = 'Yes' and name = %s", (ret_item['bom_no']), as_dict=1)
|
||||
|
||||
# get recent direct material cost, operating_cost, cost from Entered BOM of Item
|
||||
ret_item['bom_no'] = bom and bom[0]['name'] or ''
|
||||
|
||||
if bom and bom[0]['name']:
|
||||
ret_bom = {
|
||||
'dir_mat_as_per_mar' : flt(bom[0]['dir_mat_as_per_mar']) / flt(bom[0]['quantity']) or 0.00,
|
||||
'dir_mat_as_per_lpr' : flt(bom[0]['dir_mat_as_per_lpr']) / flt(bom[0]['quantity']) or 0.00,
|
||||
'dir_mat_as_per_sr' : flt(bom[0]['dir_mat_as_per_sr']) / flt(bom[0]['quantity']) or 0.00,
|
||||
'operating_cost' : flt(bom[0]['operating_cost']) / flt(bom[0]['quantity']) or 0.00,
|
||||
'value_as_per_mar' : ((flt(bom[0]['dir_mat_as_per_mar']) + flt(bom[0]['operating_cost'])) / flt(bom[0]['quantity'])) or 0.00,
|
||||
'value_as_per_lpr' : ((flt(bom[0]['dir_mat_as_per_lpr']) + flt(bom[0]['operating_cost'])) / flt(bom[0]['quantity'])) or 0.00,
|
||||
'value_as_per_sr' : ((flt(bom[0]['dir_mat_as_per_sr']) + flt(bom[0]['operating_cost'])) / flt(bom[0]['quantity'])) or 0.00,
|
||||
'amount_as_per_mar' : 0,
|
||||
'amount_as_per_lpr' : 0,
|
||||
'amount_as_per_sr' : 0
|
||||
}
|
||||
ret_item.update(ret_bom)
|
||||
if item and item[0]['is_sub_contracted_item'] != 'Yes':
|
||||
ret_bom_rates = {
|
||||
'moving_avg_rate' : 0,
|
||||
'last_purchase_rate' : 0,
|
||||
'standard_rate' : 0
|
||||
}
|
||||
ret_item.update(ret_bom_rates)
|
||||
return ret_item
|
||||
|
||||
def set_as_default_bom(self):
|
||||
# set Is Default as 1
|
||||
set(self.doc,'is_default', flt(1))
|
||||
|
||||
# get previous default bom from Item Master
|
||||
prev_def_bom = sql("select default_bom from `tabItem` where name = %s", self.doc.item,as_dict = 1)
|
||||
|
||||
if prev_def_bom[0]['default_bom'] and prev_def_bom[0]['default_bom'] != self.doc.name:
|
||||
# update Is Default as 0 in Previous Default BOM
|
||||
msgprint(cstr(prev_def_bom[0]['default_bom']) + "is no longer Default BOM for item" + cstr(self.doc.item))
|
||||
sql("update `tabBill Of Materials` set is_default = 0 where name = '%s'" % (prev_def_bom[0]['default_bom']))
|
||||
|
||||
# update current BOM as default bom in Item Master
|
||||
sql("update `tabItem` set default_bom = '%s' where name = '%s'" % (self.doc.name,self.doc.item))
|
||||
msgprint(cstr(self.doc.name) + "has been set as Default BOM for Item "+cstr(self.doc.item))
|
||||
|
||||
def unset_as_default_bom(self):
|
||||
# set Is Default as 1
|
||||
set(self.doc,'is_default', flt(0))
|
||||
|
||||
# update current BOM as default bom in Item Master
|
||||
sql("update `tabItem` set default_bom = null where name = '%s'" % (self.doc.item))
|
||||
msgprint(cstr(self.doc.name) + "has been unset as Default BOM for Item "+cstr(self.doc.item))
|
||||
|
||||
def check_active_parent_boms(self):
|
||||
act_pbom = sql("select distinct t1.parent from `tabBOM Material` t1, `tabBill Of Materials` t2 where t1.bom_no ='%s' and t2.name = t1.parent and t2.is_active = 'Yes' and t2.docstatus = 1 and t1.docstatus =1 " % self.doc.name )
|
||||
if act_pbom and act_pbom[0][0]:
|
||||
msgprint("Sorry cannot Inactivate as BOM %s is child of one or many other active parent BOMs" % self.doc.name)
|
||||
raise Exception
|
||||
|
||||
def activate_inactivate_bom(self, action):
|
||||
if cstr(action) == 'Activate':
|
||||
self.validate()
|
||||
set(self.doc, 'is_active', 'Yes')
|
||||
elif cstr(action) == 'Inactivate':
|
||||
self.check_active_parent_boms()
|
||||
set(self.doc, 'is_active', 'No')
|
||||
|
||||
#------ On Validation Of Document ----------
|
||||
def validate_main_item(self):
|
||||
item = sql("select is_manufactured_item, is_sub_contracted_item from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", self.doc.item, as_dict = 1)
|
||||
|
||||
if not item:
|
||||
msgprint("Item %s do not exists in the system. Entered in BOM := %s" % (cstr(self.doc.item), cstr(self.doc.name)))
|
||||
raise Exception
|
||||
|
||||
elif not item[0]['is_manufactured_item'] == 'Yes' and not item[0]['is_sub_contracted_item'] == 'Yes':
|
||||
msgprint("Sorry cannot make Bill Of Materials for Item %s. As it is not a manufactured / sub-contracted item. Entered in BOM := %s " % (cstr(self.doc.item), cstr(self.doc.name)))
|
||||
raise Exception
|
||||
|
||||
# validate operations
|
||||
#------------------------------------------------------
|
||||
def validate_operations(self,o,validate = "0"):
|
||||
if not o.operation_no:
|
||||
msgprint("Please Enter Operation No at Row " + cstr(o.idx)+" in BOM := " +cstr(self.doc.name))
|
||||
raise Exception
|
||||
|
||||
if not o.workstation:
|
||||
msgprint("Please Enter Workstation for Operation No. " + cstr(o.operation_no) + " in BOM NO. " + self.doc.name)
|
||||
raise Exception
|
||||
|
||||
if not o.time_in_mins:
|
||||
msgprint("Please Enter Operation Time of Operation No. " + cstr(o.operation_no) + " in BOM NO. " + self.doc.name)
|
||||
raise Exception
|
||||
|
||||
# Operation No should not repeat.
|
||||
if o.operation_no in self.op:
|
||||
msgprint("Operation No " + cstr(o.operation_no) + "is repeated in Operations Table of BOM NO. " + self.doc.name)
|
||||
raise Exception
|
||||
|
||||
# add operation in op list
|
||||
self.op.append(cstr(o.operation_no))
|
||||
|
||||
# Validate materials
|
||||
#-------------------------------------------------
|
||||
|
||||
def validate_materials(self,m):
|
||||
|
||||
# check for operation no
|
||||
if not self.op:
|
||||
msgprint("Please Enter Operations in operation table of BOM NO. " + self.doc.name)
|
||||
raise Exception
|
||||
|
||||
# check if operation no not in op list
|
||||
if m.operation_no not in self.op:
|
||||
msgprint("Operation no "+ cstr(m.operation_no) + " for item code " + cstr(m.item_code) +" is not present in BOM Operations of BOM NO. " + self.doc.name)
|
||||
raise Exception
|
||||
|
||||
if not m.item_code:
|
||||
msgprint("Please Enter Item Code at Row " + cstr(m.idx) + "of BOM Material in BOM NO. " + self.doc.name)
|
||||
raise Exception
|
||||
|
||||
item = sql("select is_manufactured_item, is_sub_contracted_item from`tabItem` where item_code = %s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", m.item_code, as_dict = 1)
|
||||
if not item:
|
||||
msgprint("Item %s is not present in Item Master." % m.item_code)
|
||||
raise Exception
|
||||
|
||||
if item[0]['is_manufactured_item'] == 'Yes' or item[0]['is_sub_contracted_item'] == 'Yes':
|
||||
bom = sql("select name, is_active, docstatus from `tabBill Of Materials` where item = %s", m.item_code, as_dict =1)
|
||||
if bom and bom[0]['name']:
|
||||
if not m.bom_no:
|
||||
msgprint("Please Enter BOM No for Item " + cstr(m.item_code) + " in Materials at Row No. " + cstr(m.idx) + " in BOM NO. " + self.doc.name)
|
||||
raise Exception
|
||||
else:
|
||||
match = 0
|
||||
for b in bom:
|
||||
if cstr(m.bom_no) == cstr(b['name']):
|
||||
if b['is_active'] != 'Yes':
|
||||
msgprint("BOM %s NOT ACTIVE BOM. Entered in BOM := %s at row no := %s" % (cstr(m.bom_no), cstr(self.doc.name), m.idx))
|
||||
raise Exception
|
||||
|
||||
#if flt(b['docstatus']) != 1:
|
||||
# msgprint("BOM %s is NOT SUBMITTED."% cstr(m.bom_no))
|
||||
# raise Exception
|
||||
|
||||
match = 1
|
||||
if not match:
|
||||
msgprint("Item %s does not belongs to Bill Of Material %s or Bill Of Material %s is NOT ACTIVE BOM. Entered in BOM := %s at row no := %s" % (cstr(m.item_code),cstr(m.bom_no), cstr(m.bom_no), self.doc.name, m.idx))
|
||||
raise Exception
|
||||
|
||||
if not item[0]['is_manufactured_item'] == 'Yes' and not item[0]['is_sub_contracted_item']== 'Yes':
|
||||
if m.bom_no:
|
||||
msgprint("As in Item Master of Item %s Is Manufactured Item / Is Sub-Contracted Item is not 'Yes' hence there should be no BOM.In BOm := %s at row no := %s" % (m.item_code, cstr(self.doc.name), m.idx))
|
||||
raise Exception
|
||||
|
||||
if not m.qty or m.qty <= 0:
|
||||
msgprint("Please Enter Qty value greater than 0(Zero) at Row " + cstr(m.idx) + " in BOM NO. " + self.doc.name)
|
||||
raise Exception
|
||||
|
||||
if m.scrap and m.scrap < 0:
|
||||
msgprint("Please Enter Scrap value Greater than 0(Zero) at Row " + cstr(m.idx) + " in BOM NO. " + self.doc.name)
|
||||
raise Exception
|
||||
|
||||
# Calculate Cost
|
||||
#-----------------------------------------------
|
||||
|
||||
def calculate_cost(self, validate = 0):
|
||||
self.op, op_cost, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, count_mat = [], 0.0, 0.0,0.0,0.0, 0
|
||||
# -------- Calculate Cost Of BOM -------------
|
||||
# --- calculate operating cost from BOM Operations ----
|
||||
for o in getlist(self.doclist, 'bom_operations'):
|
||||
# --- Validation for enteries in BOM Operations ----
|
||||
if validate:
|
||||
self.validate_operations(o)
|
||||
|
||||
o.operating_cost = flt(flt(o.time_in_mins)/60) * flt(o.hour_rate)
|
||||
if validate != 1:
|
||||
o.save()
|
||||
msgprint('Operation saved')
|
||||
|
||||
op_cost = flt(op_cost) + flt(o.operating_cost)
|
||||
|
||||
# --- calculate operating cost and direct material cost from BOM Material ---
|
||||
for m in getlist(self.doclist, 'bom_materials'):
|
||||
# --- Validation for enteries in BOM Material --- '''
|
||||
count_mat = count_mat + 1
|
||||
if validate:
|
||||
self.validate_materials(m)
|
||||
|
||||
if m.bom_no:
|
||||
# add operating cost of child boms
|
||||
op_cost += flt(m.operating_cost)
|
||||
|
||||
# update dir_mat, op_cost, value from child bom
|
||||
self.update_childs_dir_op_value(m, child_bom_cost = 1)
|
||||
|
||||
# check for is_sub_contracted_item
|
||||
item = sql("select is_sub_contracted_item from `tabItem` where name = '%s'" % m.item_code, as_dict =1)
|
||||
if item and item[0]['is_sub_contracted_item'] == 'Yes':
|
||||
# update recent mar,lpr,sr
|
||||
self.update_mar_lpr_sr(m, mar =1, lpr =1, sr =1)
|
||||
# calculate amount for sub contracted item
|
||||
self.calculate_amount( m, has_bom = 1, is_sub_cont = 1)
|
||||
# calculate Direct Material
|
||||
dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr = self.calculate_dir_mat(m, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, has_bom = 1, is_sub_cont =1)
|
||||
else:
|
||||
# update mar,lpr,sr as 0
|
||||
self.update_mar_lpr_sr( m, mar = 0, lpr = 0, sr = 0)
|
||||
# calculate amount
|
||||
self.calculate_amount( m, has_bom = 1, is_sub_cont = 0)
|
||||
# calculate Direct Material
|
||||
dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr = self.calculate_dir_mat(m, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, has_bom = 1, is_sub_cont =0)
|
||||
|
||||
else :
|
||||
# update dir_mat,op_cost, value as 0
|
||||
self.update_childs_dir_op_value(m, child_bom_cost = 0)
|
||||
# update recent mar,lpr,sr
|
||||
self.update_mar_lpr_sr(m, mar =1, lpr =1, sr =1)
|
||||
# calculate amount
|
||||
self.calculate_amount(m, has_bom = 0, is_sub_cont = 0)
|
||||
# calculate Direct Material
|
||||
dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr = self.calculate_dir_mat(m, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, has_bom =0, is_sub_cont =0)
|
||||
|
||||
# update qty_consumed_per_unit
|
||||
m.qty_consumed_per_unit = flt(m.qty) / flt(self.doc.quantity)
|
||||
m.save()
|
||||
#msgprint("dir_mat_as_per_mar < ==> " + cstr(dir_mat_as_per_mar) + "***" + "dir_mat_as_per_lpr < ==> " + cstr(dir_mat_as_per_lpr) + "***" + "dir_mat_as_per_sr < ==> " + cstr(dir_mat_as_per_sr) + "***")
|
||||
if not count_mat:
|
||||
msgprint("There should at least one Item in BOM Material. In BOM := " +cstr(self.doc.name))
|
||||
raise Exception
|
||||
|
||||
set(self.doc, 'operating_cost' ,op_cost)
|
||||
set(self.doc, 'cost_as_on' ,now())
|
||||
# update dir_mat
|
||||
set(self.doc, 'dir_mat_as_per_mar' ,dir_mat_as_per_mar)
|
||||
set(self.doc, 'dir_mat_as_per_lpr' ,dir_mat_as_per_lpr)
|
||||
set(self.doc, 'dir_mat_as_per_sr' ,dir_mat_as_per_sr)
|
||||
# update cost
|
||||
set(self.doc, 'cost_as_per_mar' ,flt(dir_mat_as_per_mar + op_cost))
|
||||
set(self.doc, 'cost_as_per_lpr' ,flt(dir_mat_as_per_lpr + op_cost))
|
||||
set(self.doc, 'cost_as_per_sr' ,flt(dir_mat_as_per_sr + op_cost))
|
||||
|
||||
def update_childs_dir_op_value(self, m, child_bom_cost = 0):
|
||||
#msgprint("IN UPDATE CHILDS DIR OP VALUE")
|
||||
if child_bom_cost:
|
||||
# get recent direct material cost, operating cost, cost from child bom
|
||||
child_bom_cost = sql("select dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, operating_cost, cost_as_per_mar, cost_as_per_lpr, cost_as_per_sr, quantity from `tabBill Of Materials` where name = %s", m.bom_no, as_dict = 1)
|
||||
|
||||
# operating_cost
|
||||
m.operating_cost = child_bom_cost and flt(child_bom_cost[0]['operating_cost']) / flt(child_bom_cost[0]['quantity']) or 0.00
|
||||
|
||||
val_dir_dict = {'value_as_per_mar': 'cost_as_per_mar', 'dir_mat_as_per_mar': 'dir_mat_as_per_mar',
|
||||
'value_as_per_lpr': 'cost_as_per_lpr', 'dir_mat_as_per_lpr': 'dir_mat_as_per_lpr',
|
||||
'value_as_per_sr' : 'cost_as_per_sr' , 'dir_mat_as_per_sr' : 'dir_mat_as_per_sr' }
|
||||
for d in val_dir_dict:
|
||||
# Set Value and Dir MAt
|
||||
m.fields[d] = child_bom_cost and flt(child_bom_cost[0][val_dir_dict[d]])/flt(child_bom_cost[0]['quantity']) or 0.00
|
||||
|
||||
def update_mar_lpr_sr(self, m, mar = 0, lpr = 0, sr = 0):
|
||||
m.moving_avg_rate, m.last_purchase_rate, m.standard_rate = self.get_mar_lpr_sr(cstr(m.item_code), mar, lpr, sr, m.qty)
|
||||
|
||||
def calculate_amount(self, m, has_bom = 0, is_sub_cont = 0):
|
||||
#msgprint("IN CALCULATE AMOUNT")
|
||||
if has_bom :
|
||||
m.amount_as_per_mar = flt(m.qty) * (is_sub_cont and flt(m.moving_avg_rate) or flt(m.value_as_per_mar)) * flt(1.00 + (flt(m.scrap)/100)) or 0
|
||||
m.amount_as_per_lpr = flt(m.qty) * (is_sub_cont and (flt(m.value_as_per_lpr) + flt(m.last_purchase_rate)) or flt(m.value_as_per_lpr)) * flt(1.00 + (flt(m.scrap)/100)) or 0
|
||||
m.amount_as_per_sr = flt(m.qty) * (is_sub_cont and (flt(m.value_as_per_sr) + flt(m.standard_rate)) or flt(m.value_as_per_mar)) * flt(1.00 + (flt(m.scrap)/100)) or 0
|
||||
|
||||
else:
|
||||
m.amount_as_per_mar = flt(m.qty) * flt(m.moving_avg_rate) * flt(1.00 + (flt(m.scrap)/100)) or 0
|
||||
m.amount_as_per_lpr = flt(m.qty) * flt(m.last_purchase_rate) * flt(1.00 + (flt(m.scrap)/100)) or 0
|
||||
m.amount_as_per_sr = flt(m.qty) * flt(m.standard_rate) * flt(1.00 + (flt(m.scrap)/100)) or 0
|
||||
#msgprint(cstr(m.item_code))
|
||||
#msgprint("amount_as_per_mar < ==> " + cstr(m.amount_as_per_mar) + "***" + "amount_as_per_lpr < ==> " + cstr(m.amount_as_per_lpr) + "***" + "amount_as_per_sr < ==> " + cstr(m.amount_as_per_sr) + "***")
|
||||
def calculate_dir_mat(self, m, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, has_bom = 0, is_sub_cont =0):
|
||||
#msgprint("IN CALCULATE DIR MAT")
|
||||
if has_bom:
|
||||
dir_mat_as_per_mar += flt(m.qty) * (is_sub_cont and flt(m.moving_avg_rate) or flt(m.dir_mat_as_per_mar)) * flt(1.00 + (flt(m.scrap)/100)) or 0
|
||||
dir_mat_as_per_lpr += flt(m.qty) * (is_sub_cont and ( flt(m.dir_mat_as_per_lpr)+ flt(m.last_purchase_rate)) or flt(m.dir_mat_as_per_lpr)) * flt(1.00 + (flt(m.scrap)/100)) or 0
|
||||
dir_mat_as_per_sr += flt(m.qty) * (is_sub_cont and ( flt(m.dir_mat_as_per_sr)+ flt(m.standard_rate) ) or flt(m.dir_mat_as_per_sr)) * flt(1.00 + (flt(m.scrap)/100)) or 0
|
||||
else:
|
||||
dir_mat_as_per_mar += flt(m.amount_as_per_mar)
|
||||
dir_mat_as_per_lpr += flt(m.amount_as_per_lpr)
|
||||
dir_mat_as_per_sr += flt(m.amount_as_per_sr)
|
||||
#msgprint(cstr(m.item_code))
|
||||
#msgprint("dir_mat_as_per_mar < ==> " + cstr(dir_mat_as_per_mar) + "***" + "dir_mat_as_per_lpr < ==> " + cstr(dir_mat_as_per_lpr) + "***" + "dir_mat_as_per_sr < ==> " + cstr(dir_mat_as_per_sr) + "***")
|
||||
return dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr
|
||||
|
||||
|
||||
# Get FIFO Rate from Stack
|
||||
# -------------------------
|
||||
def get_fifo_rate(self, fcfs_bal, qty):
|
||||
if qty:
|
||||
fcfs_val = 0
|
||||
withdraw = flt(qty)
|
||||
while withdraw:
|
||||
if not fcfs_bal:
|
||||
break # nothing in store
|
||||
|
||||
batch = fcfs_bal[0]
|
||||
|
||||
if batch[0] < withdraw:
|
||||
# not enough in current batch, clear batch
|
||||
withdraw -= batch[0]
|
||||
fcfs_val += (flt(batch[0]) * flt(batch[1]))
|
||||
fcfs_bal.pop(0)
|
||||
else:
|
||||
# all from current batch
|
||||
fcfs_val += (flt(withdraw) * flt(batch[1]))
|
||||
batch[0] -= withdraw
|
||||
withdraw = 0
|
||||
fcfs_rate = flt(fcfs_val) / flt(qty)
|
||||
return fcfs_rate
|
||||
else:
|
||||
return fcfs_bal and fcfs_bal[0][1] or 0
|
||||
|
||||
|
||||
# Get valuation rate
|
||||
# --------------------
|
||||
def get_valuation_rate(self, item_code, qty):
|
||||
# get default warehouse
|
||||
warehouse = sql("select default_warehouse from tabItem where name = %s", item_code)
|
||||
warehouse = warehouse and warehouse[0][0] or ''
|
||||
in_rate = 0
|
||||
|
||||
# get default valuation method
|
||||
val_method = sql("select valuation_method from tabItem where name = %s", item_code)
|
||||
val_method = val_method and val_method[0][0] or ''
|
||||
if not val_method: val_method = get_defaults().has_key('valuation_method') and get_defaults()['valuation_method'] or 'FIFO'
|
||||
|
||||
if val_method == 'FIFO':
|
||||
if warehouse:
|
||||
bin_obj = get_obj('Warehouse',warehouse).get_bin(item_code)
|
||||
prev_sle = bin_obj.get_prev_sle('',nowdate(), (now().split(' ')[1])[:-3])
|
||||
fcfs_stack = prev_sle and (prev_sle[0][3] and eval(prev_sle[0][3]) or []) or []
|
||||
else:
|
||||
prev_sle = sql("select fcfs_stack from `tabStock Ledger Entry` where item_code = '%s' and posting_date <= '%s' order by posting_date DESC, posting_time DESC, name DESC limit 1" % (item_code, nowdate()))
|
||||
fcfs_stack = prev_sle and (prev_sle[0][0] and eval(prev_sle[0][0]) or []) or []
|
||||
in_rate = fcfs_stack and self.get_fifo_rate(fcfs_stack, qty) or 0
|
||||
elif val_method == 'Moving Average':
|
||||
in_rate = sql("select ifnull(sum(valuation_rate), 0)/ ifnull(count(*),1) from `tabBin` where item_code = '%s' and ifnull(ma_rate, 0) > 0" % cstr(item_code))
|
||||
in_rate = in_rate and flt(in_rate[0][0]) or 0
|
||||
return in_rate
|
||||
|
||||
|
||||
# Get valuation, Last Purchase and Standard Rate
|
||||
# ------------------------------------------------
|
||||
def get_mar_lpr_sr(self, item_code, mar = 0, lpr = 0, sr = 0, qty = 1.00):
|
||||
# get list of warehouse having
|
||||
ma_rate, lpr_rate, sr_rate = 0,0,0
|
||||
if mar:
|
||||
# get recent moving average rate
|
||||
#ma_rate = sql("select ifnull(sum(ma_rate), 0)/ ifnull(count(*),1) from `tabBin` where item_code = '%s' and ifnull(ma_rate, 0) > 0" % cstr(item_code))
|
||||
#ma_rate = flt(ma_rate and ma_rate[0][0]) or 0
|
||||
ma_rate = self.get_valuation_rate(item_code, qty)
|
||||
|
||||
# get recent last purchase rate
|
||||
lpr_rate = lpr and flt(sql("select last_purchase_rate from `tabItem` where name = '%s'" % item_code)[0][0]) or 0.00
|
||||
# get recent standard rate
|
||||
sr_rate = sr and flt(sql("select standard_rate from `tabItem` where name = '%s'" % item_code)[0][0]) or 0.00
|
||||
return ma_rate, lpr_rate, sr_rate
|
||||
|
||||
#checking for duplicate items i.e items that may be entered twice
|
||||
def validate_duplicate_items(self):
|
||||
check_list = []
|
||||
for d in getlist(self.doclist, 'bom_materials'):
|
||||
if cstr(d.item_code) in check_list:
|
||||
msgprint("Item %s has been entered twice. In BOM %s" % (d.item_code, self.doc.name))
|
||||
raise Exception
|
||||
else:
|
||||
check_list.append(cstr(d.item_code))
|
||||
|
||||
#----- Document on Save function------
|
||||
def validate(self):
|
||||
#msgprint(len(getlist(self.doclist, 'bom_materials')))
|
||||
self.validate_main_item()
|
||||
self.validate_duplicate_items()
|
||||
self.calculate_cost(validate = 1)
|
||||
|
||||
def check_recursion(self):
|
||||
check_list = [['parent', 'bom_no', 'parent'], ['bom_no', 'parent', 'child']]
|
||||
for d in check_list:
|
||||
bom_list, count = [self.doc.name], 0
|
||||
while ( len(bom_list) > count ):
|
||||
boms = sql(" select %s from `tabBOM Material` where %s = '%s' " % ( d[0], d[1], cstr(bom_list[count])))
|
||||
count = count + 1
|
||||
for b in boms:
|
||||
if b[0] == self.doc.name:
|
||||
msgprint("Recursion Occured:=> '%s' cannot be '%s' of '%s'." % ( cstr(b), cstr(d[2]), cstr(self.doc.name)))
|
||||
raise Exception
|
||||
if b[0]:
|
||||
bom_list.append(b[0])
|
||||
|
||||
def on_update(self):
|
||||
if self.doc.item != cstr(self.doc.name.split('/')[1]):
|
||||
msgprint("Cannot change Item once the Bill Of Material is created.")
|
||||
raise Exception
|
||||
self.check_recursion()
|
||||
|
||||
|
||||
# ********************************************** Submit *************************************************************
|
||||
|
||||
# Add Flat BOM Details
|
||||
# -----------------------
|
||||
def add_to_flat_bom_detail(self, is_submit = 0):
|
||||
self.doc.clear_table(self.doclist, 'flat_bom_details', 1)
|
||||
fb_lbl = {'item_code': 0, 'description': 1, 'qty': 2, 'stock_uom': 3, 'moving_avg_rate': 4,'amount_as_per_mar': 5, 'last_purchase_rate': 6, 'amount_as_per_lpr':7,'standard_rate':8,'amount_as_per_sr':9,'qty_consumed_per_unit': 10, 'parent_bom': 11, 'bom_mat_no': 12, 'is_pro_applicable': 13}
|
||||
for d in self.cur_flat_bom_items:
|
||||
fb_child = addchild(self.doc, 'flat_bom_details', 'Flat BOM Detail', 1, self.doclist)
|
||||
for i in fb_lbl:
|
||||
fb_child.fields[i] = d[fb_lbl[i]]
|
||||
fb_child.docstatus = is_submit
|
||||
fb_child.save(1)
|
||||
self.doc.save()
|
||||
|
||||
|
||||
#Get Child Flat BOM Items
|
||||
#----------------------------------------
|
||||
def get_child_flat_bom_items(self, item, d):
|
||||
|
||||
child_flat_bom_items=[]
|
||||
if item and (item[0]['is_sub_contracted_item'] == 'Yes' or item[0]['is_pro_applicable'] == 'Yes'):
|
||||
|
||||
child_flat_bom_items = sql("select item_code, description, qty_consumed_per_unit, stock_uom, moving_avg_rate, last_purchase_rate, standard_rate, '%s' as parent_bom, bom_mat_no, 'No' as is_pro_applicable from `tabFlat BOM Detail` where parent = '%s' and is_pro_applicable = 'No' and docstatus = 1" % ( d.bom_no, cstr(d.bom_no)))
|
||||
self.cur_flat_bom_items.append([d.item_code, d.description, flt(d.qty), d.stock_uom, flt(d.moving_avg_rate), flt(d.amount_as_per_mar), flt(d.last_purchase_rate), flt(d.amount_as_per_lpr), flt(d.standard_rate), flt(d.amount_as_per_sr), flt(d.qty_consumed_per_unit), (item[0]['is_sub_contracted_item'] == 'Yes') and d.parent or d.bom_no, d.name, (item[0]['is_sub_contracted_item'] == 'Yes') and 'No' or 'Yes'])
|
||||
|
||||
else:
|
||||
child_flat_bom_items = sql("select item_code, description, qty_consumed_per_unit, stock_uom, moving_avg_rate, last_purchase_rate, standard_rate, if(parent_bom = '%s', '%s', parent_bom) as parent_bom, bom_mat_no, is_pro_applicable from `tabFlat BOM Detail` where parent = '%s' and docstatus = 1" % ( d.bom_no, d.parent, cstr(d.bom_no)))
|
||||
|
||||
if not child_flat_bom_items:
|
||||
msgprint("Please Submit Child BOM := %s first." % cstr(d.bom_no))
|
||||
raise Exception
|
||||
else:
|
||||
return child_flat_bom_items
|
||||
|
||||
|
||||
# Get Current Flat BOM Items
|
||||
# -----------------------------
|
||||
def get_current_flat_bom_items(self):
|
||||
|
||||
self.cur_flat_bom_items = []
|
||||
|
||||
cfb_lbl = {'item_code': 0, 'description': 1, 'qty_consumed_per_unit': 2, 'stock_uom': 3, 'moving_avg_rate': 4, 'last_purchase_rate': 5, 'standard_rate': 6, 'parent_bom': 7, 'bom_mat_no': 8, 'is_pro_applicable': 9}
|
||||
|
||||
for d in getlist(self.doclist, 'bom_materials'):
|
||||
|
||||
if d.bom_no:
|
||||
item = sql("select is_sub_contracted_item, is_pro_applicable from `tabItem` where name = '%s'" % d.item_code, as_dict = 1)
|
||||
child_flat_bom_items = self.get_child_flat_bom_items(item,d)
|
||||
|
||||
for c in child_flat_bom_items:
|
||||
self.cur_flat_bom_items.append([c[cfb_lbl['item_code']], c[cfb_lbl['description']], flt(d.qty) * flt(c[cfb_lbl['qty_consumed_per_unit']]), c[cfb_lbl['stock_uom']], flt(c[cfb_lbl['moving_avg_rate']]), flt(d.qty) * flt(c[cfb_lbl['qty_consumed_per_unit']]) * flt(c[cfb_lbl['moving_avg_rate']]) ,flt(c[cfb_lbl['last_purchase_rate']]), flt(d.qty) * flt(c[cfb_lbl['qty_consumed_per_unit']]) * flt(c[cfb_lbl['last_purchase_rate']]), flt(c[cfb_lbl['standard_rate']]), flt(d.qty) * flt(c[cfb_lbl['qty_consumed_per_unit']]) * flt(c[cfb_lbl['standard_rate']]), flt(d.qty_consumed_per_unit) * flt(c[cfb_lbl['qty_consumed_per_unit']]), c[cfb_lbl['parent_bom']], c[cfb_lbl['bom_mat_no']], c[cfb_lbl['is_pro_applicable']]])
|
||||
else:
|
||||
# add purchase_items from bom material to the child_flat_bom_items
|
||||
self.cur_flat_bom_items.append([d.item_code, d.description, flt(d.qty), d.stock_uom, flt(d.moving_avg_rate), flt(d.amount_as_per_mar), flt(d.last_purchase_rate), flt(d.amount_as_per_lpr), flt(d.standard_rate), flt(d.amount_as_per_sr), flt(d.qty_consumed_per_unit), d.parent, d.name, 'No' ])
|
||||
|
||||
# Update Flat BOM Engine
|
||||
# ------------------------
|
||||
def update_flat_bom_engine(self, is_submit = 0):
|
||||
# following will be correct data
|
||||
# get correct / updated flat bom data
|
||||
self.get_current_flat_bom_items()
|
||||
# insert to curr flat bom data
|
||||
self.add_to_flat_bom_detail(is_submit)
|
||||
|
||||
|
||||
# On Submit
|
||||
# -----------
|
||||
def on_submit(self):
|
||||
self.update_flat_bom_engine(1)
|
||||
|
||||
|
||||
def get_parent_bom_list(self, bom_no):
|
||||
p_bom = sql("select parent from `tabBOM Material` where bom_no = '%s'" % bom_no)
|
||||
return p_bom and [i[0] for i in p_bom] or []
|
||||
@@ -1,533 +0,0 @@
|
||||
# DocType, Bill Of Materials
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:52',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-20 17:27:58',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1309508837',
|
||||
'allow_attach': 0,
|
||||
'allow_copy': 0,
|
||||
'allow_email': 0,
|
||||
'allow_print': 0,
|
||||
'allow_rename': 0,
|
||||
'allow_trash': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'hide_heading': 0,
|
||||
'hide_toolbar': 0,
|
||||
'in_create': 0,
|
||||
'issingle': 0,
|
||||
'istable': 0,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'read_only': 0,
|
||||
'search_fields': 'item',
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': '%(item)s',
|
||||
'version': 170
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Bill Of Materials',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Bill Of Materials',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Bill Of Materials
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Bill Of Materials'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'role': 'System Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 0,
|
||||
'role': 'Production Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 1,
|
||||
'role': 'Production Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 0,
|
||||
'role': 'Production User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 1,
|
||||
'role': 'Production User'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 1,
|
||||
'label': 'Trash Reason',
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 2,
|
||||
'label': 'TreeView1',
|
||||
'oldfieldtype': 'HTML',
|
||||
'options': '<div style=\'border: 1px solid #CCF; padding: 8px;margin-bottom: 8px;\'><div class=\'link_type\' onclick=\'loadpage("Bill of Materials"); \'>Go To BOM Tree View</div></div>',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 3,
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 4,
|
||||
'label': 'Set as Default BOM',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 5,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'hidden': 1,
|
||||
'idx': 6,
|
||||
'label': 'Activate BOM',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'hidden': 1,
|
||||
'idx': 7,
|
||||
'label': 'Inactivate BOM',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 8,
|
||||
'label': 'Details',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select the item code for which Bill of Material is being created',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 9,
|
||||
'in_filter': 1,
|
||||
'label': 'Item',
|
||||
'oldfieldname': 'item',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 10,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Total quantity of items for which raw materials required and operations done will be defined',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'quantity',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 11,
|
||||
'label': 'Quantity',
|
||||
'oldfieldname': 'quantity',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_active',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 12,
|
||||
'label': 'Is Active',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'is_active',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nYes\nNo',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_default',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 13,
|
||||
'label': 'Is Default',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'is_default',
|
||||
'oldfieldtype': 'Check',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'Select name of the project if Bill Of Materials need to be created against any project',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'project_name',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 14,
|
||||
'in_filter': 1,
|
||||
'label': 'Project Name',
|
||||
'oldfieldname': 'project_name',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Project',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 15,
|
||||
'label': 'Operations',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Specify the operations performed and give a unique Operation no to your operations. Select the workstation which is nothing but machinery where this operation would be performed on raw materials. Hour rate will be fetched from the Workstation master. Operation time will be entered manually. Operating cost will be calculated once the Bill of Material is saved.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bom_operations',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 16,
|
||||
'label': 'BOM Operations',
|
||||
'oldfieldname': 'bom_operations',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'BOM Operation',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 17,
|
||||
'label': 'Materials',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Enter the raw materials required to manufacture the BOM item. Specify the operation no as entered in the previous tab which will be performed on the raw materials entered.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bom_materials',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 18,
|
||||
'label': 'BOM Material',
|
||||
'oldfieldname': 'bom_materials',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'BOM Material',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 19,
|
||||
'label': 'Costing',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'remarks',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 20,
|
||||
'label': 'Remarks',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'remarks',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cost_as_per_mar',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 21,
|
||||
'label': 'Cost As Per Valuation Rate',
|
||||
'oldfieldname': 'cost_as_per_mar',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cost_as_per_lpr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 22,
|
||||
'label': 'Cost As Per LPR',
|
||||
'oldfieldname': 'cost_as_per_lpr',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cost_as_per_sr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 23,
|
||||
'label': 'Cost As Per SR',
|
||||
'oldfieldname': 'cost_as_per_sr',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cost_as_on',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 24,
|
||||
'label': 'Cost as on',
|
||||
'oldfieldname': 'cost_as_on',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'dir_mat_as_per_mar',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 25,
|
||||
'label': 'Direct Material As Per Valuation',
|
||||
'oldfieldname': 'dir_mat_as_per_mar',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'dir_mat_as_per_lpr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 26,
|
||||
'label': 'Direct Material As Per LPR',
|
||||
'oldfieldname': 'dir_mat_as_per_lpr',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'dir_mat_as_per_sr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 27,
|
||||
'label': 'Direct Material As Per SR',
|
||||
'oldfieldname': 'dir_mat_as_per_sr',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'operating_cost',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 28,
|
||||
'label': 'Operating Cost',
|
||||
'oldfieldname': 'operating_cost',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'maintained_by',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 29,
|
||||
'label': 'Maintained By',
|
||||
'oldfieldname': 'maintained_by',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'hidden': 1,
|
||||
'idx': 30,
|
||||
'label': 'BOM Report',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'hidden': 0,
|
||||
'idx': 31,
|
||||
'label': 'Flat BOM',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'No Toolbar',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'flat_bom_details',
|
||||
'fieldtype': 'Table',
|
||||
'hidden': 0,
|
||||
'idx': 32,
|
||||
'label': 'Flat BOM Detail',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'flat_bom_details',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Flat BOM Detail',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
||||
@@ -1,102 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cint, flt
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def get_item_group(self):
|
||||
ret = sql("select name from `tabItem Group` ")
|
||||
item_group = []
|
||||
for r in ret:
|
||||
item =sql("select t1.name from `tabItem` t1, `tabBill Of Materials` t2 where t2.item = t1.name and t1.item_group = '%s' " % (r[0]))
|
||||
if item and item[0][0]:
|
||||
item_group.append(r[0])
|
||||
return '~~~'.join([r for r in item_group])
|
||||
|
||||
def get_item_code(self,item_group):
|
||||
# here Bill Of Materials docstatus = 1 and is_active ='yes' condition is not given because some bom is under construction
|
||||
# that is it is still in saved mode and they want see till where they have reach.
|
||||
ret = sql("select distinct t1.name from `tabItem` t1, `tabBill Of Materials` t2 where t2.item = t1.name and t1.item_group = '%s' " % (item_group))
|
||||
return '~~~'.join([r[0] for r in ret])
|
||||
|
||||
def get_bom_no(self,item_code):
|
||||
ret = sql("select name from `tabBill Of Materials` where item = '%s' " % (item_code))
|
||||
return '~~~'.join([r[0] for r in ret])
|
||||
|
||||
def get_operations(self,bom_no):
|
||||
# reply = [ 'Operation',operation_no, opn_description,BOM NO , workstation, hour_rate, time_in_minutes, Total Direct Material, Total Operating Cost, Cost]
|
||||
# reply = [ 0 , 1 , 2 ,3 , 4 , 5 , 6 , 7 , 8 ,9 , 10 , 11 ]
|
||||
ret = sql("select operation_no,opn_description,workstation,hour_rate,time_in_mins from `tabBOM Operation` where parent = %s", bom_no, as_dict = 1)
|
||||
cost = sql("select dir_mat_as_per_mar , operating_cost , cost_as_per_mar from `tabBill Of Materials` where name = %s", bom_no, as_dict = 1)
|
||||
|
||||
# Validate the BOM ENTRIES
|
||||
#check = get_obj('Bill Of Materials', bom_no, with_children =1).validate()
|
||||
reply = []
|
||||
|
||||
if ret:
|
||||
for r in ret:
|
||||
reply.append(['operation',cint(r['operation_no']), r['opn_description'] or '','%s'% bom_no,r['workstation'],flt(r['hour_rate']),flt(r['time_in_mins']),0,0,0])
|
||||
|
||||
reply[0][7]= flt(cost[0]['dir_mat_as_per_mar'])
|
||||
reply[0][8]=flt(cost[0]['operating_cost'])
|
||||
reply[0][9]=flt(cost[0]['cost_as_per_mar'])
|
||||
return reply
|
||||
|
||||
def get_item_bom(self,data):
|
||||
# reply = ['item_bom',item_code,description, BOM NO , qty, uom , scrap ,m_avg_r or value, 1 or 0]
|
||||
# reply = [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ]
|
||||
data = eval(data)
|
||||
reply = []
|
||||
ret = sql("select item_code,description,bom_no,qty,scrap,stock_uom,value_as_per_mar,moving_avg_rate from `tabBOM Material` where parent = '%s' and operation_no = '%s'" % (data['bom_no'],data['op_no']), as_dict =1 )
|
||||
|
||||
for r in ret:
|
||||
item = sql("select is_manufactured_item, is_sub_contracted_item from `tabItem` where name = '%s'" % r['item_code'], as_dict=1)
|
||||
if not item[0]['is_manufactured_item'] == 'Yes' and not item[0]['is_sub_contracted_item'] =='Yes':
|
||||
#msgprint("IS_PURCHASE")
|
||||
#if item is not manufactured or it is not sub-contracted
|
||||
reply.append([ 'item_bom', r['item_code'] or '', r['description'] or '', r['bom_no'] or '', flt(r['qty']) or 0, r['stock_uom'] or '', flt(r['scrap']) or 0, flt(r['moving_avg_rate']) or 0, 1])
|
||||
else:
|
||||
#msgprint("IS_NOT_PURCHASE")
|
||||
# if it is manufactured or sub_contracted this will be considered(here item can be purchase item)
|
||||
reply.append([ 'item_bom', r['item_code'] or '', r['description'] or '', r['bom_no'] or '', flt(r['qty']) or 0, r['stock_uom'] or '', flt(r['scrap']) or 0, flt(r['value_as_per_mar']) or 0, 0])
|
||||
return reply
|
||||
|
||||
|
||||
#------------- Wrapper Code --------------
|
||||
# BOM TREE
|
||||
def calculate_cost( self, bom_no):
|
||||
main_bom_list = get_obj(dt = 'Production Control').traverse_bom_tree( bom_no = bom_no, qty = 1, calculate_cost = 1)
|
||||
main_bom_list.reverse()
|
||||
for bom in main_bom_list:
|
||||
bom_obj = get_obj('Bill Of Materials', bom, with_children = 1)
|
||||
bom_obj.calculate_cost(validate = 0)
|
||||
bom_obj.doc.save()
|
||||
return 'calculated'
|
||||
|
||||
|
||||
def get_bom_tree_list(self,args):
|
||||
arg = eval(args)
|
||||
i =[]
|
||||
for a in sql("select t1.name from `tabBill Of Materials` t1, `tabItem` t2 where t2.item_group like '%s' and t1.item like '%s'"%(arg['item_group'] +'%',arg['item_code'] + '%')):
|
||||
if a[0] not in i:
|
||||
i.append(a[0])
|
||||
return i
|
||||
# return [s[0] for s in sql("select t1.name from `tabBill Of Materials` t1, `tabItem` t2 where t2.item_group like '%s' and t1.item like '%s' " %(arg['item_group']+'%',arg['item_code'+'%'])]
|
||||
@@ -1,31 +0,0 @@
|
||||
# DocType, BOM Control
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:53',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-23 11:22:14',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 107
|
||||
},
|
||||
|
||||
# DocType, BOM Control
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'BOM Control'
|
||||
}
|
||||
]
|
||||
@@ -1,339 +0,0 @@
|
||||
# DocType, BOM Material
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:53',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 22
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'BOM Material',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'BOM Material',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocType, BOM Material
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'BOM Material'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'operation_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'label': 'Operation No',
|
||||
'oldfieldname': 'operation_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 2,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bom_no',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'in_filter': 1,
|
||||
'label': 'BOM No',
|
||||
'oldfieldname': 'bom_no',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Bill Of Materials',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 4,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 1,
|
||||
'reqd': 0,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'scrap',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 6,
|
||||
'label': 'Scrap %',
|
||||
'oldfieldname': 'scrap',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'dir_mat_as_per_mar',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Direct Material As Per Valuation Rate',
|
||||
'oldfieldname': 'dir_mat_as_per_mar',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Qty',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'dir_mat_as_per_lpr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Direct Material As Per LPR',
|
||||
'oldfieldname': 'dir_mat_as_per_lpr',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'dir_mat_as_per_sr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 10,
|
||||
'label': 'Direct Material As Per SR',
|
||||
'oldfieldname': 'dir_mat_as_per_sr',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'operating_cost',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 11,
|
||||
'label': 'Operating Cost',
|
||||
'oldfieldname': 'operating_cost',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 12,
|
||||
'label': 'Stock UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'value_as_per_mar',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 12,
|
||||
'label': 'Value As Per Valuation Rate',
|
||||
'oldfieldname': 'value_as_per_mar',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'value_as_per_lpr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 13,
|
||||
'label': 'Value As Per LPR',
|
||||
'oldfieldname': 'value_as_per_lpr',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'value_as_per_sr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 14,
|
||||
'label': 'Value As Per SR',
|
||||
'oldfieldname': 'value_as_per_sr',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'moving_avg_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 15,
|
||||
'label': 'Valuation Rate',
|
||||
'oldfieldname': 'moving_avg_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount_as_per_mar',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 16,
|
||||
'label': 'Amount As Per Valuation Rate',
|
||||
'oldfieldname': 'amount_as_per_mar',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'last_purchase_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 17,
|
||||
'label': 'Last Purchase Rate',
|
||||
'oldfieldname': 'last_purchase_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount_as_per_lpr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 18,
|
||||
'label': 'Amount As Per LPR',
|
||||
'oldfieldname': 'amount_as_per_lpr',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'standard_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 19,
|
||||
'label': 'Standard Rate',
|
||||
'oldfieldname': 'standard_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount_as_per_sr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 20,
|
||||
'label': 'Amount As Per SR',
|
||||
'oldfieldname': 'amount_as_per_sr',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty_consumed_per_unit',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 21,
|
||||
'label': 'Qty Consumed Per Unit',
|
||||
'oldfieldname': 'qty_consumed_per_unit',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
@@ -1,173 +0,0 @@
|
||||
# DocType, BOM Operation
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:53',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 6
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'BOM Operation',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'BOM Operation',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocType, BOM Operation
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'BOM Operation'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'operation_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'label': 'Operation No',
|
||||
'oldfieldname': 'operation_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'opn_description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 2,
|
||||
'label': 'Opn Description',
|
||||
'oldfieldname': 'opn_description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'details',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'label': 'Details',
|
||||
'oldfieldname': 'details',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'workstation',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 4,
|
||||
'label': 'Workstation',
|
||||
'oldfieldname': 'workstation',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Workstation',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'hour_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 5,
|
||||
'label': 'Hour Rate',
|
||||
'oldfieldname': 'hour_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'workstation_capacity',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 1,
|
||||
'idx': 6,
|
||||
'label': 'Workstation Capacity',
|
||||
'oldfieldname': 'workstation_capacity',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'time_in_mins',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Operation Time (mins)',
|
||||
'oldfieldname': 'time_in_mins',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'operating_cost',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Operating Cost',
|
||||
'oldfieldname': 'operating_cost',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'reqd': 0
|
||||
}
|
||||
]
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
// Get Query functions
|
||||
cur_frm.fields_dict['s_bom'].get_query = function(doc) {
|
||||
return 'SELECT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`docstatus` = 1 AND `tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` DESC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['r_bom'].get_query = function(doc) {
|
||||
return 'SELECT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`docstatus` = 1 and `tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` DESC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['s_item'].get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.name FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND (`tabItem`.is_purchase_item = "Yes" OR`tabItem`.is_sub_contracted_item = "Yes") AND tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.item_code LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['r_item'].get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.name FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND (`tabItem`.is_purchase_item = "Yes" OR`tabItem`.is_sub_contracted_item = "Yes") AND tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.item_code LIMIT 50';
|
||||
}
|
||||
|
||||
// Client Triggers
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def search_parent_bom_of_bom(self):
|
||||
pbom = sql("select parent from `tabBOM Material` where bom_no = '%s' and docstatus = 1 " % self.doc.s_bom )
|
||||
self.doc.clear_table(self.doclist,'replace_bom_details', 1)
|
||||
self.add_to_replace_bom_utility_detail(pbom, 'replace_bom_details')
|
||||
|
||||
def search_parent_bom_of_item(self):
|
||||
pbom = sql("select parent from `tabBOM Material` where item_code = '%s' and (bom_no is NULL or bom_no = '') and docstatus =1" % self.doc.s_item )
|
||||
self.doc.clear_table(self.doclist,'replace_item_details', 1)
|
||||
self.add_to_replace_bom_utility_detail(pbom, 'replace_item_details')
|
||||
|
||||
def add_to_replace_bom_utility_detail(self, pbom, t_fname):
|
||||
for d in pbom:
|
||||
br_child = addchild( self.doc, t_fname, 'BOM Replace Utility Detail', 0,self.doclist)
|
||||
br_child.parent_bom = d[0]
|
||||
br_child.save()
|
||||
self.doc.save()
|
||||
|
||||
def replace_bom(self):
|
||||
# validate r_bom
|
||||
bom = sql("select name, is_active, docstatus from `tabBill Of Materials` where name = %s",self.doc.r_bom, as_dict =1)
|
||||
if not bom:
|
||||
msgprint("Please Enter Valid BOM to replace with.")
|
||||
raise Exception
|
||||
if bom and bom[0]['is_active'] != 'Yes':
|
||||
msgprint("BOM '%s' is not Active BOM." % cstr(self.doc.r_bom))
|
||||
raise Exception
|
||||
if bom and flt(bom[0]['docstatus']) != 1:
|
||||
msgprint("BOM '%s' is not Submitted BOM." % cstr(self.doc.r_bom))
|
||||
raise Exception
|
||||
|
||||
# get item code of r_bom
|
||||
item_code = cstr(sql("select item from `tabBill Of Materials` where name = '%s' " % self.doc.r_bom)[0][0])
|
||||
# call replace bom engine
|
||||
self.replace_bom_engine('replace_bom_details', 'bom_no', self.doc.s_bom, self.doc.r_bom, item_code)
|
||||
|
||||
def replace_item(self):
|
||||
item = sql("select name, is_active from `tabItem` where name = %s", self.doc.r_item, as_dict = 1)
|
||||
if not item:
|
||||
msgprint("Please enter Valid Item Code to replace with.")
|
||||
raise Exception
|
||||
if item and item[0]['is_active'] != 'Yes':
|
||||
msgprint("Item Code '%s' is not Active Item." % cstr(self.doc.r_item))
|
||||
raise Exception
|
||||
self.replace_bom_engine('replace_item_details', 'item_code', self.doc.s_item, self.doc.r_item)
|
||||
|
||||
def replace_data_in_bom_materials(self, dl, fname, s_data, r_data, item_code =''):
|
||||
for d in getlist(dl, 'bom_materials'):
|
||||
if d.fields[fname] == s_data:
|
||||
d.fields[fname] = r_data
|
||||
if fname == 'bom_no':
|
||||
d.item_code = item_code
|
||||
d.save()
|
||||
|
||||
def replace_bom_engine(self, t_fname, fname, s_data, r_data, item_code = ''):
|
||||
if not r_data:
|
||||
msgprint("Please Enter '%s' and then click on '%s'." % ((t_fname == 'replace_bom_details') and 'BOM to Replace' or 'Item to Replace',(t_fname == 'replace_bom_details') and 'Replace BOM' or 'Replace Item' ))
|
||||
raise Exception
|
||||
|
||||
for d in getlist(self.doclist, t_fname):
|
||||
if d.bom_created:
|
||||
msgprint("Please click on '%s' and then on '%s'." % ((t_fname == 'replace_bom_details') and 'Search BOM' or 'Search Item',(t_fname == 'replace_bom_details') and 'Replace BOM' or 'Replace Item' ))
|
||||
raise Exception
|
||||
|
||||
if d.replace:
|
||||
# copy_doclist is the framework funcn which create duplicate document and returns doclist of new document
|
||||
# Reinder :=
|
||||
# make copy
|
||||
if self.doc.create_new_bom:
|
||||
import webnotes.model.doc
|
||||
new_bom_dl = copy_doclist(webnotes.model.doc.get('Bill Of Materials', d.parent_bom), no_copy = ['is_active', 'is_default', 'is_sub_assembly', 'remarks', 'flat_bom_details'])
|
||||
|
||||
new_bom_dl[0].docstatus = 0
|
||||
new_bom_dl[0].save()
|
||||
else:
|
||||
new_bom_dl = get_obj('Bill Of Materials', d.parent_bom, with_children = 1).doclist
|
||||
|
||||
# replace s_data with r_data in Bom Material Detail Table
|
||||
self.replace_data_in_bom_materials(new_bom_dl, fname, s_data, r_data, item_code)
|
||||
|
||||
d.bom_created = new_bom_dl[0].name
|
||||
d.save()
|
||||
|
||||
def update_docstatus(self):
|
||||
sql("update `tabBill Of Materials` set docstatus = 0 where name = '%s' limit 1" % self.doc.bom)
|
||||
msgprint("Updated")
|
||||
|
||||
def update_bom(self):
|
||||
self.check_bom_list = []
|
||||
main_bom_list = get_obj('Production Control').traverse_bom_tree(self.doc.fg_bom_no, 1)
|
||||
main_bom_list.reverse()
|
||||
# run calculate cost and get
|
||||
#msgprint(main_bom_list)
|
||||
for bom in main_bom_list:
|
||||
if bom and bom not in self.check_bom_list:
|
||||
bom_obj = get_obj('Bill Of Materials', bom, with_children = 1)
|
||||
#print(bom_obj.doc.fields)
|
||||
bom_obj.validate()
|
||||
bom_obj.doc.docstatus = 1
|
||||
bom_obj.check_recursion()
|
||||
bom_obj.update_flat_bom_engine(is_submit = 1)
|
||||
bom_obj.doc.docstatus = 1
|
||||
bom_obj.doc.save()
|
||||
self.check_bom_list.append(bom)
|
||||
@@ -1,398 +0,0 @@
|
||||
# DocType, BOM Replace Utility
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:53',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tray',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 1,
|
||||
'version': 56
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'BOM Replace Utility',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'BOM Replace Utility',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, BOM Replace Utility
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'BOM Replace Utility'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'role': 'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 0,
|
||||
'role': 'Production User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 1,
|
||||
'role': 'Production User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 0,
|
||||
'role': 'Production Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 1,
|
||||
'role': 'Production Manager'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'create_new_bom',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 1,
|
||||
'label': 'Create New BOM'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 2,
|
||||
'label': 'BOM Details'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select the relevant BOM to be replaced which is actually a raw material used for a parent BOM.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 's_bom',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'Select BOM',
|
||||
'options': 'Bill Of Materials',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 4,
|
||||
'label': 'Note 1',
|
||||
'options': 'Click on the button "Search BOM" to fetch in the table below all the parent BOMs in which the above selected BOM is used as a raw material.'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 5
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 6,
|
||||
'label': 'Search BOM',
|
||||
'options': 'search_parent_bom_of_bom'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 7,
|
||||
'options': 'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select the BOM by which you want the above sected BOM to be replaced.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'r_bom',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 8,
|
||||
'label': 'Replace Bom with',
|
||||
'options': 'Bill Of Materials',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 9,
|
||||
'label': 'Note 2',
|
||||
'options': 'Click on the button "Replace BOM" after checking under the column Replace against relevant Parent BOMs'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 10
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 11,
|
||||
'label': 'Replace BOM',
|
||||
'options': 'replace_bom'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 12,
|
||||
'options': 'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'replace_bom_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 13,
|
||||
'label': 'Replace BOM Detail',
|
||||
'options': 'BOM Replace Utility Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 14,
|
||||
'label': 'Item Details'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select the relevant item to be replaced which is actually a raw material used for a parent BOM.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 's_item',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 15,
|
||||
'label': 'Select Item',
|
||||
'options': 'Item',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 16,
|
||||
'label': 'Note 3',
|
||||
'options': 'Click on the button "Search Item" to fetch in the table below all the parent BOMs in which the above selected item is used as a raw material.'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 17
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 18,
|
||||
'label': 'Search Item',
|
||||
'options': 'search_parent_bom_of_item'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 19,
|
||||
'options': 'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select the item by which you want the above sected item to be replaced.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'r_item',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 20,
|
||||
'label': 'Replace Item with',
|
||||
'options': 'Item',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 21,
|
||||
'label': 'Note 4',
|
||||
'options': 'Click on the button "Replace Item" after checking under the column Replace against relevant Parent BOMs'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 22
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 23,
|
||||
'label': 'Replace Item',
|
||||
'options': 'replace_item'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 24,
|
||||
'options': 'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'replace_item_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 25,
|
||||
'label': 'Replace Item Detail',
|
||||
'options': 'BOM Replace Utility Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 26,
|
||||
'label': 'Update BOM Tree'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select the root Bill of Materials in which raw materials are replaced and click on the button below to update costs.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fg_bom_no',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 27,
|
||||
'label': 'FG BOM No',
|
||||
'options': 'Bill Of Materials'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 28,
|
||||
'label': 'Update',
|
||||
'options': 'update_bom'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 29,
|
||||
'label': 'Update BOM'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bom',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 30,
|
||||
'label': 'BOM',
|
||||
'options': 'Bill Of Materials'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 31,
|
||||
'label': 'Update Docstatus',
|
||||
'options': 'update_docstatus'
|
||||
}
|
||||
]
|
||||
@@ -1,105 +0,0 @@
|
||||
# DocType, BOM Replace Utility Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:53',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'BRUD/.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'hide_toolbar': 1,
|
||||
'in_create': 1,
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'read_only': 1,
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 8
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'BOM Replace Utility Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'name': '__common__',
|
||||
'parent': 'BOM Replace Utility Detail',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, BOM Replace Utility Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'BOM Replace Utility Detail'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'parent_bom',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'label': 'Parent BOM',
|
||||
'oldfieldname': 'parent_bom',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Bill Of Materials',
|
||||
'permlevel': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'replace',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 2,
|
||||
'label': 'Replace',
|
||||
'oldfieldname': 'replace',
|
||||
'oldfieldtype': 'Check',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bom_created',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'BOM Created',
|
||||
'oldfieldname': 'bom_created',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Bill Of Materials',
|
||||
'permlevel': 1,
|
||||
'search_index': 0
|
||||
}
|
||||
]
|
||||
@@ -1,161 +0,0 @@
|
||||
# DocType, BOM Report Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:53',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 8
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'BOM Report Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'BOM Report Detail',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocType, BOM Report Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'BOM Report Detail'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 2,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 1,
|
||||
'reqd': 0,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'moving_avg_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 5,
|
||||
'label': 'Moving Avg Rate',
|
||||
'oldfieldname': 'moving_avg_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 6,
|
||||
'label': 'Amount',
|
||||
'oldfieldname': 'amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'last_purchase_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Last Purchase Rate',
|
||||
'oldfieldname': 'last_purchase_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 9,
|
||||
'label': 'Qty',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 12,
|
||||
'label': 'Stock UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'reqd': 0
|
||||
}
|
||||
]
|
||||
@@ -1,217 +0,0 @@
|
||||
# DocType, Flat BOM Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:02',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'FBD/.######',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'read_only': 0,
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 15
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Flat BOM Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, Flat BOM Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Flat BOM Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 2,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'moving_avg_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 5,
|
||||
'label': 'Valuation Rate',
|
||||
'oldfieldname': 'moving_avg_rate',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount_as_per_mar',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 6,
|
||||
'label': 'Amount As Per Valuation Rate',
|
||||
'oldfieldname': 'amount_as_per_mar',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'last_purchase_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Last Purchase Rate',
|
||||
'oldfieldname': 'last_purchase_rate',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount_as_per_lpr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Amount As Per LPR',
|
||||
'oldfieldname': 'amount_as_per_lpr',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Qty',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'standard_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Standard Rate',
|
||||
'oldfieldname': 'standard_rate',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount_as_per_sr',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 10,
|
||||
'label': 'Amount As Per SR',
|
||||
'oldfieldname': 'amount_as_per_sr',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty_consumed_per_unit',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 11,
|
||||
'label': 'Qty Consumed Per Unit',
|
||||
'oldfieldname': 'qty_consumed_per_unit',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 12,
|
||||
'label': 'Stock UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'UOM',
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'flat_bom_no',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 12,
|
||||
'label': 'Flat BOM No',
|
||||
'oldfieldname': 'flat_bom_no',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bom_mat_no',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 13,
|
||||
'label': 'BOM Mat No',
|
||||
'oldfieldname': 'bom_mat_no',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'parent_bom',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 14,
|
||||
'label': 'Parent BOM',
|
||||
'oldfieldname': 'parent_bom',
|
||||
'oldfieldtype': 'Link'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_pro_applicable',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 15,
|
||||
'label': 'Is PRO Applicable',
|
||||
'oldfieldname': 'is_pro_applicable',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nYes\nNo',
|
||||
'reqd': 0
|
||||
}
|
||||
]
|
||||
@@ -1,216 +0,0 @@
|
||||
# DocType, PF Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:12',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'PFD/.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'PF Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'PF Detail',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocType, PF Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'PF Detail'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 2,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'planned_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 5,
|
||||
'label': 'Planned Quantity',
|
||||
'oldfieldname': 'planned_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'produced_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 6,
|
||||
'label': 'Produced Quantity',
|
||||
'oldfieldname': 'produced_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'start_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 0,
|
||||
'idx': 7,
|
||||
'in_filter': 0,
|
||||
'label': 'Start Date',
|
||||
'oldfieldname': 'start_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'end_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 0,
|
||||
'idx': 8,
|
||||
'in_filter': 0,
|
||||
'label': 'End Date',
|
||||
'oldfieldname': 'end_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Quantity',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'forecast_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 9,
|
||||
'label': 'Forecast Date',
|
||||
'oldfieldname': 'forecast_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'forecast_due_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 10,
|
||||
'label': 'Forecast Due Date',
|
||||
'oldfieldname': 'forecast_due_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 12,
|
||||
'label': 'Stock UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
@@ -1,249 +0,0 @@
|
||||
# DocType, PP Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:12',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'PPID/.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 21
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'PP Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, PP Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'PP Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'source_doctype',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'label': 'Against Document ',
|
||||
'oldfieldname': 'source_doctype',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'source_docname',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Document No',
|
||||
'oldfieldname': 'source_docname',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'source_detail_docname',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 3,
|
||||
'label': 'Document Detail No',
|
||||
'oldfieldname': 'source_detail_docname',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'parent_item',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 4,
|
||||
'label': 'Parent Item',
|
||||
'oldfieldname': 'parent_item',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 5,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'document_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 6,
|
||||
'in_filter': 1,
|
||||
'label': 'Document Date',
|
||||
'oldfieldname': 'document_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'search_index': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'confirmation_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 7,
|
||||
'in_filter': 1,
|
||||
'label': 'Confirmed Delivery Date',
|
||||
'oldfieldname': 'confirmation_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bom_no',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 8,
|
||||
'label': 'BOM No',
|
||||
'oldfieldname': 'bom_no',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Bill Of Materials',
|
||||
'permlevel': 0,
|
||||
'search_index': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 9,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_reqd_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 11,
|
||||
'label': 'Total Reqd Qty',
|
||||
'oldfieldname': 'prevdoc_reqd_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'reqd': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 12,
|
||||
'label': 'Stock UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'planned_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 12,
|
||||
'label': 'Planned Quantity',
|
||||
'oldfieldname': 'planned_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': '180px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'produced_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 1,
|
||||
'idx': 13,
|
||||
'label': 'Produced Qty',
|
||||
'oldfieldname': 'produced_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'width': '130px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'pro_created',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 14,
|
||||
'label': 'PRO Created',
|
||||
'oldfieldname': 'pro_created',
|
||||
'oldfieldtype': 'Check',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'mrp',
|
||||
'fieldtype': 'Check',
|
||||
'hidden': 1,
|
||||
'idx': 15,
|
||||
'label': 'Already MRP Considered',
|
||||
'oldfieldname': 'mrp',
|
||||
'oldfieldtype': 'Check',
|
||||
'permlevel': 1,
|
||||
'width': '140px'
|
||||
}
|
||||
]
|
||||
@@ -1,131 +0,0 @@
|
||||
# DocType, PP SO Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:13',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'PP/.SO/.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 2
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'PP SO Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'PP SO Detail',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocType, PP SO Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'PP SO Detail'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'label': 'Against Document',
|
||||
'oldfieldname': 'prevdoc',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_docname',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Document No',
|
||||
'oldfieldname': 'prevdoc_docname',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'document_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 3,
|
||||
'label': 'Document Date',
|
||||
'oldfieldname': 'document_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'confirmation_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 5,
|
||||
'label': 'Confirmation Date',
|
||||
'oldfieldname': 'confirmation_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'include_in_plan',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 6,
|
||||
'label': 'Include In Plan',
|
||||
'oldfieldname': 'include_in_plan',
|
||||
'oldfieldtype': 'Check',
|
||||
'permlevel': 0,
|
||||
'width': '100px'
|
||||
}
|
||||
]
|
||||
@@ -1,52 +0,0 @@
|
||||
# DocType, PPW Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:13',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'PPWD/.#######',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'warehouse',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'label': 'Warehouse',
|
||||
'name': '__common__',
|
||||
'oldfieldname': 'warehouse',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Warehouse',
|
||||
'parent': 'PPW Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, PPW Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'PPW Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField'
|
||||
}
|
||||
]
|
||||
@@ -1,157 +0,0 @@
|
||||
# DocType, PRO Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:13',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'PRODC/.#######',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 4
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'PRO Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, PRO Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'PRO Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 2,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'source_warehouse',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'Source Warehouse',
|
||||
'oldfieldname': 'source_warehouse',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Warehouse',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'actual_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 4,
|
||||
'label': 'Current Stock',
|
||||
'oldfieldname': 'actual_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty_reqd',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 6,
|
||||
'label': 'Qty Reqd',
|
||||
'oldfieldname': 'qty_reqd',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'issued_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Issued Qty',
|
||||
'oldfieldname': 'issued_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'consumed_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Consumed Qty',
|
||||
'oldfieldname': 'consumed_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty_consumed_per_unit',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Qty Consumed Per Unit',
|
||||
'oldfieldname': 'qty_consumed_per_unit',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 12,
|
||||
'label': 'Stock UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'reqd': 1
|
||||
}
|
||||
]
|
||||
@@ -1,129 +0,0 @@
|
||||
# DocType, PRO PP Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:13',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 5
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'PRO PP Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, PRO PP Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'PRO PP Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'source_doctype',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'label': 'Source Doctype',
|
||||
'oldfieldname': 'source_doctype',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'source_docname',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Source Docname',
|
||||
'oldfieldname': 'source_docname',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'source_detail_docname',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'label': 'Source Detail Docname ',
|
||||
'oldfieldname': 'source_detail_docname',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_detail_docname',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 4,
|
||||
'label': 'Prevdoc Detail Docname',
|
||||
'oldfieldname': 'prevdoc_detail_docname',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'confirm_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 5,
|
||||
'label': 'Confirm Date',
|
||||
'oldfieldname': 'confirm_date',
|
||||
'oldfieldtype': 'Date'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty_reqd',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 6,
|
||||
'label': 'Qty Reqd',
|
||||
'oldfieldname': 'qty_reqd',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'produced_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Produced Qty',
|
||||
'oldfieldname': 'produced_qty',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'update',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 8,
|
||||
'label': 'Update',
|
||||
'oldfieldname': 'update',
|
||||
'oldfieldtype': 'Check'
|
||||
}
|
||||
]
|
||||
@@ -1,155 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__( self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
# pur_items = {'item_code':req_qty}
|
||||
self.pur_items = {}
|
||||
# bom_list = [[]]
|
||||
self.bom_list = []
|
||||
# list for sub assembly item
|
||||
self.sub_assembly_items = []
|
||||
# Item Master
|
||||
self.item_master = {}
|
||||
|
||||
def traverse_bom_tree( self, bom_no, qty, ext_pur_items = 0, ext_sub_assembly_items = 0, calculate_cost = 0, maintain_item_master = 0 ):
|
||||
count, bom_list, qty_list = 0, [bom_no], [qty]
|
||||
while (count < len(bom_list)):
|
||||
# get child items from BOM MAterial Table.
|
||||
child_items = sql("select item_code, bom_no, qty, qty_consumed_per_unit from `tabBOM Material` where parent = %s", bom_list[count], as_dict = 1)
|
||||
child_items = child_items and child_items or []
|
||||
#msgprint(bom_list[count])
|
||||
#msgprint(qty_list)
|
||||
for item in child_items:
|
||||
# Calculate qty required for FG's qty.
|
||||
item['reqd_qty'] = flt(qty) * ((count == 0) and 1 or flt(qty_list[count]) )* flt(item['qty_consumed_per_unit'])
|
||||
#gprint("Item Reqd : " + cstr(item['reqd_qty']))
|
||||
|
||||
# extracting Purchase Items
|
||||
if ext_pur_items and not item['bom_no']:
|
||||
# item exist in pur_items dict then just add qty with previous qty
|
||||
if self.pur_items.has_key(item['item_code']):
|
||||
self.pur_items[item['item_code']] = flt(self.pur_items[item['item_code']]) + flt(item['reqd_qty'])
|
||||
# maintain item master
|
||||
#if maintain_item_master:
|
||||
|
||||
# else add item in pur_item dict with reqd qty.
|
||||
else:
|
||||
self.pur_items[item['item_code']] = flt(item['reqd_qty'])
|
||||
# maintain item master
|
||||
#if maintain_item_master:
|
||||
|
||||
# For calculate cost extracting BOM Items check for duplicate boms, this optmizes the time complexity for while loop.
|
||||
if calculate_cost and item['bom_no'] and (item['bom_no'] not in bom_list):
|
||||
bom_list.append(item['bom_no'])
|
||||
qty_list.append(item['reqd_qty'])
|
||||
|
||||
# Here repeated bom are considered to calculate total qty of raw material required
|
||||
if not calculate_cost and item['bom_no']:
|
||||
# append bom to bom_list
|
||||
bom_list.append(item['bom_no'])
|
||||
qty_list.append(item['reqd_qty'])
|
||||
|
||||
# # extracting Sub Assembly Items . Make Sure Sub Assembly Items have BOM No. in BOM MATERIAL
|
||||
# if ext_sub_assembly_items:
|
||||
# # If Production Order Applicable is 'Yes'
|
||||
# if item['pro_applicable#'] == "Yes":
|
||||
# # append item in sub_assembly_items
|
||||
# self.sub_assembly_items.append([item['item_code']])
|
||||
# # Remove current bom from bom_list
|
||||
# bom_list.pop()
|
||||
|
||||
count += 1
|
||||
return bom_list
|
||||
|
||||
|
||||
|
||||
# Raise Production Order
|
||||
def create_production_order(self,company, fy, pp_detail = '', pro_detail = ''):
|
||||
pro_lbl = {'production_item': 0, 'description': 1, 'qty' : 2, 'stock_uom' : 3, 'bom_no': 4, 'consider_sa_items': 5}
|
||||
|
||||
default_values = { 'transaction_date' : now(),
|
||||
'origin' : pp_detail and 'MRP' or 'Direct',
|
||||
'wip_warehouse' : 'MB1-Stores',
|
||||
'status' : 'Draft',
|
||||
'company' : company,
|
||||
'fiscal_year' : fy }
|
||||
|
||||
pro_list, count = pp_detail and pp_detail or pro_detail, 0
|
||||
|
||||
while (count < len(pro_list)):
|
||||
pro_doc = Document('Production Order')
|
||||
|
||||
for key in pro_lbl.keys():
|
||||
pro_doc.fields[key] = pro_list[count][pro_lbl[key]]
|
||||
|
||||
for key in default_values:
|
||||
pro_doc.fields[key] = default_values[key]
|
||||
|
||||
pro_doc.save(new = 1)
|
||||
pro_list[count] = pro_doc.name
|
||||
|
||||
# This was for adding raw materials in pro detail and get sa items
|
||||
#sa_list = get_obj('Porduction Order', pro_doc.name, with_children = 1).get_purchase_item( get_sa_items = 1, add_child= 1)
|
||||
#for sa_item in sa_list:
|
||||
# pro_list.append(sa_item)
|
||||
|
||||
count = count + 1
|
||||
return pro_list
|
||||
|
||||
|
||||
def update_bom(self, bom_no):
|
||||
main_bom_list = self.traverse_bom_tree(bom_no, 1)
|
||||
main_bom_list.reverse()
|
||||
#print('--------------')
|
||||
msgprint(main_bom_list)
|
||||
#print('--------------')
|
||||
# run calculate cost and get
|
||||
for bom in main_bom_list:
|
||||
if bom and bom not in self.check_bom_list:
|
||||
#print(bom)
|
||||
bom_obj = get_obj('Bill Of Materials', bom, with_children = 1)
|
||||
#print(bom_obj.doc.fields)
|
||||
bom_obj.doc.save()
|
||||
bom_obj.check_recursion()
|
||||
bom_obj.update_flat_bom_engine()
|
||||
bom_obj.doc.docstatus = 1
|
||||
bom_obj.doc.save()
|
||||
self.check_bom_list.append(bom)
|
||||
#errprint(" " + cstr(bom) + " has been submitted successfully.")
|
||||
|
||||
|
||||
def update_all_fg(self):
|
||||
self.check_bom_list = []
|
||||
#pc_obj = get_obj(dt = 'Production Control')
|
||||
cn_bom = sql("select name from `tabBill Of Materials` where item not like 'CN%' and item not like 'LDR%' and item not like 'HD%' limit 1")
|
||||
#cn_bom = (('BOM/A012629/001',),)
|
||||
i=1
|
||||
#msgprint(cn_bom)
|
||||
for d in cn_bom:
|
||||
if not cstr(d[0]) in self.check_bom_list:
|
||||
print('Main BOM')
|
||||
msgprint(d[0])
|
||||
msgprint(i)
|
||||
#sql("start transaction")
|
||||
#self.update_bom(d[0])
|
||||
#sql("commit")
|
||||
i += 1
|
||||
@@ -1,31 +0,0 @@
|
||||
# DocType, Production Control
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:14',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-23 11:22:14',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 19
|
||||
},
|
||||
|
||||
# DocType, Production Control
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Production Control'
|
||||
}
|
||||
]
|
||||
@@ -1,113 +0,0 @@
|
||||
$import(Production Tips Common)
|
||||
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
|
||||
|
||||
if (!doc.fiscal_year && doc.__islocal){ set_default_values(doc);}
|
||||
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
||||
if (!doc.status) doc.status = 'Draft';
|
||||
cfn_set_fields(doc, cdt, cdn);
|
||||
if (doc.origin != "MRP"){
|
||||
doc.origin = "Manual";
|
||||
//get_field('Production Order', 'consider_sa_items').permlevel = 0;
|
||||
set_field_permlevel('production_item', 0);
|
||||
set_field_permlevel('bom_no', 0);
|
||||
set_field_permlevel('consider_sa_items',0);
|
||||
|
||||
}
|
||||
}
|
||||
// ================================== Refresh ==========================================
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
|
||||
cfn_set_fields(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['production_item'].get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.`description` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` LIMIT 50';
|
||||
}
|
||||
|
||||
// ---------------------- Get project name --------------------------
|
||||
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['bom_no'].get_query = function(doc) {
|
||||
if (doc.production_item){
|
||||
return 'SELECT DISTINCT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`is_active` = "Yes" AND `tabBill Of Materials`.`item` = "' + cstr(doc.production_item) + '" AND`tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50';
|
||||
}
|
||||
else {
|
||||
alert(" Please Enter Production Item First.")
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.production_item = function(doc, cdt, cdn) {
|
||||
get_server_fields('get_item_detail',doc.production_item,'',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
var cfn_set_fields = function(doc, cdt, cdn) {
|
||||
hide_field('Material Transfer');
|
||||
hide_field('Stop Production Order');
|
||||
hide_field('Unstop Production Order')
|
||||
hide_field('Backflush');
|
||||
if (doc.docstatus == 1){
|
||||
unhide_field('Stop Production Order');
|
||||
if (doc.status == 'Submitted' || doc.status == 'Material Transferred' || doc.status == 'In Process'){
|
||||
unhide_field(['Material Transfer','Backflush']);
|
||||
}
|
||||
else if (doc.status == 'Stopped'){
|
||||
unhide_field('Unstop Production Order');
|
||||
hide_field(['Stop Production Order', 'Material Transfer', 'Backflush']);
|
||||
}
|
||||
else if (doc.status == 'Completed'){
|
||||
hide_field(['Stop Production Order', 'Material Transfer', 'Backflush']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Stop PRODUCTION ORDER
|
||||
// ==================================================================================================
|
||||
cur_frm.cscript['Stop Production Order'] = function(doc,cdt,cdn) {
|
||||
var check = confirm("DO YOU REALLY WANT TO Stop PRODUCTION ORDER : " + doc.name);
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Unstop PRODUCTION ORDER
|
||||
// ==================================================================================================
|
||||
cur_frm.cscript['Unstop Production Order'] = function(doc,cdt,cdn) {
|
||||
var check = confirm("DO YOU REALLY WANT TO Unstop PRODUCTION ORDER : " + doc.name);
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Unstopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Material Transfer'] = function(doc,cdt,cdn) {
|
||||
cur_frm.cscript.make_se(doc, process = 'Material Transfer');
|
||||
}
|
||||
|
||||
cur_frm.cscript['Backflush'] = function(doc,cdt,cdn) {
|
||||
cur_frm.cscript.make_se(doc, process = 'Backflush');
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_se = function(doc, process) {
|
||||
var se = LocalDB.create('Stock Entry');
|
||||
se = locals['Stock Entry'][se];
|
||||
se.purpose = 'Production Order';
|
||||
se.process = process;
|
||||
se.posting_date = doc.posting_date;
|
||||
se.production_order = doc.name;
|
||||
se.fiscal_year = doc.fiscal_year;
|
||||
se.company = doc.company;
|
||||
|
||||
loaddoc('Stock Entry', se.name);
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# Autoname
|
||||
def autoname(self):
|
||||
p = self.doc.fiscal_year
|
||||
self.doc.name = make_autoname('PRO/' + self.doc.fiscal_year[2:5]+self.doc.fiscal_year[7:9] + '/.######')
|
||||
|
||||
def get_item_detail(self, production_item):
|
||||
item = sql("select description, stock_uom, default_bom from `tabItem` where (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now()) and name = %s", production_item, as_dict = 1 )
|
||||
ret = {
|
||||
'description' : item and item[0]['description'] or '',
|
||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||
'default_bom' : item and item[0]['default_bom'] or ''
|
||||
}
|
||||
return ret
|
||||
|
||||
def validate(self):
|
||||
if not self.doc.production_item :
|
||||
msgprint("Please enter Production Item")
|
||||
raise Exception
|
||||
if self.doc.production_item :
|
||||
item_detail = sql("select docstatus from `tabItem` where name = '%s'" % self.doc.production_item, as_dict = 1)
|
||||
if not item_detail:
|
||||
msgprint("Item '%s' do not exist in the system." % cstr(self.doc.production_item))
|
||||
raise Exception
|
||||
if item_detail[0]['docstatus'] == 2:
|
||||
msgprint("Item '%s' is Trashed Item ."% self.doc.production_item)
|
||||
raise Exception
|
||||
if self.doc.bom_no:
|
||||
bom_detail = sql("select item, is_active, docstatus from `tabBill Of Materials` where name = '%s'" % self.doc.bom_no, as_dict =1)
|
||||
if not bom_detail:
|
||||
msgprint("BOM No '%s' do not exist in the system." % cstr(self.doc.bom_no))
|
||||
raise Exception
|
||||
if cstr(bom_detail[0]['item']) != cstr(self.doc.production_item):
|
||||
msgprint("The Item '%s' in BOM := '%s' do not match with Produciton Item '%s'." % (cstr(bom_detail[0]['item']), cstr(self.doc.bom_no), cstr(self.doc.production_item)))
|
||||
raise Exception
|
||||
if cstr(bom_detail[0]['is_active']) != 'Yes':
|
||||
msgprint("BOM := '%s' is not Active BOM." % self.doc.bom_no)
|
||||
raise Exception
|
||||
if flt(bom_detail[0]['docstatus']) != 1:
|
||||
msgprint("BOM := '%s' is not Submitted BOM." % self.doc.bom_no)
|
||||
raise Exception
|
||||
|
||||
def update_status(self, status):
|
||||
# Set Status
|
||||
if status == 'Stopped':
|
||||
set(self.doc, 'status', cstr(status))
|
||||
else:
|
||||
if flt(self.doc.qty) == flt(self.doc.produced_qty):
|
||||
set(self.doc, 'status', 'Completed')
|
||||
if flt(self.doc.qty) > flt(self.doc.produced_qty):
|
||||
set(self.doc, 'status', 'In Process')
|
||||
if flt(self.doc.produced_qty) == 0:
|
||||
set(self.doc, 'status', 'Submitted')
|
||||
|
||||
# Update Planned Qty of Production Item
|
||||
qty = (flt(self.doc.qty) - flt(self.doc.produced_qty)) * ((status == 'Stopped') and -1 or 1)
|
||||
get_obj('Warehouse', self.doc.fg_warehouse).update_bin(0, 0, 0, 0, flt(qty), self.doc.production_item, now())
|
||||
|
||||
# Acknowledge user
|
||||
msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s and status has been updated as %s." % (cstr(status), cstr(self.doc.status)))
|
||||
|
||||
def on_submit(self):
|
||||
# Set Status AS "Submitted"
|
||||
set(self.doc,'status', 'Submitted')
|
||||
|
||||
# increase Planned Qty of Prooduction Item by Qty
|
||||
get_obj('Warehouse', self.doc.fg_warehouse).update_bin(0, 0, 0, 0,flt(self.doc.qty), self.doc.production_item, now())
|
||||
|
||||
|
||||
def on_cancel(self):
|
||||
# Stock Entries Against this Production Order
|
||||
st = sql("select name from `tabStock Entry` where production_order = '%s' and docstatus = 1" % cstr(self.doc.name))
|
||||
if st and st[0][0]:
|
||||
msgprint("Stock Entry "+ cstr(st[0][0]) + " has already been submitted.")
|
||||
raise Exception
|
||||
|
||||
# Set Status AS "Submitted"
|
||||
set(self.doc,'status', 'Cancelled')
|
||||
|
||||
# decrease Planned Qty of Prooduction Item by Qty
|
||||
get_obj('Warehouse', self.doc.fg_warehouse).update_bin(0, 0, 0, 0,-flt(self.doc.qty), self.doc.production_item, now())
|
||||
@@ -1,438 +0,0 @@
|
||||
# DocType, Production Order
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:14',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-08-31 10:03:21',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1313485457',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'in_create': 0,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 180
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Production Order',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Production Order',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Production Order
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Production Order'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': 'System Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': 'All'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': 'Production Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': 'Production User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'label': 'Production Order',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'The date on which current entry is made in system.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'transaction_date',
|
||||
'fieldtype': 'Date',
|
||||
'label': 'Transaction Date',
|
||||
'oldfieldname': 'transaction_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'The date on which current entry will get or has actually executed.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'posting_date',
|
||||
'fieldtype': 'Date',
|
||||
'label': 'Posting Date',
|
||||
'oldfieldname': 'posting_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Item for which this Production Order is raised.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'production_item',
|
||||
'fieldtype': 'Link',
|
||||
'in_filter': 1,
|
||||
'label': 'Production Item',
|
||||
'oldfieldname': 'production_item',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 1,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Bill of Material which was considered for manufacturing the production item.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bom_no',
|
||||
'fieldtype': 'Link',
|
||||
'label': 'BOM No',
|
||||
'oldfieldname': 'bom_no',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Bill Of Materials',
|
||||
'permlevel': 1,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'origin',
|
||||
'fieldtype': 'Select',
|
||||
'in_filter': 1,
|
||||
'label': 'Origin',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'origin',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'Manual\nMRP',
|
||||
'permlevel': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Quantity of item for which Production Order is raised.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'label': 'Qty',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'Select name of the project if Production Order need to be created against any project',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'project_name',
|
||||
'fieldtype': 'Link',
|
||||
'in_filter': 1,
|
||||
'label': 'Project Name',
|
||||
'oldfieldname': 'project_name',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Project',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amended_from',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Amended From',
|
||||
'oldfieldname': 'amended_from',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amendment_date',
|
||||
'fieldtype': 'Date',
|
||||
'label': 'Amendment Date',
|
||||
'oldfieldname': 'amendment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Stock UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'in_filter': 1,
|
||||
'label': 'Status',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled',
|
||||
'permlevel': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'The warehouse for finished goods where stock of produced items will be updated.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fg_warehouse',
|
||||
'fieldtype': 'Link',
|
||||
'in_filter': 1,
|
||||
'label': 'FG Warehouse',
|
||||
'oldfieldname': 'fg_warehouse',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Warehouse',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'The work in progress warehouse where raw materials will be operated upon to create finished goods.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'wip_warehouse',
|
||||
'fieldtype': 'Link',
|
||||
'in_filter': 1,
|
||||
'label': 'WIP Warehouse',
|
||||
'oldfieldname': 'wip_warehouse',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Warehouse',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select "Yes" if stock is maintained and tracked for sub - assembly items.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'consider_sa_items',
|
||||
'fieldtype': 'Select',
|
||||
'in_filter': 1,
|
||||
'label': 'Consider SA Items',
|
||||
'oldfieldname': 'consider_sa_items',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nYes\nNo',
|
||||
'permlevel': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Updated after finished goods are transferred to FG Warehouse through Stock Entry',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'produced_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'label': 'Produced Qty',
|
||||
'oldfieldname': 'produced_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'label': 'Company',
|
||||
'oldfieldname': 'company',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Company',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fiscal_year',
|
||||
'fieldtype': 'Select',
|
||||
'in_filter': 1,
|
||||
'label': 'Fiscal Year',
|
||||
'oldfieldname': 'fiscal_year',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Fiscal Year',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'label': 'Next Steps',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'label': 'Material Transfer',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'label': 'Backflush',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'label': 'Stop Production Order',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'label': 'Unstop Production Order',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
}
|
||||
]
|
||||
@@ -1,45 +0,0 @@
|
||||
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
if(!doc.fiscal_year){ set_default_values(doc);}
|
||||
}
|
||||
|
||||
cur_frm.cscript.item_code = function(doc,cdt,cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
temp = "{'item_code':'"+(d.item_code?d.item_code:'')+"'}";
|
||||
get_server_fields('get_item_details', temp, 'pp_details', doc, cdt, cdn, 1);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['pp_details'].grid.get_field('item_code').get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.`name`,`tabItem`.`item_name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life`="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.%(key)s like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
|
||||
}
|
||||
|
||||
// Get Query for BOM NO
|
||||
//-------------------------------------------------------------------------------
|
||||
cur_frm.fields_dict['pp_details'].grid.get_field('bom_no').get_query = function(doc) {
|
||||
var d = locals[this.doctype][this.docname];
|
||||
return 'SELECT DISTINCT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`item` = "' + d.item_code + '" AND `tabBill Of Materials`.`is_active` = "Yes" AND `tabBill Of Materials`.`name` like "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.cscript['Clear Document Table'] = function(doc, cdt, cdn){
|
||||
$c('runserverobj', args={'method':'clear_table', 'arg': 'pp_so_details', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript['Clear Item Table'] = function(doc, cdt, cdn){
|
||||
$c('runserverobj', args={'method':'clear_table', 'arg': 'pp_details', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript['Download Raw Material Report'] = function(doc, cdt, cdn) {
|
||||
call_back = function(r, rt){
|
||||
if (r.message) {
|
||||
$c_obj_csv(make_doclist(cdt, cdn), 'get_raw_materials_report', '');
|
||||
}
|
||||
}
|
||||
$c('runserverobj', args = {'method':'validate_data','args':'','docs':compress_doclist(make_doclist(doc.doctype, doc.name))}, call_back)
|
||||
}
|
||||
@@ -1,281 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.item_dict = {}
|
||||
self.defaults = get_defaults()
|
||||
|
||||
def get_item_details(self, args):
|
||||
args = eval(args)
|
||||
item = sql("select description, stock_uom, default_bom from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())" % args['item_code'], as_dict =1 )
|
||||
if item:
|
||||
ret = {'description' : item and item[0]['description'],
|
||||
'stock_uom' : item and item[0]['stock_uom'],
|
||||
'bom_no' : item and item[0]['default_bom']
|
||||
}
|
||||
return ret
|
||||
else:
|
||||
msgprint("Item %s does not exist in system." %(args['item_code']))
|
||||
raise Exception
|
||||
|
||||
def validate_data(self):
|
||||
for d in getlist(self.doclist, 'pp_details'):
|
||||
if not d.pro_created:
|
||||
|
||||
bom = sql("select name from `tabBill Of Materials` where item = %s and docstatus < 2", d.item_code, as_dict = 1)
|
||||
if d.bom_no and not bom:
|
||||
msgprint("There is no Active BOM for item code " + cstr(d.item_code) + " at row no." + cstr(d.idx)+ " which is Submitted. ")
|
||||
raise Exception
|
||||
if bom and bom[0]['name'] and not d.bom_no:
|
||||
msgprint("Please Enter BOM No. for item code " + cstr(d.item_code) + "at row no " + cstr(d.idx))
|
||||
raise Exception
|
||||
item = sql("select is_purchase_item from `tabItem` where name = %s", d.item_code,as_dict = 1)
|
||||
# if not item[0]['is_mrp_item']:
|
||||
# msgprint("Please Delete Row No " + cstr(d.idx) + " as Item " + cstr(d.item_code) + " is not MRP ITEM ")
|
||||
# raise Exception
|
||||
if not item[0]['is_purchase_item'] and not d.bom_no:
|
||||
msgprint("Please Delete Row No. "+ cstr(d.idx)+" as Item " + cstr(d.item_code) + " is not a PURCHASE ITEM ")
|
||||
raise Exception
|
||||
if not flt(d.planned_qty):
|
||||
msgprint("Please Enter Planned Qty for item code " + cstr(d.item_code) + "at row no " + cstr(d.idx))
|
||||
raise Exception
|
||||
if flt(d.prevdoc_reqd_qty) and flt(d.planned_qty) > flt(d.prevdoc_reqd_qty):
|
||||
msgprint(" Planned Qty cannot be greater than total Qty at row no " + cstr(d.idx))
|
||||
raise Exception
|
||||
|
||||
item = sql("select is_manufactured_item, is_sub_contracted_item from`tabItem` where name = %s", d.item_code, as_dict = 1)
|
||||
if not item:
|
||||
msgprint("Item %s is not present in Item Master." % d.item_code)
|
||||
raise Exception
|
||||
|
||||
if item[0]['is_manufactured_item'] == 'Yes' or item[0]['is_sub_contracted_item'] == 'Yes':
|
||||
bom = sql("select name, docstatus from `tabBill Of Materials` where item = %s", d.item_code, as_dict =1)
|
||||
if bom and bom[0]['name']:
|
||||
if not d.bom_no:
|
||||
msgprint("Please Enter BOM No for Item " + cstr(d.item_code) + " in Materials at Row No. " + cstr(d.idx) + " in BOM NO. " + self.doc.name)
|
||||
raise Exception
|
||||
else:
|
||||
match = 0
|
||||
for b in bom:
|
||||
if flt(b['docstatus']) > 1:
|
||||
msgprint("BOM %s is NOT SUBMITTED."% cstr(d.bom_no))
|
||||
raise Exception
|
||||
|
||||
match = 1
|
||||
if not match:
|
||||
msgprint("Item %s does not belong to Bill Of Material %s or Bill Of Material %s is NOT ACTIVE BOM." % (cstr(d.item_code),cstr(d.bom_no), cstr(d.bom_no)))
|
||||
raise Exception
|
||||
|
||||
if not item[0]['is_manufactured_item'] == 'Yes' and not item[0]['is_sub_contracted_item']== 'Yes':
|
||||
if d.bom_no:
|
||||
msgprint("As in Item Master of Item %s Is Manufactured Item / Is Sub-Contracted Item is not 'Yes' hence there should be no BOM." % d.item_code)
|
||||
raise Exception
|
||||
|
||||
return 1
|
||||
|
||||
def pull_document(self):
|
||||
if self.doc.sales_order:
|
||||
open_so = sql("select distinct 'Sales Order' as prevdoc, t1.name, ifnull(t1.transaction_date, ''), ifnull(t2.confirmation_date,'') from `tabSales Order` t1, `tabSales Order Detail` t2, `tabDelivery Note Packing Detail` t3 where ifnull(t3.planned_qty,0) < ifnull(t3.qty,0) and (t2.qty - ifnull(t2.delivered_qty,0)) > 0 and t3.parent_detail_docname = t2.name and t2.parent = t1.name and t1.docstatus = 1 and t1.name = '%s' order by t1.transaction_date" % self.doc.sales_order)
|
||||
self.add_open_documents(open_so)
|
||||
#if self.doc.production_forecast:
|
||||
#open_pf = sql("select distinct 'Production Forecast' as prevdoc, t1.name, ifnull(t1.transaction_date,''), ifnull(t1.forecast_due_date,'') from `tabProduction Forecast` t1, `tabPF Detail` t2 where t2.planned_qty < t2.qty and t2.parent = t1.name and t1.name = '%s' and t1.docstatus = 1 order by t1.forecast_due_date " % self.doc.production_forecast)
|
||||
#self.add_open_documents(open_pf)
|
||||
|
||||
def validate_duplicate_docname(self, check_data):
|
||||
for d in getlist(self.doclist, 'pp_so_details'):
|
||||
if [ d.prevdoc_docname, d.document_date, d.confirmation_date] == check_data :
|
||||
msgprint(cstr(d.prevdoc) + ": " + cstr(d.prevdoc_docname) + " appears more than once.")
|
||||
raise Exception
|
||||
|
||||
def add_open_documents(self, open_doc):
|
||||
for r in open_doc:
|
||||
self.validate_duplicate_docname([r[1], r[2], r[3]])
|
||||
pp_so = addchild(self.doc, 'pp_so_details', 'PP SO Detail', 1, self.doclist)
|
||||
pp_so.prevdoc = r[0]
|
||||
pp_so.prevdoc_docname = r[1]
|
||||
pp_so.document_date = cstr(r[2])
|
||||
pp_so.confirmation_date = cstr(r[3])
|
||||
pp_so.save()
|
||||
|
||||
def get_open_docs(self):
|
||||
# Step 1:=> Remove unwanted rows from PP SO DETAIL TABLE
|
||||
self.remove_unwanted_rows_from_table(check_field ='include_in_plan', table_fname='pp_so_details')
|
||||
|
||||
# Step 2:=> Check From Date should be before To Date
|
||||
if self.doc.from_date:
|
||||
if (getdate(self.doc.from_date) > getdate(self.doc.to_date)):
|
||||
msgprint("From Date cannot be after To Date")
|
||||
raise Exception
|
||||
|
||||
# Step 3:=> At Least to date should be there
|
||||
if not self.doc.to_date:
|
||||
msgprint("To Date is Mandatory.")
|
||||
raise Exception
|
||||
|
||||
# Step 4:=> GEt Open Sales ORder and Production Forecasts
|
||||
open_so = sql("select distinct 'Sales Order' as prevdoc, t1.name, t1.transaction_date, t2.confirmation_date from `tabSales Order` t1, `tabSales Order Detail` t2 where (t2.qty - ifnull(t2.delivered_qty,0)) > 0 and t2.parent = t1.name %s and t1.transaction_date <= '%s' and t1.docstatus = 1 order by t1.transaction_date" % ((self.doc.from_date and "and t1.transaction_date >= '%s' " % self.doc.from_date or '') , self.doc.to_date))
|
||||
#open_pf = sql("select distinct 'Production Forecast' as prevdoc, t1.name, t1.transaction_date, t1.forecast_due_date from `tabProduction Forecast` t1, `tabPF Detail` t2 where ifnull(t2.planned_qty,0) < ifnull(t2.qty,0) and t1.name = t2.parent %s and t1.forecast_due_date <= '%s' and t1.docstatus = 1 order by t1.forecast_due_date " % ( self.doc.from_date and "and t1.forecast_due_date >= '%s' " % self.doc.from_date or '', self.doc.to_date))
|
||||
#open_doc = open_so + open_pf
|
||||
open_doc = open_so
|
||||
self.add_open_documents(open_doc)
|
||||
|
||||
def remove_unwanted_rows_from_table(self, check_field, table_fname):
|
||||
for d in getlist(self.doclist, table_fname):
|
||||
if not d.fields[check_field]:
|
||||
d.fields['__oldparent'] = d.parent
|
||||
d.parent = 'old_parent:' + d.parent # for client to send it back while saving
|
||||
d.docstatus = 2
|
||||
if not d.fields.get('__islocal'):
|
||||
d.save()
|
||||
else:
|
||||
d.save()
|
||||
|
||||
def get_packing_list_items(self, sales_order):
|
||||
#sales_com_obj.make_packing_list(self,'sales_order_details')
|
||||
pack_l = sql("select t2.name, t2.parent_item, t2.item_code, t0.transaction_date, t1.confirmation_date,(t1.qty - ifnull(t1.delivered_qty,0)) * (ifnull(t2.qty,0) / ifnull(t1.qty,1)) as 'pending_qty' from `tabSales Order` t0, `tabSales Order Detail` t1, `tabDelivery Note Packing Detail` t2 where ifnull(t2.planned_qty,0) < ifnull(t2.qty,0) and (t1.qty - ifnull(t1.delivered_qty,0)) > 0 and t2.parent_detail_docname = t1.name and t0.name = t1.parent and t1.parent = '%s' and t2.parent = '%s' and t1.docstatus =1 and t2.docstatus = 1" % (sales_order, sales_order), as_dict =1)
|
||||
for p in pack_l:
|
||||
pi = addchild(self.doc, 'pp_details', 'PP Detail', 0, self.doclist)
|
||||
pi.source_doctype = 'Sales Order'
|
||||
pi.source_docname = sales_order
|
||||
pi.source_detail_docname = p['name']
|
||||
pi.parent_item = p['parent_item']
|
||||
pi.item_code = p['item_code']
|
||||
pi.document_date = cstr(p['transaction_date'])
|
||||
pi.confirmation_date = cstr(p['confirmation_date'])
|
||||
item_details = sql("select description, stock_uom from tabItem where name=%s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", p['item_code'])
|
||||
pi.description = item_details and item_details[0][0] or ''
|
||||
pi.stock_uom = item_details and item_details[0][1] or ''
|
||||
pi.prevdoc_reqd_qty = flt(p['pending_qty'])
|
||||
pi.save()
|
||||
|
||||
def get_items(self):
|
||||
# Step 1:=> Remove unwanted rows from PP SO DETAIL TABLE
|
||||
self.remove_unwanted_rows_from_table(check_field ='include_in_plan', table_fname='pp_so_details')
|
||||
# Step 2:=> Remove unwanted rows from PP DETAIL TABLE
|
||||
self.doc.clear_table(self.doclist, 'pp_details', 1)
|
||||
# Step 3:=> Get All Details From Production Forecast and Sales Order which are marked Include In Plan in PP SO Detail
|
||||
for d in getlist(self.doclist, 'pp_so_details'):
|
||||
if d.include_in_plan:
|
||||
# Step 3.a :=> Get packing List items from sales order
|
||||
if d.prevdoc == 'Sales Order':
|
||||
self.get_packing_list_items(d.prevdoc_docname)
|
||||
# Step 3.b :=> Get Production Forecast items
|
||||
if d.prevdoc == 'Production Forecast':
|
||||
get_obj('DocType Mapper', 'Production Forecast-Production Planning Tool').dt_map('Production Forecast','Production Planning Tool', d.prevdoc_docname, self.doc, self.doclist, "[['Production Forecast','Production Planning Tool'],['PF Detail', 'PP Detail']]")
|
||||
|
||||
self.set_defaults_pp_detail()
|
||||
|
||||
def clear_table(self, table_name = ''):
|
||||
self.doc.clear_table(self.doclist, table_name, 1)
|
||||
|
||||
def set_defaults_pp_detail(self):
|
||||
for d in getlist(self.doclist,'pp_details'):
|
||||
if not d.mrp:
|
||||
# set default BOM
|
||||
if not d.bom_no:
|
||||
bom = sql("select default_bom from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00' or end_of_life > now())", d.item_code, as_dict = 1)
|
||||
if bom and bom[0]['default_bom']:
|
||||
d.bom_no = bom[0]['default_bom']
|
||||
# Set planned qty as prevdoc_reqd_qty
|
||||
d.planned_qty = flt(d.prevdoc_reqd_qty)
|
||||
d.save()
|
||||
|
||||
def make_items_dict(self, items_list):
|
||||
# items_list = [[item_name, qty]]
|
||||
for i in items_list:
|
||||
if self.item_dict.has_key(i[0]):
|
||||
self.item_dict[i[0]] = flt(self.item_dict[i[0]]) + flt(i[1])
|
||||
else:
|
||||
self.item_dict[i[0]] = flt(i[1])
|
||||
|
||||
def get_raw_materials(self, bom_dict):
|
||||
for bom in bom_dict:
|
||||
# get all purchase items
|
||||
if self.doc.consider_sa_items == 'No':
|
||||
fl_bom_items = sql("select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s' from `tabFlat BOM Detail` where parent = '%s' and is_pro_applicable = 'No' and docstatus < 2 group by item_code" % (bom_dict[bom], bom))
|
||||
self.make_items_dict(fl_bom_items)
|
||||
|
||||
# get all purchase items without sa child_items
|
||||
if self.doc.consider_sa_items == 'Yes':
|
||||
fl_bom_sa_items = sql("select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s' from `tabFlat BOM Detail` where parent = '%s' and parent_bom != '%s' and is_pro_applicable = 'Yes' and docstatus < 2 group by item_code" % (bom_dict[bom], bom, bom))
|
||||
self.make_items_dict(fl_bom_sa_items)
|
||||
fl_bom_items = sql("select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s' from `tabFlat BOM Detail` where parent = '%s' and parent_bom not in (select distinct parent_bom from `tabFlat BOM Detail` where parent = '%s' and parent_bom != '%s' and is_pro_applicable = 'Yes' and docstatus <2) and docstatus < 2 and is_pro_applicable = 'No' group by item_code" % (bom_dict[bom], bom, bom, bom) )
|
||||
self.make_items_dict(fl_bom_items)
|
||||
|
||||
return self.item_dict
|
||||
|
||||
def send_csv(self, item_dict):
|
||||
item_list = [['Item Code', 'Description', 'Stock UOM','Required Qty', 'Indented Qty', 'Ordered Qty', 'Actual Qty', ]]
|
||||
for d in item_dict:
|
||||
item_detail = sql("select description, stock_uom from `tabItem` where name = '%s'" % d)
|
||||
item_qty= sql("select sum(indented_qty), sum(ordered_qty), sum(actual_qty) from `tabBin` where item_code = '%s' " % d)
|
||||
item_list.append([d, cstr(item_detail[0][0]), cstr(item_detail[0][1]), flt(item_dict[d]), item_qty and flt(item_qty[0][0]), item_qty and flt(item_qty[0][1]), item_qty and flt(item_qty[0][2])])
|
||||
return item_list
|
||||
|
||||
def get_raw_materials_report(self):
|
||||
#self.validate_data()
|
||||
bom_dict = self.check_criteria_for_same_items(check_for = 'Report')
|
||||
item_dict = self.get_raw_materials(bom_dict)
|
||||
#msgprint(item_dict)
|
||||
#raise Exception
|
||||
return self.send_csv(item_dict)
|
||||
|
||||
def raise_production_order(self):
|
||||
self.validate_data()
|
||||
pp_detail = self.check_criteria_for_same_items(check_for = 'Raise Production Order')
|
||||
pro = get_obj(dt = 'Production Control').create_production_order(self.doc.company, self.doc.fiscal_year, pp_detail = pp_detail)
|
||||
if len(pro) == 1:
|
||||
result = "Only Production Order " + cstr(pro[0]) + " has been generated."
|
||||
elif len(pro) > 1 :
|
||||
result = "Production Order From " + cstr(pro[0]) + " to " + cstr(pro[len(pro) - 1]) + " has been generated."
|
||||
else :
|
||||
result = " No Production Order is generated."
|
||||
msgprint(result)
|
||||
|
||||
def check_criteria_for_same_items(self, check_for):
|
||||
pro_lbl = {'production_item': 0, 'description': 1, 'qty' : 2, 'stock_uom' : 3, 'bom_no': 4, 'consider_sa_items': 5}
|
||||
pp_detail, appended, bom_dict = [], 0, {}
|
||||
for d in getlist(self.doclist, 'pp_details'):
|
||||
if check_for == 'Report':
|
||||
if d.bom_no:
|
||||
if bom_dict.has_key(d.bom_no):
|
||||
bom_dict[d.bom_no] = flt(bom_dict[d.bom_no]) + flt(d.planned_qty)
|
||||
else:
|
||||
bom_dict[d.bom_no] = flt(d.planned_qty)
|
||||
else:
|
||||
self.make_items_dict([[d.item_code, d.planned_qty]])
|
||||
|
||||
if check_for == 'Raise Production Order' and not d.pro_created:
|
||||
appended = 0
|
||||
if pp_detail:
|
||||
for i in pp_detail:
|
||||
# if same bom_no
|
||||
if d.bom_no and d.bom_no == i[pro_lbl['bom_no']]:
|
||||
# set appended , add qty
|
||||
appended, i[pro_lbl['qty']], d.pro_created = 1, i[pro_lbl['qty']] + flt(d.planned_qty) , 1
|
||||
|
||||
if not appended and d.bom_no:
|
||||
pp_detail.append([d.item_code, d.description, d.planned_qty, d.stock_uom, d.bom_no, self.doc.consider_sa_items])
|
||||
d.pro_created = 1
|
||||
|
||||
d.save()
|
||||
return (check_for =='Report') and bom_dict or pp_detail
|
||||
@@ -1,330 +0,0 @@
|
||||
# DocType, Production Planning Tool
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:14',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-30 14:49:58',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1294312191',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'in_create': 1,
|
||||
'issingle': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'read_only': 1,
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 1,
|
||||
'version': 87
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Production Planning Tool',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Production Planning Tool',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Production Planning Tool
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Production Planning Tool'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'role': 'Production User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'role': 'Production Manager'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select Sales Orders from which you want to create Production Orders. Enter the From and To Dates to get Open Orders in that period.',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Find Sales Orders'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'from_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 2,
|
||||
'label': 'From Date'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'to_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 3,
|
||||
'label': 'To Date'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 4,
|
||||
'width': '40%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 5,
|
||||
'label': 'Get Open Documents',
|
||||
'options': 'get_open_docs'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 6,
|
||||
'options': 'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 7,
|
||||
'label': 'Clear Document Table',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'pp_so_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 8,
|
||||
'label': 'PP SO Details',
|
||||
'options': 'PP SO Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 9,
|
||||
'options': 'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_order',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 10,
|
||||
'label': 'Sales Order',
|
||||
'options': 'Sales Order'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'production_forecast',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 1,
|
||||
'idx': 11,
|
||||
'label': 'Production Forecast',
|
||||
'options': 'Production Forecast'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 12,
|
||||
'width': '40%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 13,
|
||||
'label': 'Add In Plan',
|
||||
'options': 'pull_document'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Click on "Get Items" to get un-fulfilled items from your Sales Orders. After setting the quantities you can raise Production Orders or download the material requirements for analysis',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 14,
|
||||
'label': 'Items'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 15,
|
||||
'label': 'Get Items',
|
||||
'options': 'get_items'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 16,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 17,
|
||||
'label': 'Clear Item Table',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 18,
|
||||
'options': 'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'No',
|
||||
'description': 'Select "Yes" if stock is maintained and tracked for sub assembly items.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'consider_sa_items',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 19,
|
||||
'label': 'Consider Sub Assemblies',
|
||||
'options': 'No\nYes',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'pp_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 20,
|
||||
'label': 'PP Details',
|
||||
'options': 'PP Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 21,
|
||||
'options': 'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 22,
|
||||
'label': 'Raise Production Order',
|
||||
'options': 'raise_production_order'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 23,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 24,
|
||||
'label': 'Download Raw Material Report',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 25,
|
||||
'label': 'Company Info'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fiscal_year',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 26,
|
||||
'in_filter': 1,
|
||||
'label': 'Fiscal Year',
|
||||
'options': 'Link:Fiscal Year'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 27,
|
||||
'label': 'Company',
|
||||
'options': 'Company'
|
||||
}
|
||||
]
|
||||
@@ -1,5 +0,0 @@
|
||||
//get query select Territory
|
||||
//=======================================================================================================================
|
||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def get_open_sales_order(self):
|
||||
if not (self.doc.from_date and self.doc.to_date):
|
||||
msgprint("From Date and To Date are Mandatory")
|
||||
return
|
||||
|
||||
cond = ''
|
||||
if self.doc.customer:
|
||||
cond += " AND t1.customer = '%s' " % self.doc.customer
|
||||
if self.doc.sales_order:
|
||||
cond += " AND t1.name = '%s' " % self.doc.sales_order
|
||||
if self.doc.territory:
|
||||
cond += " AND t1.territory = '%s' " %self.doc.territory
|
||||
|
||||
dl = sql("select distinct t1.name, t1.customer, t1.delivery_date, t1.territory, t1.rounded_total from `tabSales Order` t1, `tabSales Order Detail` t2 where t1.transaction_date >= '%s' and t1.transaction_date <= '%s' and t1.docstatus=1 and t1.status != 'Completed' and t1.name = t2.parent and t2.docstatus =1 and t2.qty > t2.delivered_qty and (t2.confirmation_date is null or t2.confirmation_date= '' or t2.confirmation_date='0000-00-00') %s"% (self.doc.from_date, self.doc.to_date, cond))
|
||||
self.doc.clear_table(self.doclist, 'entries')
|
||||
count = 0
|
||||
for d in dl:
|
||||
nl = addchild(self.doc, 'entries', 'Update Delivery Date Detail', 1, self.doclist)
|
||||
nl.sales_order_no = str(d[0])
|
||||
nl.customer = str(d[1])
|
||||
nl.territory = str(d[3])
|
||||
nl.rounded_total = str(d[4])
|
||||
nl.delivery_date = str(d[2])
|
||||
count = count +1
|
||||
if not count:
|
||||
msgprint("No Sales Order found as per filters set.")
|
||||
|
||||
def update_sales_order(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.confirmation_date:
|
||||
sql("update `tabSales Order Detail` set confirmation_date = %s where parent = %s ", (d.confirmation_date, d.sales_order_no))
|
||||
msgprint("Updated")
|
||||
@@ -1,150 +0,0 @@
|
||||
# DocType, Update Delivery Date
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:29',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 5
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Update Delivery Date',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'name': '__common__',
|
||||
'parent': 'Update Delivery Date',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Update Delivery Date
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Update Delivery Date'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'from_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 1,
|
||||
'label': 'From Date',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'to_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 2,
|
||||
'label': 'To Date',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'Customer',
|
||||
'options': 'Customer'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_order',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 4,
|
||||
'label': 'Sales Order',
|
||||
'options': 'Sales Order'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 5,
|
||||
'label': 'Company',
|
||||
'options': 'link:Company'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'territory',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 6,
|
||||
'label': 'Territory',
|
||||
'options': 'Territory',
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 7,
|
||||
'label': 'Get Open Sales Order',
|
||||
'options': 'get_open_sales_order'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': 'No Toolbar',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'entries',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 8,
|
||||
'label': 'Entries',
|
||||
'options': 'Update Delivery Date Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 9,
|
||||
'label': 'Update Sales Order',
|
||||
'options': 'update_sales_order'
|
||||
}
|
||||
]
|
||||
@@ -1,143 +0,0 @@
|
||||
# DocType, Update Delivery Date Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:29',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Update Delivery Date Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, Update Delivery Date Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Update Delivery Date Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_order_no',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'label': 'Sales Order No',
|
||||
'oldfieldname': 'sales_order_no',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Sales Order',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Customer',
|
||||
'oldfieldname': 'customer',
|
||||
'oldfieldtype': 'Data',
|
||||
'options': 'Customer',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'city',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'label': 'City',
|
||||
'oldfieldname': 'city',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'state',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 4,
|
||||
'label': 'State',
|
||||
'oldfieldname': 'state',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'State',
|
||||
'permlevel': 0,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'territory',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 5,
|
||||
'label': 'Territory',
|
||||
'oldfieldname': 'territory',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Territory',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rounded_total',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 6,
|
||||
'label': 'Total Amount',
|
||||
'oldfieldname': 'rounded_total',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'delivery_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 7,
|
||||
'label': 'Expected Delivery Date',
|
||||
'oldfieldname': 'delivery_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'confirmation_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 8,
|
||||
'label': 'Confirmation Date',
|
||||
'oldfieldname': 'confirmation_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def update_bom_operation(self):
|
||||
bom_list = sql(" select DISTINCT parent from `tabBOM Operation` where workstation = '%s'" % self.doc.name)
|
||||
for bom_no in bom_list:
|
||||
sql("update `tabBOM Operation` set hour_rate = '%s' where parent = '%s' and workstation = '%s'"%( self.doc.hour_rate, bom_no[0], self.doc.name))
|
||||
|
||||
def on_update(self):
|
||||
set(self.doc, 'overhead', flt(self.doc.hour_rate_electricity) + flt(self.doc.hour_rate_consumable) + flt(self.doc.hour_rate_rent))
|
||||
set(self.doc, 'hour_rate', flt(self.doc.hour_rate_labour) + flt(self.doc.overhead))
|
||||
self.update_bom_operation()
|
||||
@@ -1,284 +0,0 @@
|
||||
# DocType, Workstation
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:31',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-01-04 13:40:42',
|
||||
'modified_by': 'rahul@webnotestech.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'allow_trash': 1,
|
||||
'autoname': 'field:workstation_name',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 11
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Workstation',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Workstation',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Workstation
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Workstation'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'role': 'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 0,
|
||||
'role': 'Production User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 0,
|
||||
'role': 'Production User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 1,
|
||||
'role': 'Production Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 1,
|
||||
'role': 'Production User'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 1,
|
||||
'label': 'Trash Reason',
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'workstation_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Workstation Name',
|
||||
'oldfieldname': 'workstation_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'warehouse',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'Warehouse',
|
||||
'oldfieldname': 'warehouse',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Warehouse',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 4,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'capacity',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 5,
|
||||
'label': 'Capacity',
|
||||
'oldfieldname': 'capacity',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'capacity_units',
|
||||
'fieldtype': 'Select',
|
||||
'hidden': 1,
|
||||
'idx': 6,
|
||||
'label': 'Capacity Units',
|
||||
'oldfieldname': 'capacity_units',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nUnits/Shifts\nUnits/Hour',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'hour_rate_labour',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Hour Rate Labour',
|
||||
'oldfieldname': 'hour_rate_labour',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 8,
|
||||
'label': 'Over Heads',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'hour_rate_electricity',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Hour Rate Electricity',
|
||||
'oldfieldname': 'hour_rate_electricity',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'hour_rate_consumable',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 10,
|
||||
'label': 'Hour Rate Consumable',
|
||||
'oldfieldname': 'hour_rate_consumable',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'hour_rate_rent',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 11,
|
||||
'label': 'Hour Rate Rent',
|
||||
'oldfieldname': 'hour_rate_rent',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'overhead',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 12,
|
||||
'label': 'Overhead',
|
||||
'oldfieldname': 'overhead',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 13,
|
||||
'label': 'Hour Rate',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'hour_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 14,
|
||||
'label': 'Hour Rate',
|
||||
'oldfieldname': 'hour_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
@@ -1,44 +0,0 @@
|
||||
<div style="margin:0px">
|
||||
<div id="bom_header"> </div>
|
||||
<!--
|
||||
<div style="color: #444444;" mce_style="color: #444444;">
|
||||
<table style="width: 100%;" border="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="standard_title" style="width: 70%;">Bill of Materials</td>
|
||||
<td style="width: 30%; text-align: right; vertical-align: top;"><span class="link_type" style="vertical-align:top" mce_style="vertical-align:top"> <img style="cursor:pointer" mce_style="cursor:pointer" onclick="nav_obj.show_last_open()" src="images/ui/close_btn.gif" mce_src="images/ui/close_btn.gif" alt="" /> </span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
--> <!-- table.coa_toolbar td { vertical-align: middle; } --> <!--
|
||||
<div style="margin-top: 16px; padding: 4px; background-color: #EEE; border: 1px solid #AAA;" mce_style="margin-top: 16px; padding: 4px; background-color: #EEE; border: 1px solid #AAA;">
|
||||
<table class="coa_toolbar" border="0" cellspacing="2px">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Item Group:</td>
|
||||
<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="bom_item_group"></select></td>
|
||||
<td>Enter Item Code:</td>
|
||||
<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="bom_item_code"></select></td>
|
||||
<td>Enter BOM No:</td>
|
||||
<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="bom_bom_no"></select></td>
|
||||
<td>
|
||||
<div id="bom_refresh"></div>
|
||||
</td>
|
||||
<td>
|
||||
<div id="bom_calculate_cost"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
--> <!--
|
||||
<div style="margin: 0px 16px 16px; overflow: auto; padding-top: 4px; height: 300px;">-->
|
||||
<div style="overflow: auto; margin-top: 8px; padding-top: 4px; height: 300px;">
|
||||
<div style="width: 900px;">
|
||||
<div id="bom_head_op" style="display: none;"></div>
|
||||
<div id="bom_head_it" style="display: none; border-bottom: 2px solid #444;"></div>
|
||||
<div id="bom_tree"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,508 +0,0 @@
|
||||
pscript['onload_Bill of Materials'] = function() {
|
||||
|
||||
// header and toolbar
|
||||
var h = new PageHeader('bom_header','Bill of Materials','BOM gives the breakdown of cost for product');
|
||||
|
||||
var dv = $a(h.toolbar_area,'div','',{margin:'4px 0px'});
|
||||
|
||||
var tbl = make_table(dv, 1,3,'480px',[],{padding:'4px', width:'160px'});
|
||||
|
||||
var sel = $a($td(tbl,0,0),'select','',{width:'160px'});
|
||||
sel.id = 'bom_item_group';
|
||||
|
||||
var sel = $a($td(tbl,0,1),'select','',{width:'160px'});
|
||||
sel.id = 'bom_item_code'; sel.innerHTML = 'Select Item Code...'; sel.disabled = 1;
|
||||
|
||||
var sel = $a($td(tbl,0,2),'select','',{width:'160px'});
|
||||
sel.id = 'bom_bom_no'; sel.innerHTML = 'Select Bom No...'; sel.disabled = 1;
|
||||
|
||||
h.add_button('Calculate Cost', function(){ pscript.bom_calculate_cost(pscript.bom_no); },1,'ui-icon-calculator');
|
||||
h.add_button('Refresh', function(){ pscript.bom_refresh(); },0,'ui-icon-refresh');
|
||||
h.add_button('Collapse All', function(){pscript.collapse_all();},0,'');
|
||||
|
||||
// select for Item Group
|
||||
//$i('bom_item_group').style.width = '180px';
|
||||
// $i('bom_item_code').style.width = '110px';
|
||||
// $i('bom_bom_no').style.width = '150px';
|
||||
$i('bom_tree').innerHTML = 'Please Select Item Group';
|
||||
add_sel_options($i('bom_item_group'), ['Loading ... ']);
|
||||
|
||||
$c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_item_group'}, function(r,rt) {
|
||||
pscript.item_group = r.message.split('~~~');
|
||||
empty_select($i('bom_item_group'));
|
||||
// add_sel_options($i('bom_item_group'), add_lists([' '], pscript.item_group), ' ');
|
||||
add_sel_options($i('bom_item_group'), add_lists(['Select Item Group...'], pscript.item_group), 'Select Item Group...');
|
||||
$i('bom_item_group').onchange = function() {
|
||||
|
||||
//$i('bom_item_code').innerHTML = '';
|
||||
// $i('bom_bom_no').innerHTML = '';
|
||||
$i('bom_head_op').innerHTML = '';
|
||||
$i('bom_head_it').innerHTML = '';
|
||||
$i('bom_tree').innerHTML = 'Please Select Item Code';
|
||||
pscript.bom_select_item_code(sel_val(this));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pscript.bom_select_item_code = function(item_group) {
|
||||
|
||||
//select for Item Code
|
||||
|
||||
add_sel_options($i('bom_item_code'), ['Loading ... ']);
|
||||
|
||||
$c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_item_code', 'arg':item_group}, function(r,rt) {
|
||||
pscript.item_code = r.message.split('~~~');
|
||||
empty_select($i('bom_item_code'));
|
||||
add_sel_options($i('bom_item_code'), add_lists(['Select Item Code...'], pscript.item_code), 'Select Item Code...');
|
||||
if(sel_val($i('bom_item_code')) == 'Select Item Group...'){
|
||||
$i('bom_item_code').disabled = 1;
|
||||
$i('bom_bom_no').disabled = 1;
|
||||
}
|
||||
else{ $i('bom_item_code').disabled = 0; }
|
||||
|
||||
$i('bom_item_code').onchange = function() {
|
||||
// $i('bom_bom_no').innerHTML = '';
|
||||
$i('bom_head_op').innerHTML = '';
|
||||
$i('bom_head_it').innerHTML = '';
|
||||
$i('bom_tree').innerHTML = 'Please Select BOM NO.';
|
||||
pscript.bom_select_bom_no(sel_val(this));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
pscript.bom_select_bom_no = function(item_code) {
|
||||
|
||||
//select for BOM NO
|
||||
|
||||
add_sel_options($i('bom_bom_no'), ['Loading ... ']);
|
||||
|
||||
$c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_bom_no', 'arg':item_code}, function(r,rt) {
|
||||
var bom_list = r.message.split('~~~');
|
||||
empty_select($i('bom_bom_no'));
|
||||
empty_select($i('bom_bom_no'));
|
||||
add_sel_options($i('bom_bom_no'), add_lists(['Select Bom No...'], bom_list), 'Select Bom No...');
|
||||
if(sel_val($i('bom_item_code')) == 'Select Item Code...'){
|
||||
$i('bom_bom_no').disabled = 1;
|
||||
}
|
||||
else{
|
||||
$i('bom_bom_no').disabled = 0;
|
||||
}
|
||||
|
||||
$i('bom_bom_no').onchange = function() {
|
||||
$i('bom_head_op').innerHTML = '';
|
||||
$i('bom_head_it').innerHTML = '';
|
||||
$i('bom_tree').innerHTML = 'Loading...';
|
||||
pscript.show_bom(); }
|
||||
});
|
||||
}
|
||||
|
||||
// Refresh Function
|
||||
pscript.bom_refresh = function() {
|
||||
$i('bom_head_op').innerHTML = '';
|
||||
$i('bom_head_it').innerHTML = '';
|
||||
$i('bom_tree').innerHTML = 'Refreshing....';
|
||||
pscript.show_bom();
|
||||
}
|
||||
|
||||
//Calculate Cost Function
|
||||
pscript.bom_calculate_cost = function() {
|
||||
$i('bom_head_op').innerHTML = '';
|
||||
$i('bom_head_it').innerHTML = '';
|
||||
$i('bom_tree').innerHTML = ' Calculating Cost...';
|
||||
$c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'calculate_cost', 'arg':pscript.bom_no}, function(r,rt) {
|
||||
var calculated = r.message;
|
||||
if (calculated == 'calculated') {pscript.show_bom();}
|
||||
else {$i('bom_tree').innerHTML = "Sorry it's taking too long try next time....";}
|
||||
});
|
||||
}
|
||||
|
||||
pscript.collapse_all = function(){
|
||||
alert("In");
|
||||
pscript.bom_tree.collapseall()
|
||||
}
|
||||
|
||||
pscript.show_bom = function () {
|
||||
pscript.item_code = $i('bom_item_code').value;
|
||||
pscript.bom_no = $i('bom_bom_no').value;
|
||||
// $i('bom_refresh').innerHTML = '';
|
||||
//$i('bom_refresh').innerHTML = "<input type='button' value='Refresh' onClick='javascript:pscript.bom_refresh()' />";
|
||||
//$i('bom_calculate_cost').innerHTML = "<input type='button' value='Calculate Cost' onClick='javascript:pscript.bom_calculate_cost(pscript.bom_no)' />";
|
||||
if (pscript.item_code == "") {
|
||||
alert("Please Enter Item Code");
|
||||
return;
|
||||
}
|
||||
if (pscript.bom_no == "") {
|
||||
alert("Please Enter BOM No");
|
||||
return;
|
||||
}
|
||||
$ds('bom_head_op');
|
||||
$ds('bom_head_it');
|
||||
$ds('bom_tree');
|
||||
pscript.bom_onexp = function(node) {
|
||||
//alert("Server Call")
|
||||
if(!node.expanded_once) {
|
||||
$ds(node.loading_div);
|
||||
if (!node.is_item){
|
||||
// We will get List Of Items and BOM for particular Operation
|
||||
data = "{'op_no':'" + node.text[1] +"','bom_no':'" + node.text[3] +"'}";
|
||||
$c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_item_bom', 'arg':data},
|
||||
function(r,rt) {
|
||||
$dh(node.loading_div);
|
||||
var nl = r.message;
|
||||
for(var i=0; i<nl.length; i++) {
|
||||
if (nl[i][8] == 1) {
|
||||
pscript.bom_tree.addNode(node,$i('bom_head_op'), nl[i], 'images/icons/box.png', null, null);
|
||||
}
|
||||
else {
|
||||
pscript.bom_tree.addNode(node,$i('bom_head_op'), nl[i], 'images/icons/package.png', null, pscript.bom_onexp);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//alert("bom_no:%s"%node.text[2])
|
||||
//We will get List Of Operations for particular Item and BOM
|
||||
$c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_operations', 'arg':node.text[3]},
|
||||
function(r,rt) {
|
||||
$dh(node.loading_div);
|
||||
var nl = r.message;
|
||||
for(var i=0; i<nl.length; i++) {
|
||||
pscript.bom_tree.addNode(node, $i('bom_head_op'), nl[i], 'images/icons/folder.png', null, pscript.bom_onexp);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// First this function will execute and we will get list of operations
|
||||
$c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_operations', 'arg':pscript.bom_no}, function(r,rt) {
|
||||
var nl = r.message;
|
||||
|
||||
$i('bom_tree').innerHTML = '';
|
||||
var t = new Tree($i('bom_tree'),$i('bom_head_op'),$i('bom_head_it'));
|
||||
|
||||
pscript.bom_tree = t;
|
||||
pscript.bom_curnode = null;
|
||||
|
||||
for(var i=0; i<nl.length; i++) {
|
||||
t.addNode(null, $i('bom_head_op'), nl[i], 'images/icons/folder.png', null, pscript.bom_onexp);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Tree
|
||||
//
|
||||
|
||||
function Tree(parent,head_op,head_it) {
|
||||
this.container = parent;
|
||||
this.heading = head_op;
|
||||
this.nodes = {};
|
||||
this.all_nodes = [];
|
||||
|
||||
var me = this;
|
||||
|
||||
this.body = $a(parent, 'div');
|
||||
this.hopbody = $a(head_op, 'div');
|
||||
this.hitbody = $a(head_it, 'div');
|
||||
|
||||
// columns
|
||||
this.col_details = [
|
||||
['340px','Opn No', 'Opn Descr','Item Code', 'Description',1,2]
|
||||
,['150px','BOM' , 'BOM', 3]
|
||||
,['80px', 'Workstn', 'Qty', 4]
|
||||
,['45px', 'Hr Rate','Stock UOM',5]
|
||||
,['45px', 'Time','Scrap',6]
|
||||
,['50px', 'Mat Cost','Rate',7]
|
||||
,['45px', 'Op Cost','',8]
|
||||
,['50px', 'Tot Cost','',9]
|
||||
,['25px', 'Refresh']
|
||||
]
|
||||
|
||||
// Operation header
|
||||
this.hopbody_tab = $a(this.hopbody, 'table');
|
||||
$y(this.hopbody_tab, {borderCollapse:'collapse', tableLayout:'fixed'})
|
||||
|
||||
var r0 = this.hopbody_tab.insertRow(0);
|
||||
for(var i=0; i<this.col_details.length; i++) {
|
||||
var c = r0.insertCell(i);
|
||||
c.style.width = this.col_details[i][0];
|
||||
c.style.padding = '2px';
|
||||
c.style.border = '1px solid #DDD';
|
||||
if (i > 0 && this.col_details[i][1] != 'Refresh') c.innerHTML = this.col_details[i][1];
|
||||
}
|
||||
this.hopbody_label = $a(r0.cells[0], 'div');
|
||||
var hopbody_nodetab = $a(this.hopbody_label, 'table');
|
||||
$y(hopbody_nodetab, {borderCollapse:'collapse', tableLayout:'fixed'})
|
||||
|
||||
var r0 = hopbody_nodetab.insertRow(0);
|
||||
var c = r0.insertCell(0); c.style.width = '16px';
|
||||
var c = r0.insertCell(1); c.style.width = '20px'; c.innerHTML = "<img src='images/icons/wrench.png' />";
|
||||
var c = r0.insertCell(2); c.style.width = '80px'; c.innerHTML = this.col_details[0][1];
|
||||
l=340-116;
|
||||
var c = r0.insertCell(3); c.style.width = l+'px'; c.innerHTML = this.col_details[0][2];
|
||||
|
||||
// Item Header
|
||||
this.hitbody_tab = $a(this.hitbody, 'table');
|
||||
$y(this.hitbody_tab, {borderCollapse:'collapse', tableLayout:'fixed'})
|
||||
|
||||
var r0 = this.hitbody_tab.insertRow(0);
|
||||
for(var i=0; i<this.col_details.length; i++) {
|
||||
var c = r0.insertCell(i);
|
||||
c.style.width = this.col_details[i][0];
|
||||
c.style.padding = '2px';
|
||||
c.style.border = '1px solid #DDD';
|
||||
if (i > 0 && this.col_details[i][1] != 'Refresh') c.innerHTML = this.col_details[i][2];
|
||||
}
|
||||
this.hitbody_label = $a(r0.cells[0], 'div');
|
||||
var hitbody_nodetab = $a(this.hitbody_label, 'table');
|
||||
$y(hitbody_nodetab, {borderCollapse:'collapse', tableLayout:'fixed'})
|
||||
|
||||
var r0 = hitbody_nodetab.insertRow(0);
|
||||
var c = r0.insertCell(0); c.style.width = '16px';
|
||||
var c = r0.insertCell(1); c.style.width = '20px'; c.innerHTML = "<img src='images/icons/package.png' />";
|
||||
var c = r0.insertCell(2); c.style.width = '100px'; c.innerHTML = this.col_details[0][3];
|
||||
l=350-136;
|
||||
var c = r0.insertCell(3); c.style.width = l+'px'; c.innerHTML = this.col_details[0][4];
|
||||
|
||||
this.addNode = function(parent, head_op, label, imagesrc, onclick, onexpand) {
|
||||
var t = new TreeNode(me, parent, head_op, label, imagesrc, onclick, onexpand);
|
||||
if(!parent) {
|
||||
me.nodes[label]=t; // add to roots
|
||||
} else {
|
||||
parent.nodes[label] = t; // add to the node
|
||||
}
|
||||
|
||||
this.all_nodes.push(t);
|
||||
|
||||
// note: this will only be for groups
|
||||
if(onexpand)t.create_expimage();
|
||||
t.expanded_once = false;
|
||||
|
||||
return t;
|
||||
|
||||
}
|
||||
|
||||
this.deleteNode = function(node) {
|
||||
node.container.remove(node);
|
||||
|
||||
}
|
||||
var me = this;
|
||||
|
||||
this.collapseall = function() {
|
||||
//alert("collapseall")
|
||||
for(n in me.nodes) {
|
||||
if (me.nodes[n].expimage){
|
||||
l = me.nodes[n].get_list_of_child_nodes()
|
||||
for (var i=0; i < l.length; i++ ) l[i].collapse(l[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function TreeNode(tree, parent, head_op, label, imagesrc, onclick, onexpand) {
|
||||
|
||||
var me = this;
|
||||
this.parent = parent;
|
||||
this.head = head_op;
|
||||
this.nodes = {};
|
||||
this.onclick = onclick;
|
||||
this.onexpand = onexpand;
|
||||
this.text = label;
|
||||
|
||||
if(!parent) {
|
||||
var container = tree.body;
|
||||
}
|
||||
else {
|
||||
var container = parent.body;
|
||||
}
|
||||
var h_container = tree.hopbody;
|
||||
|
||||
var t = $a(container, "div");
|
||||
var ht = $a(h_container, "div");
|
||||
|
||||
t.style.display = "none";
|
||||
ht.style.display = "none";
|
||||
|
||||
this.node_area = $a(t, "div");
|
||||
this.node_area.style.cursor = 'pointer';
|
||||
|
||||
this.loading_div = $a(container, "div");
|
||||
this.loading_div.innerHTML = 'Loading...';
|
||||
$dh(this.loading_div);
|
||||
|
||||
// main table
|
||||
this.tab = $a(this.node_area, 'table');
|
||||
$y(this.tab, {borderCollapse:'collapse', tableLayout:'fixed'})
|
||||
|
||||
var r0 = this.tab.insertRow(0);
|
||||
for(var i=0; i<tree.col_details.length; i++) {
|
||||
var c = r0.insertCell(i);
|
||||
c.style.width = tree.col_details[i][0];
|
||||
c.style.padding = '2px';
|
||||
c.style.border = '1px solid #DDD';
|
||||
}
|
||||
|
||||
this.label = $a(r0.cells[0], 'div');
|
||||
|
||||
var m=0;
|
||||
var tn = this;
|
||||
|
||||
while(tn.parent){m+=16;tn=tn.parent;}
|
||||
this.label.style.marginLeft = m+'px';
|
||||
this.loading_div.style.marginLeft = m+40+'px';
|
||||
var l = 350 - m;
|
||||
this.body = $a(t, 'div'); // children will come here
|
||||
|
||||
// make the node
|
||||
var nodetab = $a(this.label, 'table');
|
||||
$y(nodetab, {borderCollapse:'collapse', tableLayout:'fixed'})
|
||||
|
||||
var r0 = nodetab.insertRow(0);
|
||||
var c = r0.insertCell(0); c.style.width = '16px';
|
||||
var c = r0.insertCell(1); c.style.width = '20px';
|
||||
var c = r0.insertCell(2); c.style.width = '100px';
|
||||
l=l-136;
|
||||
|
||||
var c = r0.insertCell(3); c.style.width = l+'px';
|
||||
// BOM - is it item or operation
|
||||
this.is_item = 1;
|
||||
if(label[0] == 'operation') {
|
||||
this.is_item = 0;
|
||||
imagesrc = 'images/icons/wrench.png';
|
||||
}
|
||||
|
||||
if(!imagesrc) imagesrc = "images/icons/folder.png";
|
||||
this.usrimg = $a(nodetab.rows[0].cells[1], 'img');
|
||||
this.usrimg.src = imagesrc;
|
||||
|
||||
|
||||
//this.node_area.onmouseover = function() {this.style.backgroundColor = '#DEF'; }
|
||||
//this.node_area.onmouseout = function() { this.style.backgroundColor = '#FFF'; }
|
||||
|
||||
this.create_expimage = function() {
|
||||
if(!me.expimage) {
|
||||
me.expimage = $a(nodetab.rows[0].cells[0], 'img');
|
||||
me.expimage.style.marginTop = "3px";
|
||||
me.expimage.src = "images/icons/plus.gif";
|
||||
me.expimage.onclick = me.toggle;
|
||||
me.expimage.node = me;
|
||||
}
|
||||
}
|
||||
|
||||
this.get_list_of_child_nodes = function() {
|
||||
var main_l = [];
|
||||
for (n in me.nodes){
|
||||
if(!me.expimage){}
|
||||
else{
|
||||
var l = [];
|
||||
if (me.nodes[n].get_list_of_child_nodes()) l = me.nodes[n].get_list_of_child_nodes();
|
||||
for(var i=0 ; i < l.length; i ++){
|
||||
main_l.push(l[i]);
|
||||
}
|
||||
alert(1);
|
||||
main_l.push(me.nodes[n]);
|
||||
alert(2);
|
||||
}
|
||||
}
|
||||
return main_l
|
||||
}
|
||||
|
||||
this.select = function() {
|
||||
me.show_selected();
|
||||
if(this.onclick)this.onclick(this);
|
||||
}
|
||||
this.show_selected = function() {
|
||||
if(pscript.bom_curnode)pscript.bom_curnode.deselect();
|
||||
me.tab.style.backgroundColor = '#DEF';
|
||||
if(me.is_item == 1) tree.hitbody_tab.style.backgroundColor = '#DEF';
|
||||
if(me.is_item == 0) tree.hopbody_tab.style.backgroundColor = '#DEF';
|
||||
me.tab.style.fontWeight = 'bold';
|
||||
pscript.bom_curnode = me;
|
||||
$ds(me.refresh);
|
||||
}
|
||||
|
||||
this.deselect = function() {
|
||||
me.tab.style.fontWeight = 'normal';
|
||||
pscript.bom_curnode=null;
|
||||
me.tab.style.backgroundColor = '#FFF';
|
||||
tree.hopbody_tab.style.backgroundColor = '#FFF';
|
||||
tree.hitbody_tab.style.backgroundColor = '#FFF';
|
||||
$dh(me.refresh);
|
||||
}
|
||||
|
||||
|
||||
var expanded = 1;
|
||||
this.toggle = function(node) {
|
||||
//alert("toggle")
|
||||
if(!me.expimage)return;
|
||||
if(me.expanded)me.collapse(this.node);
|
||||
else me.expand(this.node);
|
||||
}
|
||||
this.collapse = function(node) {
|
||||
//alert("collapse")
|
||||
if(!node.expimage)return;
|
||||
node.body.style.display = 'none';
|
||||
if(node.expimage.src)node.expimage.src = "images/icons/plus.gif";
|
||||
node.expanded = 0;
|
||||
}
|
||||
this.expand = function(node) {
|
||||
//alert("expand")
|
||||
if(!node.expimage)return;
|
||||
if(node.onexpand)node.onexpand(node);
|
||||
node.body.style.display = 'block';
|
||||
if(node.expimage.src)node.expimage.src = "images/icons/minus.gif";
|
||||
node.expanded = 1;
|
||||
node.expanded_once = 1;
|
||||
}
|
||||
|
||||
// BOM - Set values
|
||||
for(var i=0;i<tree.col_details.length; i++) {
|
||||
if ( i == 0) {
|
||||
if(this.is_item == 1) {
|
||||
var c = $a( nodetab.rows[0].cells[2], 'span', 'link_type');
|
||||
c.item_code = label[tree.col_details[i][5]]
|
||||
c.onclick = function() { loaddoc("Item", this.item_code); }
|
||||
}
|
||||
if(this.is_item == 0) var c = nodetab.rows[0].cells[2];
|
||||
var d = nodetab.rows[0].cells[3];
|
||||
c.innerHTML = label[tree.col_details[i][5]];
|
||||
d.innerHTML = label[tree.col_details[i][6]].substring(0,15) + '...';
|
||||
}
|
||||
if(i==1) {
|
||||
var c = $a(this.tab.rows[0].cells[i], 'div', 'link_type', {overflow:'hidden', width:'100%'});
|
||||
c.bom_no = label[tree.col_details[i][3]]
|
||||
c.onclick = function() { loaddoc("Bill Of Materials", this.bom_no); }
|
||||
c.innerHTML = label[tree.col_details[i][3]];
|
||||
}
|
||||
if(this.is_item == 1 && i > 1 && i < 6) {
|
||||
var c = this.tab.rows[0].cells[i];
|
||||
c.innerHTML = label[tree.col_details[i][3]];
|
||||
}
|
||||
if(this.is_item == 0 && i > 1 && tree.col_details[i][1] != 'Refresh') {
|
||||
var c = this.tab.rows[0].cells[i];
|
||||
c.innerHTML = label[tree.col_details[i][3]];
|
||||
}
|
||||
if(tree.col_details[i][1] == 'Refresh') {
|
||||
this.refresh = $a(this.tab.rows[0].cells[i], 'span', 'link_type');
|
||||
this.refresh.onclick = function() {
|
||||
me.node = me
|
||||
if(me.node.expanded_once){
|
||||
me.node.body.innerHTML = '';
|
||||
me.node.expanded_once = 0
|
||||
me.expanded = 0
|
||||
me.toggle();
|
||||
}
|
||||
else {me.toggle()}
|
||||
}
|
||||
this.refresh.innerHTML = "<img src='images/icons/page_refresh.gif' />"
|
||||
$dh(this.refresh);
|
||||
}
|
||||
}
|
||||
|
||||
this.tab.onclick= function(e) { me.select(); }
|
||||
this.tab.ondblclick = function(e) { me.select(); if(me.ondblclick)me.ondblclick(me); }
|
||||
t.style.display = "block";
|
||||
ht.style.display = "block";
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
# Page, Bill of Materials
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-10-12 15:19:31',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-23 12:58:19',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'page_name': 'Bill of Materials',
|
||||
'show_in_menu': 1,
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# These values are common for all Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'name': '__common__',
|
||||
'parent': 'Bill of Materials',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Page'
|
||||
},
|
||||
|
||||
# Page, Bill of Materials
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': 'Bill of Materials'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'idx': 1,
|
||||
'role': 'Administrator'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'idx': 2,
|
||||
'role': 'Production User'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'idx': 3,
|
||||
'role': 'Production Manager'
|
||||
}
|
||||
]
|
||||
@@ -1,37 +0,0 @@
|
||||
# Search Criteria, consumption_against_production
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:32',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-06-11 16:32:48',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all Search Criteria
|
||||
{
|
||||
'add_col': '`tabProduction Order`.consider_sa_items',
|
||||
'add_cond': '`tabProduction Order`.name = `tabStock Entry`.production_order',
|
||||
'add_tab': '`tabProduction Order`',
|
||||
'columns': 'Stock Entry\x01ID,Stock Entry\x01Production Order,Stock Entry\x01Process,Stock Entry\x01Posting Date,Stock Entry\x01Company,Stock Entry Detail\x01Source Warehouse,Stock Entry Detail\x01Target Warehouse,Stock Entry Detail\x01FG Item,Stock Entry Detail\x01Item Code,Stock Entry Detail\x01Description,Stock Entry Detail\x01Reqd Qty,Stock Entry Detail\x01Transfer Quantity',
|
||||
'criteria_name': 'Consumption Against Production',
|
||||
'doc_type': 'Stock Entry Detail',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Stock Entry\x01Submitted':1,'Stock Entry\x01Purpose':'Production Order','Stock Entry\x01Process':''}",
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'parent_doc_type': 'Stock Entry',
|
||||
'sort_by': '`tabStock Entry`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# Search Criteria, consumption_against_production
|
||||
{
|
||||
'doctype': 'Search Criteria',
|
||||
'name': 'consumption_against_production'
|
||||
}
|
||||
]
|
||||
@@ -1,18 +0,0 @@
|
||||
report.customize_filters = function() {
|
||||
|
||||
//to hide all filters
|
||||
//this.hide_all_filters();
|
||||
|
||||
// to disable a filter from query set
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Status'].df.ignore = 1;
|
||||
|
||||
// to unhide required filters
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'From Confirmed Delivery Date'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'To Confirmed Delivery Date'].df.filter_hide = 0;
|
||||
|
||||
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
# Search Criteria, delivery_plan
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-09-01 15:48:09',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-08-30 14:06:22',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Search Criteria
|
||||
{
|
||||
'add_col': "SUM(`tabSales Order Detail`.`pending_qty` * `tabSales Order Detail`.`basic_rate` ) AS 'Amount'",
|
||||
'add_cond': "`tabSales Order Detail`.pending_qty > 0 and (`tabSales Order Detail`.confirmation_date is not null or `tabSales Order Detail`.confirmation_date!='' or `tabSales Order Detail`.confirmation_date != '00-00-0000')",
|
||||
'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Name',
|
||||
'criteria_name': 'Delivery Plan',
|
||||
'doc_type': 'Sales Order Detail',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
|
||||
'group_by': '`tabSales Order Detail`.`confirmation_date`, `tabSales Order`.`name`',
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'parent_doc_type': 'Sales Order',
|
||||
'sort_by': '`tabSales Order`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# Search Criteria, delivery_plan
|
||||
{
|
||||
'doctype': 'Search Criteria',
|
||||
'name': 'delivery_plan'
|
||||
}
|
||||
]
|
||||
@@ -1,16 +0,0 @@
|
||||
report.customize_filters = function() {
|
||||
|
||||
//to hide all filters
|
||||
this.hide_all_filters();
|
||||
|
||||
// to unhide required filters
|
||||
this.filter_fields_dict['Stock Entry'+FILTER_SEP +'ID'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Stock Entry'+FILTER_SEP +'Production Order'].df.filter_hide = 0;
|
||||
|
||||
this.filter_fields_dict['Stock Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Stock Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
|
||||
|
||||
this.filter_fields_dict['Stock Entry Detail'+FILTER_SEP +'Target Warehouse'].df.filter_hide = 0;
|
||||
|
||||
this.filter_fields_dict['Stock Entry Detail'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
# Search Criteria, itemwise_production_report
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:32',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-06-14 15:50:44',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all Search Criteria
|
||||
{
|
||||
'columns': 'Stock Entry\x01ID,Stock Entry\x01Posting Date,Stock Entry\x01Production Order,Stock Entry\x01Process,Stock Entry\x01Company,Stock Entry Detail\x01Target Warehouse,Stock Entry Detail\x01Item Code,Stock Entry Detail\x01Description,Stock Entry Detail\x01Stock UOM,Stock Entry Detail\x01Transfer Quantity',
|
||||
'criteria_name': 'Itemwise Production Report',
|
||||
'doc_type': 'Stock Entry Detail',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Stock Entry\x01Saved':1,'Stock Entry\x01Submitted':1,'Stock Entry\x01Purpose':'Production Order','Stock Entry\x01Process':'Backflush','Stock Entry Detail\x01FG Item':1}",
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'parent_doc_type': 'Stock Entry',
|
||||
'sort_by': '`tabStock Entry`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# Search Criteria, itemwise_production_report
|
||||
{
|
||||
'doctype': 'Search Criteria',
|
||||
'name': 'itemwise_production_report'
|
||||
}
|
||||
]
|
||||
@@ -1,34 +0,0 @@
|
||||
# Search Criteria, production_orders_in_process
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:32',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-06-15 10:01:15',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all Search Criteria
|
||||
{
|
||||
'add_cond': '`tabProduction Order`.qty > `tabProduction Order`.produced_qty',
|
||||
'columns': 'Production Order\x01ID,Production Order\x01Origin,Production Order\x01Status,Production Order\x01Posting Date,Production Order\x01Production Item,Production Order\x01BOM No,Production Order\x01Description,Production Order\x01Stock UOM,Production Order\x01Qty,Production Order\x01Produced Qty,Production Order\x01FG Warehouse,Production Order\x01WIP Warehouse,Production Order\x01Consider SA Items,Production Order\x01Fiscal Year,Production Order\x01Company',
|
||||
'criteria_name': 'Production Orders In Process',
|
||||
'doc_type': 'Production Order',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Production Order\x01Submitted':1,'Production Order\x01Origin':'','Production Order\x01Status':'','Production Order\x01Consider SA Items':'','Production Order\x01Fiscal Year':''}",
|
||||
'module': 'Production',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'sort_by': '`tabProduction Order`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# Search Criteria, production_orders_in_process
|
||||
{
|
||||
'doctype': 'Search Criteria',
|
||||
'name': 'production_orders_in_process'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user