restructured erpnext and deleted unwanted

This commit is contained in:
nabinhait
2011-07-01 13:34:41 +05:30
parent c1c54c9400
commit ec097975d0
1280 changed files with 54494 additions and 88652 deletions

View File

@@ -0,0 +1 @@
[{'modified_by': 'Administrator', 'name': 'Ticket', 'parent': None, 'dt_label': 'Task', 'creation': '2010-06-28 12:55:47', 'modified': '2010-06-28 12:55:47', 'module': 'Accounts', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'Ticket', 'parentfield': None}]

View File

@@ -0,0 +1,405 @@
[
{
'_last_update': None,
'_user_tags': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': u'DocType Mapper',
'from_doctype': 'Customer Issue',
'idx': None,
'modified': '2011-05-18 13:37:43',
'modified_by': 'Administrator',
'module': 'Mapper',
'name': 'Customer Issue-Maintenance Visit',
'owner': 'ashwini@webnotestech.com',
'parent': None,
'parentfield': None,
'parenttype': None,
'ref_doc_submitted': 1,
'to_doctype': 'Maintenance Visit'
},
{
'checking_operator': '=',
'creation': '2010-09-01 15:48:10',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer',
'idx': 1,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00555',
'owner': 'harshada@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:24',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_address',
'idx': 2,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': '000003470',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer_address'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_address',
'idx': 2,
'map': 'Yes',
'match_id': 0,
'modified': '2010-08-08 17:09:34',
'modified_by': 'Administrator',
'name': 'FMD/00012',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'address'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:24',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_person',
'idx': 3,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': '000003471',
'owner': 'Administrator',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_person'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_name',
'idx': 4,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00011',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer_name'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:24',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'address_display',
'idx': 5,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': '000003472',
'owner': 'Administrator',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'address_display'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:24',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_display',
'idx': 6,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': '000003473',
'owner': 'Administrator',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_display'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:24',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_mobile',
'idx': 7,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': '000003474',
'owner': 'Administrator',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_mobile'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:24',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_email',
'idx': 8,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': '000003475',
'owner': 'Administrator',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_email'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'territory',
'idx': 9,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00013',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'territory'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:24',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_group',
'idx': 10,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': '000003476',
'owner': 'Administrator',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer_group'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'company',
'idx': 11,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00014',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'company'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'fiscal_year',
'idx': 12,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00015',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'fiscal_year'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'name',
'idx': 13,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00016',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer_issue_no'
},
{
'checking_operator': '=',
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'complaint',
'idx': 14,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00017',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'description'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'item_code',
'idx': 15,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00018',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'item_code'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'item_name',
'idx': 16,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00019',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'item_name'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'doctype',
'idx': 17,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00020',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'prevdoc_doctype'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'name',
'idx': 18,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'FMD/00021',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'prevdoc_docname'
},
{
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Table Mapper Detail',
'from_field': None,
'from_table': 'Customer Issue',
'idx': 1,
'match_id': 1,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'TMD/0000003',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper',
'reference_doctype_key': 'prevdoc_doctype',
'reference_key': 'prevdoc_docname',
'to_field': 'maintenance_visit_details',
'to_table': 'Maintenance Visit Detail',
'validation_logic': 'docstatus=1'
},
{
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
'doctype': 'Table Mapper Detail',
'from_field': None,
'from_table': 'Customer Issue',
'idx': 2,
'match_id': 0,
'modified': '2011-05-20 15:54:24',
'modified_by': 'Administrator',
'name': 'TMD/0000004',
'owner': 'ashwini@webnotestech.com',
'parent': 'Customer Issue-Maintenance Visit',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper',
'reference_doctype_key': None,
'reference_key': 'prevdoc_docname',
'to_field': None,
'to_table': 'Maintenance Visit',
'validation_logic': 'docstatus=1'
}
]

View File

@@ -0,0 +1,369 @@
[
{
'_last_update': None,
'_user_tags': None,
'creation': '2010-08-08 17:09:35',
'docstatus': 0,
'doctype': u'DocType Mapper',
'from_doctype': 'Sales Order',
'idx': None,
'modified': '2011-05-18 11:05:26',
'modified_by': 'Administrator',
'module': 'Mapper',
'name': 'Sales Order-Maintenance Schedule',
'owner': 'Administrator',
'parent': None,
'parentfield': None,
'parenttype': None,
'ref_doc_submitted': 1,
'to_doctype': 'Maintenance Schedule'
},
{
'checking_operator': '=',
'creation': '2010-09-15 14:15:40',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer',
'idx': 1,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00594',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_address',
'idx': 2,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003515',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer_address'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_address',
'idx': 2,
'map': 'Yes',
'match_id': 0,
'modified': '2010-08-08 17:09:36',
'modified_by': 'Administrator',
'name': 'FMD/00398',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'address'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_person',
'idx': 3,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00399',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_person'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:35',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_name',
'idx': 4,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00397',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer_name'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'address_display',
'idx': 5,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003516',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'address_display'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_display',
'idx': 6,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003517',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_display'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_mobile',
'idx': 7,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003518',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_mobile'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_email',
'idx': 8,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003519',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_email'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'territory',
'idx': 9,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00400',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'territory'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_group',
'idx': 10,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003520',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer_group'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'company',
'idx': 11,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00401',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'company'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'name',
'idx': 12,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00402',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'sales_order_no'
},
{
'checking_operator': '=',
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'item_code',
'idx': 13,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00403',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'item_code'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'item_name',
'idx': 14,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00404',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'item_name'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'description',
'idx': 15,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00405',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'description'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'parent',
'idx': 16,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00406',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'prevdoc_docname'
},
{
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Table Mapper Detail',
'from_field': 'sales_order_details',
'from_table': 'Sales Order Detail',
'idx': 1,
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'TMD/0000041',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper',
'reference_doctype_key': None,
'reference_key': None,
'to_field': 'item_maintenance_detail',
'to_table': 'Item Maintenance Detail',
'validation_logic': 'docstatus =1'
},
{
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Table Mapper Detail',
'from_field': None,
'from_table': 'Sales Order',
'idx': 2,
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'TMD/0000042',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Schedule',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper',
'reference_doctype_key': None,
'reference_key': None,
'to_field': None,
'to_table': 'Maintenance Schedule',
'validation_logic': 'docstatus=1'
}
]

View File

@@ -0,0 +1,405 @@
[
{
'_last_update': None,
'_user_tags': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': u'DocType Mapper',
'from_doctype': 'Sales Order',
'idx': None,
'modified': '2011-05-18 13:35:55',
'modified_by': 'Administrator',
'module': 'Mapper',
'name': 'Sales Order-Maintenance Visit',
'owner': 'ashwini@webnotestech.com',
'parent': None,
'parentfield': None,
'parenttype': None,
'ref_doc_submitted': 1,
'to_doctype': 'Maintenance Visit'
},
{
'checking_operator': '=',
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer',
'idx': 1,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003521',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_address',
'idx': 2,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003522',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer_address'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_address',
'idx': 2,
'map': 'Yes',
'match_id': 0,
'modified': '2010-08-08 17:09:36',
'modified_by': 'Administrator',
'name': 'FMD/00408',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'address'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_person',
'idx': 3,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00409',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_person'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_name',
'idx': 4,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00407',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer_name'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'address_display',
'idx': 5,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003523',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'address_display'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_display',
'idx': 6,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003524',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_display'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_mobile',
'idx': 7,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003525',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_mobile'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'contact_email',
'idx': 8,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003526',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'contact_email'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'territory',
'idx': 9,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00410',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'territory'
},
{
'checking_operator': None,
'creation': '2011-05-20 15:54:27',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'customer_group',
'idx': 10,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': '000003527',
'owner': 'Administrator',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'customer_group'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'company',
'idx': 11,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00411',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'company'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'fiscal_year',
'idx': 12,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00412',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'fiscal_year'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'name',
'idx': 13,
'map': 'Yes',
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00413',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'sales_order_no'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'item_code',
'idx': 14,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00414',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'item_code'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'item_name',
'idx': 15,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00415',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'item_name'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'description',
'idx': 16,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00416',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'description'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'parent',
'idx': 17,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00417',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'prevdoc_docname'
},
{
'checking_operator': None,
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'parenttype',
'idx': 18,
'map': 'Yes',
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'FMD/00418',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'prevdoc_doctype'
},
{
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Table Mapper Detail',
'from_field': 'sales_order_details',
'from_table': 'Sales Order Detail',
'idx': 1,
'match_id': 1,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'TMD/0000043',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper',
'reference_doctype_key': None,
'reference_key': None,
'to_field': 'maintenance_visit_details',
'to_table': 'Maintenance Visit Detail',
'validation_logic': 'docstatus=1'
},
{
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'doctype': 'Table Mapper Detail',
'from_field': None,
'from_table': 'Sales Order',
'idx': 2,
'match_id': 0,
'modified': '2011-05-20 15:54:27',
'modified_by': 'Administrator',
'name': 'TMD/0000044',
'owner': 'ashwini@webnotestech.com',
'parent': 'Sales Order-Maintenance Visit',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper',
'reference_doctype_key': None,
'reference_key': None,
'to_field': None,
'to_table': 'Maintenance Visit',
'validation_logic': 'docstatus=1'
}
]

View File

@@ -0,0 +1,281 @@
[
{
'_last_update': None,
'creation': '2011-06-30 15:51:59',
'disabled': 'No',
'docstatus': 0,
'doctype': u'Module Def',
'doctype_list': 'DocType Label, Ticket',
'file_list': None,
'idx': None,
'is_hidden': 'No',
'last_updated_date': None,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'module_desc': 'Manage maintenance quotes, orders, schedule etc.',
'module_icon': 'Maintenance.gif',
'module_label': 'Support',
'module_name': 'Support',
'module_page': None,
'module_seq': 8,
'name': 'Support',
'owner': 'Administrator',
'parent': None,
'parentfield': None,
'parenttype': None,
'trash_reason': None,
'widget_code': None
},
{
'click_function': None,
'creation': '2011-06-30 15:51:59',
'description': 'A unique number identifying each entity of an item',
'display_name': 'Serial No',
'doc_name': 'Serial No',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'item_code\nstatus\npr_no\ndelivery_note_no\ncustomer',
'hide': None,
'icon': None,
'idx': 1,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDI01361',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:59',
'description': "Database of Support Ticket's raised by Customers",
'display_name': 'Support Ticket',
'doc_name': 'Support Ticket',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'status\nopening_date\ncustomer\nallocated_to',
'hide': None,
'icon': None,
'idx': 2,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDI01362',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:59',
'description': 'Create schedule based on maintenance order',
'display_name': 'Maintenance Schedule',
'doc_name': 'Maintenance Schedule',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'status\ntransaction_date\ncustomer\nsales_order_no',
'hide': None,
'icon': None,
'idx': 3,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDI01363',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:59',
'description': 'Database of issues raised your Customers',
'display_name': 'Customer Issue',
'doc_name': 'Customer Issue',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'status\ncomplaint_date\ncustomer\nallocated_to\nallocated_on',
'hide': None,
'icon': None,
'idx': 4,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDI01364',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:59',
'description': None,
'display_name': 'Maintenance Visit',
'doc_name': 'Maintenance Visit',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'status\nmntc_date\ncustomer\nmaintenance_type\ncompletion_status',
'hide': None,
'icon': None,
'idx': 5,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDI01365',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:59',
'description': 'List of all scheduled mainteance. You can filter by sales person, date, serial no etc. ',
'display_name': 'Maintenance Schedule Details',
'doc_name': 'Maintenance Schedule Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 6,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDI01366',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:59',
'description': 'List of all issues raised by customer',
'display_name': 'Customer Issues',
'doc_name': 'Customer Issue',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 7,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDI01367',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:59',
'description': None,
'display_name': 'Warranty/AMC Expiry Details',
'doc_name': 'Serial No',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 8,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDI01368',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:59',
'description': None,
'display_name': 'Warranty/AMC Summary',
'doc_name': 'Serial No',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 9,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDI01369',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:59',
'description': None,
'display_name': 'Maintenance Orderwise Pending Amount To Bill',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 10,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDI01370',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'creation': '2011-06-30 15:51:59',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 1,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDR00342',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Administrator'
},
{
'creation': '2011-06-30 15:51:59',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 2,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDR00343',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Maintenance User'
},
{
'creation': '2011-06-30 15:51:59',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 3,
'modified': '2011-07-01 09:36:38',
'modified_by': 'Administrator',
'name': 'MDR00344',
'owner': 'Administrator',
'parent': 'Support',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Maintenance Manager'
}
]

View File

@@ -0,0 +1 @@
[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Maintenance Manager', 'parent': None, 'creation': '2010-07-22 15:19:33', 'modified': '2010-07-22 15:19:33', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Maintenance Manager', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Maintenance User', 'parent': None, 'creation': '2010-07-22 15:19:19', 'modified': '2010-07-22 15:19:19', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Maintenance User', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'Administrator', 'name': 'Support Manager', 'parent': None, 'creation': '2010-12-28 15:17:40', 'modified': '2010-12-28 15:17:40', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Support Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'Administrator', 'name': 'Support Team', 'parent': None, 'creation': '2010-12-28 15:19:11', 'modified': '2010-12-28 15:19:11', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Support Team', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

0
support/__init__.py Normal file
View File

View File

View File

@@ -0,0 +1,116 @@
cur_frm.cscript.onload = function(doc,cdt,cdn){
if(!doc.status) set_multiple(dt,dn,{status:'Open'});
if(doc.__islocal){
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
}
cur_frm.cscript.refresh = function(doc,ct,cdn){
if(!doc.docstatus) hide_field('Make Maintenance Visit');
else if(doc.docstatus && (doc.status == 'Open' || doc.status == 'Work In Progress')) unhide_field('Make Maintenance Visit');
}
//customer
cur_frm.cscript.customer = function(doc,dt,dn) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
cur_frm.refresh();
}
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
}
cur_frm.fields_dict.customer_address.on_new = function(dn) {
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
}
cur_frm.fields_dict.contact_person.on_new = function(dn) {
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
}
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
}
cur_frm.cscript['Make Maintenance Visit'] = function(doc, cdt, cdn) {
if (doc.docstatus == 1) {
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_visit','',
function(r,rt){
if(r.message == 'No'){
n = createLocal("Maintenance Visit");
$c('dt_map', args={
'docs':compress_doclist([locals["Maintenance Visit"][n]]),
'from_doctype':'Customer Issue',
'to_doctype':'Maintenance Visit',
'from_docname':doc.name,
'from_to_list':"[['Customer Issue', 'Maintenance Visit'], ['Customer Issue', 'Maintenance Visit Detail']]"
}
, function(r,rt) {
loaddoc("Maintenance Visit", n);
}
);
}
else{
msgprint("You have already completed maintenance against this Customer Issue");
}
}
);
}
}
// ----------
// serial no
// ----------
cur_frm.fields_dict['serial_no'].get_query = function(doc, cdt, cdn) {
var cond = '';
if(doc.item_code) cond = ' AND `tabSerial No`.item_code = "'+ doc.item_code +'"';
return 'SELECT `tabSerial No`.name, `tabSerial No`.description FROM `tabSerial No` WHERE `tabSerial No`.docstatus != 2 AND `tabSerial No`.name LIKE "%s" '+cond+' ORDER BY `tabSerial No`.name ASC LIMIT 50';
}
cur_frm.add_fetch('serial_no', 'item_code', 'item_code');
cur_frm.add_fetch('serial_no', 'item_name', 'item_name');
cur_frm.add_fetch('serial_no', 'description', 'description');
cur_frm.add_fetch('serial_no', 'maintenance_status', 'warranty_amc_status');
cur_frm.add_fetch('serial_no', 'warranty_expiry_date', 'warranty_expiry_date');
cur_frm.add_fetch('serial_no', 'amc_expiry_date', 'amc_expiry_date');
cur_frm.add_fetch('serial_no', 'customer', 'customer');
cur_frm.add_fetch('serial_no', 'customer_name', 'customer_name');
cur_frm.add_fetch('serial_no', 'delivery_address', 'customer_address');
// ----------
// item code
// ----------
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
if(doc.serial_no){
return 'SELECT `tabSerial No`.item_code, `tabSerial No`.description FROM `tabSerial No` WHERE `tabSerial No`.docstatus != 2 AND `tabSerial No`.name = "'+ doc.serial_no +'" AND `tabSerial No`.item_code LIKE "%s" ORDER BY `tabSerial No`.item_code ASC LIMIT 50';
}
else{
return 'SELECT `tabItem`.name, `tabItem`.item_name, `tabItem`.description FROM `tabItem` WHERE `tabItem`.docstatus != 2 AND `tabItem`.name LIKE "%s" ORDER BY `tabItem`.name ASC LIMIT 50';
}
}
cur_frm.add_fetch('item_code', 'item_name', 'item_name');
cur_frm.add_fetch('item_code', 'description', 'description');
//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';
}

View File

@@ -0,0 +1,98 @@
# 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
# -----------------------------------------------------------------------------------------
from utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
self.prefix = is_testing and 'test' or 'tab'
def autoname(self):
#self.doc.name = make_autoname('CI/' + self.doc.fiscal_year + '/.######')
self.doc.name = make_autoname(self.doc.naming_series + '.######')
#def get_customer_details(self):
# details = sql("select address, territory, customer_group, customer_name from `tabCustomer` where name = '%s' and docstatus != 2" %(self.doc.customer), as_dict = 1)
# if details:
# ret = {
# 'customer_address' : details and details[0]['address'] or '',
# 'customer_name' : details and details[0]['customer_name'] or '',
# 'territory' : details and details[0]['territory'] or '',
# 'customer_group' : details and details[0]['customer_group'] or ''
# }
# # ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
# contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where customer_name = '%s' and is_customer = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(self.doc.customer), as_dict = 1)
# ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
# ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
# ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
#
# return cstr(ret)
# else:
# msgprint("Customer : %s does not exist in system." % (name))
# raise Exception
# Get customer's contact person details
# ==============================================================
#def get_contact_details(self):
# contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s' and docstatus != 2" %(self.doc.contact_person, self.doc.customer), as_dict = 1)
# ret = {
# 'contact_no' : contact and contact[0]['contact_no'] or '',
# 'email_id' : contact and contact[0]['email_id'] or ''
# }
# return str(ret)
#check if maintenance schedule already generated
#============================================
def check_maintenance_visit(self):
nm = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1 and t1.completion_status='Fully Completed'", self.doc.name)
nm = nm and nm[0][0] or ''
if not nm:
return cstr('No')
def on_submit(self):
if session['user'] != 'Guest':
if not self.doc.allocated_to:
msgprint("Please select service person name whom you want to assign this issue")
raise Exception
def validate(self):
if session['user'] != 'Guest' and not self.doc.customer:
msgprint("Please select Customer from whom issue is raised")
raise Exception
#if not self.doc.email_id and not self.doc.contact_no:
# msgprint("Please specify contact no. and/or email_id")
# raise Exception
#elif self.doc.email_id and not validate_email_add(self.doc.email_id.strip(' ')):
# msgprint('error:%s is not a valid email id' % self.doc.email_id)
# raise Exception
def on_cancel(self):
lst = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent = t1.name and t2.prevdoc_docname = '%s' and t1.docstatus!=2"%(self.doc.name))
if lst:
lst1 = ','.join([x[0] for x in lst])
msgprint("Maintenance Visit No. "+lst1+" already created against this customer issue. So can not be Cancelled")
raise Exception
else:
set(self.doc, 'status', 'Cancelled')
def on_update(self):
pass

View File

@@ -0,0 +1,674 @@
# DocType, Customer Issue
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:57',
'docstatus': 0,
'modified': '2011-05-27 18:30:14',
'modified_by': 'Administrator',
'owner': 'harshada@webnotestech.com'
},
# These values are common for all DocType
{
'_last_update': '1308741898',
'colour': 'White:FFF',
'doctype': 'DocType',
'module': 'Support',
'name': '__common__',
'search_fields': 'status,customer,customer_name,allocated_to,allocated_on, territory',
'section_style': 'Tabbed',
'server_code_error': ' ',
'show_in_menu': 0,
'subject': '%(complaint)s By %(complaint_raised_by)s on %(issue_date)s',
'tag_fields': 'status',
'version': 96
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Customer Issue',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Customer Issue',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1
},
# DocType, Customer Issue
{
'doctype': 'DocType',
'name': 'Customer Issue'
},
# DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'role': 'Guest',
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 0,
'role': 'System Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 1,
'role': 'System Manager'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 0,
'role': 'Maintenance Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 5,
'permlevel': 1,
'role': 'Maintenance Manager'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 6,
'permlevel': 0,
'role': 'Maintenance User',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 7,
'permlevel': 1,
'role': 'Maintenance User'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Customer Issue',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'naming_series',
'fieldtype': 'Select',
'idx': 2,
'in_filter': 0,
'label': 'Series',
'no_copy': 1,
'oldfieldname': 'naming_series',
'oldfieldtype': 'Select',
'options': '\nCI/2010-2011/',
'permlevel': 0,
'reqd': 1,
'search_index': 0
},
# DocField
{
'colour': 'White:FFF',
'default': 'Open',
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Select',
'idx': 3,
'in_filter': 1,
'label': 'Status',
'no_copy': 1,
'oldfieldname': 'status',
'oldfieldtype': 'Select',
'options': '\nOpen\nClosed\nWork In Progress\nCancelled',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'default': 'Today',
'doctype': 'DocField',
'fieldname': 'complaint_date',
'fieldtype': 'Date',
'idx': 4,
'in_filter': 1,
'label': 'Issue Date',
'oldfieldname': 'complaint_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'complaint_raised_by',
'fieldtype': 'Data',
'idx': 5,
'label': 'Raised By',
'oldfieldname': 'complaint_raised_by',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'from_company',
'fieldtype': 'Data',
'idx': 6,
'label': 'From Company',
'oldfieldname': 'from_company',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'service_address',
'fieldtype': 'Small Text',
'idx': 7,
'label': 'Service Address',
'oldfieldname': 'service_address',
'oldfieldtype': 'Small Text',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 8,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'customer',
'fieldtype': 'Link',
'idx': 9,
'in_filter': 1,
'label': 'Customer',
'oldfieldname': 'customer',
'oldfieldtype': 'Link',
'options': 'Customer',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_address',
'fieldtype': 'Link',
'idx': 10,
'label': 'Customer Address',
'options': 'Address',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_person',
'fieldtype': 'Link',
'idx': 11,
'label': 'Contact Person',
'options': 'Contact',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_name',
'fieldtype': 'Data',
'idx': 12,
'label': 'Name',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'address_display',
'fieldtype': 'Small Text',
'idx': 13,
'label': 'Address',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_display',
'fieldtype': 'Small Text',
'idx': 14,
'label': 'Contact',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_mobile',
'fieldtype': 'Data',
'idx': 15,
'label': 'Mobile No',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_email',
'fieldtype': 'Data',
'idx': 16,
'label': 'Contact Email',
'permlevel': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'territory',
'fieldtype': 'Link',
'idx': 17,
'in_filter': 1,
'label': 'Territory',
'oldfieldname': 'territory',
'oldfieldtype': 'Link',
'options': 'Territory',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_group',
'fieldtype': 'Link',
'idx': 18,
'label': 'Customer Group',
'options': 'Customer Group',
'permlevel': 0,
'print_hide': 1,
'reqd': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
'idx': 19,
'in_filter': 1,
'label': 'Company',
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'Company',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'idx': 20,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Select',
'options': 'link:Fiscal Year',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'hidden': 1,
'idx': 21,
'label': 'Amended From',
'no_copy': 1,
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
'permlevel': 0,
'print_hide': 1,
'width': '150px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'hidden': 1,
'idx': 22,
'label': 'Amendment Date',
'no_copy': 1,
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'print_hide': 1,
'width': '100px'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 23,
'label': 'Issue Details',
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'serial_no',
'fieldtype': 'Link',
'idx': 24,
'label': 'Serial No',
'options': 'Serial No',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'item_code',
'fieldtype': 'Link',
'idx': 25,
'in_filter': 1,
'label': 'Item Code',
'oldfieldname': 'item_code',
'oldfieldtype': 'Link',
'options': 'Item',
'permlevel': 0,
'reqd': 0,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'colour': 'White:FFF',
'depends_on': 'eval:doc.item_code',
'doctype': 'DocField',
'fieldname': 'item_name',
'fieldtype': 'Data',
'idx': 26,
'label': 'Item Name',
'oldfieldname': 'item_name',
'oldfieldtype': 'Data',
'permlevel': 1
},
# DocField
{
'colour': 'White:FFF',
'depends_on': 'eval:doc.item_code',
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
'idx': 27,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Small Text',
'permlevel': 1,
'width': '300px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'complaint',
'fieldtype': 'Small Text',
'idx': 28,
'label': 'Issue',
'no_copy': 1,
'oldfieldname': 'complaint',
'oldfieldtype': 'Small Text',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 29,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'warranty_amc_status',
'fieldtype': 'Select',
'hidden': 0,
'idx': 30,
'in_filter': 1,
'label': 'Warranty / AMC Status',
'options': '\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'warranty_expiry_date',
'fieldtype': 'Date',
'idx': 31,
'label': 'Warranty Expiry Date',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amc_expiry_date',
'fieldtype': 'Date',
'idx': 32,
'label': 'AMC Expiry Date',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'allocated_on',
'fieldtype': 'Date',
'idx': 33,
'in_filter': 1,
'label': 'Allocated On',
'oldfieldname': 'allocated_on',
'oldfieldtype': 'Date',
'permlevel': 0,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'allocated_to',
'fieldtype': 'Link',
'idx': 34,
'in_filter': 1,
'label': 'Allocated To',
'oldfieldname': 'allocated_to',
'oldfieldtype': 'Link',
'options': 'Sales Person',
'permlevel': 0,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 35,
'label': 'Resolution Detail',
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'resolution_details',
'fieldtype': 'Text',
'idx': 36,
'label': 'Resolution Details',
'no_copy': 1,
'oldfieldname': 'resolution_details',
'oldfieldtype': 'Text',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 37,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'resolution_date',
'fieldtype': 'Date',
'idx': 38,
'in_filter': 1,
'label': 'Resolution Date',
'no_copy': 1,
'oldfieldname': 'resolution_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'resolved_by',
'fieldtype': 'Link',
'idx': 39,
'in_filter': 1,
'label': 'Resolved By',
'no_copy': 1,
'oldfieldname': 'resolved_by',
'oldfieldtype': 'Link',
'options': 'Sales Person',
'permlevel': 0,
'search_index': 1
},
# DocField
{
'allow_on_submit': 0,
'colour': 'White:FFF',
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 40,
'label': 'Next Steps',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 41,
'label': 'Make Maintenance Visit',
'oldfieldtype': 'Button',
'permlevel': 0,
'trigger': 'Client'
}
]

View File

@@ -0,0 +1,184 @@
# DocType, Item Maintenance Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:06',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'umair@iwebnotes.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'autoname': 'IMD.#####',
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'Support',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 8
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Item Maintenance Detail',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# DocType, Item Maintenance Detail
{
'doctype': 'DocType',
'name': 'Item Maintenance Detail'
},
# DocField
{
'colour': 'White:FFF',
'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': 'item_name',
'fieldtype': 'Data',
'idx': 2,
'label': 'Item Name',
'oldfieldname': 'item_name',
'oldfieldtype': 'Data',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Data',
'idx': 3,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Data',
'permlevel': 1,
'width': '300px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'start_date',
'fieldtype': 'Date',
'idx': 4,
'in_filter': 1,
'label': 'Start Date',
'oldfieldname': 'start_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'end_date',
'fieldtype': 'Date',
'idx': 5,
'in_filter': 1,
'label': 'End Date',
'oldfieldname': 'end_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'periodicity',
'fieldtype': 'Select',
'idx': 6,
'label': 'Periodicity',
'oldfieldname': 'periodicity',
'oldfieldtype': 'Select',
'options': '\nWeekly\nMonthly\nQuarterly\nHalf Yearly\nYearly\nRandom',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'no_of_visits',
'fieldtype': 'Int',
'idx': 7,
'label': 'No of Visits',
'oldfieldname': 'no_of_visits',
'oldfieldtype': 'Int',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'incharge_name',
'fieldtype': 'Link',
'idx': 8,
'in_filter': 1,
'label': 'Incharge Name',
'oldfieldname': 'incharge_name',
'oldfieldtype': 'Link',
'options': 'Sales Person',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'serial_no',
'fieldtype': 'Small Text',
'idx': 9,
'label': 'Serial No',
'oldfieldname': 'serial_no',
'oldfieldtype': 'Small Text',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'prevdoc_docname',
'fieldtype': 'Data',
'idx': 10,
'in_filter': 1,
'label': 'Against Docname',
'no_copy': 1,
'oldfieldname': 'prevdoc_docname',
'oldfieldtype': 'Data',
'permlevel': 1,
'print_hide': 1,
'search_index': 1,
'width': '150px'
}
]

View File

@@ -0,0 +1,117 @@
cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(doc.__islocal){
set_multiple(dt,dn,{transaction_date:get_today()});
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
}
//customer
cur_frm.cscript.customer = function(doc,dt,dn) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
cur_frm.refresh();
}
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
}
cur_frm.fields_dict.customer_address.on_new = function(dn) {
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
}
cur_frm.fields_dict.contact_person.on_new = function(dn) {
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
}
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
}
//
cur_frm.fields_dict['item_maintenance_detail'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50';
}
// Get Items based on SO Selected
cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
var callback = function(r,rt) {
unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
cur_frm.refresh();
}
get_server_fields('pull_sales_order_detail','','',doc, dt, dn,1,callback);
}
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
var fname = cur_frm.cscript.fname;
var d = locals[cdt][cdn];
if (d.item_code) {
get_server_fields('get_item_details',d.item_code, 'item_maintenance_detail',doc,cdt,cdn,1);
}
}
/*
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_customer = 1 AND `tabContact`.customer = "'+ doc.customer+'" AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
}
cur_frm.cscript.customer = function(doc, cdt, cdn) {
get_server_fields('get_customer_details','','',doc, cdt, cdn, 1);
}
*/
cur_frm.fields_dict['sales_order_no'].get_query = function(doc) {
doc = locals[this.doctype][this.docname];
var cond = '';
if(doc.customer) {
cond = '`tabSales Order`.customer = "'+doc.customer+'" AND';
}
return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Detail`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Detail`.parent = `tabSales Order`.name AND `tabSales Order Detail`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
}
cur_frm.cscript.periodicity = function(doc, cdt, cdn){
var d = locals[cdt][cdn];
if(d.start_date && d.end_date){
arg = {}
arg.start_date = d.start_date;
arg.end_date = d.end_date;
arg.periodicity = d.periodicity;
get_server_fields('get_no_of_visits',docstring(arg),'item_maintenance_detail',doc, cdt, cdn, 1);
}
else{
msgprint("Please enter Start Date and End Date");
}
}
cur_frm.cscript['Generate Schedule'] = function(doc, cdt, cdn) {
if (!doc.__islocal) {
$c('runserverobj', args={'method':'generate_schedule', 'docs':compress_doclist(make_doclist(cdt,cdn))},
function(r,rt){
refresh_field('maintenance_schedule_detail');
}
);
} else {
alert("Please save the document before generating maintenance schedule");
}
}
//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';
}

View File

@@ -0,0 +1,302 @@
# 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
# -----------------------------------------------------------------------------------------
from utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
# pull sales order details
#--------------------------
def pull_sales_order_detail(self):
self.doc.clear_table(self.doclist, 'item_maintenance_detail')
self.doc.clear_table(self.doclist, 'maintenance_schedule_detail')
self.doclist = get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule').dt_map('Sales Order', 'Maintenance Schedule', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Maintenance Schedule'],['Sales Order Detail', 'Item Maintenance Detail']]")
#pull item details
#-------------------
def get_item_details(self, item_code):
item = sql("select item_name, description from `tabItem` where name = '%s'" %(item_code), as_dict=1)
ret = {
'item_name': item and item[0]['item_name'] or '',
'description' : item and item[0]['description'] or ''
}
return str(ret)
#pull customer details
#-------------------------
#def get_customer_details(self):
# det = sql("select t1.customer_name,t1.address,t1.territory,t2.contact_name from `tabCustomer` t1, `tabContact` t2 where t1.name = %s and t1.name=t2.customer and t2.is_primary_contact = 'Yes'", self.doc.customer, as_dict=1)
#
# ret = {
# 'customer_name': det and det[0]['customer_name'] or '',
# 'address' : det and det[0]['address'] or '',
# 'territory': det and det[0]['territory'] or '',
# 'contact_person' : det and det[0]['contact_name'] or ''
# }
# return str(ret)
# generate maintenance schedule
#-------------------------------------
def generate_schedule(self):
import datetime
self.doc.clear_table(self.doclist, 'maintenance_schedule_detail')
count = 0
for d in getlist(self.doclist, 'item_maintenance_detail'):
self.validate_maintenance_detail()
s_list =[]
s_list = self.create_schedule_list(d.start_date, d.end_date, d.no_of_visits)
for i in range(d.no_of_visits):
child = addchild(self.doc,'maintenance_schedule_detail','Maintenance Schedule Detail',1,self.doclist)
child.item_code = d.item_code
child.scheduled_date = s_list[i].strftime('%Y-%m-%d')
if d.serial_no:
child.serial_no = d.serial_no
child.idx = count
count = count+1
child.incharge_name = d.incharge_name
child.save(1)
self.on_update()
#get schedule dates
#----------------------
def create_schedule_list(self, start_date, end_date, no_of_visit):
schedule_list = []
start_date1 = start_date
date_diff = (getdate(end_date) - getdate(start_date)).days
add_by = date_diff/no_of_visit
#schedule_list.append(start_date1)
while(getdate(start_date1) < getdate(end_date)):
start_date1 = add_days(start_date1, add_by)
if len(schedule_list) < no_of_visit:
schedule_list.append(getdate(start_date1))
return schedule_list
#validate date range and periodicity selected
#-------------------------------------------------
def validate_period(self, arg):
arg1 = eval(arg)
if getdate(arg1['start_date']) >= getdate(arg1['end_date']):
msgprint("Start date should be less than end date ")
raise Exception
period = (getdate(arg1['end_date'])-getdate(arg1['start_date'])).days+1
if (arg1['periodicity']=='Yearly' or arg1['periodicity']=='Half Yearly' or arg1['periodicity']=='Quarterly') and period<365:
msgprint(cstr(arg1['periodicity'])+ " periodicity can be set for period of atleast 1 year or more only")
raise Exception
elif arg1['periodicity']=='Monthly' and period<30:
msgprint("Monthly periodicity can be set for period of atleast 1 month or more")
raise Exception
elif arg1['periodicity']=='Weekly' and period<7:
msgprint("Weekly periodicity can be set for period of atleast 1 week or more")
raise Exception
#get count on the basis of periodicity selected
#----------------------------------------------------
def get_no_of_visits(self, arg):
arg1 = eval(arg)
start_date = arg1['start_date']
self.validate_period(arg)
period = (getdate(arg1['end_date'])-getdate(arg1['start_date'])).days+1
count =0
if arg1['periodicity'] == 'Weekly':
count = period/7
elif arg1['periodicity'] == 'Monthly':
count = period/30
elif arg1['periodicity'] == 'Quarterly':
count = period/91
elif arg1['periodicity'] == 'Half Yearly':
count = period/182
elif arg1['periodicity'] == 'Yearly':
count = period/365
ret = {'no_of_visits':count}
return str(ret)
def validate_maintenance_detail(self):
if not getlist(self.doclist, 'item_maintenance_detail'):
msgprint("Please enter Maintaince Details first")
raise Exception
for d in getlist(self.doclist, 'item_maintenance_detail'):
if not d.item_code:
msgprint("Please select item code")
raise Exception
elif not d.start_date or not d.end_date:
msgprint("Please select Start Date and End Date for item "+d.item_code)
raise Exception
elif not d.no_of_visits:
msgprint("Please mention no of visits required")
raise Exception
elif not d.incharge_name:
msgprint("Please select Incharge Person's name")
raise Exception
if getdate(d.start_date) >= getdate(d.end_date):
msgprint("Start date should be less than end date for item "+d.item_code)
raise Exception
#check if maintenance schedule already created against same sales order
#-----------------------------------------------------------------------------------
def validate_sales_order(self):
for d in getlist(self.doclist, 'item_maintenance_detail'):
if d.prevdoc_docname:
chk = sql("select t1.name from `tabMaintenance Schedule` t1, `tabItem Maintenance Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", d.prevdoc_docname)
if chk:
msgprint("Maintenance Schedule against "+d.prevdoc_docname+" already exist")
raise Exception
# Validate values with reference document
#----------------------------------------
def validate_reference_value(self):
get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule', with_children = 1).validate_reference_value(self, self.doc.name)
def validate_serial_no(self):
for d in getlist(self.doclist, 'item_maintenance_detail'):
cur_s_no=[]
if d.serial_no:
cur_serial_no = d.serial_no.replace(' ', '')
cur_s_no = cur_serial_no.split(',')
for x in cur_s_no:
chk = sql("select name, status from `tabSerial No` where docstatus!=2 and name=%s", (x))
chk1 = chk and chk[0][0] or ''
status = chk and chk[0][1] or ''
if not chk1:
msgprint("Serial no "+x+" does not exist in system.")
raise Exception
else:
if status=='In Store' or status=='Note in Use' or status=='Scrapped':
msgprint("Serial no "+x+" is '"+status+"'")
raise Exception
def validate(self):
self.validate_maintenance_detail()
self.validate_sales_order()
if self.doc.sales_order_no:
self.validate_reference_value()
self.validate_serial_no()
self.validate_start_date()
# validate that maintenance start date can not be before serial no delivery date
#-------------------------------------------------------------------------------------------
def validate_start_date(self):
for d in getlist(self.doclist, 'item_maintenance_detail'):
if d.serial_no:
cur_serial_no = d.serial_no.replace(' ', '')
cur_s_no = cur_serial_no.split(',')
for x in cur_s_no:
dt = sql("select delivery_date from `tabSerial No` where name = %s", x)
dt = dt and dt[0][0] or ''
if dt:
if dt > getdate(d.start_date):
msgprint("Maintenance start date can not be before delivery date "+dt.strftime('%Y-%m-%d')+" for serial no "+x)
raise Exception
#update amc expiry date in serial no
#------------------------------------------
def update_amc_date(self,serial_no,amc_end_date):
#get current list of serial no
cur_serial_no = serial_no.replace(' ', '')
cur_s_no = cur_serial_no.split(',')
for x in cur_s_no:
sql("update `tabSerial No` set amc_expiry_date = '%s', maintenance_status = 'Under AMC' where name = '%s'"% (amc_end_date,x))
def on_update(self):
set(self.doc, 'status', 'Draft')
#validate that new maintenance start date does not clash with existing mntc end date
#-------------------------------------------------------------------------------------------------
def validate_serial_no_warranty(self):
for d in getlist(self.doclist, 'item_maintenance_detail'):
if d.serial_no:
dt = sql("select warranty_expiry_date, amc_expiry_date from `tabSerial No` where name = %s", d.serial_no, as_dict=1)
if dt[0]['warranty_expiry_date']:
if dt[0]['warranty_expiry_date'] >= getdate(d.start_date):
msgprint("Serial no "+d.serial_no+" for item "+d.item_code+" is already under warranty till "+(dt[0]['warranty_expiry_date']).strftime('%Y-%m-%d')+". You can schedule AMC start date after "+(dt[0]['warranty_expiry_date']).strftime('%Y-%m-%d'))
raise Exception
if dt[0]['amc_expiry_date']:
if dt[0]['amc_expiry_date'] >= getdate(d.start_date):
msgprint("Serial no "+d.serial_no+" for item "+d.item_code+" is already under AMC till "+(dt[0]['amc_expiry_date']).strftime('%Y-%m-%d')+". You can schedule new AMC start date after "+(dt[0]['amc_expiry_date']).strftime('%Y-%m-%d'))
raise Exception
#validate if schedule generated for all items
#-------------------------------------------------
def validate_schedule(self):
item_lst1 =[]
item_lst2 =[]
for d in getlist(self.doclist, 'item_maintenance_detail'):
if d.item_code not in item_lst1:
item_lst1.append(d.item_code)
for m in getlist(self.doclist, 'maintenance_schedule_detail'):
if m.item_code not in item_lst2:
item_lst2.append(m.item_code)
if len(item_lst1) != len(item_lst2):
msgprint("Maintenance Schedule is not generated for all the items. Please click on 'Generate Schedule'")
raise Exception
else:
for x in item_lst1:
if x not in item_lst2:
msgprint("Maintenance Schedule is not generated for item "+x+". Please click on 'Generate Schedule'")
raise Exception
#check if serial no present in item maintenance table
#-----------------------------------------------------------
def check_serial_no_added(self):
serial_present =[]
for d in getlist(self.doclist, 'item_maintenance_detail'):
if d.serial_no:
serial_present.append(d.item_code)
for m in getlist(self.doclist, 'maintenance_schedule_detail'):
if serial_present:
if m.item_code in serial_present and not m.serial_no:
msgprint("Please click on 'Generate Schedule' to fetch serial no added for item "+m.item_code)
raise Exception
def on_submit(self):
if not getlist(self.doclist, 'maintenance_schedule_detail'):
msgprint("Please click on 'Generate Schedule' to get schedule")
raise Exception
self.check_serial_no_added()
self.validate_serial_no_warranty()
self.validate_schedule()
for d in getlist(self.doclist, 'item_maintenance_detail'):
if d.serial_no:
self.update_amc_date(d.serial_no, d.end_date)
set(self.doc, 'status', 'Submitted')
def on_cancel(self):
for d in getlist(self.doclist, 'item_maintenance_detail'):
if d.serial_no:
self.update_amc_date(d.serial_no, '')
set(self.doc, 'status', 'Cancelled')

View File

@@ -0,0 +1,419 @@
# DocType, Maintenance Schedule
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:09',
'docstatus': 0,
'modified': '2011-05-17 17:13:43',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1305632624',
'autoname': 'MS.#####',
'colour': 'White:FFF',
'doctype': 'DocType',
'module': 'Support',
'name': '__common__',
'search_fields': 'status,customer,customer_name, sales_order_no',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 155
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Maintenance Schedule',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Maintenance Schedule',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1
},
# DocType, Maintenance Schedule
{
'doctype': 'DocType',
'name': 'Maintenance Schedule'
},
# DocPerm
{
'amend': 1,
'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
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 0,
'role': 'Maintenance Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 1,
'role': 'Maintenance Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Customer Details',
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 2,
'oldfieldtype': 'Column Break',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer',
'fieldtype': 'Link',
'idx': 3,
'in_filter': 1,
'label': 'Customer',
'oldfieldname': 'customer',
'oldfieldtype': 'Link',
'options': 'Customer',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_address',
'fieldtype': 'Link',
'idx': 4,
'label': 'Customer Address',
'options': 'Address',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_person',
'fieldtype': 'Link',
'idx': 5,
'label': 'Contact Person',
'options': 'Contact',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'customer_name',
'fieldtype': 'Data',
'idx': 6,
'in_filter': 1,
'label': 'Name',
'oldfieldname': 'customer_name',
'oldfieldtype': 'Data',
'permlevel': 1,
'reqd': 0,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'address_display',
'fieldtype': 'Small Text',
'idx': 7,
'label': 'Address',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_display',
'fieldtype': 'Small Text',
'idx': 8,
'label': 'Contact',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_mobile',
'fieldtype': 'Text',
'idx': 9,
'label': 'Mobile No',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_email',
'fieldtype': 'Text',
'idx': 10,
'label': 'Contact Email',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 11,
'oldfieldtype': 'Column Break',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'transaction_date',
'fieldtype': 'Date',
'idx': 12,
'in_filter': 1,
'label': 'Transaction Date',
'oldfieldname': 'transaction_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 0
},
# DocField
{
'colour': 'White:FFF',
'default': 'Draft',
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Select',
'idx': 13,
'in_filter': 1,
'label': 'Status',
'no_copy': 1,
'oldfieldname': 'status',
'oldfieldtype': 'Select',
'options': '\nDraft\nSubmitted\nCancelled',
'permlevel': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'idx': 14,
'label': 'Amended From',
'no_copy': 1,
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'hidden': 1,
'idx': 15,
'label': 'Amendment Date',
'no_copy': 1,
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
'idx': 16,
'in_filter': 1,
'label': 'Company',
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'Company',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'territory',
'fieldtype': 'Link',
'idx': 17,
'in_filter': 1,
'label': 'Territory',
'oldfieldname': 'territory',
'oldfieldtype': 'Link',
'options': 'Territory',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_group',
'fieldtype': 'Link',
'idx': 18,
'label': 'Customer Group',
'options': 'Customer Group',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 19,
'label': 'Items',
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'sales_order_no',
'fieldtype': 'Link',
'idx': 20,
'in_filter': 1,
'label': 'Sales Order No',
'oldfieldname': 'sales_order_no',
'oldfieldtype': 'Link',
'options': 'Sales Order',
'permlevel': 0,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 21,
'label': 'Get Items',
'oldfieldtype': 'Button',
'options': 'pull_sales_order_detail',
'permlevel': 0,
'report_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'item_maintenance_detail',
'fieldtype': 'Table',
'idx': 22,
'label': 'Item Maintenance Detail',
'oldfieldname': 'item_maintenance_detail',
'oldfieldtype': 'Table',
'options': 'Item Maintenance Detail',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 23,
'label': 'Schedule',
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 24,
'label': 'Generate Schedule',
'oldfieldtype': 'Button',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'maintenance_schedule_detail',
'fieldtype': 'Table',
'idx': 25,
'label': 'Maintenance Schedule Detail',
'oldfieldname': 'maintenance_schedule_detail',
'oldfieldtype': 'Table',
'options': 'Maintenance Schedule Detail',
'permlevel': 1
}
]

View File

@@ -0,0 +1,133 @@
# DocType, Maintenance Schedule Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:09',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'umair@iwebnotes.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'autoname': 'MSD.#####',
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'Support',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 12
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Maintenance Schedule Detail',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# DocType, Maintenance Schedule Detail
{
'doctype': 'DocType',
'name': 'Maintenance Schedule Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'item_code',
'fieldtype': 'Link',
'idx': 1,
'in_filter': 1,
'label': 'Item Code',
'oldfieldname': 'item_code',
'oldfieldtype': 'Link',
'options': 'Item',
'permlevel': 1,
'reqd': 0,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'item_name',
'fieldtype': 'Data',
'idx': 2,
'in_filter': 0,
'label': 'Item Name',
'oldfieldname': 'item_name',
'oldfieldtype': 'Data',
'permlevel': 1,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'scheduled_date',
'fieldtype': 'Date',
'idx': 3,
'in_filter': 1,
'label': 'Scheduled Date',
'oldfieldname': 'scheduled_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'actual_date',
'fieldtype': 'Date',
'hidden': 1,
'idx': 4,
'label': 'Actual Date',
'no_copy': 1,
'oldfieldname': 'actual_date',
'oldfieldtype': 'Date',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'incharge_name',
'fieldtype': 'Link',
'idx': 5,
'in_filter': 1,
'label': 'Incharge Name',
'oldfieldname': 'incharge_name',
'oldfieldtype': 'Link',
'options': 'Sales Person',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'serial_no',
'fieldtype': 'Small Text',
'idx': 6,
'in_filter': 1,
'label': 'Serial No',
'no_copy': 0,
'oldfieldname': 'serial_no',
'oldfieldtype': 'Small Text',
'permlevel': 1,
'search_index': 1,
'width': '160px'
}
]

View File

@@ -0,0 +1,114 @@
cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(doc.customer) cur_frm.cscript.customer(doc,cdt,cdn);
if(doc.__islocal){
set_multiple(dt,dn,{mntc_date:get_today()});
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
//if(doc.maintenance_type) cur_frm.cscript.maintenance_type(doc,cdt,cdn);
}
//customer
cur_frm.cscript.customer = function(doc,dt,dn) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
cur_frm.refresh();
}
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
}
cur_frm.fields_dict.customer_address.on_new = function(dn) {
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
}
cur_frm.fields_dict.contact_person.on_new = function(dn) {
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
}
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
}
cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
var callback = function(r,rt) {
unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
cur_frm.refresh();
}
get_server_fields('fetch_items','','',doc, dt, dn,1,callback);
}
/*
cur_frm.cscript.maintenance_type = function(doc,cdt,cdn){
if(doc.maintenance_type == 'Scheduled') {
hide_field('sales_order_no');
hide_field('customer_issue_no');
hide_field('Get Items');
doc.customer_issue_no = '';
doc.sales_order_no = '';
}
else if(doc.maintenance_type == 'Unscheduled') {
unhide_field('sales_order_no');
hide_field('customer_issue_no');
unhide_field('Get Items');
doc.customer_issue_no = '';
}
else if(doc.maintenance_type == 'Breakdown') {
hide_field('sales_order_no');
unhide_field('customer_issue_no');
unhide_field('Get Items');
doc.sales_order_no = '';
}
}*/
cur_frm.fields_dict['maintenance_visit_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50';
}
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
var fname = cur_frm.cscript.fname;
var d = locals[cdt][cdn];
if (d.item_code) {
get_server_fields('get_item_details',d.item_code, 'maintenance_visit_details',doc,cdt,cdn,1);
}
}
cur_frm.fields_dict['sales_order_no'].get_query = function(doc) {
doc = locals[this.doctype][this.docname];
var cond = '';
if(doc.customer) {
cond = '`tabSales Order`.customer = "'+doc.customer+'" AND';
}
//return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Detail` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Detail`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Detail`.parent = `tabSales Order`.name AND `tabSales Order Detail`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
}
cur_frm.fields_dict['customer_issue_no'].get_query = function(doc) {
doc = locals[this.doctype][this.docname];
var cond = '';
if(doc.customer) {
cond = '`tabCustomer Issue`.customer = "'+doc.customer+'" AND';
}
return repl('SELECT `tabCustomer Issue`.name FROM `tabCustomer Issue` WHERE `tabCustomer Issue`.company = "%(company)s" AND %(cond)s `tabCustomer Issue`.docstatus = 1 AND (`tabCustomer Issue`.status = "Open" OR `tabCustomer Issue`.status = "Work In Progress") AND `tabCustomer Issue`.name LIKE "%s" ORDER BY `tabCustomer Issue`.name DESC LIMIT 50', {company:doc.company, cond:cond});
}
//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';
}

View File

@@ -0,0 +1,161 @@
# 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
# -----------------------------------------------------------------------------------------
from utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
#get item details
#------------------
def get_item_details(self, item_code):
item = sql("select item_name,description from `tabItem` where name = '%s'" %(item_code), as_dict=1)
ret = {
'item_name' : item and item[0]['item_name'] or '',
'description' : item and item[0]['description'] or ''
}
return str(ret)
#get customer details
#-----------------------
#def get_customer_details(self):
# det = sql("select t1.customer_name,t1.address,t1.territory,t2.contact_name from `tabCustomer` t1, `tabContact` t2 where t1.name = %s and t1.name=t2.customer and t2.is_primary_contact = 'Yes'", self.doc.customer, as_dict=1)
#
# ret = {
# 'customer_name' : det and det[0]['customer_name'] or '',
# 'address' : det and det[0]['address'] or '',
# 'territory': det and det[0]['territory'] or '',
# 'contact_person' : det and det[0]['contact_name'] or ''
# }
# return str(ret)
# fetch details of resp Sales order or customer issue
#-----------------------------------------------------------
def fetch_items(self):
if self.doc.sales_order_no and self.doc.customer_issue_no:
msgprint("You can not fetch details of both, Sales Order and Customer Issue, in same Maintenance Visit")
raise Exception
self.doc.clear_table(self.doclist, 'maintenance_visit_details')
if self.doc.sales_order_no:
self.doclist = get_obj('DocType Mapper', 'Sales Order-Maintenance Visit').dt_map('Sales Order', 'Maintenance Visit', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Maintenance Visit'],['Sales Order Detail', 'Maintenance Visit Detail']]")
elif self.doc.customer_issue_no:
self.doclist = get_obj('DocType Mapper', 'Customer Issue-Maintenance Visit').dt_map('Customer Issue', 'Maintenance Visit', self.doc.customer_issue_no, self.doc, self.doclist, "[['Customer Issue', 'Maintenance Visit'],['Customer Issue', 'Maintenance Visit Detail']]")
#validate reference value using doctype mapper
#-----------------------------------------------------
def validate_reference_value(self, check_for):
if check_for == 'Sales Order':
get_obj('DocType Mapper', 'Sales Order-Maintenance Visit', with_children = 1).validate_reference_value(self, self.doc.name)
elif check_for == 'Customer Issue':
get_obj('DocType Mapper', 'Customer Issue-Maintenance Visit', with_children = 1).validate_reference_value(self, self.doc.name)
#check if serial no exist in system
#--------------------------------------
def validate_serial_no(self):
for d in getlist(self.doclist, 'maintenance_visit_details'):
if d.serial_no and not sql("select name from `tabSerial No` where name = '%s' and docstatus != 2" % d.serial_no):
msgprint("Serial No: "+ d.serial_no + " not exists in the system")
raise Exception
#elif not d.serial_no and d.item_code:
# ser = sql("select has_serial_no from tabItem where name = '%s'" % d.item_code)
# ser = ser and ser[0][0] or 'No'
# if ser == 'Yes':
# msgprint("Serial No is mandatory for item: " + d.item_code)
# raise Exception
def validate(self):
if not getlist(self.doclist, 'maintenance_visit_details'):
msgprint("Please enter maintenance details")
raise Exception
for d in getlist(self.doclist, 'maintenance_visit_details'):
if d.prevdoc_doctype == 'Sales Order':
check_for = 'Sales Order'
elif d.prevdoc_doctype == 'Customer Issue':
check_for = 'Customer Issue'
else:
msgprint("Maintenance Visit must be created either against Sales Order or against Customer Issue")
raise Exception
if check_for:
self.validate_reference_value(check_for)
self.validate_serial_no()
def update_customer_issue(self, flag):
for d in getlist(self.doclist, 'maintenance_visit_details'):
if d.prevdoc_docname and d.prevdoc_doctype == 'Customer Issue' :
if flag==1:
mntc_date = self.doc.mntc_date
service_person = d.service_person
work_done = d.work_done
if self.doc.completion_status == 'Fully Completed':
status = 'Closed'
elif self.doc.completion_status == 'Partially Completed':
status = 'Work In Progress'
else:
nm = sql("select t1.name, t1.mntc_date, t2.service_person, t2.work_done from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent = t1.name and t1.completion_status = 'Partially Completed' and t2.prevdoc_docname = %s and t1.name!=%s and t1.docstatus = 1 order by t1.name desc limit 1", (d.prevdoc_docname, self.doc.name))
if nm:
status = 'Work In Progress'
mntc_date = nm and nm[0][1] or ''
service_person = nm and nm[0][2] or ''
work_done = nm and nm[0][3] or ''
else:
status = 'Open'
mntc_date = ''
service_person = ''
work_done = ''
sql("update `tabCustomer Issue` set resolution_date=%s, resolved_by=%s, resolution_details=%s, status=%s where name =%s",(mntc_date,service_person,work_done,status,d.prevdoc_docname))
# check if last maintenance visit against same sales order/ customer issue
#-----------------------------------------------------------------------------------
def check_if_last_visit(self):
for d in getlist(self.doclist, 'maintenance_visit_details'):
if d.prevdoc_docname:
check_for_docname = d.prevdoc_docname
check_for_doctype = d.prevdoc_doctype
if check_for_docname:
check = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent = t1.name and t1.name!=%s and t2.prevdoc_docname=%s and t1.docstatus = 1 and (t1.mntc_date > %s or (t1.mntc_date = %s and t1.mntc_time > %s))", (self.doc.name, check_for_docname, self.doc.mntc_date, self.doc.mntc_date, self.doc.mntc_time))
if check:
check_lst = [x[0] for x in check]
check_lst =','.join(check_lst)
msgprint("To cancel this, you need to cancel Maintenance Visit(s) "+cstr(check_lst)+" created after this maintenance visit against same "+check_for_doctype)
raise Exception
else:
self.update_customer_issue(0)
def on_submit(self):
self.update_customer_issue(1)
set(self.doc, 'status', 'Submitted')
def on_cancel(self):
self.check_if_last_visit()
set(self.doc, 'status', 'Cancelled')
def on_update(self):
pass

View File

@@ -0,0 +1,517 @@
# DocType, Maintenance Visit
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:09',
'docstatus': 0,
'modified': '2011-07-01 11:20:38',
'modified_by': 'Administrator',
'owner': 'ashwini@webnotestech.com'
},
# These values are common for all DocType
{
'_last_update': '1305704021',
'autoname': 'MV.#####',
'colour': 'White:FFF',
'doctype': 'DocType',
'module': 'Support',
'name': '__common__',
'search_fields': 'status,maintenance_type,customer,customer_name, address,mntc_date,company,fiscal_year',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'subject': 'To %(customer_name)s on %(mntc_date)s',
'tag_fields': 'completion_status,maintenance_type',
'version': 101
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Maintenance Visit',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Maintenance Visit',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1
},
# DocType, Maintenance Visit
{
'doctype': 'DocType',
'name': 'Maintenance Visit'
},
# DocPerm
{
'amend': 1,
'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
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 0,
'role': 'Maintenance Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 1,
'role': 'Maintenance Manager'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 5,
'permlevel': 0,
'role': 'Maintenance User',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 6,
'permlevel': 1,
'role': 'Maintenance User'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Customer Details',
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 2,
'oldfieldtype': 'Column Break',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer',
'fieldtype': 'Link',
'idx': 3,
'in_filter': 1,
'label': 'Customer',
'oldfieldname': 'customer',
'oldfieldtype': 'Link',
'options': 'Customer',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_address',
'fieldtype': 'Link',
'idx': 4,
'label': 'Customer Address',
'options': 'Address',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_person',
'fieldtype': 'Link',
'idx': 5,
'label': 'Contact Person',
'options': 'Contact',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_name',
'fieldtype': 'Data',
'idx': 6,
'label': 'Name',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'address_display',
'fieldtype': 'Small Text',
'idx': 7,
'label': 'Address',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_display',
'fieldtype': 'Small Text',
'idx': 8,
'label': 'Contact',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_mobile',
'fieldtype': 'Data',
'idx': 9,
'label': 'Mobile No',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_email',
'fieldtype': 'Data',
'idx': 10,
'label': 'Contact Email',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Select',
'idx': 11,
'in_filter': 1,
'label': 'Company',
'oldfieldname': 'company',
'oldfieldtype': 'Select',
'options': 'link:Company',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'idx': 12,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Select',
'options': 'link:Fiscal Year',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 13,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField
{
'default': 'Today',
'doctype': 'DocField',
'fieldname': 'mntc_date',
'fieldtype': 'Date',
'idx': 14,
'label': 'Maintenance Date',
'no_copy': 1,
'oldfieldname': 'mntc_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'mntc_time',
'fieldtype': 'Time',
'idx': 15,
'label': 'Maintenance Time',
'no_copy': 1,
'oldfieldname': 'mntc_time',
'oldfieldtype': 'Time',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'default': 'Draft',
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Data',
'idx': 16,
'label': 'Status',
'no_copy': 1,
'oldfieldname': 'status',
'oldfieldtype': 'Data',
'options': '\nDraft\nCancelled\nSubmitted',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'idx': 17,
'label': 'Amended From',
'no_copy': 1,
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
'permlevel': 1,
'print_hide': 1,
'width': '150px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'idx': 18,
'label': 'Amendment Date',
'no_copy': 1,
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'print_hide': 1,
'width': '100px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'territory',
'fieldtype': 'Link',
'idx': 19,
'label': 'Territory',
'options': 'Territory',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_group',
'fieldtype': 'Link',
'idx': 20,
'label': 'Customer Group',
'options': 'Customer Group',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 21,
'label': 'Maintenance Details',
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'completion_status',
'fieldtype': 'Select',
'idx': 22,
'label': 'Completion Status',
'oldfieldname': 'completion_status',
'oldfieldtype': 'Select',
'options': '\nPartially Completed\nFully Completed',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'default': 'Unscheduled',
'doctype': 'DocField',
'fieldname': 'maintenance_type',
'fieldtype': 'Select',
'idx': 23,
'in_filter': 1,
'label': 'Maintenance Type',
'oldfieldname': 'maintenance_type',
'oldfieldtype': 'Select',
'options': '\nScheduled\nUnscheduled\nBreakdown',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 24,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'sales_order_no',
'fieldtype': 'Link',
'idx': 25,
'in_filter': 1,
'label': 'Sales Order No',
'oldfieldname': 'sales_order_no',
'oldfieldtype': 'Link',
'options': 'Sales Order',
'permlevel': 0,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'customer_issue_no',
'fieldtype': 'Link',
'idx': 26,
'in_filter': 1,
'label': 'Customer Issue No',
'oldfieldname': 'customer_issue_no',
'oldfieldtype': 'Link',
'options': 'Customer Issue',
'permlevel': 0,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 27,
'label': 'Get Items',
'oldfieldtype': 'Button',
'options': 'fetch_items',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 28,
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'maintenance_visit_details',
'fieldtype': 'Table',
'idx': 29,
'label': 'Maintenance Visit Detail',
'oldfieldname': 'maintenance_visit_details',
'oldfieldtype': 'Table',
'options': 'Maintenance Visit Detail',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 30,
'label': 'Feedback',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_feedback',
'fieldtype': 'Small Text',
'idx': 31,
'label': 'Customer Feedback',
'oldfieldname': 'customer_feedback',
'oldfieldtype': 'Small Text',
'permlevel': 0
}
]

View File

@@ -0,0 +1,172 @@
# DocType, Maintenance Visit Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:09',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'ashwini@webnotestech.com'
},
# These values are common for all DocType
{
'autoname': 'MVD.#####',
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'Support',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 13
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Maintenance Visit Detail',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# DocType, Maintenance Visit Detail
{
'doctype': 'DocType',
'name': 'Maintenance Visit Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Small Text',
'permlevel': 0,
'reqd': 1,
'width': '300px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'service_person',
'fieldtype': 'Link',
'idx': 2,
'label': 'Service Person',
'oldfieldname': 'service_person',
'oldfieldtype': 'Link',
'options': 'Sales Person',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'work_done',
'fieldtype': 'Small Text',
'idx': 3,
'label': 'Work Done',
'oldfieldname': 'work_done',
'oldfieldtype': 'Small Text',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'item_code',
'fieldtype': 'Link',
'idx': 4,
'label': 'Item Code',
'oldfieldname': 'item_code',
'oldfieldtype': 'Link',
'options': 'Item',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'item_name',
'fieldtype': 'Data',
'idx': 5,
'label': 'Item Name',
'oldfieldname': 'item_name',
'oldfieldtype': 'Data',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'serial_no',
'fieldtype': 'Small Text',
'idx': 6,
'label': 'Serial No',
'oldfieldname': 'serial_no',
'oldfieldtype': 'Small Text',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'prevdoc_docname',
'fieldtype': 'Data',
'hidden': 0,
'idx': 7,
'label': 'Against Document No',
'no_copy': 1,
'oldfieldname': 'prevdoc_docname',
'oldfieldtype': 'Data',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'width': '160px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'prevdoc_detail_docname',
'fieldtype': 'Data',
'hidden': 1,
'idx': 8,
'label': 'Against Document Detail No',
'no_copy': 1,
'oldfieldname': 'prevdoc_detail_docname',
'oldfieldtype': 'Data',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'width': '160px'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'prevdoc_doctype',
'fieldtype': 'Data',
'hidden': 0,
'idx': 9,
'label': 'Document Type',
'no_copy': 1,
'oldfieldname': 'prevdoc_doctype',
'oldfieldtype': 'Data',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'width': '150px'
}
]

View File

@@ -0,0 +1,63 @@
import webnotes
from webnotes.utils.email_lib.receive import POP3Mailbox
class SupportMailbox(POP3Mailbox):
def __init__(self):
"""
settings_doc must contain
is_ssl, host, username, password
"""
POP3Mailbox.__init__(self, 'Support Email Settings')
def check_mails(self):
"""
returns true if there are active sessions
"""
return webnotes.conn.sql("select user from tabSessions where time_to_sec(timediff(now(), lastupdate)) < 1800")
def process_message(self, mail):
"""
Updates message from support email as either new or reply
"""
from home import update_feed
content, content_type = '[Blank Email]', 'text/plain'
if mail.text_content:
content, content_type = mail.text_content, 'text/plain'
else:
content, content_type = mail.html_content, 'text/html'
thread_id = mail.get_thread_id()
if webnotes.conn.exists('Support Ticket', thread_id):
from webnotes.model.code import get_obj
st = get_obj('Support Ticket', thread_id)
st.make_response_record(content, mail.mail['From'], content_type)
webnotes.conn.set(st.doc, 'status', 'To Reply')
update_feed(st.doc)
return
# new ticket
from webnotes.model.doc import Document
d = Document('Support Ticket')
d.description = content
d.subject = mail.mail['Subject']
d.raised_by = mail.mail['From']
d.content_type = content_type
d.status = 'Open'
try:
d.save(1)
except:
d.description = 'Unable to extract message'
d.save(1)
# update feed
update_feed(d)
def get_support_mails():
"""
Gets new emails from support inbox and updates / creates Support Ticket records
"""
SupportMailbox().get_messages()

View File

@@ -0,0 +1,139 @@
// threading structure
// -------- orginal message --------
// xoxoxoxo
// -------- reply 1 --------
// -------- reply 2 --------
// xoxoxoxo
// -------- new reply --------
var cs = cur_frm.cscript;
$.extend(cur_frm.cscript, {
onload: function(doc, dt, dn) {
//
// help area
//
if(in_list(user_roles,'System Manager')) {
cur_frm.page_layout.footer.help_area.innerHTML = '';
new wn.widgets.Footer({
parent:cur_frm.page_layout.footer.help_area,
columns:2,
items: [
{
column: 0,
label:'Support Email Settings',
description:'Integrate your incoming support emails to support ticket',
onclick: function() { loaddoc('Support Email Settings','Support Email Settings'); }
},
]
})
}
if(!doc.customer) hide_field(['customer_name','address_display','contact_display','contact_mobile','contact_email']);
},
refresh: function(doc) {
cs.make_listing(doc);
if(!doc.__islocal) {
// can't change the main message & subject once set
set_field_permlevel('subject',2);
set_field_permlevel('description',2);
set_field_permlevel('raised_by',2);
}
},
//
// make thread listing
//
make_listing: function(doc) {
cur_frm.fields_dict['Thread HTML'].wrapper.innerHTML = '';
// render first message
new EmailMessage(cur_frm.fields_dict['Thread HTML'].wrapper, {
from_email: doc.raised_by,
creation: doc.creation,
mail: doc.description,
content_type: doc.content_type
}, null, -1)
// render thread
cs.thread_list = new wn.widgets.Listing({
parent: cur_frm.fields_dict['Thread HTML'].wrapper,
no_result_message: 'No responses yet',
get_query: function() {
return 'select mail, from_email, creation, content_type '+
'from `tabSupport Ticket Response` where parent="'+doc.name+'" order by creation asc'
},
as_dict: 1,
render_row: function(parent, data, list, idx) {
new EmailMessage(parent, data, list, idx);
}
});
cs.thread_list.run();
},
Send: function(doc, dt, dn) {
$c_obj([doc], 'send_response', '', function(r,rt) {
locals[dt][dn].new_response = '';
refresh_field('new_response');
cs.make_listing(doc);
});
},
customer: function(doc, dt, dn) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
cur_frm.refresh();
}
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
if(doc.customer) unhide_field(['customer_name','address_display','contact_display','contact_mobile','contact_email']);
}
})
EmailMessage = function(parent, args, list, idx) {
var me = this;
$.extend(this, args);
this.make = function() {
this.creation = wn.datetime.str_to_user(this.creation);
if(this.from_email)
this.from_email = this.from_email.replace('<', '&lt;').replace('>', '&gt;');
// main wrapper
w = $a(parent, 'div', '',
{margin:'7px 0px', padding:'0px', border:'1px solid #c8c8c8', backgroundColor:'#f9f9f9'}
);
$br(w, '7px');
// sender and timestamp
$a($a(w, 'div', '', {marginBottom:'7px', padding: '7px', backgroundColor:'#d2d2f2'}),
'span', 'link_type', {}, repl('By %(from_email)s on %(creation)s:', this),
function() {
// toggle message display on timestamp
if(me.message.style.display.toLowerCase()=='none') {
$ds(me.message);
} else {
$dh(me.message);
}
}
);
// email text
this.message = $a(w, 'div', '',
// style
{lineHeight:'1.7em', display:'none', padding: '7px'},
// newlines for text email
(this.content_type=='text/plain' ? this.mail
.replace(/\n[ ]*\n[\n\t ]*/g, '\n\n') // excess whitespace
.replace(/\n/g, '<br>') : this.mail)
);
// show only first and last message
if(idx==-1 || list && list.values.length-1==idx) {
$ds(this.message)
}
}
this.make();
}

View File

@@ -0,0 +1,48 @@
import webnotes
from utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def send_response(self):
"""
Adds a new response to the ticket and sends an email to the sender
"""
if not self.doc.new_response:
webnotes.msgprint("Please write something as a response", raise_exception=1)
subject = '[' + self.doc.name + '] ' + self.doc.subject
response = self.doc.new_response + '\n\n[Please do not change the subject while responding.]'
signature = webnotes.conn.get_value('Support Email Settings',None,'signature')
if signature:
response += '\n\n' + signature
from webnotes.utils.email_lib import sendmail
sendmail(\
recipients = [self.doc.raised_by], \
sender=webnotes.conn.get_value('Support Email Settings',None,'email'), \
subject=subject, \
msg=response)
self.doc.new_response = None
webnotes.conn.set(self.doc,'status','Waiting for Customer')
self.make_response_record(response)
def make_response_record(self, response, from_email = None, content_type='text/plain'):
"""
Creates a new Support Ticket Response record
"""
# add to Support Ticket Response
from webnotes.model.doc import Document
d = Document('Support Ticket Response')
d.from_email = from_email or webnotes.user.name
d.parent = self.doc.name
d.mail = response
d.content_type = content_type
d.save(1)

View File

@@ -0,0 +1,419 @@
# DocType, Support Ticket
[
# These values are common in all dictionaries
{
'creation': '2011-05-23 14:50:46',
'docstatus': 0,
'modified': '2011-06-27 10:46:31',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1308898257',
'allow_trash': 1,
'autoname': 'SUP.######',
'colour': 'White:FFF',
'doctype': 'DocType',
'module': 'Support',
'name': '__common__',
'search_fields': 'status,customer,allocated_to,subject,raised_by',
'section_style': 'Tray',
'server_code_error': ' ',
'show_in_menu': 0,
'subject': '%(subject)s',
'tag_fields': 'status',
'version': 140
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Support Ticket',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Support Ticket',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1
},
# DocType, Support Ticket
{
'doctype': 'DocType',
'name': 'Support Ticket'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'role': 'Guest',
'submit': 0,
'write': 1
},
# DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 2,
'match': 'customer',
'permlevel': 0,
'role': 'Customer',
'write': 1
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 0,
'role': 'Support Team',
'write': 1
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 4,
'match': 'allocated_to',
'permlevel': 1,
'role': 'Support Team',
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 5,
'permlevel': 2,
'role': 'Support Team'
},
# DocField
{
'colour': 'White:FFF',
'default': 'Open',
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Select',
'idx': 1,
'in_filter': 0,
'label': 'Status',
'no_copy': 1,
'oldfieldname': 'status',
'oldfieldtype': 'Select',
'options': '\nOpen\nTo Reply\nWaiting for Customer\nHold\nClosed',
'permlevel': 1,
'reqd': 0,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'subject',
'fieldtype': 'Text',
'idx': 2,
'in_filter': 1,
'label': 'Subject',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'depends_on': 'eval:doc.__islocal',
'doctype': 'DocField',
'fieldname': 'raised_by',
'fieldtype': 'Data',
'idx': 3,
'in_filter': 1,
'label': 'Raised By (Email)',
'oldfieldname': 'raised_by',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'depends_on': 'eval:doc.__islocal',
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Text',
'idx': 4,
'label': 'Description',
'oldfieldname': 'problem_description',
'oldfieldtype': 'Text',
'permlevel': 0,
'reqd': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'problem_description',
'fieldtype': 'Text',
'idx': 5,
'label': 'Problem Description',
'oldfieldname': 'problem_description',
'oldfieldtype': 'Text',
'permlevel': 0
},
# DocField
{
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 6,
'label': 'Thread HTML',
'permlevel': 1
},
# DocField
{
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldname': 'new_response',
'fieldtype': 'Text',
'idx': 7,
'label': 'New Response',
'permlevel': 0
},
# DocField
{
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 8,
'label': 'Send',
'options': 'send_response',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 9,
'label': 'Additional Info',
'permlevel': 1
},
# DocField
{
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 10,
'oldfieldtype': 'Column Break',
'permlevel': 1,
'width': '50%'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'customer',
'fieldtype': 'Link',
'idx': 11,
'in_filter': 1,
'label': 'Customer',
'oldfieldname': 'customer',
'oldfieldtype': 'Link',
'options': 'Customer',
'permlevel': 1,
'print_hide': 1,
'reqd': 0,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_name',
'fieldtype': 'Data',
'idx': 12,
'in_filter': 1,
'label': 'Customer Name',
'oldfieldname': 'customer_name',
'oldfieldtype': 'Data',
'permlevel': 2,
'reqd': 0,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'address_display',
'fieldtype': 'Small Text',
'idx': 13,
'label': 'Address',
'permlevel': 2
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_display',
'fieldtype': 'Data',
'idx': 14,
'label': 'Contact Name',
'permlevel': 2
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_mobile',
'fieldtype': 'Data',
'idx': 15,
'label': 'Mobile No',
'permlevel': 2
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_email',
'fieldtype': 'Data',
'idx': 16,
'label': 'Contact Email',
'oldfieldname': 'contact_no',
'oldfieldtype': 'Data',
'permlevel': 2
},
# DocField
{
'default': 'Today',
'doctype': 'DocField',
'fieldname': 'opening_date',
'fieldtype': 'Date',
'idx': 17,
'label': 'Opening Date',
'no_copy': 1,
'oldfieldname': 'opening_date',
'oldfieldtype': 'Date',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'opening_time',
'fieldtype': 'Time',
'idx': 18,
'label': 'Opening Time',
'no_copy': 1,
'oldfieldname': 'opening_time',
'oldfieldtype': 'Time',
'permlevel': 1
},
# DocField
{
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 19,
'oldfieldtype': 'Column Break',
'permlevel': 1
},
# DocField
{
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldname': 'allocated_to',
'fieldtype': 'Link',
'idx': 20,
'in_filter': 1,
'label': 'Allocated To',
'oldfieldname': 'allocated_to',
'oldfieldtype': 'Link',
'options': 'Profile',
'permlevel': 1,
'search_index': 1
},
# DocField
{
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldname': 'resolution_details',
'fieldtype': 'Text',
'idx': 21,
'label': 'Resolution Details',
'no_copy': 1,
'oldfieldname': 'resolution_details',
'oldfieldtype': 'Text',
'permlevel': 1
},
# DocField
{
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldname': 'resolution_date',
'fieldtype': 'Date',
'idx': 22,
'in_filter': 0,
'label': 'Resolution Date',
'no_copy': 1,
'oldfieldname': 'resolution_date',
'oldfieldtype': 'Date',
'permlevel': 1,
'search_index': 1
},
# DocField
{
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldname': 'resolution_time',
'fieldtype': 'Time',
'idx': 23,
'label': 'Resolution Time',
'oldfieldname': 'resolution_time',
'oldfieldtype': 'Time',
'permlevel': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'content_type',
'fieldtype': 'Data',
'hidden': 1,
'idx': 24,
'label': 'Content Type',
'permlevel': 0
}
]

View File

@@ -0,0 +1,67 @@
# DocType, Support Ticket Response
[
# These values are common in all dictionaries
{
'creation': '2011-05-23 14:50:48',
'docstatus': 0,
'modified': '2011-05-24 10:17:30',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'Support',
'name': '__common__',
'section_style': 'Simple',
'show_in_menu': 0,
'version': 4
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Support Ticket Response',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# DocType, Support Ticket Response
{
'doctype': 'DocType',
'name': 'Support Ticket Response'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'mail',
'fieldtype': 'Text',
'idx': 1,
'label': 'Mail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'from_email',
'fieldtype': 'Data',
'idx': 2,
'label': 'From Email'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'content_type',
'fieldtype': 'Data',
'idx': 3,
'label': 'Content Type'
}
]

View File

View File

@@ -0,0 +1,9 @@
report.customize_filters = function() {
this.hide_all_filters();
this.mytabs.items['Select Columns'].hide();
this.mytabs.items['More Filters'].hide()
this.filter_fields_dict['Serial No'+FILTER_SEP +'Territory'].df.filter_hide = 0;
this.filter_fields_dict['Serial No'+FILTER_SEP +'Item Group'].df.filter_hide = 0;
this.filter_fields_dict['Serial No'+FILTER_SEP +'Territory'].df.in_first_page = 1;
this.filter_fields_dict['Serial No'+FILTER_SEP +'Item Group'].df.in_first_page = 1;
}

View File

@@ -0,0 +1,70 @@
# ADD NEW COLUMNS
row_list = [['Item Group','Data','150px',''],
['Out of AMC','Int','150px',''],
['Under AMC','Int','150px',''],
['Out of Warranty','Int','150px',''],
['Under Warranty','Int','150px',''],
['Total','Int','150px','']
]
for r in row_list:
colnames.append(r[0])
coltypes.append(r[1])
colwidths.append(r[2])
coloptions.append(r[3])
col_idx[r[0]] = len(colnames)-1
#ADD VALUES TO THE COLUMN
out=[]
oa,ua,ow,uw,sum=0,0,0,0,0
nowdate = nowdate()
for r in res:
cc = r[col_idx['Territory']]
item_groups = sql("select distinct item_group from `tabSerial No` where territory = '%s' and item_group like '%%%s'" %(cc,filter_values.get('item_group')))
for col in range(len(colnames)-1): # this would make all first row blank. just for look
r.append('')
out.append(r)
# Add Totals for each Territory
# -----------------------------
det = sql("select COUNT(CASE WHEN amc_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN amc_expiry_date <= '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date <= '%s' THEN name ELSE NULL END) from `tabSerial No` where territory = '%s' and item_group like '%%%s'" %(nowdate,nowdate,nowdate,nowdate,cc,filter_values.get('item_group')))
r[col_idx['Item Group']] = ''
r[col_idx['Out of AMC']] = cstr(det[0][0])
r[col_idx['Under AMC']] = cstr(det[0][1])
r[col_idx['Out of Warranty']] = cstr(det[0][2])
r[col_idx['Under Warranty']] = cstr(det[0][3])
tot = cint(det[0][0]) + cint(det[0][1]) + cint(det[0][2]) + cint(det[0][3])
r[col_idx['Total']] = cstr(tot)
oa += cint(det[0][0])
ua += cint(det[0][1])
ow += cint(det[0][2])
uw += cint(det[0][3])
sum += tot
# Add Brand Details belonging to Territory
# ----------------------------------------
for br in item_groups:
br_det = sql("select COUNT(CASE WHEN amc_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN amc_expiry_date <= '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date <= '%s' THEN name ELSE NULL END) from `tabSerial No` where territory = '%s' and item_group = '%s'"%(nowdate,nowdate,nowdate,nowdate,cc,br[0]))
t_row = ['' for i in range(len(colnames))]
t_row[col_idx['Item Group']] = br[0]
t_row[col_idx['Out of AMC']] = cint(br_det[0][0])
t_row[col_idx['Under AMC']] = cint(br_det[0][1])
t_row[col_idx['Out of Warranty']] = cint(br_det[0][2])
t_row[col_idx['Under Warranty']] = cint(br_det[0][3])
tot = cint(br_det[0][0]) + cint(br_det[0][1]) + cint(br_det[0][2])+ cint(br_det[0][3])
t_row[col_idx['Total']] = tot
out.append(t_row)
#ADD NEW ROW
# ----------
newrow=['','TOTAL',oa,ua,ow,uw,sum]
out.append(newrow)
res=out

View File

@@ -0,0 +1,37 @@
[
{
'add_col': None,
'add_cond': "`tabSerial No`.`territory` is not null\n`tabSerial No`.`territory` != ''\n`tabSerial No`.`status` not in ('In Store', 'Scrapped')",
'add_tab': None,
'columns': 'Serial No\x01Territory',
'creation': '2010-08-08 17:09:32',
'criteria_name': 'AMC Summary',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Serial No',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Serial No\x01Saved':1,'Serial No\x01Status':''}",
'graph_series': None,
'graph_values': None,
'group_by': '`tabSerial No`.`cost_center`',
'idx': None,
'modified': '2010-07-15 16:00:11',
'modified_by': 'Administrator',
'module': 'Maintenance',
'name': 'amc_summary',
'owner': 'Administrator',
'page_len': 50,
'parent': None,
'parent_doc_type': None,
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabSerial No`.`cost_center`',
'sort_order': 'ASC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,7 @@
report.customize_filters = function() {
this.filter_fields_dict['Customer Issue'+FILTER_SEP +'Status'].df.in_first_page = 1;
this.filter_fields_dict['Customer Issue'+FILTER_SEP +'Allocated To'].df.in_first_page = 1;
this.filter_fields_dict['Customer Issue'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
}
this.mytabs.items['Select Columns'].hide()

View File

@@ -0,0 +1,37 @@
[
{
'add_col': None,
'add_cond': None,
'add_tab': None,
'columns': 'Customer Issue\x01ID,Customer Issue\x01Status,Customer Issue\x01Complaint Date,Customer Issue\x01Complaint,Customer Issue\x01Item Code,Customer Issue\x01Item Name,Customer Issue\x01Allocated To,Customer Issue\x01Allocated On,Customer Issue\x01Resolved By,Customer Issue\x01Resolution Date,Customer Issue\x01Customer Name,Customer Issue\x01Fiscal Year',
'creation': '2010-09-01 15:47:57',
'criteria_name': 'Customer Issues',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Customer Issue',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Customer Issue\x01Saved':1,'Customer Issue\x01Submitted':1,'Customer Issue\x01Status':'','Customer Issue\x01Fiscal Year':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-08-30 13:21:32',
'modified_by': 'Administrator',
'module': 'Maintenance',
'name': 'customer_issues',
'owner': 'Administrator',
'page_len': 50,
'parent': None,
'parent_doc_type': None,
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabCustomer Issue`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,4 @@
report.customize_filters = function() {
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;
}

View File

@@ -0,0 +1,37 @@
[
{
'add_col': "SUM((`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`billed_qty`) * `tabSales Order Detail`.`basic_rate`) AS 'Pending Amount'",
'add_cond': "`tabSales Order`.status != 'Stopped'\n`tabSales Order`.order_type='Maintenance'",
'add_tab': None,
'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order\x01Customer Address,Sales Order\x01Status,Sales Order\x01% Billed,Sales Order\x01Sales Order Date',
'creation': '2010-09-01 15:47:57',
'criteria_name': 'Maintenance Orderwise Pending Amount To Bill',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Sales Order Detail',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-08-30 13:40:44',
'modified_by': 'Administrator',
'module': 'Maintenance',
'name': 'maintenance_orderwise_pending_amount_to_bill',
'owner': 'ashwini@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': 'Sales Order',
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabSales Order`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,13 @@
report.customize_filters = function() {
this.filter_fields_dict['Maintenance Schedule Detail'+FILTER_SEP +'From Scheduled Date'].df.in_first_page = 1;
this.filter_fields_dict['Maintenance Schedule Detail'+FILTER_SEP +'To Scheduled Date'].df.in_first_page = 1;
this.filter_fields_dict['Maintenance Schedule Detail'+FILTER_SEP +'Incharge Name'].df.in_first_page = 1;
this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Customer'].df.in_first_page = 1;
this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Customer Name'].df.in_first_page = 1;
this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Sales Order No'].df.in_first_page = 1;
//this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Status'].df.in_first_page = 0;
this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
}
this.mytabs.items['Select Columns'].hide()

View File

@@ -0,0 +1,37 @@
[
{
'add_col': None,
'add_cond': None,
'add_tab': None,
'columns': 'Maintenance Schedule Detail\x01Item Code,Maintenance Schedule Detail\x01Item Name,Maintenance Schedule Detail\x01Serial No,Maintenance Schedule Detail\x01Incharge Name,Maintenance Schedule Detail\x01Scheduled Date,Maintenance Schedule\x01Customer Name,Maintenance Schedule\x01Address,Maintenance Schedule\x01Sales Order No',
'creation': '2010-09-01 15:47:57',
'criteria_name': 'Maintenance Schedule Details',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Maintenance Schedule Detail',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Maintenance Schedule\x01Submitted':1,'Maintenance Schedule\x01Status':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-08-30 13:18:23',
'modified_by': 'Administrator',
'module': 'Maintenance',
'name': 'maintenance_schedule_details',
'owner': 'nabin@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': 'Maintenance Schedule',
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabMaintenance Schedule Detail`.`item_code`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,9 @@
//this.mytabs.items['Select Columns'].hide();
report.customize_filters = function() {
this.filter_fields_dict['Serial No'+FILTER_SEP +'Status'].df.in_first_page = 0;
this.filter_fields_dict['Serial No'+FILTER_SEP +'Customer'].df.in_first_page = 1;
this.filter_fields_dict['Serial No'+FILTER_SEP +'Customer Name'].df.in_first_page = 1;
this.filter_fields_dict['Serial No'+FILTER_SEP +'Maintenance Status'].df.in_first_page = 1;
}

View File

@@ -0,0 +1,37 @@
[
{
'add_col': None,
'add_cond': None,
'add_tab': None,
'columns': 'Serial No\x01ID,Serial No\x01Item Code,Serial No\x01Description,Serial No\x01Status,Serial No\x01Item Group,Serial No\x01Purchase Receipt No,Serial No\x01Delivery Note No,Serial No\x01Customer,Serial No\x01Customer Name,Serial No\x01AMC Expiry Date,Serial No\x01Warranty Expiry Date',
'creation': '2010-09-01 15:47:57',
'criteria_name': 'Warranty/AMC Expiry Details',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Serial No',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Serial No\x01Saved':1,'Serial No\x01Status':'','Serial No\x01Maintenance Status':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-08-30 13:32:21',
'modified_by': 'Administrator',
'module': 'Maintenance',
'name': 'warranty-amc_expiry_details',
'owner': 'Administrator',
'page_len': 50,
'parent': None,
'parent_doc_type': None,
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabSerial No`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,10 @@
report.customize_filters = function() {
this.hide_all_filters();
this.mytabs.items['Select Columns'].hide();
this.mytabs.items['More Filters'].hide();
this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Territory'+NEWLINE+'Item Group',ignore:1,parent:'Serial No',in_first_page:1, report_default:'Item Group'});
}
report.aftertableprint = function(t) {
$yt(t,'*',1,{whiteSpace:'pre'});
}

View File

@@ -0,0 +1,37 @@
opt = filter_values.get('based_on')
opt_dict = {'Territory':'territory', 'Item Group':'item_group'}
# ADD NEW COLUMNS
row_list = [[opt,'Data','150px',''],
['Out of AMC','Int','150px',''],
['Under AMC','Int','150px',''],
['Out of Warranty','Int','150px',''],
['Under Warranty','Int','150px',''],
['Total','Int','150px','']]
for r in row_list:
colnames.append(r[0])
coltypes.append(r[1])
colwidths.append(r[2])
coloptions.append(r[3])
col_idx[r[0]] = len(colnames)-1
#ADD VALUES TO THE COLUMN
out=[]
oa,ua,ow,uw,sum=0,0,0,0,0
nowdate = nowdate()
for r in res:
lft_rgt = sql("select lft, rgt from `tab%s` where name = '%s'" % (opt,r[col_idx[opt]].strip()))
det = sql("select COUNT(CASE WHEN t1.amc_expiry_date < '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.amc_expiry_date >= '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.warranty_expiry_date < '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.warranty_expiry_date >= '%s' THEN t1.name ELSE NULL END) from `tabSerial No` t1, `tab%s` t2 where t1.%s = t2.name and t2.lft>= '%s' and t2. rgt <= '%s' and t1.status not in ('In Store', 'Scrapped','Not in Use') and ifnull(item_group,'')!='' and ifnull(territory,'')!=''" %(nowdate,nowdate,nowdate,nowdate,opt, opt_dict[opt], lft_rgt[0][0], lft_rgt[0][1]))
r.append(cint(det[0][0]))
r.append(cint(det[0][1]))
r.append(cint(det[0][2]))
r.append(cint(det[0][3]))
tot = cint(det[0][0]) + cint(det[0][1]) + cint(det[0][2]) + cint(det[0][3])
r.append(tot)
out.append(r)

View File

@@ -0,0 +1 @@
SELECT CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM `tab%(based_on)s` AS node,`tab%(based_on)s` AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.docstatus !=2 GROUP BY node.name ORDER BY node.lft

View File

@@ -0,0 +1,37 @@
[
{
'add_col': None,
'add_cond': None,
'add_tab': None,
'columns': '',
'creation': '2010-12-14 17:56:43',
'criteria_name': 'Warranty/AMC Summary',
'custom_query': None,
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Serial No',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Serial No\x01Saved':1,'Serial No\x01Status':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-09-25 12:14:49',
'modified_by': 'Administrator',
'module': 'Maintenance',
'name': 'warranty-amc_summary',
'owner': 'Administrator',
'page_len': 50,
'parent': None,
'parent_doc_type': None,
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': 'name',
'sort_order': 'DESC',
'standard': 'Yes'
}
]