mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-18 12:39:18 +00:00
restructured erpnext and deleted unwanted
This commit is contained in:
@@ -0,0 +1,480 @@
|
||||
[
|
||||
{
|
||||
'_last_update': None,
|
||||
'_user_tags': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': u'DocType Mapper',
|
||||
'from_doctype': 'Delivery Note',
|
||||
'idx': None,
|
||||
'modified': '2011-05-17 11:42:57',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Mapper',
|
||||
'name': 'Delivery Note-Installation Note',
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'ref_doc_submitted': 1,
|
||||
'to_doctype': 'Installation Note'
|
||||
},
|
||||
{
|
||||
'checking_operator': '=',
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'company',
|
||||
'idx': 1,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00022',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 2,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00023',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'fiscal_year'
|
||||
},
|
||||
{
|
||||
'checking_operator': '=',
|
||||
'creation': '2010-09-01 15:48:10',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'customer',
|
||||
'idx': 3,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00556',
|
||||
'owner': 'harshada@webnotestech.com',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 4,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003477',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 4,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2010-08-08 17:09:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00025',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'address'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'contact_person',
|
||||
'idx': 5,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00026',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 6,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00024',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 7,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003478',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 8,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003479',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 9,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003480',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 10,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003481',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 11,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00027',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 12,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003482',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 'name',
|
||||
'idx': 13,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00028',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'delivery_note_no'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'name',
|
||||
'idx': 14,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00029',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'prevdoc_detail_docname'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parent',
|
||||
'idx': 15,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00030',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'prevdoc_docname'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parenttype',
|
||||
'idx': 16,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00031',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 'item_code',
|
||||
'idx': 17,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00032',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 'description',
|
||||
'idx': 18,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00033',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'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': 'eval: flt(obj.qty) - flt(obj.installed_qty)',
|
||||
'idx': 19,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00034',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'qty'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'serial_no',
|
||||
'idx': 20,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00035',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'serial_no'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-09 09:44:02',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'posting_date',
|
||||
'idx': 21,
|
||||
'map': 'Yes',
|
||||
'match_id': 2,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00551',
|
||||
'owner': 'ashwini@webnotestech.com',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'prevdoc_date'
|
||||
},
|
||||
{
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': 'delivery_note_details',
|
||||
'from_table': 'Delivery Note Detail',
|
||||
'idx': 1,
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'TMD/0000005',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'reference_doctype_key': None,
|
||||
'reference_key': None,
|
||||
'to_field': 'installed_item_details',
|
||||
'to_table': 'Installed Item Details',
|
||||
'validation_logic': 'qty > ifnull(installed_qty,0) and docstatus = 1'
|
||||
},
|
||||
{
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': None,
|
||||
'from_table': 'Delivery Note',
|
||||
'idx': 2,
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'TMD/0000006',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'reference_doctype_key': None,
|
||||
'reference_key': None,
|
||||
'to_field': None,
|
||||
'to_table': 'Installation Note',
|
||||
'validation_logic': 'docstatus = 1'
|
||||
},
|
||||
{
|
||||
'creation': '2010-08-09 09:44:02',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': None,
|
||||
'from_table': 'Delivery Note',
|
||||
'idx': 3,
|
||||
'match_id': 2,
|
||||
'modified': '2011-05-20 15:54:24',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'TMD/0000058',
|
||||
'owner': 'ashwini@webnotestech.com',
|
||||
'parent': 'Delivery Note-Installation Note',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'reference_doctype_key': 'prevdoc_doctype',
|
||||
'reference_key': 'prevdoc_docname',
|
||||
'to_field': 'installed_item_details',
|
||||
'to_table': 'Installed Item Details',
|
||||
'validation_logic': 'docstatus = 1'
|
||||
}
|
||||
]
|
||||
621
selling/DocType Mapper/Enquiry-Quotation/Enquiry-Quotation.txt
Normal file
621
selling/DocType Mapper/Enquiry-Quotation/Enquiry-Quotation.txt
Normal file
@@ -0,0 +1,621 @@
|
||||
[
|
||||
{
|
||||
'_last_update': None,
|
||||
'_user_tags': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': u'DocType Mapper',
|
||||
'from_doctype': 'Enquiry',
|
||||
'idx': None,
|
||||
'modified': '2011-05-10 16:04:40',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Mapper',
|
||||
'name': 'Enquiry-Quotation',
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'ref_doc_submitted': 1,
|
||||
'to_doctype': 'Quotation'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'contact_no',
|
||||
'idx': 1,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2010-08-08 17:09:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00080',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'contact_no'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'item_code',
|
||||
'idx': 1,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00081',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'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': 2,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00082',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'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': 'qty',
|
||||
'idx': 3,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00084',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'qty'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'subject',
|
||||
'idx': 4,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2010-08-08 17:09:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00083',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'enq_det'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'uom',
|
||||
'idx': 4,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00085',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'stock_uom'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'source',
|
||||
'idx': 5,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00086',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'source'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'campaign',
|
||||
'idx': 6,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00087',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'campaign'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'name',
|
||||
'idx': 7,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00088',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'enq_no'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-09-01 15:48:10',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'customer',
|
||||
'idx': 8,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00560',
|
||||
'owner': 'harshada@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'customer'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-20 15:54:25',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'customer_address',
|
||||
'idx': 9,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003489',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'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_name',
|
||||
'idx': 10,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2010-08-08 17:09:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00089',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'customer_name'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'contact_person',
|
||||
'idx': 10,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00092',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'contact_person'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-20 15:54:25',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'address_display',
|
||||
'idx': 11,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003490',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'address_display'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-09-01 15:48:10',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'customer_name',
|
||||
'idx': 11,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2010-09-01 15:48:10',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00561',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'customer_name'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-20 15:54:25',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'contact_display',
|
||||
'idx': 12,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003491',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'contact_display'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'address',
|
||||
'idx': 12,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2010-08-08 17:09:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00091',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'customer_address'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-20 15:54:25',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'contact_mobile',
|
||||
'idx': 13,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003492',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'contact_mobile'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-20 15:54:25',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'contact_email',
|
||||
'idx': 14,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000003493',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'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': 'email_id',
|
||||
'idx': 14,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2010-08-08 17:09:34',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00093',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'email_id'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'territory',
|
||||
'idx': 15,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00094',
|
||||
'owner': 'harshada@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'territory'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'customer_group',
|
||||
'idx': 16,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00090',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'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': 'description',
|
||||
'idx': 17,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00095',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'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_group',
|
||||
'idx': 18,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00096',
|
||||
'owner': 'harshada@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'item_group'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'brand',
|
||||
'idx': 19,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00097',
|
||||
'owner': 'harshada@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'brand'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parent',
|
||||
'idx': 20,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00098',
|
||||
'owner': 'ashwini@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'prevdoc_docname'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parenttype',
|
||||
'idx': 21,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00099',
|
||||
'owner': 'ashwini@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'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': 'lead',
|
||||
'idx': 22,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00100',
|
||||
'owner': 'harshada@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'lead'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'lead_name',
|
||||
'idx': 23,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00101',
|
||||
'owner': 'harshada@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'lead_name'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'enquiry_from',
|
||||
'idx': 24,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00102',
|
||||
'owner': 'harshada@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'quotation_to'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'enquiry_type',
|
||||
'idx': 25,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FMD/00103',
|
||||
'owner': 'harshada@webnotestech.com',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'order_type'
|
||||
},
|
||||
{
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': None,
|
||||
'from_table': 'Enquiry',
|
||||
'idx': 1,
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'TMD/0000011',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'reference_doctype_key': None,
|
||||
'reference_key': None,
|
||||
'to_field': None,
|
||||
'to_table': 'Quotation',
|
||||
'validation_logic': 'docstatus=1'
|
||||
},
|
||||
{
|
||||
'creation': '2010-08-08 17:09:34',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': 'enq_details',
|
||||
'from_table': 'Enquiry Detail',
|
||||
'idx': 2,
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-20 15:54:25',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'TMD/0000012',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Enquiry-Quotation',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'reference_doctype_key': None,
|
||||
'reference_key': None,
|
||||
'to_field': 'quotation_details',
|
||||
'to_table': 'Quotation Detail',
|
||||
'validation_logic': 'docstatus=1'
|
||||
}
|
||||
]
|
||||
1
selling/DocType Mapper/Lead-Customer/Lead-Customer.txt
Normal file
1
selling/DocType Mapper/Lead-Customer/Lead-Customer.txt
Normal file
File diff suppressed because one or more lines are too long
1
selling/DocType Mapper/Lead-Enquiry/Lead-Enquiry.txt
Normal file
1
selling/DocType Mapper/Lead-Enquiry/Lead-Enquiry.txt
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Project-Sales Order', 'parent': None, 'to_doctype': 'Sales Order', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_doctype': 'Project', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00892', 'parent': 'Project-Sales Order', 'to_field': 'customer', 'creation': '2010-08-26 13:29:10', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': '=', 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'customer', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00864', 'parent': 'Project-Sales Order', 'to_field': 'customer_name', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': '', 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00865', 'parent': 'Project-Sales Order', 'to_field': 'customer_address', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_address', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00866', 'parent': 'Project-Sales Order', 'to_field': 'contact_person', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_person', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00867', 'parent': 'Project-Sales Order', 'to_field': 'contact_no', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_no', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00868', 'parent': 'Project-Sales Order', 'to_field': 'email_id', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'email_id', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00885', 'parent': 'Project-Sales Order', 'to_field': 'customer_group', 'creation': '2010-08-19 14:15:00', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_group', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00886', 'parent': 'Project-Sales Order', 'to_field': 'territory', 'creation': '2010-08-19 14:15:00', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'territory', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000086', 'parent': 'Project-Sales Order', 'is_reference_table': None, 'to_field': None, 'creation': '2010-08-18 14:41:39', 'reference_doctype_key': '', 'modified': '2010-09-01 14:23:28', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Project', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'to_table': 'Sales Order', 'from_field': None, 'validation_logic': 'name is not null', 'parentfield': 'table_mapper_details'}]
|
||||
File diff suppressed because it is too large
Load Diff
673
selling/Module Def/Selling/Selling.txt
Normal file
673
selling/Module Def/Selling/Selling.txt
Normal file
@@ -0,0 +1,673 @@
|
||||
[
|
||||
{
|
||||
'_last_update': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'disabled': 'No',
|
||||
'docstatus': 0,
|
||||
'doctype': u'Module Def',
|
||||
'doctype_list': 'Print Format, Sales Order\nPrint Format, Quotation Format\nPrint Format, Delivery Note Format',
|
||||
'file_list': 'crm.gif,FileData/00208',
|
||||
'idx': None,
|
||||
'is_hidden': 'No',
|
||||
'last_updated_date': None,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'module_desc': 'Manage you sales team, with your leads, customers, quotes, orders etc.',
|
||||
'module_icon': 'Selling.gif',
|
||||
'module_label': 'Selling',
|
||||
'module_name': 'Selling',
|
||||
'module_page': None,
|
||||
'module_seq': 3,
|
||||
'name': 'Selling',
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'trash_reason': None,
|
||||
'widget_code': None
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Database of potential customers you need to keep in touch with',
|
||||
'display_name': 'Lead',
|
||||
'doc_name': 'Lead',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'status\nlead_owner\nlead_name\ncontact_no\ncontact_by\ncontact_date\nexpected_month',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01284',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Your Customer Database',
|
||||
'display_name': 'Customer',
|
||||
'doc_name': 'Customer',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'customer_group\ncountry',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01285',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Specific requirements from a Lead / Customer',
|
||||
'display_name': 'Enquiry',
|
||||
'doc_name': 'Enquiry',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ncompany',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01286',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Offers you have made to your customers',
|
||||
'display_name': 'Quotation',
|
||||
'doc_name': 'Quotation',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ngrand_total\ncompany',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01287',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Database of confirmed Sale Orders from your Customers',
|
||||
'display_name': 'Sales Order',
|
||||
'doc_name': 'Sales Order',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'status\ntransaction_date\ncustomer\ncost_center\ngrand_total\nper_delivered\nper_billed\ncompany',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 5,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01288',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Sales Dashboard',
|
||||
'doc_name': 'Sales Dashboard',
|
||||
'doc_type': 'Pages',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01289',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': None,
|
||||
'doc_name': 'Reports',
|
||||
'doc_type': 'Separator',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 7,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01290',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Gross Profit',
|
||||
'doc_name': 'Delivery Note Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 8,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01291',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Territory, Item Group wise GP',
|
||||
'doc_name': 'Delivery Note',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 9,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01292',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Itemwise Sales Details',
|
||||
'doc_name': 'Sales Order Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 10,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01293',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Itemwise Delivery Details',
|
||||
'doc_name': 'Delivery Note Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 11,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01294',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Sales Personwise Transaction Summary',
|
||||
'doc_name': 'Sales Person',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 12,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01295',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Total Target Variance Report',
|
||||
'doc_name': 'Target Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 13,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01296',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Sales Persons Target Variance (Item Group wise)',
|
||||
'doc_name': 'Target Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 14,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01297',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Territories Target Variance (Item Group wise)',
|
||||
'doc_name': 'Target Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 15,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01298',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Sales Order Pending Items',
|
||||
'doc_name': 'Sales Order Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 16,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01299',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Sales Orderwise Booking & Delivery Summary',
|
||||
'doc_name': 'Sales Order Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 17,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01300',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Sales Orderwise Pending Qty To Deliver',
|
||||
'doc_name': 'Sales Order Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 18,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01301',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Sales 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': 19,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01302',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Delivered Items to be Install',
|
||||
'doc_name': 'Delivery Note Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 20,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01303',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Itemwise Price List',
|
||||
'doc_name': 'Ref Rate Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 21,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01304',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': None,
|
||||
'display_name': 'Follow-up Report',
|
||||
'doc_name': 'Follow up',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 22,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01305',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Ledger details of your debtors',
|
||||
'display_name': "Debtor's Ledger",
|
||||
'doc_name': 'GL Entry',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 23,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01306',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Customer Category',
|
||||
'display_name': 'Customer Group',
|
||||
'doc_name': 'Customer Group',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'id\ndescription',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 24,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01307',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Sales person details',
|
||||
'display_name': 'Sales Person',
|
||||
'doc_name': 'Sales Person',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'id\nterritory\ndepartment\nmobile_no\nemail_id',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 25,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01308',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Item master',
|
||||
'display_name': 'Item',
|
||||
'doc_name': 'Item',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'name\nitem_group\ndescription',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 26,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01309',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Sales partner details',
|
||||
'display_name': 'Sales Partner',
|
||||
'doc_name': 'Sales Partner',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'id\npartner_type\nmobile\nemail\nterritory',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 27,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01310',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'description': 'Business campaigns',
|
||||
'display_name': 'Campaign',
|
||||
'doc_name': 'Campaign',
|
||||
'doc_type': 'Setup Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'id\ncampaign_name\ndescription',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 28,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01311',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 1,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00328',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'Administrator'
|
||||
},
|
||||
{
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 2,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00329',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'Sales Manager'
|
||||
},
|
||||
{
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 3,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00330',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'Sales User'
|
||||
},
|
||||
{
|
||||
'creation': '2011-06-30 15:45:03',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 4,
|
||||
'modified': '2011-06-30 15:45:03',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00331',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Selling',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'Sales Master Manager'
|
||||
}
|
||||
]
|
||||
1
selling/Role/Customer/Customer.txt
Normal file
1
selling/Role/Customer/Customer.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'modified_by': 'Administrator', 'name': 'Customer', 'parent': None, 'creation': '2009-06-26 14:42:33', 'modified': '2009-06-26 14:42:33', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Customer', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
|
||||
1
selling/Role/Partner/Partner.txt
Normal file
1
selling/Role/Partner/Partner.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'modified_by': 'yogesh@webnotestech.com', 'name': 'Partner', 'parent': None, 'creation': '2009-07-13 11:29:39', 'modified': '2009-07-13 11:29:39', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Partner', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
|
||||
1
selling/Role/Sales Manager/Sales Manager.txt
Normal file
1
selling/Role/Sales Manager/Sales Manager.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'modified_by': 'Administrator', 'name': 'Sales Manager', 'parent': None, 'creation': '2010-04-08 12:07:36', 'modified': '2010-04-08 12:07:36', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Sales Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
|
||||
@@ -0,0 +1 @@
|
||||
[{'modified_by': 'Administrator', 'name': 'Sales Master Manager', 'parent': None, 'creation': '2010-04-08 13:50:11', 'modified': '2010-04-08 13:50:11', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
|
||||
1
selling/Role/Sales User/Sales User.txt
Normal file
1
selling/Role/Sales User/Sales User.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'modified_by': 'Administrator', 'name': 'Sales User', 'parent': None, 'creation': '2010-04-08 12:07:44', 'modified': '2010-04-08 12:07:44', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
|
||||
0
selling/__init__.py
Normal file
0
selling/__init__.py
Normal file
0
selling/doctype/__init__.py
Normal file
0
selling/doctype/__init__.py
Normal file
0
selling/doctype/campaign/__init__.py
Normal file
0
selling/doctype/campaign/__init__.py
Normal file
10
selling/doctype/campaign/campaign.js
Normal file
10
selling/doctype/campaign/campaign.js
Normal file
@@ -0,0 +1,10 @@
|
||||
$import(Tips Common)
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
168
selling/doctype/campaign/campaign.txt
Normal file
168
selling/doctype/campaign/campaign.txt
Normal file
@@ -0,0 +1,168 @@
|
||||
# DocType, Campaign
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:54',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'allow_trash': 1,
|
||||
'autoname': 'field:campaign_name',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 6
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Campaign',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Campaign',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'submit': 0
|
||||
},
|
||||
|
||||
# DocType, Campaign
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Campaign'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Manager',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Manager',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Master Manager',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales User',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales User',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Master Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 1,
|
||||
'label': 'Trash Reason',
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 2,
|
||||
'label': 'Campaign',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'campaign_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'label': 'Campaign Name',
|
||||
'oldfieldname': 'campaign_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 4,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0,
|
||||
'width': '300px'
|
||||
}
|
||||
]
|
||||
0
selling/doctype/customer/__init__.py
Normal file
0
selling/doctype/customer/__init__.py
Normal file
211
selling/doctype/customer/customer.js
Normal file
211
selling/doctype/customer/customer.js
Normal file
@@ -0,0 +1,211 @@
|
||||
$import(Contact Control)
|
||||
|
||||
/* ********************************* onload ********************************************* */
|
||||
|
||||
cur_frm.cscript.onload = function(doc,dt,dn){
|
||||
// history doctypes and scripts
|
||||
cur_frm.history_dict = {
|
||||
'Quotation' : 'cur_frm.cscript.make_qtn_list(this.body, this.doc)',
|
||||
'Sales Order' : 'cur_frm.cscript.make_so_list(this.body, this.doc)',
|
||||
'Delivery Note' : 'cur_frm.cscript.make_dn_list(this.body, this.doc)',
|
||||
'Sales Invoice' : 'cur_frm.cscript.make_si_list(this.body, this.doc)'
|
||||
}
|
||||
// make address, contact, shipping, history list body
|
||||
cur_frm.cscript.make_hl_body();
|
||||
//cur_frm.cscript.make_sl_body();
|
||||
}
|
||||
|
||||
cur_frm.add_fetch('lead_name', 'company_name', 'customer_name');
|
||||
cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate');
|
||||
|
||||
/* ********************************* refresh ********************************************* */
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,dt,dn) {
|
||||
if(sys_defaults.cust_master_name == 'Customer Name')
|
||||
hide_field('naming_series');
|
||||
else
|
||||
unhide_field('naming_series');
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['Address HTML','Contact HTML']);
|
||||
//cur_frm.cscript.set_hl_msg(doc);
|
||||
//cur_frm.cscript.set_sl_msg(doc);
|
||||
}else{
|
||||
unhide_field(['Address HTML','Contact HTML']);
|
||||
// make lists
|
||||
cur_frm.cscript.make_address(doc,dt,dn);
|
||||
cur_frm.cscript.make_contact(doc,dt,dn);
|
||||
cur_frm.cscript.make_history(doc,dt,dn);
|
||||
//cur_frm.cscript.make_shipping_address(doc,dt,dn);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_address = function() {
|
||||
if(!cur_frm.address_list) {
|
||||
cur_frm.address_list = new wn.widgets.Listing({
|
||||
parent: cur_frm.fields_dict['Address HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Address",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Address"][dn];
|
||||
ndoc.customer = cur_frm.doc.name;
|
||||
ndoc.customer_name = cur_frm.doc.customer_name;
|
||||
ndoc.address_type = 'Office';
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.address_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
||||
},
|
||||
as_dict: 1,
|
||||
no_results_message: 'No addresses created',
|
||||
render_row: function(wrapper, data) {
|
||||
$(wrapper).css('padding','5px 0px');
|
||||
var link = $ln(wrapper,cstr(data.name), function() { loaddoc("Address", this.dn); }, {fontWeight:'bold'});
|
||||
link.dn = data.name
|
||||
|
||||
$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_address ? '[Primary]' : '') + (data.is_shipping_address ? '[Shipping]' : ''));
|
||||
$a(wrapper,'div','',{marginTop:'5px', color:'#555'},
|
||||
(data.address_line1 ? data.address_line1 + '<br />' : '') +
|
||||
(data.address_line2 ? data.address_line2 + '<br />' : '') +
|
||||
(data.city ? data.city + '<br />' : '') +
|
||||
(data.state ? data.state + ', ' : '') +
|
||||
(data.country ? data.country + '<br />' : '') +
|
||||
(data.pincode ? 'Pincode: ' + data.pincode + '<br />' : '') +
|
||||
(data.phone ? 'Phone: ' + data.phone + '<br />' : '') +
|
||||
(data.fax ? 'Fax: ' + data.fax + '<br />' : '') +
|
||||
(data.email_id ? 'Email: ' + data.email_id + '<br />' : ''));
|
||||
}
|
||||
});
|
||||
}
|
||||
cur_frm.address_list.run();
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_contact = function() {
|
||||
if(!cur_frm.contact_list) {
|
||||
cur_frm.contact_list = new wn.widgets.Listing({
|
||||
parent: cur_frm.fields_dict['Contact HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Contact",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Contact"][dn];
|
||||
ndoc.customer = cur_frm.doc.name;
|
||||
ndoc.customer_name = cur_frm.doc.customer_name;
|
||||
if(cur_frm.doc.customer_type == 'Individual') {
|
||||
ndoc.first_name = cur_frm.doc.customer_name;
|
||||
}
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.contact_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
||||
},
|
||||
as_dict: 1,
|
||||
no_results_message: 'No contacts created',
|
||||
render_row: function(wrapper, data) {
|
||||
$(wrapper).css('padding', '5px 0px');
|
||||
var link = $ln(wrapper, cstr(data.name), function() { loaddoc("Contact", this.dn); }, {fontWeight:'bold'});
|
||||
link.dn = data.name
|
||||
|
||||
$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_contact ? '[Primary]' : ''));
|
||||
$a(wrapper,'div', '',{marginTop:'5px', color:'#555'}, data.first_name + (data.last_name ? ' ' + data.last_name + '<br />' : '<br>') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.mobile_no ? 'Mobile: ' + data.mobile_no + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : '') + (data.department ? 'Department: ' + data.department + '<br />' : '') + (data.designation ? 'Designation: ' + data.designation + '<br />' : ''));
|
||||
}
|
||||
});
|
||||
}
|
||||
cur_frm.contact_list.run();
|
||||
|
||||
}
|
||||
|
||||
/* ********************************* client triggers ************************************** */
|
||||
|
||||
// ---------------
|
||||
// customer group
|
||||
// ---------------
|
||||
cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) {
|
||||
return 'SELECT `tabCustomer Group`.`name`, `tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "No" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.cscript.CGHelp = function(doc,dt,dn){
|
||||
var call_back = function(){
|
||||
var sb_obj = new SalesBrowser();
|
||||
sb_obj.set_val('Customer Group');
|
||||
}
|
||||
loadpage('Sales Browser',call_back);
|
||||
}
|
||||
|
||||
// -----
|
||||
// lead
|
||||
// -----
|
||||
cur_frm.fields_dict['lead_name'].get_query = function(doc,dt,dn){
|
||||
return 'SELECT `tabLead`.`name` FROM `tabLead` WHERE `tabLead`.`status`!="Converted" AND `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50';
|
||||
}
|
||||
|
||||
/* ********************************* transaction history ************************************** */
|
||||
|
||||
// --------------------
|
||||
// make quotation list
|
||||
// --------------------
|
||||
cur_frm.cscript.make_qtn_list = function(parent,doc){
|
||||
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
|
||||
lst.colnames = ['Sr.','Id','Status','Quotation Date','Contact Person','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Data','Currency'];
|
||||
lst.coloptions = ['','Quotation','','','',''];
|
||||
|
||||
var q = repl("select name,status,transaction_date, contact_person, grand_total from tabQuotation where customer='%(cust)s' order by transaction_date desc", {'cust':doc.name});
|
||||
var q_max = repl("select count(name) from tabQuotation where customer='%(cust)s'", {'cust':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Quotation','Quotation');
|
||||
}
|
||||
|
||||
// -------------
|
||||
// make so list
|
||||
// -------------
|
||||
cur_frm.cscript.make_so_list = function(parent,doc){
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','30%','25%'];
|
||||
lst.colnames = ['Sr.','Id','Status','Sales Order Date','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Currency'];
|
||||
lst.coloptions = ['','Sales Order','','',''];
|
||||
|
||||
var q = repl("select name,status,transaction_date, grand_total from `tabSales Order` where customer='%(cust)s' order by transaction_date desc", {'cust':doc.name});
|
||||
var q_max = repl("select count(name) from `tabSales Order` where customer='%(cust)s'", {'cust':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Order','Sales Order');
|
||||
}
|
||||
|
||||
// -------------
|
||||
// make dn list
|
||||
// -------------
|
||||
cur_frm.cscript.make_dn_list = function(parent,doc){
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
|
||||
lst.colnames = ['Sr.','Id','Status','Delivery Note Date','Territory','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Link','Currency'];
|
||||
lst.coloptions = ['','Delivery Note','','','Territory',''];
|
||||
|
||||
var q = repl("select name,status,transaction_date,territory,grand_total from `tabDelivery Note` where customer='%(cust)s' order by transaction_date desc", {'cust':doc.name});
|
||||
var q_max = repl("select count(name) from `tabDelivery Note` where customer='%(cust)s'", {'cust':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Delivery Note','Delivery Note');
|
||||
}
|
||||
|
||||
// -------------
|
||||
// make si list
|
||||
// -------------
|
||||
cur_frm.cscript.make_si_list = function(parent,doc){
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
|
||||
lst.colnames = ['Sr.','Id','Posting Date','Due Date','Debit To','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Link','Currency'];
|
||||
lst.coloptions = ['','Receivable Voucher','','','Account',''];
|
||||
|
||||
|
||||
var q = repl("select name,posting_date,due_date,debit_to,grand_total from `tabReceivable Voucher` where customer='%(cust)s' order by posting_date desc", {'cust':doc.name});
|
||||
var q_max = repl("select count(name) from `tabReceivable Voucher` where customer='%(cust)s'", {'cust':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Receivable Voucher');
|
||||
}
|
||||
230
selling/doctype/customer/customer.py
Normal file
230
selling/doctype/customer/customer.py
Normal file
@@ -0,0 +1,230 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, date_diff, flt, formatdate, get_defaults, getdate, has_common, now, nowdate, replace_newlines, sendmail, set_default, user_format, validate_email_add
|
||||
from webnotes.model.doc import Document, make_autoname
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# ******************************************************* autoname ***********************************************************
|
||||
def autoname(self):
|
||||
cust_master_name = get_defaults().get('cust_master_name')
|
||||
if cust_master_name == 'Customer Name':
|
||||
|
||||
# filter out bad characters in name
|
||||
#cust = self.doc.customer_name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
|
||||
cust = self.doc.customer_name
|
||||
|
||||
supp = sql("select name from `tabSupplier` where name = %s", (cust))
|
||||
supp = supp and supp[0][0] or ''
|
||||
if supp:
|
||||
msgprint("You already have a Supplier with same name")
|
||||
raise Exception
|
||||
else:
|
||||
self.doc.name = cust
|
||||
|
||||
else:
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
|
||||
# ******************************************************* triggers ***********************************************************
|
||||
# ----------------
|
||||
# get company abbr
|
||||
# -----------------
|
||||
def get_company_abbr(self):
|
||||
return get_value('Company', self.doc.company, 'abbr')
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------
|
||||
# get parent account(i.e receivables group from company where default account head need to be created)
|
||||
# -----------------------------------------------------------------------------------------------------
|
||||
def get_receivables_group(self):
|
||||
g = sql("select receivables_group from tabCompany where name=%s", self.doc.company)
|
||||
g = g and g[0][0] or ''
|
||||
if not g:
|
||||
msgprint("Update Company master, assign a default group for Receivables")
|
||||
raise Exception
|
||||
return g
|
||||
|
||||
# ******************************************************* validate *********************************************************
|
||||
# ----------------
|
||||
# validate values
|
||||
# ----------------
|
||||
def validate_values(self):
|
||||
# Master name by naming series -> Series field mandatory
|
||||
if get_defaults().get('cust_master_name') == 'Naming Series' and not self.doc.naming_series:
|
||||
msgprint("Series is Mandatory.")
|
||||
raise Exception
|
||||
|
||||
# ---------
|
||||
# validate
|
||||
# ---------
|
||||
def validate(self):
|
||||
self.validate_values()
|
||||
|
||||
# ******************************************************* on update *********************************************************
|
||||
# ------------------------
|
||||
# create customer address
|
||||
# ------------------------
|
||||
def create_customer_address(self):
|
||||
addr_flds = [self.doc.address_line1, self.doc.address_line2, self.doc.city, self.doc.state, self.doc.country, self.doc.pincode]
|
||||
address_line = "\n".join(filter(lambda x : (x!='' and x!=None),addr_flds))
|
||||
|
||||
if self.doc.phone_1:
|
||||
address_line = address_line + "\n" + "Phone: " + cstr(self.doc.phone_1)
|
||||
if self.doc.email_id:
|
||||
address_line = address_line + "\n" + "E-mail: " + cstr(self.doc.email_id)
|
||||
set(self.doc,'address', address_line)
|
||||
|
||||
telephone = "(O): " + cstr(self.doc.phone_1) +"\n"+ cstr(self.doc.phone_2) + "\n" + "(M): " + "\n" + "(fax): " + cstr(self.doc.fax_1)
|
||||
set(self.doc,'telephone',telephone)
|
||||
|
||||
|
||||
# ------------------------------------
|
||||
# create primary contact for customer
|
||||
# ------------------------------------
|
||||
def create_p_contact(self,nm,phn_no,email_id,mob_no,fax,cont_addr):
|
||||
c1 = Document('Contact')
|
||||
c1.first_name = nm
|
||||
c1.contact_name = nm
|
||||
c1.contact_no = phn_no
|
||||
c1.email_id = email_id
|
||||
c1.mobile_no = mob_no
|
||||
c1.fax = fax
|
||||
c1.contact_address = cont_addr
|
||||
c1.is_primary_contact = 'Yes'
|
||||
c1.is_customer =1
|
||||
c1.customer = self.doc.name
|
||||
c1.customer_name = self.doc.customer_name
|
||||
c1.customer_address = self.doc.address
|
||||
c1.customer_group = self.doc.customer_group
|
||||
c1.save(1)
|
||||
|
||||
|
||||
# ------------------------
|
||||
# create customer contact
|
||||
# ------------------------
|
||||
def create_customer_contact(self):
|
||||
contact = sql("select distinct name from `tabContact` where customer_name=%s", (self.doc.customer_name))
|
||||
contact = contact and contact[0][0] or ''
|
||||
if not contact:
|
||||
# create primary contact for individual customer
|
||||
if self.doc.customer_type == 'Individual':
|
||||
self.create_p_contact(self.doc.customer_name,self.doc.phone_1,self.doc.email_id,'',self.doc.fax_1,self.doc.address)
|
||||
|
||||
# create primary contact for lead
|
||||
elif self.doc.lead_name:
|
||||
c_detail = sql("select lead_name, company_name, contact_no, mobile_no, email_id, fax, address from `tabLead` where name =%s", self.doc.lead_name, as_dict=1)
|
||||
self.create_p_contact(c_detail and c_detail[0]['lead_name'] or '', c_detail and c_detail[0]['contact_no'] or '', c_detail and c_detail[0]['email_id'] or '', c_detail and c_detail[0]['mobile_no'] or '', c_detail and c_detail[0]['fax'] or '', c_detail and c_detail[0]['address'] or '')
|
||||
|
||||
|
||||
# -------------------
|
||||
# update lead status
|
||||
# -------------------
|
||||
def update_lead_status(self):
|
||||
if self.doc.lead_name:
|
||||
sql("update `tabLead` set status='Converted' where name = %s", self.doc.lead_name)
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# create accont head - in tree under receivables_group of selected company
|
||||
# -------------------------------------------------------------------------
|
||||
def create_account_head(self):
|
||||
if self.doc.company :
|
||||
abbr = self.get_company_abbr()
|
||||
if not sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
|
||||
parent_account = self.get_receivables_group()
|
||||
arg = {'account_name':self.doc.name,'parent_account': parent_account, 'group_or_ledger':'Ledger', 'company':self.doc.company,'account_type':'','tax_rate':'0','master_type':'Customer','master_name':self.doc.name,'address':self.doc.address}
|
||||
# create
|
||||
ac = get_obj('GL Control').add_ac(cstr(arg))
|
||||
msgprint("Account Head created for "+ac)
|
||||
else :
|
||||
msgprint("Please Select Company under which you want to create account head")
|
||||
|
||||
|
||||
# ----------------------------------------
|
||||
# update credit days and limit in account
|
||||
# ----------------------------------------
|
||||
def update_credit_days_limit(self):
|
||||
sql("update tabAccount set credit_days = '%s', credit_limit = '%s' where name = '%s'" % (self.doc.credit_days, self.doc.credit_limit, self.doc.name + " - " + self.get_company_abbr()))
|
||||
|
||||
|
||||
#create address and contact from lead
|
||||
def create_lead_address_contact(self):
|
||||
if self.doc.lead_name:
|
||||
details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, contact_no, mobile_no, fax, email_id from `tabLead` where name = '%s'" %(self.doc.lead_name), as_dict = 1)
|
||||
d = Document('Address')
|
||||
d.address_line1 = details[0]['address_line1']
|
||||
d.address_line2 = details[0]['address_line2']
|
||||
d.city = details[0]['city']
|
||||
d.country = details[0]['country']
|
||||
d.pincode = details[0]['pincode']
|
||||
d.state = details[0]['state']
|
||||
d.fax = details[0]['fax']
|
||||
d.email_id = details[0]['email_id']
|
||||
d.phone = details[0]['contact_no']
|
||||
d.customer = self.doc.name
|
||||
d.customer_name = self.doc.customer_name
|
||||
d.is_primary_address = 1
|
||||
d.address_type = 'Office'
|
||||
try:
|
||||
d.save(1)
|
||||
except NameError, e:
|
||||
pass
|
||||
|
||||
c = Document('Contact')
|
||||
c.first_name = details[0]['lead_name']
|
||||
c.email_id = details[0]['email_id']
|
||||
c.phone = details[0]['contact_no']
|
||||
c.phone = details[0]['contact_no']
|
||||
c.customer = self.doc.name
|
||||
c.customer_name = self.doc.customer_name
|
||||
c.is_primary_contact = 1
|
||||
try:
|
||||
c.save(1)
|
||||
except NameError, e:
|
||||
pass
|
||||
|
||||
# ----------
|
||||
# on update
|
||||
# ----------
|
||||
def on_update(self):
|
||||
# create customer addr
|
||||
#self.create_customer_address()
|
||||
# create customer contact
|
||||
#self.create_customer_contact()
|
||||
# update lead status
|
||||
self.update_lead_status()
|
||||
# create account head
|
||||
self.create_account_head()
|
||||
# update credit days and limit in account
|
||||
self.update_credit_days_limit()
|
||||
#create address and contact from lead
|
||||
self.create_lead_address_contact()
|
||||
|
||||
def delete_customer_address(self):
|
||||
for rec in sql("select * from `tabAddress` where customer='%s'" %(self.doc.name), as_dict=1):
|
||||
sql("delete from `tabAddress` where name=%s",(rec['name']))
|
||||
|
||||
def delete_customer_contact(self):
|
||||
for rec in sql("select * from `tabContact` where customer='%s'" %(self.doc.name), as_dict=1):
|
||||
sql("delete from `tabContact` where name=%s",(rec['name']))
|
||||
|
||||
# ******************************************************* on trash *********************************************************
|
||||
def on_trash(self):
|
||||
self.delete_customer_address()
|
||||
self.delete_customer_contact()
|
||||
if self.doc.lead_name:
|
||||
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
|
||||
485
selling/doctype/customer/customer.txt
Normal file
485
selling/doctype/customer/customer.txt
Normal file
@@ -0,0 +1,485 @@
|
||||
# DocType, Customer
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:56',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-05-26 17:31:31',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1306834669',
|
||||
'allow_print': 0,
|
||||
'allow_trash': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'search_fields': 'customer_name,customer_group,country,territory',
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': "eval:'%(customer_name)s'=='%(name)s' ? ' ' : '%(customer_name)s'",
|
||||
'tag_fields': 'customer_group,customer_type',
|
||||
'version': 431
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Customer',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Customer',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'submit': 0
|
||||
},
|
||||
|
||||
# DocType, Customer
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Customer'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Manager',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Manager',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales User',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales User',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Master Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Master Manager',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Basic Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 2,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer Name',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'customer_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'label': 'Customer Type',
|
||||
'oldfieldname': 'customer_type',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nCompany\nIndividual',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 4,
|
||||
'label': 'Series',
|
||||
'no_copy': 1,
|
||||
'options': '\nCUST\nCUSTMUM',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Fetch lead which will be converted into customer.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'lead_name',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 5,
|
||||
'in_filter': 1,
|
||||
'label': 'Lead Ref',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'lead_name',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Lead',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 6,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': '<a href="javascript:cur_frm.cscript.CGHelp();">To manage Customer Groups, click here</a>',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_group',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 7,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer Group',
|
||||
'oldfieldname': 'customer_group',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Customer Group',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': '<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'territory',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 8,
|
||||
'label': 'Territory',
|
||||
'oldfieldname': 'territory',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Territory',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 9,
|
||||
'label': 'Address & Contacts',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 10,
|
||||
'label': 'Address Desc',
|
||||
'options': '<em>Addresses will appear only when you save the customer</em>',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 11,
|
||||
'label': 'Address HTML',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 12,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 13,
|
||||
'label': 'Contact Desc',
|
||||
'options': '<em>Contact Details will appear only when you save the customer</em>',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 14,
|
||||
'label': 'Contact HTML',
|
||||
'oldfieldtype': 'HTML',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 15,
|
||||
'label': 'More Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'To create an Account Head under a different company, then set the company and click the button below.',
|
||||
'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
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': "Your Customer's TAX registration numbers (if applicable) or any general information",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_details',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 17,
|
||||
'label': 'Customer Details',
|
||||
'oldfieldname': 'customer_details',
|
||||
'oldfieldtype': 'Code',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 18,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'credit_days',
|
||||
'fieldtype': 'Int',
|
||||
'idx': 19,
|
||||
'label': 'Credit Days',
|
||||
'oldfieldname': 'credit_days',
|
||||
'oldfieldtype': 'Int',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'credit_limit',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 20,
|
||||
'label': 'Credit Limit',
|
||||
'oldfieldname': 'credit_limit',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'website',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 21,
|
||||
'label': 'Website',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 22,
|
||||
'label': 'Sales Team',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'default_sales_partner',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 23,
|
||||
'label': 'Default Sales Partner',
|
||||
'oldfieldname': 'default_sales_partner',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Sales Partner',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'default_commission_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 24,
|
||||
'label': 'Default Commission Rate',
|
||||
'oldfieldname': 'default_commission_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_team',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 25,
|
||||
'label': 'Sales Team Details',
|
||||
'oldfieldname': 'sales_team',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Sales Team',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 26,
|
||||
'label': 'Transaction History',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 27,
|
||||
'label': 'History HTML',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 28,
|
||||
'label': 'Trash Reason',
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
0
selling/doctype/enquiry/__init__.py
Normal file
0
selling/doctype/enquiry/__init__.py
Normal file
335
selling/doctype/enquiry/enquiry.js
Normal file
335
selling/doctype/enquiry/enquiry.js
Normal file
@@ -0,0 +1,335 @@
|
||||
$import(SMS Control)
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn){
|
||||
|
||||
//cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
|
||||
if(!doc.docstatus){
|
||||
hide_field(['Update Follow up']);
|
||||
hide_field(['email_id1','cc_to','subject','message','Attachment Html', 'Create New File', 'enquiry_attachment_detail','Send Email']);
|
||||
}
|
||||
else{
|
||||
unhide_field(['Update Follow up']);
|
||||
unhide_field(['email_id1','cc_to','subject','message','Attachment Html', 'Create New File', 'enquiry_attachment_detail','Send Email']);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.clear_custom_buttons();
|
||||
if(doc.docstatus == 1) {
|
||||
cur_frm.add_custom_button('Create Quotation', cur_frm.cscript['Create Quotation']);
|
||||
cur_frm.add_custom_button('Enquiry Lost', cur_frm.cscript['Declare Enquiry Lost']);
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
|
||||
}
|
||||
|
||||
//cur_frm.cscript.clear_values(doc,cdt,cdn);
|
||||
}
|
||||
|
||||
// ONLOAD
|
||||
// ===============================================================
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
if(!doc.enquiry_from) hide_field(['customer', 'customer_address', 'contact_person', 'customer_name','lead', 'lead_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
|
||||
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
||||
if(!doc.date) doc.transaction_date = date.obj_to_str(new Date());
|
||||
if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
|
||||
if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});
|
||||
|
||||
if(doc.enquiry_from) {
|
||||
if(doc.enquiry_from == 'Customer') {
|
||||
hide_field(['lead', 'lead_name']);
|
||||
}
|
||||
else if (doc.enquiry_from == 'Lead') {
|
||||
hide_field(['customer', 'customer_address', 'contact_person', 'customer_name', 'contact_display', 'customer_group']);
|
||||
}
|
||||
}
|
||||
|
||||
// setup fetch
|
||||
cur_frm.cscript.set_fetch();
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
if(doc.enquiry_from == 'Lead' && doc.lead) {
|
||||
cur_frm.cscript.lead(doc,cdt,cdn);
|
||||
}
|
||||
}
|
||||
|
||||
// fetch
|
||||
// ===============================================================
|
||||
cur_frm.cscript.set_fetch = function() {
|
||||
|
||||
// item
|
||||
cur_frm.add_fetch('item_code', 'item_name', 'item_name');
|
||||
cur_frm.add_fetch('item_code', 'stock_uom', 'uom');
|
||||
cur_frm.add_fetch('item_code', 'description', 'description');
|
||||
cur_frm.add_fetch('item_code', 'item_group', 'item_group');
|
||||
cur_frm.add_fetch('item_code', 'brand', 'brand');
|
||||
|
||||
// customer
|
||||
|
||||
}
|
||||
|
||||
// hide - unhide fields on basis of enquiry_from lead or customer
|
||||
cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.lead_cust_show(doc,cdt,cdn);
|
||||
}
|
||||
|
||||
// hide - unhide fields based on lead or customer
|
||||
cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
|
||||
if(doc.enquiry_from == 'Lead'){
|
||||
unhide_field(['lead']);
|
||||
hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
|
||||
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
|
||||
}
|
||||
else if(doc.enquiry_from == 'Customer'){
|
||||
unhide_field(['customer']);
|
||||
hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);
|
||||
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
|
||||
}
|
||||
}
|
||||
|
||||
// customer
|
||||
cur_frm.cscript.customer = function(doc,dt,dn) {
|
||||
if(doc.customer) get_server_fields('get_default_customer_address', JSON.stringify({customer: doc.customer}),'', doc, dt, dn, 1);
|
||||
if(doc.customer) unhide_field(['customer_name','customer_address','contact_person','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';
|
||||
}
|
||||
|
||||
// lead
|
||||
cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
|
||||
return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||
if(doc.lead) get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1);
|
||||
if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);
|
||||
}
|
||||
|
||||
|
||||
//item getquery
|
||||
//=======================================
|
||||
cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
|
||||
if (doc.enquiry_type == 'Maintenance')
|
||||
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
|
||||
else
|
||||
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
|
||||
}
|
||||
|
||||
//Fetch Item Details
|
||||
//====================================================================================================================
|
||||
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
get_server_fields('get_item_details',d.item_code,'enquiry_details',doc,cdt,cdn,1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//Fetch Customer Details
|
||||
//======================================================================================================================
|
||||
cur_frm.cscript.customer = function(doc, cdt, cdn){
|
||||
if (doc.customer) {
|
||||
get_server_fields('get_cust_address',doc.customer,'',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`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
//=======================================================================================================================
|
||||
cur_frm.cscript.contact_person = function(doc, cdt, cdn){
|
||||
if (doc.contact_person) {
|
||||
arg = {};
|
||||
arg.contact_person = doc.contact_person;
|
||||
arg.customer = doc.customer;
|
||||
get_server_fields('get_contact_details',docstring(arg),'',doc,cdt,cdn,1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// hide - unhide fields based on lead or customer..
|
||||
//=======================================================================================================================
|
||||
cur_frm.cscript.clear_values = function(doc,cdt,cdn) {
|
||||
if(doc.enquiry_from == 'Lead') {
|
||||
doc.customer = doc.customer_name = doc.contact_person = doc.customer_group = "";
|
||||
}
|
||||
else if(doc.enquiry_from == 'Customer') {
|
||||
doc.lead = doc.lead_name = "";
|
||||
}
|
||||
refresh_many(['lead','lead_name','customer','customer_name','contact_person','customer_group']);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
//================ hide - unhide fields on basis of enquiry from either lead or customer ===============================
|
||||
cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.clear_values(doc,cdt,cdn);
|
||||
doc.address = doc.territory = doc.contact_no = doc.email_id = "";
|
||||
refresh_many(['territory','address','contact_no','email_id']);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
//================ create new contact ============================================================================
|
||||
cur_frm.cscript.new_contact = function(){
|
||||
tn = createLocal('Contact');
|
||||
locals['Contact'][tn].is_customer = 1;
|
||||
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
|
||||
loaddoc('Contact', tn);
|
||||
}
|
||||
*/
|
||||
|
||||
//=======================================================================================================================
|
||||
cur_frm.cscript['Create New File'] = function(doc){
|
||||
var fl = LocalDB.create('File');
|
||||
fl = locals['File'][fl];
|
||||
loaddoc('File', fl.name);
|
||||
}
|
||||
|
||||
//update follow up
|
||||
//=================================================================================
|
||||
cur_frm.cscript['Update Follow up'] = function(doc,cdt,cdn){
|
||||
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'update_follow_up','',function(r, rt){
|
||||
refresh_field('follow_up');
|
||||
doc.__unsaved = 0;
|
||||
cur_frm.refresh_header();
|
||||
});
|
||||
}
|
||||
|
||||
// Create New Quotation
|
||||
// =======================================================================================================================
|
||||
cur_frm.cscript['Create Quotation'] = function(){
|
||||
n = createLocal("Quotation");
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals["Quotation"][n]]),
|
||||
'from_doctype':'Enquiry',
|
||||
'to_doctype':'Quotation',
|
||||
'from_docname':cur_frm.docname,
|
||||
'from_to_list':"[['Enquiry', 'Quotation'],['Enquiry Detail','Quotation Detail']]"
|
||||
}
|
||||
, function(r,rt) {
|
||||
loaddoc("Quotation", n);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// declare enquiry lost
|
||||
//-------------------------
|
||||
cur_frm.cscript['Declare Enquiry Lost'] = function(){
|
||||
var e_lost_dialog;
|
||||
|
||||
set_e_lost_dialog = function(){
|
||||
e_lost_dialog = new Dialog(400,150,'Add Enquiry Lost Reason');
|
||||
e_lost_dialog.make_body([
|
||||
['HTML', 'Message', '<div class="comment">Please add enquiry lost reason</div>'],
|
||||
['Text', 'Enquiry Lost Reason'],
|
||||
['HTML', 'Response', '<div class = "comment" id="update_enquiry_dialog_response"></div>'],
|
||||
['HTML', 'Add Reason', '<div></div>']
|
||||
]);
|
||||
|
||||
var add_reason_btn1 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
|
||||
add_reason_btn1.innerHTML = 'Add';
|
||||
add_reason_btn1.onclick = function(){ e_lost_dialog.add(); }
|
||||
|
||||
var add_reason_btn2 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
|
||||
add_reason_btn2.innerHTML = 'Cancel';
|
||||
$y(add_reason_btn2,{marginLeft:'4px'});
|
||||
add_reason_btn2.onclick = function(){ e_lost_dialog.hide();}
|
||||
|
||||
e_lost_dialog.onshow = function() {
|
||||
e_lost_dialog.widgets['Enquiry Lost Reason'].value = '';
|
||||
$i('update_enquiry_dialog_response').innerHTML = '';
|
||||
}
|
||||
|
||||
e_lost_dialog.add = function() {
|
||||
// sending...
|
||||
$i('update_enquiry_dialog_response').innerHTML = 'Processing...';
|
||||
var arg = strip(e_lost_dialog.widgets['Enquiry Lost Reason'].value);
|
||||
var call_back = function(r,rt) {
|
||||
if(r.message == 'true'){
|
||||
$i('update_enquiry_dialog_response').innerHTML = 'Done';
|
||||
e_lost_dialog.hide();
|
||||
}
|
||||
}
|
||||
if(arg) {
|
||||
$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_enquiry_lost',arg,call_back);
|
||||
}
|
||||
else{
|
||||
msgprint("Please add enquiry lost reason");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!e_lost_dialog){
|
||||
set_e_lost_dialog();
|
||||
}
|
||||
e_lost_dialog.show();
|
||||
}
|
||||
|
||||
//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';}
|
||||
|
||||
/*
|
||||
//===================== Enquiry From validation - either customer or lead is mandatory =====================================
|
||||
cur_frm.cscript.enq_frm_validate = function(doc,cdt,cdn){
|
||||
|
||||
if(doc.enquiry_from == 'Lead'){
|
||||
if(!doc.lead){
|
||||
alert("Lead is mandatory.");
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
else if(doc.enquiry_from == 'Customer'){
|
||||
if(!doc.customer){
|
||||
alert("Customer is mandatory.");
|
||||
validated = false;
|
||||
}
|
||||
else if(!doc.contact_person){
|
||||
alert("Contact Person is mandatory.");
|
||||
validated = false;
|
||||
}
|
||||
else if(!doc.customer_group){
|
||||
alert("Customer Group is mandatory.");
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//===================validation function ==============================================================================
|
||||
|
||||
cur_frm.cscript.validate = function(doc,cdt,cdn){
|
||||
//cur_frm.cscript.enq_frm_validate(doc,cdt,cdn);
|
||||
}
|
||||
335
selling/doctype/enquiry/enquiry.py
Normal file
335
selling/doctype/enquiry/enquiry.py
Normal file
@@ -0,0 +1,335 @@
|
||||
# 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.fname = 'enq_details'
|
||||
self.tname = 'Enquiry Detail'
|
||||
|
||||
# Autoname
|
||||
# ====================================================================================================================
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.####')
|
||||
|
||||
#--------Get customer address-------
|
||||
# ====================================================================================================================
|
||||
def get_cust_address(self,name):
|
||||
details = sql("select customer_name, address, territory, customer_group from `tabCustomer` where name = '%s' and docstatus != 2" %(name), as_dict = 1)
|
||||
if details:
|
||||
ret = {
|
||||
'customer_name': details and details[0]['customer_name'] or '',
|
||||
'address' : details and details[0]['address'] 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 = '%s' and is_customer = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), 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
|
||||
|
||||
|
||||
# ====================================================================================================================
|
||||
def get_contact_details(self, arg):
|
||||
arg = eval(arg)
|
||||
contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s'" %(arg['contact_person'],arg['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)
|
||||
|
||||
# ====================================================================================================================
|
||||
def on_update(self):
|
||||
# Add to calendar
|
||||
#if self.doc.contact_date and self.doc.last_contact_date != self.doc.contact_date:
|
||||
if self.doc.contact_date and self.doc.contact_date_ref != self.doc.contact_date:
|
||||
if self.doc.contact_by:
|
||||
self.add_calendar_event()
|
||||
set(self.doc, 'contact_date_ref',self.doc.contact_date)
|
||||
set(self.doc, 'status', 'Draft')
|
||||
|
||||
# Add to Calendar
|
||||
# ====================================================================================================================
|
||||
def add_calendar_event(self):
|
||||
desc=''
|
||||
user_lst =[]
|
||||
if self.doc.customer:
|
||||
if self.doc.contact_person:
|
||||
desc = 'Contact '+cstr(self.doc.contact_person)
|
||||
else:
|
||||
desc = 'Contact customer '+cstr(self.doc.customer)
|
||||
elif self.doc.lead:
|
||||
if self.doc.lead_name:
|
||||
desc = 'Contact '+cstr(self.doc.lead_name)
|
||||
else:
|
||||
desc = 'Contact lead '+cstr(self.doc.lead)
|
||||
desc = desc+ '. By : ' + cstr(self.doc.contact_by)
|
||||
|
||||
if self.doc.to_discuss:
|
||||
desc = desc+' To Discuss : ' + cstr(self.doc.to_discuss)
|
||||
|
||||
ev = Document('Event')
|
||||
ev.description = desc
|
||||
ev.event_date = self.doc.contact_date
|
||||
ev.event_hour = '10:00'
|
||||
ev.event_type = 'Private'
|
||||
ev.ref_type = 'Enquiry'
|
||||
ev.ref_name = self.doc.name
|
||||
ev.save(1)
|
||||
|
||||
user_lst.append(self.doc.owner)
|
||||
|
||||
chk = sql("select t1.name from `tabProfile` t1, `tabSales Person` t2 where t2.email_id = t1.name and t2.name=%s",self.doc.contact_by)
|
||||
if chk:
|
||||
user_lst.append(chk[0][0])
|
||||
|
||||
for d in user_lst:
|
||||
ch = addchild(ev, 'event_individuals', 'Event User', 0)
|
||||
ch.person = d
|
||||
ch.save(1)
|
||||
|
||||
#user_list = ['Sales Manager', 'Sales User']
|
||||
#for d in user_list:
|
||||
# ch = addchild(ev, 'event_individuals', 'Event User', 0)
|
||||
# ch.person = d
|
||||
# ch.save()
|
||||
|
||||
#--------------Validation For Last Contact Date-----------------
|
||||
# ====================================================================================================================
|
||||
def set_last_contact_date(self):
|
||||
#if not self.doc.contact_date_ref:
|
||||
#self.doc.contact_date_ref=self.doc.contact_date
|
||||
#self.doc.last_contact_date=self.doc.contact_date_ref
|
||||
if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:
|
||||
if getdate(self.doc.contact_date_ref) < getdate(self.doc.contact_date):
|
||||
self.doc.last_contact_date=self.doc.contact_date_ref
|
||||
else:
|
||||
msgprint("Contact Date Cannot be before Last Contact Date")
|
||||
raise Exception
|
||||
#set(self.doc, 'contact_date_ref',self.doc.contact_date)
|
||||
|
||||
# check if item present in item table
|
||||
# ====================================================================================================================
|
||||
def validate_item_details(self):
|
||||
if not getlist(self.doclist, 'enquiry_details'):
|
||||
msgprint("Please select items for which enquiry needs to be made")
|
||||
raise Exception
|
||||
|
||||
#check if enquiry date in the range of fiscal year selected
|
||||
#=====================================================
|
||||
def validate_fiscal_year(self):
|
||||
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
|
||||
ysd=fy and fy[0][0] or ""
|
||||
yed=add_days(str(ysd),365)
|
||||
if str(self.doc.transaction_date) < str(ysd) or str(self.doc.transaction_date) > str(yed):
|
||||
msgprint("Enquiry Date is not within the Fiscal Year selected")
|
||||
raise Exception
|
||||
|
||||
def validate(self):
|
||||
self.validate_fiscal_year()
|
||||
self.set_last_contact_date()
|
||||
self.validate_item_details()
|
||||
|
||||
# On Submit Functions
|
||||
# ====================================================================================================================
|
||||
def on_submit(self):
|
||||
set(self.doc, 'status', 'Submitted')
|
||||
|
||||
# ====================================================================================================================
|
||||
def on_cancel(self):
|
||||
chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Detail` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
|
||||
if chk:
|
||||
msgprint("Quotation No. "+cstr(chk[0][0])+" is submitted against this Enquiry. Thus can not be cancelled.")
|
||||
raise Exception
|
||||
else:
|
||||
set(self.doc, 'status', 'Cancelled')
|
||||
|
||||
get_obj('Feed Control').make_feed(self.doc, 'cancelled')
|
||||
|
||||
# declare as enquiry lost
|
||||
#---------------------------
|
||||
def declare_enquiry_lost(self,arg):
|
||||
chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Detail` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
|
||||
if chk:
|
||||
msgprint("Quotation No. "+cstr(chk[0][0])+" is submitted against this Enquiry. Thus 'Enquiry Lost' can not be declared against it.")
|
||||
raise Exception
|
||||
else:
|
||||
set(self.doc, 'status', 'Enquiry Lost')
|
||||
set(self.doc, 'order_lost_reason', arg)
|
||||
return cstr('true')
|
||||
|
||||
# ====================================================================================================================
|
||||
def update_follow_up(self):
|
||||
|
||||
sql("delete from `tabFollow up` where parent = '%s'"%self.doc.name);
|
||||
for d in getlist(self.doclist, 'follow_up'):
|
||||
d.save()
|
||||
self.doc.save()
|
||||
|
||||
|
||||
# On Send Email
|
||||
# ====================================================================================================================
|
||||
#def send_emails(self,email,sender,subject,message):
|
||||
# if email:
|
||||
# sendmail(email,sender,subject=subject or 'Enquiry',parts=[['text/plain',message or self.get_enq_summary()]])
|
||||
|
||||
# Prepare HTML Table and Enter Enquiry Details in it, which will be added in enq summary
|
||||
# ====================================================================================================================
|
||||
def quote_table(self):
|
||||
if getlist(self.doclist,'enq_details'):
|
||||
header_lbl = ['Item Code','Item Name','Description','Reqd Qty','UOM']
|
||||
item_tbl = '''<table style="width:90%%; border:1px solid #AAA; border-collapse:collapse"><tr>'''
|
||||
for i in header_lbl:
|
||||
item_header = '''<td style="width=20%%; border:1px solid #AAA; border-collapse:collapse;"><b>%s</b></td>''' % i
|
||||
item_tbl += item_header
|
||||
item_tbl += '''</tr>'''
|
||||
|
||||
for d in getlist(self.doclist,'enq_details'):
|
||||
item_det = '''
|
||||
<tr><td style="width:20%%; border:1px solid #AAA; border-collpase:collapse">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td></tr>
|
||||
''' % (d.item_code,d.item_name,d.description,d.reqd_qty,d.uom)
|
||||
item_tbl += item_det
|
||||
item_tbl += '''</table>'''
|
||||
return item_tbl
|
||||
|
||||
# Prepare HTML Page containing summary of Enquiry, which will be sent as message in E-mail
|
||||
# ====================================================================================================================
|
||||
def get_enq_summary(self):
|
||||
|
||||
t = """
|
||||
<html><head></head>
|
||||
<body>
|
||||
<div style="border:1px solid #AAA; padding:20px; width:100%%">
|
||||
<div style="text-align:center;font-size:14px"><b>Request For Quotation</b><br></div>
|
||||
<div style="text-align:center;font-size:12px"> %(from_company)s</div>
|
||||
<div style="text-align:center; font-size:10px"> %(company_address)s</div>
|
||||
<div style="border-bottom:1px solid #AAA; padding:10px"></div>
|
||||
|
||||
<div style="padding-top:10px"><b>Quotation Details</b></div>
|
||||
<div><table style="width:100%%">
|
||||
<tr><td style="width:40%%">Enquiry No:</td> <td style="width:60%%"> %(name)s</td></tr>
|
||||
<tr><td style="width:40%%">Opening Date:</td> <td style="width:60%%"> %(transaction_date)s</td></tr>
|
||||
<tr><td style="width:40%%">Expected By Date:</td> <td style="width:60%%"> %(expected_date)s</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="padding-top:10px"><b>Terms and Conditions</b></div>
|
||||
<div> %(terms_and_conditions)s</div>
|
||||
|
||||
<div style="padding-top:10px"><b>Contact Details</b></div>
|
||||
<div><table style="width:100%%">
|
||||
<tr><td style="width=40%%">Contact Person:</td><td style="width:60%%"> %(contact_person)s</td></tr>
|
||||
<tr><td style="width=40%%">Contact No:</td><td style="width:60%%"> %(contact_no)s</td></tr>
|
||||
<tr><td style="width=40%%">Email:</td><td style="width:60%%"> %(email)s</td></tr>
|
||||
</table></div>
|
||||
""" % (self.doc.fields)
|
||||
|
||||
t += """<br><div><b>Quotation Items</b><br></div><div style="width:100%%">%s</div>
|
||||
<br>
|
||||
To login into the system, use link : <div><a href='http://67.205.111.118/v160/login.html' target='_blank'>http://67.205.111.118/v160/login.html</a></div><br><br>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
""" % (self.quote_table())
|
||||
return t
|
||||
|
||||
#-----------------Email--------------------------------------------
|
||||
# ====================================================================================================================
|
||||
def send_emails(self, email=[], subject='', message=''):
|
||||
if email:
|
||||
sender_email= sql("Select email from `tabProfile` where name='%s'"%session['user'])
|
||||
if sender_email and sender_email[0][0]:
|
||||
attach_list=[]
|
||||
for at in getlist(self.doclist,'enquiry_attachment_detail'):
|
||||
if at.select_file:
|
||||
attach_list.append(at.select_file)
|
||||
cc_list=[]
|
||||
if self.doc.cc_to:
|
||||
for cl in (self.doc.cc_to.split(',')):
|
||||
if not validate_email_add(cl.strip(' ')):
|
||||
msgprint('error:%s is not a valid email id' % cl.strip(' '))
|
||||
raise Exception
|
||||
cc_list.append(cl.strip(' '))
|
||||
sendmail(cc_list, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], attach=attach_list)
|
||||
sendmail(email, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], cc=cc_list, attach=attach_list)
|
||||
#sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list)
|
||||
msgprint("Mail has been sent")
|
||||
self.add_in_follow_up(message,'Email')
|
||||
else:
|
||||
msgprint("Please enter your mail id in Profile")
|
||||
raise Exception
|
||||
|
||||
#-------------------------Checking Sent Mails Details----------------------------------------------
|
||||
# ====================================================================================================================
|
||||
def sent_mail(self):
|
||||
if not self.doc.subject or not self.doc.message:
|
||||
msgprint("Please enter subject & message in their respective fields.")
|
||||
elif not self.doc.email_id1:
|
||||
msgprint("Recipient not specified. Please add email id in 'Send To'.")
|
||||
raise Exception
|
||||
else :
|
||||
if not validate_email_add(self.doc.email_id1.strip(' ')):
|
||||
msgprint('error:%s is not a valid email id' % self.doc.email_id1)
|
||||
else:
|
||||
self.send_emails([self.doc.email_id1.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
|
||||
|
||||
#---------------------- Add details in follow up table----------------
|
||||
# ====================================================================================================================
|
||||
def add_in_follow_up(self,message,type):
|
||||
import datetime
|
||||
child = addchild( self.doc, 'follow_up', 'Follow up', 1, self.doclist)
|
||||
child.date = datetime.datetime.now().date().strftime('%Y-%m-%d')
|
||||
child.notes = message
|
||||
child.follow_up_type = type
|
||||
child.save()
|
||||
|
||||
#-------------------SMS----------------------------------------------
|
||||
# ====================================================================================================================
|
||||
def send_sms(self):
|
||||
if not self.doc.sms_message:
|
||||
msgprint("Please enter message in SMS Section ")
|
||||
raise Exception
|
||||
elif not getlist(self.doclist, 'enquiry_sms_detail'):
|
||||
msgprint("Please mention mobile no. to which sms needs to be sent")
|
||||
raise Exception
|
||||
else:
|
||||
receiver_list = []
|
||||
for d in getlist(self.doclist,'enquiry_sms_detail'):
|
||||
if d.other_mobile_no:
|
||||
receiver_list.append(d.other_mobile_no)
|
||||
|
||||
if receiver_list:
|
||||
msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.sms_message))
|
||||
self.add_in_follow_up(self.doc.sms_message,'SMS')
|
||||
657
selling/doctype/enquiry/enquiry.txt
Normal file
657
selling/doctype/enquiry/enquiry.txt
Normal file
@@ -0,0 +1,657 @@
|
||||
# DocType, Enquiry
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:00',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-05-12 18:27:46',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1305205067',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Transaction',
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'search_fields': 'status,transaction_date,customer,lead,enquiry_type,territory,company',
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': 'To %(customer_name)s%(lead_name)s on %(transaction_date)s',
|
||||
'version': 586
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Enquiry',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Enquiry',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Enquiry
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Enquiry'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# 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': 'Sales User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Enter customer enquiry for which you might raise a quotation in future',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Basic Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'To manage multiple series please go to Setup > Manage Series',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 2,
|
||||
'label': 'Series',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'naming_series',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'ENQUIRY\nENQ',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'enquiry_from',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'label': 'Enquiry From',
|
||||
'oldfieldname': 'enquiry_from',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nLead\nCustomer',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 4,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer',
|
||||
'oldfieldname': 'customer',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Customer',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'search_index': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_address',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 5,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer Address',
|
||||
'options': 'Address',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_person',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 6,
|
||||
'in_filter': 1,
|
||||
'label': 'Contact Person',
|
||||
'options': 'Contact',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 7,
|
||||
'label': 'Customer Name',
|
||||
'permlevel': 1,
|
||||
'print_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'lead',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 8,
|
||||
'in_filter': 1,
|
||||
'label': 'Lead',
|
||||
'oldfieldname': 'lead',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Lead',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'lead_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 9,
|
||||
'label': 'Name',
|
||||
'oldfieldname': 'lead_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'address_display',
|
||||
'fieldtype': 'Small Text',
|
||||
'hidden': 0,
|
||||
'idx': 10,
|
||||
'label': 'Address',
|
||||
'oldfieldname': 'address',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_display',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 11,
|
||||
'label': 'Contact',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_mobile',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 12,
|
||||
'label': 'Contact Mobile No',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_email',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 13,
|
||||
'label': 'Contact Email',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 14,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': 'Today',
|
||||
'description': 'The date at which current entry is made in system.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'transaction_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 15,
|
||||
'label': 'Enquiry Date',
|
||||
'oldfieldname': 'transaction_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': '50px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'enquiry_type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 16,
|
||||
'label': 'Enquiry Type',
|
||||
'oldfieldname': 'enquiry_type',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nSales\nMaintenance',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'Draft',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 17,
|
||||
'label': 'Status',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nDraft\nSubmitted\nQuotation Sent\nOrder Confirmed\nEnquiry Lost\nCancelled',
|
||||
'permlevel': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amended_from',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 18,
|
||||
'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': 19,
|
||||
'label': 'Amendment Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amendment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': '<a href="javascript:cur_frm.cscript.TerritoryHelp();">To Manage Territory, click here</a>',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'territory',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 20,
|
||||
'in_filter': 1,
|
||||
'label': 'Territory',
|
||||
'options': 'Territory',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': '<a href="javascript:cur_frm.cscript.CGHelp();">To Manage Customer Groups, click here</a>',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_group',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 21,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer Group',
|
||||
'oldfieldname': 'customer_group',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Customer Group',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 22,
|
||||
'label': 'Items',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': "Items which do not exist in Item master can also be entered on customer's request",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'enquiry_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 23,
|
||||
'label': 'Enquiry Details',
|
||||
'oldfieldname': 'enquiry_details',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Enquiry Detail',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Filing in Additional Information about the Enquiry will help you analyze your data better.',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 24,
|
||||
'label': 'More Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 25,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 26,
|
||||
'in_filter': 1,
|
||||
'label': 'Company',
|
||||
'oldfieldname': 'company',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Company',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fiscal_year',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 27,
|
||||
'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': 'source',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 28,
|
||||
'label': 'Source',
|
||||
'oldfieldname': 'source',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In",
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Enter name of campaign if source of enquiry is campaign',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'campaign',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 29,
|
||||
'label': 'Campaign',
|
||||
'oldfieldname': 'campaign',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Campaign',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'order_lost_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 30,
|
||||
'label': 'Order Lost Reason',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'order_lost_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1,
|
||||
'report_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 31,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Your sales person who will contact the customer in future',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_by',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 32,
|
||||
'in_filter': 1,
|
||||
'label': 'Next Contact By',
|
||||
'oldfieldname': 'contact_by',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Profile',
|
||||
'permlevel': 0,
|
||||
'width': '75px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Your sales person will get a reminder on this date to contact the customer',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 33,
|
||||
'label': 'Next Contact Date',
|
||||
'oldfieldname': 'contact_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'description': 'Date on which the lead was last contacted',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'last_contact_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 34,
|
||||
'label': 'Last Contact Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'last_contact_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'to_discuss',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 35,
|
||||
'label': 'To Discuss',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'to_discuss',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Keep a track of communication related to this enquiry which will help for future reference.',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 36,
|
||||
'label': 'Communication History',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'follow_up',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 37,
|
||||
'label': 'Follow Up',
|
||||
'oldfieldname': 'follow_up',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Follow up',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
||||
0
selling/doctype/enquiry_detail/__init__.py
Normal file
0
selling/doctype/enquiry_detail/__init__.py
Normal file
145
selling/doctype/enquiry_detail/enquiry_detail.txt
Normal file
145
selling/doctype/enquiry_detail/enquiry_detail.txt
Normal file
@@ -0,0 +1,145 @@
|
||||
# DocType, Enquiry Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:01',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'yogesh@webnotestech.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 59
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Enquiry Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, Enquiry Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Enquiry Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'reqd': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Item Name',
|
||||
'oldfieldname': 'item_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 3,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'reqd': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_group',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 1,
|
||||
'idx': 6,
|
||||
'label': 'Item Group',
|
||||
'oldfieldname': 'item_group',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item Group',
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'brand',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 1,
|
||||
'idx': 7,
|
||||
'label': 'Brand',
|
||||
'oldfieldname': 'brand',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Brand',
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'basic_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 1,
|
||||
'idx': 8,
|
||||
'label': 'Basic Rate',
|
||||
'oldfieldname': 'basic_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Qty',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'uom',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 10,
|
||||
'label': 'UOM',
|
||||
'oldfieldname': 'uom',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'UOM'
|
||||
}
|
||||
]
|
||||
0
selling/doctype/enquiry_sms_detail/__init__.py
Normal file
0
selling/doctype/enquiry_sms_detail/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-12-11 11:45:55', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'dhanalekshmi@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'Enquiry SMS Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-12-11 11:45:55', 'doctype': 'DocField', 'oldfieldname': 'other_mobile_no', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Mobile No', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Enquiry SMS Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL03494', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 11:13:11', 'parenttype': 'DocType', 'fieldname': 'other_mobile_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
selling/doctype/follow_up/__init__.py
Normal file
0
selling/doctype/follow_up/__init__.py
Normal file
94
selling/doctype/follow_up/follow_up.txt
Normal file
94
selling/doctype/follow_up/follow_up.txt
Normal file
@@ -0,0 +1,94 @@
|
||||
# DocType, Follow up
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:02',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-10-13 12:06:26',
|
||||
'modified_by': 'yogesh@webnotestech.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tray',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 10
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Follow up',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, Follow up
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Follow up'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 1,
|
||||
'in_filter': 1,
|
||||
'label': 'Date',
|
||||
'oldfieldname': 'date',
|
||||
'oldfieldtype': 'Date'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'notes',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 2,
|
||||
'in_filter': 0,
|
||||
'label': 'Notes',
|
||||
'oldfieldname': 'notes',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'follow_up_type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'in_filter': 1,
|
||||
'label': 'Follow up type',
|
||||
'oldfieldname': 'follow_up_type',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nPhone\nEmail\nSMS\nVisit\nOther'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'follow_up_by',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 4,
|
||||
'in_filter': 1,
|
||||
'label': 'Follow up by',
|
||||
'oldfieldname': 'follow_up_by',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Sales Person'
|
||||
}
|
||||
]
|
||||
0
selling/doctype/industry_type/__init__.py
Normal file
0
selling/doctype/industry_type/__init__.py
Normal file
10
selling/doctype/industry_type/industry_type.js
Normal file
10
selling/doctype/industry_type/industry_type.js
Normal file
@@ -0,0 +1,10 @@
|
||||
$import(Tips Common)
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
89
selling/doctype/industry_type/industry_type.txt
Normal file
89
selling/doctype/industry_type/industry_type.txt
Normal file
@@ -0,0 +1,89 @@
|
||||
# DocType, Industry Type
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:04',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'harshada@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'field:industry',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 4
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'industry',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'label': 'Industry',
|
||||
'name': '__common__',
|
||||
'oldfieldname': 'industry',
|
||||
'oldfieldtype': 'Data',
|
||||
'parent': 'Industry Type',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Industry Type',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Industry Type
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Industry Type'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'role': 'Sales Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'role': 'Sales User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'role': 'Sales Master Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField'
|
||||
}
|
||||
]
|
||||
0
selling/doctype/installation_note/__init__.py
Normal file
0
selling/doctype/installation_note/__init__.py
Normal file
69
selling/doctype/installation_note/installation_note.js
Normal file
69
selling/doctype/installation_note/installation_note.js
Normal file
@@ -0,0 +1,69 @@
|
||||
cur_frm.cscript.tname = "Installed Item Details";
|
||||
cur_frm.cscript.fname = "installed_item_details";
|
||||
|
||||
cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
|
||||
if(doc.__islocal){
|
||||
set_multiple(dt,dn,{inst_date:get_today()});
|
||||
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
|
||||
}
|
||||
if (doc.customer) {
|
||||
unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['delivery_note_no'].get_query = function(doc) {
|
||||
doc = locals[this.doctype][this.docname];
|
||||
var cond = '';
|
||||
if(doc.customer) {
|
||||
cond = '`tabDelivery Note`.customer = "'+doc.customer+'" AND';
|
||||
}
|
||||
return repl('SELECT DISTINCT `tabDelivery Note`.name, `tabDelivery Note`.customer_name FROM `tabDelivery Note`, `tabDelivery Note Detail` WHERE `tabDelivery Note`.company = "%(company)s" AND `tabDelivery Note`.docstatus = 1 AND ifnull(`tabDelivery Note`.per_installed,0) < 100 AND %(cond)s `tabDelivery Note`.name LIKE "%s" ORDER BY `tabDelivery Note`.name DESC LIMIT 50', {company:doc.company, cond:cond});
|
||||
}
|
||||
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
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_delivery_note_details','','',doc, dt, dn,1,callback);
|
||||
}
|
||||
|
||||
//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';
|
||||
}
|
||||
|
||||
209
selling/doctype/installation_note/installation_note.py
Normal file
209
selling/doctype/installation_note/installation_note.py
Normal file
@@ -0,0 +1,209 @@
|
||||
# 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.tname = 'Installed Item Details'
|
||||
self.fname = 'installed_item_details'
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
#fetch 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 delivery note details
|
||||
#====================================
|
||||
def pull_delivery_note_details(self):
|
||||
self.validate_prev_docname()
|
||||
self.doclist = get_obj('DocType Mapper', 'Delivery Note-Installation Note').dt_map('Delivery Note', 'Installation Note', self.doc.delivery_note_no, self.doc, self.doclist, "[['Delivery Note', 'Installation Note'],['Delivery Note Detail', 'Installed Item Details']]")
|
||||
|
||||
# Validates that Delivery Note is not pulled twice
|
||||
#============================================
|
||||
def validate_prev_docname(self):
|
||||
for d in getlist(self.doclist, 'installed_item_details'):
|
||||
if self.doc.delivery_note_no == d.prevdoc_docname:
|
||||
msgprint(cstr(self.doc.delivery_note_no) + " delivery note details have already been pulled. ")
|
||||
raise Exception, "Validation Error. "
|
||||
|
||||
#Fiscal Year Validation
|
||||
#================================
|
||||
def validate_fiscal_year(self):
|
||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.inst_date,'Installation Date')
|
||||
|
||||
# Validate Mandatory
|
||||
#===============================
|
||||
def validate_mandatory(self):
|
||||
# Amendment Date
|
||||
if self.doc.amended_from and not self.doc.amendment_date:
|
||||
msgprint("Please Enter Amendment Date")
|
||||
raise Exception, "Validation Error. "
|
||||
|
||||
# Validate values with reference document
|
||||
#----------------------------------------
|
||||
def validate_reference_value(self):
|
||||
get_obj('DocType Mapper', 'Delivery Note-Installation Note', with_children = 1).validate_reference_value(self, self.doc.name)
|
||||
|
||||
#check if serial no added
|
||||
#-----------------------------
|
||||
def is_serial_no_added(self,item_code,serial_no):
|
||||
ar_required = sql("select has_serial_no from tabItem where name = '%s'" % item_code)
|
||||
ar_required = ar_required and ar_required[0][0] or ''
|
||||
if ar_required == 'Yes' and not serial_no:
|
||||
msgprint("Serial No is mandatory for item: "+ item_code)
|
||||
raise Exception
|
||||
elif ar_required != 'Yes' and cstr(serial_no).strip():
|
||||
msgprint("If serial no required, please select 'Yes' in 'Has Serial No' in Item :"+item_code)
|
||||
raise Exception
|
||||
|
||||
#check if serial no exist in system
|
||||
#-------------------------------------
|
||||
def is_serial_no_exist(self, item_code, serial_no):
|
||||
for x in serial_no:
|
||||
chk = sql("select name from `tabSerial No` where name =%s", x)
|
||||
if not chk:
|
||||
msgprint("Serial No "+x+" does not exist in the system")
|
||||
raise Exception
|
||||
|
||||
#check if serial no already installed
|
||||
#------------------------------------------
|
||||
def is_serial_no_installed(self,cur_s_no,item_code):
|
||||
for x in cur_s_no:
|
||||
status = sql("select status from `tabSerial No` where name = %s", x)
|
||||
status = status and status[0][0] or ''
|
||||
|
||||
if status == 'Installed':
|
||||
msgprint("Item "+item_code+" with serial no. "+x+" already installed")
|
||||
raise Exception, "Validation Error."
|
||||
|
||||
#get list of serial no from previous_doc
|
||||
#----------------------------------------------
|
||||
def get_prevdoc_serial_no(self, prevdoc_detail_docname, prevdoc_docname):
|
||||
from material_management.doctype.stock_ledger.stock_ledger import get_sr_no_list
|
||||
|
||||
res = sql("select serial_no from `tabDelivery Note Detail` where name = '%s' and parent ='%s'" % (prevdoc_detail_docname, prevdoc_docname))
|
||||
return get_sr_no_list(res[0][0])
|
||||
|
||||
#check if all serial nos from current record exist in resp delivery note
|
||||
#---------------------------------------------------------------------------------
|
||||
def is_serial_no_match(self, cur_s_no, prevdoc_s_no, prevdoc_docname):
|
||||
for x in cur_s_no:
|
||||
if not(x in prevdoc_s_no):
|
||||
msgprint("Serial No. "+x+" not present in the Delivery Note "+prevdoc_docname, raise_exception = 1)
|
||||
raise Exception, "Validation Error."
|
||||
|
||||
#validate serial number
|
||||
#----------------------------------------
|
||||
def validate_serial_no(self):
|
||||
cur_s_no, prevdoc_s_no, sr_list = [], [], []
|
||||
from stock.doctype.stock_ledger.stock_ledger import get_sr_no_list
|
||||
|
||||
for d in getlist(self.doclist, 'installed_item_details'):
|
||||
self.is_serial_no_added(d.item_code, d.serial_no)
|
||||
|
||||
if d.serial_no:
|
||||
|
||||
sr_list = get_sr_no_list(d.serial_no, d.qty)
|
||||
self.is_serial_no_exist(d.item_code, sr_list)
|
||||
|
||||
prevdoc_s_no = self.get_prevdoc_serial_no(d.prevdoc_detail_docname, d.prevdoc_docname)
|
||||
if prevdoc_s_no:
|
||||
self.is_serial_no_match(sr_list, prevdoc_s_no, d.prevdoc_docname)
|
||||
|
||||
self.is_serial_no_installed(sr_list, d.item_code)
|
||||
return sr_list
|
||||
|
||||
#validate installation date
|
||||
#-------------------------------
|
||||
def validate_installation_date(self):
|
||||
for d in getlist(self.doclist, 'installed_item_details'):
|
||||
if d.prevdoc_docname:
|
||||
d_date = sql("select posting_date from `tabDelivery Note` where name=%s", d.prevdoc_docname)
|
||||
d_date = d_date and d_date[0][0] or ''
|
||||
|
||||
if d_date > getdate(self.doc.inst_date):
|
||||
msgprint("Installation Date can not be before Delivery Date "+cstr(d_date)+" for item "+d.item_code)
|
||||
raise Exception
|
||||
|
||||
def validate(self):
|
||||
self.validate_fiscal_year()
|
||||
self.validate_installation_date()
|
||||
self.check_item_table()
|
||||
sales_com_obj = get_obj(dt = 'Sales Common')
|
||||
sales_com_obj.check_active_sales_items(self)
|
||||
sales_com_obj.get_prevdoc_date(self)
|
||||
self.validate_mandatory()
|
||||
self.validate_reference_value()
|
||||
|
||||
def check_item_table(self):
|
||||
if not(getlist(self.doclist, 'installed_item_details')):
|
||||
msgprint("Please fetch items from Delivery Note selected")
|
||||
raise Exception
|
||||
|
||||
def on_update(self):
|
||||
set(self.doc, 'status', 'Draft')
|
||||
|
||||
def on_submit(self):
|
||||
valid_lst = []
|
||||
valid_lst = self.validate_serial_no()
|
||||
|
||||
get_obj("Sales Common").update_prevdoc_detail(1,self)
|
||||
|
||||
for x in valid_lst:
|
||||
wp = sql("select warranty_period from `tabSerial No` where name = '%s'"% x)
|
||||
wp = wp and wp[0][0] or 0
|
||||
if wp:
|
||||
sql("update `tabSerial No` set maintenance_status = 'Under Warranty' where name = '%s'" % x)
|
||||
|
||||
sql("update `tabSerial No` set status = 'Installed' where name = '%s'" % x)
|
||||
|
||||
set(self.doc, 'status', 'Submitted')
|
||||
|
||||
|
||||
def on_cancel(self):
|
||||
cur_s_no = []
|
||||
sales_com_obj = get_obj(dt = 'Sales Common')
|
||||
sales_com_obj.update_prevdoc_detail(0,self)
|
||||
|
||||
for d in getlist(self.doclist, 'installed_item_details'):
|
||||
if d.serial_no:
|
||||
#get current list of serial no
|
||||
cur_serial_no = d.serial_no.replace(' ', '')
|
||||
cur_s_no = cur_serial_no.split(',')
|
||||
|
||||
for x in cur_s_no:
|
||||
sql("update `tabSerial No` set status = 'Delivered' where name = '%s'" % x)
|
||||
|
||||
set(self.doc, 'status', 'Cancelled')
|
||||
478
selling/doctype/installation_note/installation_note.txt
Normal file
478
selling/doctype/installation_note/installation_note.txt
Normal file
@@ -0,0 +1,478 @@
|
||||
# DocType, Installation Note
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:04',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-05-17 16:34:30',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1308741898',
|
||||
'autoname': 'IN/.####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': 'At %(customer_name)s on %(inst_date)s',
|
||||
'version': 96
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Installation Note',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Installation Note',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Installation Note
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Installation Note'
|
||||
},
|
||||
|
||||
# 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': 'Sales User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Manager'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Installation Note',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 2,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'label': 'Series',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'naming_series',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nIN',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 4,
|
||||
'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': 5,
|
||||
'label': 'Customer Address',
|
||||
'options': 'Address',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_person',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 6,
|
||||
'label': 'Contact Person',
|
||||
'options': 'Contact',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 7,
|
||||
'label': 'Name',
|
||||
'oldfieldname': 'customer_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'reqd': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'address_display',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 8,
|
||||
'label': 'Address',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_display',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 9,
|
||||
'label': 'Contact',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_mobile',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 10,
|
||||
'label': 'Mobile No',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_email',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 11,
|
||||
'label': 'Contact Email',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'territory',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 12,
|
||||
'in_filter': 1,
|
||||
'label': 'Territory',
|
||||
'options': 'Territory',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_group',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 13,
|
||||
'label': 'Customer Group',
|
||||
'options': 'Customer Group',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 14,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'inst_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 15,
|
||||
'label': 'Installation Date',
|
||||
'oldfieldname': 'inst_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'inst_time',
|
||||
'fieldtype': 'Time',
|
||||
'idx': 16,
|
||||
'label': 'Installation Time',
|
||||
'oldfieldname': 'inst_time',
|
||||
'oldfieldtype': 'Time',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': 'Draft',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 17,
|
||||
'label': 'Status',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'Draft\nSubmitted\nCancelled',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select the relevant company name if you have multiple companies.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 18,
|
||||
'in_filter': 1,
|
||||
'label': 'Company',
|
||||
'oldfieldname': 'company',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Company',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fiscal_year',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 19,
|
||||
'in_filter': 1,
|
||||
'label': 'Fiscal Year',
|
||||
'oldfieldname': 'fiscal_year',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Fiscal Year',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amended_from',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 20,
|
||||
'label': 'Amended From',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amended_from',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'The date at which current entry is corrected in the system.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amendment_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 21,
|
||||
'label': 'Amendment Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amendment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'remarks',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 22,
|
||||
'label': 'Remarks',
|
||||
'oldfieldname': 'remarks',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cancel_reason',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 23,
|
||||
'label': 'Cancel Reason',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'cancel_reason',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 24,
|
||||
'label': 'Item Details',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'delivery_note_no',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 25,
|
||||
'label': 'Delivery Note No',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'delivery_note_no',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Delivery Note',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'hidden': 0,
|
||||
'idx': 26,
|
||||
'label': 'Get Items',
|
||||
'oldfieldtype': 'Button',
|
||||
'options': 'pull_delivery_note_details',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'installed_item_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 27,
|
||||
'label': 'Installed Item Details',
|
||||
'oldfieldname': 'installed_item_details',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Installed Item Details',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
||||
0
selling/doctype/installed_item_details/__init__.py
Normal file
0
selling/doctype/installed_item_details/__init__.py
Normal file
@@ -0,0 +1,159 @@
|
||||
# DocType, Installed Item Details
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:05',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'abhishek@webnotestech.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'IID/.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 24
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Installed Item Details',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, Installed Item Details
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Installed Item Details'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 0,
|
||||
'idx': 3,
|
||||
'label': 'Delivery Date',
|
||||
'oldfieldname': 'prevdoc_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'serial_no',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 5,
|
||||
'label': 'Serial No',
|
||||
'oldfieldname': 'serial_no',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0,
|
||||
'width': '180px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_detail_docname',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 6,
|
||||
'label': 'Against Document Detail No',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'prevdoc_detail_docname',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_docname',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 7,
|
||||
'in_filter': 1,
|
||||
'label': 'Against Document No',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'prevdoc_docname',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_doctype',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 8,
|
||||
'in_filter': 1,
|
||||
'label': 'Document Type',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'prevdoc_doctype',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Installed Qty',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
}
|
||||
]
|
||||
0
selling/doctype/lead/__init__.py
Normal file
0
selling/doctype/lead/__init__.py
Normal file
147
selling/doctype/lead/lead.js
Normal file
147
selling/doctype/lead/lead.js
Normal file
@@ -0,0 +1,147 @@
|
||||
// Module CRM
|
||||
|
||||
$import(SMS Control)
|
||||
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(user =='Guest'){
|
||||
hide_field(['status', 'naming_series', 'order_lost_reason', 'customer', 'rating', 'fax', 'website', 'territory', 'TerritoryHelp', 'address_line1', 'address_line2', 'city', 'state', 'country', 'pincode', 'address', 'lead_owner', 'market_segment', 'industry', 'campaign_name', 'interested_in', 'company', 'fiscal_year', 'contact_by', 'contact_date', 'last_contact_date', 'contact_date_ref', 'to_discuss', 'More Info', 'follow_up', 'Communication History', 'cc_to', 'subject', 'message', 'Attachment Html', 'Create New File', 'lead_attachment_detail', 'Send Email', 'Email', 'Create Customer', 'Create Enquiry', 'Next Steps', 'transaction_date', 'type', 'source']);
|
||||
doc.source = 'Website';
|
||||
}
|
||||
if(!doc.status) set_multiple(dt,dn,{status:'Open'});
|
||||
|
||||
if (!doc.date){
|
||||
doc.date = date.obj_to_str(new Date());
|
||||
}
|
||||
// set naming series
|
||||
if(user=='Guest') doc.naming_series = 'WebLead';
|
||||
|
||||
cur_frm.add_fetch('customer', 'customer_name', 'company_name');
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
// custom buttons
|
||||
//---------------
|
||||
cur_frm.clear_custom_buttons()
|
||||
if(!doc.__islocal && !in_list(['Converted', 'Lead Lost'], doc.status)) {
|
||||
cur_frm.add_custom_button('Create Customer', cur_frm.cscript['Create Customer']);
|
||||
cur_frm.add_custom_button('Create Enquiry', cur_frm.cscript['Create Enquiry']);
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Client Side Triggers
|
||||
// ===========================================================
|
||||
// ************ Status ******************
|
||||
cur_frm.cscript.status = function(doc, cdt, cdn){
|
||||
cur_frm.cscript.refresh(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
/*
|
||||
// *********** Country ******************
|
||||
// This will show states belonging to country
|
||||
cur_frm.cscript.country = function(doc, cdt, cdn) {
|
||||
var mydoc=doc;
|
||||
$c('runserverobj', args={'method':'check_state', 'docs':compress_doclist([doc])},
|
||||
function(r,rt){
|
||||
if(r.message) {
|
||||
var doc = locals[mydoc.doctype][mydoc.name];
|
||||
doc.state = '';
|
||||
get_field(doc.doctype, 'state' , doc.name).options = r.message;
|
||||
refresh_field('state');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
|
||||
var call_back = function(){
|
||||
var sb_obj = new SalesBrowser();
|
||||
sb_obj.set_val('Territory');
|
||||
}
|
||||
|
||||
loadpage('Sales Browser',call_back);
|
||||
}
|
||||
|
||||
// Create New File
|
||||
// ===============================================================
|
||||
cur_frm.cscript['Create New File'] = function(doc){
|
||||
new_doc("File");
|
||||
}
|
||||
|
||||
//Trigger in Item Table
|
||||
//===================================
|
||||
cur_frm.cscript.item_code=function(doc,cdt,cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) { get_server_fields('get_item_detail',d.item_code,'lead_item_detail',doc,cdt,cdn,1);}
|
||||
}
|
||||
|
||||
// Create New Customer
|
||||
// ===============================================================
|
||||
cur_frm.cscript['Create Customer'] = function(){
|
||||
var doc = cur_frm.doc;
|
||||
$c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist([doc])},
|
||||
function(r,rt){
|
||||
if(r.message == 'Converted'){
|
||||
msgprint("This lead is already converted to customer");
|
||||
}
|
||||
else{
|
||||
n = createLocal("Customer");
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals["Customer"][n]]),
|
||||
'from_doctype':'Lead',
|
||||
'to_doctype':'Customer',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Lead', 'Customer']]"
|
||||
},
|
||||
function(r,rt) {
|
||||
loaddoc("Customer", n);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// send email
|
||||
// ===============================================================
|
||||
cur_frm.cscript['Send Email'] = function(doc,cdt,cdn){
|
||||
if(doc.__islocal != 1){
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'send_mail','',function(r,rt){});
|
||||
}else{
|
||||
msgprint("Please save lead first before sending email")
|
||||
}
|
||||
}
|
||||
|
||||
// Create New Enquiry
|
||||
// ===============================================================
|
||||
cur_frm.cscript['Create Enquiry'] = function(){
|
||||
var doc = cur_frm.doc;
|
||||
$c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist([doc])},
|
||||
function(r,rt){
|
||||
if(r.message == 'Converted'){
|
||||
msgprint("This lead is now converted to customer. Please create enquiry on behalf of customer");
|
||||
}
|
||||
else{
|
||||
n = createLocal("Enquiry");
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals["Enquiry"][n]]),
|
||||
'from_doctype':'Lead',
|
||||
'to_doctype':'Enquiry',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Lead', 'Enquiry']]"
|
||||
}
|
||||
, function(r,rt) {
|
||||
loaddoc("Enquiry", n);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//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';
|
||||
}
|
||||
212
selling/doctype/lead/lead.py
Normal file
212
selling/doctype/lead/lead.py
Normal file
@@ -0,0 +1,212 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
#check status of lead
|
||||
#------------------------
|
||||
def check_status(self):
|
||||
chk = sql("select status from `tabLead` where name=%s", self.doc.name)
|
||||
chk = chk and chk[0][0] or ''
|
||||
return cstr(chk)
|
||||
|
||||
# Gets states belonging cto country selected
|
||||
# =====================================================================
|
||||
#def check_state(self):
|
||||
# return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
|
||||
|
||||
# Get item detail (will be removed later)
|
||||
#=======================================
|
||||
def get_item_detail(self,item_code):
|
||||
it=sql("select item_name,brand,item_group,description,stock_uom from `tabItem` where name='%s'"%item_code)
|
||||
if it:
|
||||
ret = {
|
||||
'item_name' : it and it[0][0] or '',
|
||||
'brand' : it and it[0][1] or '',
|
||||
'item_group' : it and it[0][2] or '',
|
||||
'description': it and it[0][3] or '',
|
||||
'uom' : it and it[0][4] or ''
|
||||
}
|
||||
return cstr(ret)
|
||||
|
||||
def validate(self):
|
||||
import string
|
||||
# Get Address
|
||||
# ======================================================================
|
||||
#if (self.doc.address_line1) or (self.doc.address_line2) or (self.doc.city) or (self.doc.state) or (self.doc.country) or (self.doc.pincode):
|
||||
# address =["address_line1", "address_line2", "city", "state", "country", "pincode"]
|
||||
# comp_address=''
|
||||
# for d in address:
|
||||
# if self.doc.fields[d]:
|
||||
# comp_address += self.doc.fields[d] + "\n"
|
||||
# if self.doc.website:
|
||||
# comp_address += "Website : "+ self.doc.website
|
||||
# self.doc.address = comp_address
|
||||
|
||||
if self.doc.status == 'Lead Lost' and not self.doc.order_lost_reason:
|
||||
msgprint("Please Enter Order Lost Reason")
|
||||
raise Exception
|
||||
|
||||
if self.doc.source == 'Campaign' and not self.doc.campaign_name and session['user'] != 'Guest':
|
||||
msgprint("Please specify campaign name")
|
||||
raise Exception
|
||||
|
||||
if self.doc.email_id:
|
||||
if not validate_email_add(self.doc.email_id):
|
||||
msgprint('Please enter valid email id.')
|
||||
raise Exception
|
||||
|
||||
if not self.doc.naming_series:
|
||||
if session['user'] == 'Guest':
|
||||
so = sql("select options from `tabDocField` where parent = 'Lead' and fieldname = 'naming_series'")
|
||||
#so = sql("select series_options from `tabNaming Series Options` where doc_type='Lead'")
|
||||
if so:
|
||||
sr = so[0][0].split("\n")
|
||||
set(self.doc, 'naming_series', sr[0])
|
||||
else:
|
||||
msgprint("Please specify naming series")
|
||||
raise Exception
|
||||
|
||||
def on_update(self):
|
||||
# Add to calendar
|
||||
# ========================================================================
|
||||
if self.doc.contact_by:
|
||||
self.add_calendar_event()
|
||||
|
||||
if session['user'] == 'Guest':
|
||||
if self.doc.email_id:
|
||||
self.send_email_notification()
|
||||
|
||||
if not self.doc.naming_series:
|
||||
if session['user'] == 'Guest':
|
||||
#so = sql("select series_options from `tabNaming Series Options` where doc_type='Lead'")
|
||||
so = sql("select options from `tabDocField` where parent = 'Lead' and fieldname = 'naming_series'")
|
||||
if so:
|
||||
sr = so[0][0].split("\n")
|
||||
set(self.doc, 'naming_series', sr[0])
|
||||
else:
|
||||
msgprint("Please specify naming series")
|
||||
raise Exception
|
||||
|
||||
def send_email_notification(self):
|
||||
if not validate_email_add(self.doc.email_id.strip(' ')):
|
||||
msgprint('error:%s is not a valid email id' % self.doc.email_id.strip(' '))
|
||||
raise Exception
|
||||
else:
|
||||
subject = 'Thank you for interest in erpnext'
|
||||
|
||||
sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]])
|
||||
#sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list)
|
||||
msgprint("Mail Sent")
|
||||
|
||||
def get_notification_msg(self):
|
||||
t = """
|
||||
<html>
|
||||
<body>
|
||||
Dear %s,<br><br>
|
||||
|
||||
Thank you for contacting us.<br><br>
|
||||
|
||||
You have left following message for us,<br>
|
||||
%s
|
||||
<br><br>
|
||||
|
||||
You will receive reply on this shortly.<br><br>
|
||||
|
||||
Cheers!
|
||||
</body>
|
||||
</html>
|
||||
""" % (self.doc.lead_name, self.doc.remark)
|
||||
|
||||
return t
|
||||
|
||||
# Add to Calendar
|
||||
# ===========================================================================
|
||||
def add_calendar_event(self):
|
||||
# delete any earlier event by this lead
|
||||
sql("delete from tabEvent where ref_type='Lead' and ref_name=%s", self.doc.name)
|
||||
|
||||
in_calendar_of = self.doc.lead_owner
|
||||
|
||||
# get profile (id) if exists for contact_by
|
||||
email_id = webnotes.conn.get_value('Sales Person', self.doc.contact_by, 'email_id')
|
||||
if webnotes.conn.exists('Profile', email_id):
|
||||
in_calendar_of = email_id
|
||||
|
||||
ev = Document('Event')
|
||||
ev.owner = in_calendar_of
|
||||
ev.description = 'Contact ' + cstr(self.doc.lead_name) + '.By : ' + cstr(self.doc.contact_by) + '.To Discuss : ' + cstr(self.doc.to_discuss)
|
||||
ev.event_date = self.doc.contact_date
|
||||
ev.event_hour = '10:00'
|
||||
ev.event_type = 'Private'
|
||||
ev.ref_type = 'Lead'
|
||||
ev.ref_name = self.doc.name
|
||||
ev.save(1)
|
||||
|
||||
|
||||
#-----------------Email--------------------------------------------
|
||||
def send_emails(self, email=[], subject='', message=''):
|
||||
if email:
|
||||
sendmail(email, sender = webnotes.user.name, subject = subject , parts = [['text/html', message]])
|
||||
msgprint("Mail Sent")
|
||||
self.add_in_follow_up(message,'Email')
|
||||
|
||||
#-------------------------Checking Sent Mails Details----------------------------------------------
|
||||
def send_mail(self):
|
||||
if not self.doc.subject or not self.doc.message:
|
||||
msgprint("Please enter subject & message in their respective fields.")
|
||||
elif not self.doc.email_id:
|
||||
msgprint("Recipient not specified. Please add email id of lead in 'Email id' field provided in 'Contact Info' section.")
|
||||
raise Exception
|
||||
else :
|
||||
self.send_emails([self.doc.email_id.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
|
||||
|
||||
#---------------------- Add details in follow up table----------------
|
||||
def add_in_follow_up(self,message,type):
|
||||
import datetime
|
||||
child = addchild( self.doc, 'follow_up', 'Follow up', 1, self.doclist)
|
||||
child.date = datetime.datetime.now().date().strftime('%Y-%m-%d')
|
||||
child.notes = message
|
||||
child.follow_up_type = type
|
||||
child.save()
|
||||
|
||||
#-------------------SMS----------------------------------------------
|
||||
def send_sms(self):
|
||||
if not self.doc.sms_message or not self.doc.mobile_no:
|
||||
msgprint("Please enter mobile number in Basic Info Section and message in SMS Section ")
|
||||
raise Exception
|
||||
else:
|
||||
receiver_list = []
|
||||
if self.doc.mobile_no:
|
||||
receiver_list.append(self.doc.mobile_no)
|
||||
for d in getlist(self.doclist,'lead_sms_detail'):
|
||||
if d.other_mobile_no:
|
||||
receiver_list.append(d.other_mobile_no)
|
||||
|
||||
if receiver_list:
|
||||
msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.sms_message))
|
||||
self.add_in_follow_up(self.doc.sms_message,'SMS')
|
||||
787
selling/doctype/lead/lead.txt
Normal file
787
selling/doctype/lead/lead.txt
Normal file
@@ -0,0 +1,787 @@
|
||||
# DocType, Lead
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:07',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-05-10 12:15:21',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1305009922',
|
||||
'allow_trash': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'search_fields': 'lead_name,lead_owner,status',
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': '%(lead_name)s from %(company_name)s | To Discuss: %(to_discuss)s',
|
||||
'tag_fields': 'status,source',
|
||||
'version': 394
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Lead',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Lead',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Lead
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Lead'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales User',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 1,
|
||||
'role': 'All'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 0,
|
||||
'role': 'System Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 7,
|
||||
'permlevel': 0,
|
||||
'role': 'Guest',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Basic Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 2,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'lead_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'in_filter': 1,
|
||||
'label': 'Contact Name',
|
||||
'oldfieldname': 'lead_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'source',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 4,
|
||||
'in_filter': 1,
|
||||
'label': 'Source',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'source',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWebsite",
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': "eval:doc.source == 'Existing Customer'",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 5,
|
||||
'label': 'From Customer',
|
||||
'oldfieldname': 'customer',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Customer',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': "eval:doc.source == 'Campaign'",
|
||||
'description': 'Enter campaign name if the source of lead is campaign.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'campaign_name',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 6,
|
||||
'label': 'Campaign Name',
|
||||
'oldfieldname': 'campaign_name',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Campaign',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Name of organization from where lead has come',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 7,
|
||||
'in_filter': 1,
|
||||
'label': 'Company Name',
|
||||
'oldfieldname': 'company_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'To manage multiple series please go to Setup > Manage Series',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 8,
|
||||
'label': 'Series',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'naming_series',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nLEAD\nLEAD/10-11/\nLEAD/MUMBAI/',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'Open',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 9,
|
||||
'in_filter': 1,
|
||||
'label': 'Status',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nOpen\nAttempted to Contact\nContact in Future\nContacted\nInterested\nNot interested\nLead Lost\nConverted',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': 'Today',
|
||||
'description': 'The date at which current entry is made in system.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'transaction_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 10,
|
||||
'in_filter': 1,
|
||||
'label': 'Lead Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'transaction_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 11,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 12,
|
||||
'in_filter': 1,
|
||||
'label': 'Lead Type',
|
||||
'oldfieldname': 'type',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nClient\nChannel Partner\nConsultant',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'request_type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 13,
|
||||
'label': 'Request Type',
|
||||
'oldfieldname': 'request_type',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nProduct Enquiry\nRequest for Information\nSuggestions\nOther',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Probability of lead converting to customer',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rating',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 14,
|
||||
'in_filter': 1,
|
||||
'label': 'Rating',
|
||||
'oldfieldname': 'rating',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nHot\nWarm\nCold',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'remark',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 15,
|
||||
'label': 'Remark',
|
||||
'oldfieldname': 'remark',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'depends_on': "eval:doc.status == 'Lead Lost'",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'order_lost_reason',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 16,
|
||||
'label': 'Lost Reason',
|
||||
'oldfieldname': 'order_lost_reason',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Order Lost Reason',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 17,
|
||||
'label': 'Trash Reason',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 18,
|
||||
'label': 'Contact Info',
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'phone',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 19,
|
||||
'label': 'Phone',
|
||||
'oldfieldname': 'contact_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'mobile_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 20,
|
||||
'label': 'Mobile No.',
|
||||
'oldfieldname': 'mobile_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'email_id',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 21,
|
||||
'label': 'Email Id',
|
||||
'oldfieldname': 'email_id',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fax',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 22,
|
||||
'label': 'Fax',
|
||||
'oldfieldname': 'fax',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'website',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 23,
|
||||
'label': 'Website',
|
||||
'oldfieldname': 'website',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': '<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'territory',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 24,
|
||||
'label': 'Territory',
|
||||
'oldfieldname': 'territory',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Territory',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 25,
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'address_line1',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 26,
|
||||
'label': 'Address Line 1',
|
||||
'oldfieldname': 'address_line1',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'address_line2',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 27,
|
||||
'label': 'Address Line 2',
|
||||
'oldfieldname': 'address_line2',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'city',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 28,
|
||||
'label': 'City',
|
||||
'oldfieldname': 'city',
|
||||
'oldfieldtype': 'Select',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'country',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 29,
|
||||
'label': 'Country',
|
||||
'oldfieldname': 'country',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Country',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'state',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 30,
|
||||
'label': 'State',
|
||||
'oldfieldname': 'state',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'Suggest',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'pincode',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 31,
|
||||
'label': 'Pin Code',
|
||||
'oldfieldname': 'pincode',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 32,
|
||||
'label': 'More Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 33,
|
||||
'label': 'Company',
|
||||
'oldfieldname': 'company',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Company',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '__user',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'lead_owner',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 34,
|
||||
'in_filter': 1,
|
||||
'label': 'Lead Owner',
|
||||
'oldfieldname': 'lead_owner',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Profile',
|
||||
'permlevel': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'market_segment',
|
||||
'fieldtype': 'Select',
|
||||
'hidden': 0,
|
||||
'idx': 35,
|
||||
'in_filter': 1,
|
||||
'label': 'Market Segment',
|
||||
'oldfieldname': 'market_segment',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nLower Income\nMiddle Income\nUpper Income',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'industry',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 36,
|
||||
'label': 'Industry',
|
||||
'oldfieldname': 'industry',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Industry Type',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Your products or facilities in which the lead is interested',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'interested_in',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 37,
|
||||
'label': 'Interested In',
|
||||
'oldfieldname': 'interested_in',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fiscal_year',
|
||||
'fieldtype': 'Select',
|
||||
'hidden': 1,
|
||||
'idx': 38,
|
||||
'in_filter': 1,
|
||||
'label': 'Fiscal Year',
|
||||
'oldfieldname': 'fiscal_year',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Fiscal Year',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 39,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Your sales person who will contact the lead in future',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_by',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 40,
|
||||
'in_filter': 1,
|
||||
'label': 'Next Contact By',
|
||||
'oldfieldname': 'contact_by',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Profile',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Your sales person will get a reminder on this date to contact the lead',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 41,
|
||||
'in_filter': 1,
|
||||
'label': 'Next Contact Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'contact_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'description': 'Date on which the lead was last contacted',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'last_contact_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 42,
|
||||
'label': 'Last Contact Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'last_contact_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'to_discuss',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 43,
|
||||
'label': 'To Discuss',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'to_discuss',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Keep a track of communication with this lead which will help for future reference.',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 44,
|
||||
'label': 'Communication History',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'follow_up',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 45,
|
||||
'label': 'Follow up',
|
||||
'oldfieldname': 'follow_up',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Follow up',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
||||
0
selling/doctype/lead_attachment_detail/__init__.py
Normal file
0
selling/doctype/lead_attachment_detail/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-10-06 12:12:21', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Lead Attachment Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-10-06 12:12:21', 'doctype': 'DocField', 'oldfieldname': 'select_file', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Select File For Attachment', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Lead Attachment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03137', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-10-06 12:35:51', 'parenttype': 'DocType', 'fieldname': 'select_file', 'fieldtype': 'Link', 'options': 'File', 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
selling/doctype/lead_item_detail/__init__.py
Normal file
0
selling/doctype/lead_item_detail/__init__.py
Normal file
1
selling/doctype/lead_item_detail/lead_item_detail.txt
Normal file
1
selling/doctype/lead_item_detail/lead_item_detail.txt
Normal file
File diff suppressed because one or more lines are too long
0
selling/doctype/lead_sms_detail/__init__.py
Normal file
0
selling/doctype/lead_sms_detail/__init__.py
Normal file
1
selling/doctype/lead_sms_detail/lead_sms_detail.txt
Normal file
1
selling/doctype/lead_sms_detail/lead_sms_detail.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-10-06 12:10:26', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Lead SMS Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-10-06 12:10:26', 'doctype': 'DocField', 'oldfieldname': 'other_mobile_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Mobile No', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Lead SMS Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03136', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-10-06 17:26:45', 'parenttype': 'DocType', 'fieldname': 'other_mobile_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
|
||||
0
selling/doctype/plot_control/__init__.py
Normal file
0
selling/doctype/plot_control/__init__.py
Normal file
229
selling/doctype/plot_control/plot_control.py
Normal file
229
selling/doctype/plot_control/plot_control.py
Normal file
@@ -0,0 +1,229 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist = []):
|
||||
self.doc ,self.doclist = doc, doclist
|
||||
|
||||
#============================get monthly sales====================================================
|
||||
def get_monthwise_amount(self,lst):
|
||||
lst = lst.split(',')
|
||||
if not lst[1]:
|
||||
ret = convert_to_lists(sql("SELECT SUM(grand_total) AMOUNT,CASE MONTH(due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME FROM `tabReceivable Voucher` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY MONTH(due_date) ORDER BY MONTH(due_date)"%lst[0]))
|
||||
else:
|
||||
ret = convert_to_lists(sql("select sum(t2.amount) AMOUNT ,CASE MONTH(t1.due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME from `tabReceivable Voucher` t1,`tabRV Detail` t2 WHERE t1.name = t2.parent and t1.docstatus = 1 and t2.item_group = '%s' AND t1.fiscal_year = '%s' GROUP BY MONTH(t1.due_date) ORDER BY MONTH(t1.due_date)"%(lst[1],lst[0])))
|
||||
|
||||
m =cint(sql("select month('%s')"%(get_defaults()['year_start_date']))[0][0])
|
||||
|
||||
lst1 = [[1,'JAN'],[2 ,'FEB'], [3,'MAR'],[4,'APR'],[5,'MAY'],[6,'JUN'],[7,'JUL'],[8,'AUG'],[9,'SEP'],[10,'OCT'],[11,'NOV'],[12,'DEC']]
|
||||
lst2=[]
|
||||
k=1
|
||||
|
||||
for i in range(1,13):
|
||||
for j in lst1:
|
||||
if j[0]==m:
|
||||
lst2.append([k,j[1]])
|
||||
m +=1
|
||||
if m==13: m=1
|
||||
k +=1
|
||||
return {'msg_data':ret,'x_axis':lst2}
|
||||
|
||||
#===============================get weekly sales=================================================
|
||||
def get_weekwise_amount(self,lst):
|
||||
|
||||
lst = lst.split(',')
|
||||
|
||||
cases = self.get_week_cases(lst[0],lst[1])
|
||||
|
||||
if not lst[2]:
|
||||
query = "SELECT SUM(grand_total) AMOUNT,CASE WEEK(due_date)"+ cases +"END Weekly FROM `tabReceivable Voucher` WHERE MONTH(due_date) = %d AND docstatus = 1 AND fiscal_year = '%s' GROUP BY Weekly ORDER BY Weekly"
|
||||
|
||||
ret = convert_to_lists(sql(query%(cint(lst[0]),lst[1])))
|
||||
|
||||
else:
|
||||
|
||||
query = "SELECT SUM(t2.amount) AMOUNT,CASE WEEK(t1.due_date)" + cases + "END Weekly FROM `tabReceivable Voucher` t1, `tabRV Detail` t2 WHERE MONTH(t1.due_date) = %d AND t1.docstatus = 1 AND t1.fiscal_year = '%s' AND t1.name = t2.parent AND t2.item_group ='%s' GROUP BY Weekly ORDER BY Weekly"
|
||||
|
||||
ret =convert_to_lists(sql(query%(cint(lst[0]),lst[1],lst[2])))
|
||||
|
||||
return ret and ret or ''
|
||||
#================================================================================
|
||||
def get_week_cases(self,m1,fy):
|
||||
d1 = self.make_date("%s,%s"%(cstr(m1),fy))
|
||||
|
||||
w = sql("select week('%s'),week(last_day('%s'))"%(d1,d1))
|
||||
w1 = cint(w[0][0])
|
||||
w2 = cint(w[0][1])
|
||||
|
||||
w3 = []
|
||||
str1 = " "
|
||||
for i in range(1,7):
|
||||
if(w1 <= w2):
|
||||
w3.append(w1)
|
||||
str1 += "WHEN "+ cstr(w1) +" THEN 'Week"+cstr(i) +"' "
|
||||
w1 += 1
|
||||
|
||||
return str1
|
||||
|
||||
#===============================get yearly weekwise sales=================================================
|
||||
def get_year_weekwise_amount(self,lst):
|
||||
|
||||
lst = lst.split(',')
|
||||
yr_st = get_defaults()['year_start_date']
|
||||
|
||||
fy = lst[0]
|
||||
m1 = cint(yr_st.split('-')[1])
|
||||
|
||||
cases = ' '
|
||||
for i in range(1,13):
|
||||
cases += self.get_week_cases(m1,fy)
|
||||
m1 +=1
|
||||
if(m1 == 13): m1 = 1
|
||||
|
||||
if not lst[1]:
|
||||
query = "SELECT SUM(grand_total) AMOUNT,CASE WEEK(due_date)"+cases+"END Weekly, month(due_date) month FROM `tabReceivable Voucher` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY `month`,weekly ORDER BY `month`,weekly"
|
||||
ret = convert_to_lists(sql(query%lst[0]))
|
||||
|
||||
else:
|
||||
|
||||
query = "SELECT SUM(t2.amount) AMOUNT,CASE WEEK(t1.due_date)" + cases + "END Weekly, month(due_date) month FROM `tabReceivable Voucher` t1, `tabRV Detail` t2 WHERE t1.docstatus = 1 AND t1.fiscal_year = '%s' AND t1.name = t2.parent AND t2.item_group ='%s' GROUP BY Weekly ORDER BY Weekly"
|
||||
ret = convert_to_lists(sql(query%(lst[0],lst[1])))
|
||||
|
||||
|
||||
return ret and ret or ''
|
||||
|
||||
|
||||
#====================================make yearly weekwise dates================================================
|
||||
def yr_wk_dates(self,fy):
|
||||
|
||||
from datetime import date
|
||||
yr_st = get_defaults()['year_start_date']
|
||||
yr_en = get_defaults()['year_end_date']
|
||||
|
||||
fy = fy.split('-')
|
||||
y1 = yr_st.split('-')
|
||||
date1 = date(cint(fy[0]),cint(y1[1]),cint(y1[2]))
|
||||
|
||||
y2 = yr_en.split('-')
|
||||
date2 = date(cint(fy[1]),cint(y2[1]),cint(y2[2]))
|
||||
|
||||
|
||||
|
||||
date_lst = [[1,self.get_months(cint(y1[1]))]]
|
||||
m1=cint(y1[1])+1
|
||||
x_axis_lst = [[1,'Week1',cint(y1[1])]]
|
||||
|
||||
from datetime import date, timedelta
|
||||
d =dt= date1
|
||||
|
||||
week=k=1
|
||||
for i in range(0,53):
|
||||
|
||||
if dt <= date2:
|
||||
|
||||
if(d.weekday()>3):
|
||||
d = d+timedelta(7-d.weekday())
|
||||
else:
|
||||
d = d - timedelta(d.weekday())
|
||||
dlt = timedelta(days = (week-1)*7)
|
||||
dt = d + dlt + timedelta(days=6)
|
||||
|
||||
m2 = cint(sql("Select month('%s')"%dt)[0][0])
|
||||
|
||||
if(m1 == m2):
|
||||
date_lst.append([i+2,self.get_months(m2)])
|
||||
x_axis_lst.append([i+2,'Week1',m2])
|
||||
k=1
|
||||
m1 += 1
|
||||
if(m1==13): m1 =1
|
||||
else:
|
||||
date_lst.append([i+2,' '])
|
||||
x_axis_lst.append([i+2,'Week%d'%k,m2])
|
||||
week += 1
|
||||
k +=1
|
||||
|
||||
|
||||
return [date_lst,x_axis_lst]
|
||||
#===================================================================================
|
||||
|
||||
def get_months(self,m):
|
||||
m_lst = {1:'JAN',2:'FEB',3:'MAR',4:'APR',5:'MAY',6:'JUN',7:'JUL',8:'AUG',9:'SEP',10:'OCT',11:'NOV',12:'DEC'}
|
||||
return m_lst[m]
|
||||
|
||||
|
||||
|
||||
def get_weekdates(self,lst):
|
||||
from datetime import date, timedelta
|
||||
|
||||
d = dt = self.make_date(lst)
|
||||
date_lst = [[1,cstr(d.strftime("%d/%m/%y"))]]
|
||||
week=flag =1
|
||||
j=1
|
||||
last_day = sql("select last_day('%s')"%d)[0][0]
|
||||
lst_m = cint(lst.split(',')[0])
|
||||
for i in range(2,8):
|
||||
f=0
|
||||
if(dt < last_day):
|
||||
#if(d.weekday()>4):
|
||||
#d = d+timedelta(7-d.weekday())
|
||||
#else:
|
||||
d = d - timedelta(d.weekday()-1)
|
||||
dlt = timedelta(days = (week-1)*7)
|
||||
dt = d + dlt + timedelta(days=6)
|
||||
|
||||
if(cint(sql("select month('%s')"%dt)[0][0]) == lst_m and dt!=last_day):
|
||||
for k in date_lst:
|
||||
if(cstr(dt.strftime("%d/%m/%y")) == k[1]):
|
||||
f = 1
|
||||
if f == 0:
|
||||
date_lst.append([i,cstr(dt.strftime("%d/%m/%y"))])
|
||||
|
||||
elif(dt==last_day and flag ==1):
|
||||
date_lst.append([i,cstr(last_day.strftime("%d/%m/%y"))])
|
||||
flag = 0
|
||||
|
||||
elif(flag == 1):
|
||||
date_lst.append([i,cstr(last_day.strftime("%d/%m/%y"))])
|
||||
week += 1
|
||||
|
||||
return date_lst and date_lst or ''
|
||||
|
||||
|
||||
def make_date(self,lst):
|
||||
|
||||
from datetime import date, timedelta
|
||||
lst = lst.split(',')
|
||||
year = lst[1].split('-')
|
||||
if(len(lst[0])==1): month = '0'+lst[0]
|
||||
else: month = lst[0]
|
||||
if(1<=cint(month)<=3): year = year[1]
|
||||
elif(4<=cint(month)<=12): year = year[0]
|
||||
|
||||
d = date(cint(year),cint(month),1)
|
||||
|
||||
return d
|
||||
|
||||
def get_item_groups(self):
|
||||
ret = convert_to_lists(sql("select name from `tabItem Group` where docstatus != 2 and is_group = 'No'"))
|
||||
#ret = convert_to_lists(sql("select item_group from `tabItem` where is_sales_item='Yes' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now()) and item_group !=''"))
|
||||
return ret and ret or ''
|
||||
|
||||
def get_fiscal_year(self):
|
||||
ret = convert_to_lists(sql("select name from `tabFiscal Year` where docstatus =0"))
|
||||
return ret and ret or ''
|
||||
30
selling/doctype/plot_control/plot_control.txt
Normal file
30
selling/doctype/plot_control/plot_control.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
# DocType, Plot Control
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:12',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'harshada@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 215
|
||||
},
|
||||
|
||||
# DocType, Plot Control
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Plot Control'
|
||||
}
|
||||
]
|
||||
0
selling/doctype/quotation/__init__.py
Normal file
0
selling/doctype/quotation/__init__.py
Normal file
310
selling/doctype/quotation/quotation.js
Normal file
310
selling/doctype/quotation/quotation.js
Normal file
@@ -0,0 +1,310 @@
|
||||
// Module CRM
|
||||
cur_frm.cscript.tname = "Quotation Detail";
|
||||
cur_frm.cscript.fname = "quotation_details";
|
||||
cur_frm.cscript.other_fname = "other_charges";
|
||||
cur_frm.cscript.sales_team_fname = "sales_team";
|
||||
|
||||
// =====================================================================================
|
||||
$import(Sales Common)
|
||||
$import(Other Charges)
|
||||
$import(SMS Control)
|
||||
|
||||
// ONLOAD
|
||||
// ===================================================================================
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(!doc.quotation_to) hide_field(['customer','customer_address','contact_person','customer_name','lead', 'lead_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
|
||||
if(!doc.price_list_name) set_multiple(cdt,cdn,{price_list_name:sys_defaults.price_list_name});
|
||||
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
||||
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
|
||||
if(!doc.conversion_rate) set_multiple(cdt,cdn,{conversion_rate:'1.00'});
|
||||
if(!doc.currency && sys_defaults.currency) set_multiple(cdt,cdn,{currency:sys_defaults.currency});
|
||||
//if(!doc.price_list_name && sys_defaults.price_list_name) set_multiple(cdt,cdn,{price_list_name:sys_defaults.price_list_name});
|
||||
if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
|
||||
if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});
|
||||
|
||||
if(doc.quotation_to) {
|
||||
if(doc.quotation_to == 'Customer') {
|
||||
hide_field(['lead', 'lead_name']);
|
||||
}
|
||||
else if (doc.quotation_to == 'Lead') {
|
||||
hide_field(['customer','customer_address','contact_person', 'customer_name','contact_display', 'customer_group']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||
// load default charges
|
||||
if(doc.__islocal && !getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length)
|
||||
cur_frm.cscript.load_taxes(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
// hide - unhide fields based on lead or customer..
|
||||
// =======================================================================================================================
|
||||
cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
|
||||
if(doc.quotation_to == 'Lead'){
|
||||
unhide_field(['lead']);
|
||||
hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
|
||||
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
|
||||
}
|
||||
else if(doc.quotation_to == 'Customer'){
|
||||
unhide_field(['customer']);
|
||||
hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);
|
||||
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
|
||||
}
|
||||
//refresh_many(['lead','customer']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//================ hide - unhide fields on basis of quotation to either lead or customer ===============================
|
||||
cur_frm.cscript.quotation_to = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.lead_cust_show(doc,cdt,cdn);
|
||||
//doc.customer_address = doc.territory = doc.contact_no = doc.email_id = "";
|
||||
//refresh_many(['territory','customer_address','contact_no','email_id']);
|
||||
//doc.address_display = doc.contact_display = "";
|
||||
//refresh_many(['address_display','contact_display']);
|
||||
}
|
||||
|
||||
|
||||
// REFRESH
|
||||
// ===================================================================================
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
cur_frm.clear_custom_buttons();
|
||||
|
||||
if(doc.docstatus == 1 && doc.status!='Order Lost') {
|
||||
cur_frm.add_custom_button('Make Sales Order', cur_frm.cscript['Make Sales Order']);
|
||||
cur_frm.add_custom_button('Set as Lost', cur_frm.cscript['Declare Order Lost']);
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
|
||||
}
|
||||
|
||||
if (!doc.docstatus) hide_field(['Update Follow up']);
|
||||
else unhide_field(['Update Follow up']);
|
||||
//cur_frm.cscript.lead_cust_show(doc,cdt,cdn);
|
||||
}
|
||||
|
||||
// ============== Lead and its Details ============================
|
||||
|
||||
/*
|
||||
//================ create new contact ============================================================================
|
||||
cur_frm.cscript.new_contact = function(){
|
||||
tn = createLocal('Contact');
|
||||
locals['Contact'][tn].is_customer = 1;
|
||||
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
|
||||
loaddoc('Contact', tn);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// DOCTYPE TRIGGERS
|
||||
// ====================================================================================
|
||||
|
||||
/*
|
||||
// ***************** Get Contact Person based on customer selected *****************
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabContact`.contact_name, `tabContact`.email_id FROM `tabContact` WHERE `tabContact`.is_customer = 1 AND `tabContact`.docstatus != 2 AND `tabContact`.customer = "'+ doc.customer +'" AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
|
||||
}
|
||||
*/
|
||||
|
||||
//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';
|
||||
}
|
||||
|
||||
//lead
|
||||
cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
|
||||
return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||
if(doc.lead) get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1);
|
||||
if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);
|
||||
}
|
||||
|
||||
|
||||
// =====================================================================================
|
||||
cur_frm.fields_dict['enq_no'].get_query = function(doc,cdt,cdn){
|
||||
var cond='';
|
||||
var cond1='';
|
||||
if(doc.order_type) cond = 'ifnull(`tabEnquiry`.enquiry_type, "") = "'+doc.order_type+'" AND';
|
||||
if(doc.customer) cond1 = '`tabEnquiry`.customer = "'+doc.customer+'" AND';
|
||||
else if(doc.lead) cond1 = '`tabEnquiry`.lead = "'+doc.lead+'" AND';
|
||||
|
||||
return repl('SELECT `tabEnquiry`.`name` FROM `tabEnquiry` WHERE `tabEnquiry`.`docstatus` = 1 AND `tabEnquiry`.status = "Submitted" AND %(cond)s %(cond1)s `tabEnquiry`.`name` LIKE "%s" ORDER BY `tabEnquiry`.`name` ASC LIMIT 50', {cond:cond, cond1:cond1});
|
||||
}
|
||||
|
||||
// Make Sales Order
|
||||
// =====================================================================================
|
||||
cur_frm.cscript['Make Sales Order'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
|
||||
if (doc.docstatus == 1) {
|
||||
var n = createLocal("Sales Order");
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals["Sales Order"][n]]),
|
||||
'from_doctype':'Quotation',
|
||||
'to_doctype':'Sales Order',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Quotation', 'Sales Order'], ['Quotation Detail', 'Sales Order Detail'],['RV Tax Detail','RV Tax Detail'], ['Sales Team', 'Sales Team'], ['TC Detail', 'TC Detail']]"
|
||||
}, function(r,rt) {
|
||||
loaddoc("Sales Order", n);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//pull enquiry details
|
||||
cur_frm.cscript['Pull Enquiry Detail'] = function(doc,cdt,cdn){
|
||||
|
||||
var callback = function(r,rt){
|
||||
if(r.message){
|
||||
doc.quotation_to = r.message;
|
||||
|
||||
if(doc.quotation_to == 'Lead') {
|
||||
unhide_field(['lead','lead_name','address_display','contact_mobile','contact_email','territory']);
|
||||
}
|
||||
else if(doc.quotation_to == 'Customer') {
|
||||
unhide_field(['customer','customer_address','contact_person','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
|
||||
}
|
||||
refresh_many(['quotation_details','quotation_to','customer','customer_address','contact_person','lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','order_type']);
|
||||
}
|
||||
}
|
||||
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'pull_enq_details','',callback);
|
||||
|
||||
}
|
||||
|
||||
//update follow up
|
||||
//=================================================================================
|
||||
cur_frm.cscript['Update Follow up'] = function(doc){
|
||||
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'update_followup_details','',function(r, rt){
|
||||
refresh_field('follow_up');
|
||||
doc.__unsaved = 0;
|
||||
cur_frm.refresh_header();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// declare order lost
|
||||
//-------------------------
|
||||
cur_frm.cscript['Declare Order Lost'] = function(){
|
||||
var qtn_lost_dialog;
|
||||
|
||||
set_qtn_lost_dialog = function(doc,cdt,cdn){
|
||||
qtn_lost_dialog = new Dialog(400,400,'Add Quotation Lost Reason');
|
||||
qtn_lost_dialog.make_body([
|
||||
['HTML', 'Message', '<div class="comment">Please add quotation lost reason</div>'],
|
||||
['Text', 'Quotation Lost Reason'],
|
||||
['HTML', 'Response', '<div class = "comment" id="update_quotation_dialog_response"></div>'],
|
||||
['HTML', 'Add Reason', '<div></div>']
|
||||
]);
|
||||
|
||||
var add_reason_btn1 = $a($i(qtn_lost_dialog.widgets['Add Reason']), 'button', 'button');
|
||||
add_reason_btn1.innerHTML = 'Add';
|
||||
add_reason_btn1.onclick = function(){ qtn_lost_dialog.add(); }
|
||||
|
||||
var add_reason_btn2 = $a($i(qtn_lost_dialog.widgets['Add Reason']), 'button', 'button');
|
||||
add_reason_btn2.innerHTML = 'Cancel';
|
||||
$y(add_reason_btn2,{marginLeft:'4px'});
|
||||
add_reason_btn2.onclick = function(){ qtn_lost_dialog.hide();}
|
||||
|
||||
qtn_lost_dialog.onshow = function() {
|
||||
qtn_lost_dialog.widgets['Quotation Lost Reason'].value = '';
|
||||
$i('update_quotation_dialog_response').innerHTML = '';
|
||||
}
|
||||
|
||||
qtn_lost_dialog.add = function() {
|
||||
// sending...
|
||||
$i('update_quotation_dialog_response').innerHTML = 'Processing...';
|
||||
var arg = strip(qtn_lost_dialog.widgets['Quotation Lost Reason'].value);
|
||||
var call_back = function(r,rt) {
|
||||
if(r.message == 'true'){
|
||||
$i('update_quotation_dialog_response').innerHTML = 'Done';
|
||||
qtn_lost_dialog.hide();
|
||||
}
|
||||
}
|
||||
if(arg) $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_order_lost',arg,call_back);
|
||||
else msgprint("Please add Quotation lost reason");
|
||||
}
|
||||
}
|
||||
|
||||
if(!qtn_lost_dialog){
|
||||
set_qtn_lost_dialog(doc,cdt,cdn);
|
||||
}
|
||||
qtn_lost_dialog.show();
|
||||
}
|
||||
|
||||
|
||||
// GET REPORT
|
||||
// ========================================================================================
|
||||
cur_frm.cscript['Get Report'] = function(doc,cdt,cdn) {
|
||||
var callback = function(report){
|
||||
report.set_filter('Sales Order Detail', 'Quotation No.',doc.name)
|
||||
report.dt.run();
|
||||
}
|
||||
loadreport('Sales Order Detail','Itemwise Sales Details', callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
//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';}
|
||||
*/
|
||||
|
||||
//===================== Quotation to validation - either customer or lead mandatory ====================
|
||||
cur_frm.cscript.quot_to_validate = function(doc,cdt,cdn){
|
||||
|
||||
if(doc.quotation_to == 'Lead'){
|
||||
|
||||
if(!doc.lead){
|
||||
alert("Lead is mandatory.");
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
else if(doc.quotation_to == 'Customer'){
|
||||
|
||||
if(!doc.customer){
|
||||
alert("Customer is mandatory.");
|
||||
validated = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//===================validation function =================================
|
||||
|
||||
cur_frm.cscript.validate = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.quot_to_validate(doc,cdt,cdn);
|
||||
}
|
||||
363
selling/doctype/quotation/quotation.py
Normal file
363
selling/doctype/quotation/quotation.py
Normal file
@@ -0,0 +1,363 @@
|
||||
# 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, load_json
|
||||
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.tname = 'Quotation Detail'
|
||||
self.fname = 'quotation_details'
|
||||
|
||||
# Notification objects
|
||||
self.notify_obj = get_obj('Notification Control')
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
|
||||
# DOCTYPE TRIGGER FUNCTIONS
|
||||
# ==============================================================================
|
||||
|
||||
# Pull Enquiry Details
|
||||
# --------------------
|
||||
def pull_enq_details(self):
|
||||
self.doc.clear_table(self.doclist, 'quotation_details')
|
||||
get_obj('DocType Mapper', 'Enquiry-Quotation').dt_map('Enquiry', 'Quotation', self.doc.enq_no, self.doc, self.doclist, "[['Enquiry', 'Quotation'],['Enquiry Detail', 'Quotation Detail']]")
|
||||
|
||||
self.get_adj_percent()
|
||||
|
||||
return cstr(self.doc.quotation_to)
|
||||
|
||||
# Get Customer Details
|
||||
# --------------------
|
||||
#def get_customer_details(self):
|
||||
# return cstr(get_obj('Sales Common').get_customer_details(self))
|
||||
|
||||
# Get contact person details based on customer selected
|
||||
# ------------------------------------------------------
|
||||
def get_contact_details(self):
|
||||
return cstr(get_obj('Sales Common').get_contact_details(self,0))
|
||||
|
||||
# Clear Quotation Details
|
||||
# -----------------------
|
||||
def clear_quotation_details(self):
|
||||
self.doc.clear_table(self.doclist, 'quotation_details')
|
||||
|
||||
|
||||
# QUOTATION DETAILS TRIGGER FUNCTIONS
|
||||
# ================================================================================
|
||||
|
||||
# Get Item Details
|
||||
# -----------------
|
||||
def get_item_details(self, item_code):
|
||||
return get_obj('Sales Common').get_item_details(item_code, self)
|
||||
|
||||
# Re-calculates Basic Rate & amount based on Price List Selected
|
||||
# --------------------------------------------------------------
|
||||
def get_adj_percent(self, arg=''):
|
||||
get_obj('Sales Common').get_adj_percent(self)
|
||||
|
||||
|
||||
# OTHER CHARGES TRIGGER FUNCTIONS
|
||||
# ====================================================================================
|
||||
|
||||
# Get Tax rate if account type is TAX
|
||||
# -----------------------------------
|
||||
def get_rate(self,arg):
|
||||
return get_obj('Sales Common').get_rate(arg)
|
||||
|
||||
# Load Default Charges
|
||||
# ----------------------------------------------------------
|
||||
def load_default_taxes(self):
|
||||
return get_obj('Sales Common').load_default_taxes(self)
|
||||
|
||||
# Pull details from other charges master (Get Other Charges)
|
||||
# ----------------------------------------------------------
|
||||
def get_other_charges(self):
|
||||
return get_obj('Sales Common').get_other_charges(self)
|
||||
|
||||
# Get Lead Details along with its details
|
||||
# ==============================================================
|
||||
def get_lead_details1(self, name):
|
||||
details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1)
|
||||
ret = {
|
||||
'lead_name' : details and details[0]['lead_name'] or '',
|
||||
'address_display' : (details and details[0]['address_line1']
|
||||
+ (details[0]['address_line2'] and '\n' + details[0]['address_line2'] or '') + '\n'
|
||||
+ details[0]['city']
|
||||
+ (details[0]['pincode'] and ', ' + details[0]['pincode'] or '') + '\n'
|
||||
+ (details[0]['state'] and details[0]['state']+', ' or '')
|
||||
+ details[0]['country'] + '\nTel: ' + details[0]['contact_no'] + '\n' or '-'),
|
||||
'territory' : details and details[0]['territory'] or '',
|
||||
'contact_mobile' : details and details[0]['mobile_no'] or '-',
|
||||
'contact_email' : details and details[0]['email_id'] or '-'
|
||||
}
|
||||
return cstr(ret)
|
||||
|
||||
|
||||
# GET TERMS AND CONDITIONS
|
||||
# ====================================================================================
|
||||
def get_tc_details(self):
|
||||
return get_obj('Sales Common').get_tc_details(self)
|
||||
|
||||
|
||||
# VALIDATE
|
||||
# ==============================================================================================
|
||||
|
||||
# Amendment date is necessary if document is amended
|
||||
# --------------------------------------------------
|
||||
def validate_mandatory(self):
|
||||
if self.doc.amended_from and not self.doc.amendment_date:
|
||||
msgprint("Please Enter Amendment Date")
|
||||
raise Exception
|
||||
|
||||
# Fiscal Year Validation
|
||||
# ----------------------
|
||||
def validate_fiscal_year(self):
|
||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Quotation Date')
|
||||
|
||||
# Does not allow same item code to be entered twice
|
||||
# -------------------------------------------------
|
||||
def validate_for_items(self):
|
||||
check_list=[]
|
||||
chk_dupl_itm = []
|
||||
for d in getlist(self.doclist,'quotation_details'):
|
||||
ch = sql("select is_stock_item from `tabItem` where name = '%s'"%d.item_code)
|
||||
if ch and ch[0][0]=='Yes':
|
||||
if cstr(d.item_code) in check_list:
|
||||
msgprint("Item %s has been entered twice." % d.item_code)
|
||||
raise Exception
|
||||
else:
|
||||
check_list.append(cstr(d.item_code))
|
||||
|
||||
if ch and ch[0][0]=='No':
|
||||
f = [cstr(d.item_code),cstr(d.description)]
|
||||
if f in chk_dupl_itm:
|
||||
msgprint("Item %s has been entered twice." % d.item_code)
|
||||
raise Exception
|
||||
else:
|
||||
chk_dupl_itm.append(f)
|
||||
|
||||
|
||||
#do not allow sales item in maintenance quotation and service item in sales quotation
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
def validate_order_type(self):
|
||||
if self.doc.order_type == 'Maintenance':
|
||||
for d in getlist(self.doclist, 'quotation_details'):
|
||||
is_service_item = sql("select is_service_item from `tabItem` where name=%s", d.item_code)
|
||||
is_service_item = is_service_item and is_service_item[0][0] or 'No'
|
||||
|
||||
if is_service_item == 'No':
|
||||
msgprint("You can not select non service item "+d.item_code+" in Maintenance Quotation")
|
||||
raise Exception
|
||||
else:
|
||||
for d in getlist(self.doclist, 'quotation_details'):
|
||||
is_sales_item = sql("select is_sales_item from `tabItem` where name=%s", d.item_code)
|
||||
is_sales_item = is_sales_item and is_sales_item[0][0] or 'No'
|
||||
|
||||
if is_sales_item == 'No':
|
||||
msgprint("You can not select non sales item "+d.item_code+" in Sales Quotation")
|
||||
raise Exception
|
||||
|
||||
#--------------Validation For Last Contact Date-----------------
|
||||
# ====================================================================================================================
|
||||
def set_last_contact_date(self):
|
||||
#if not self.doc.contact_date_ref:
|
||||
#self.doc.contact_date_ref=self.doc.contact_date
|
||||
#self.doc.last_contact_date=self.doc.contact_date_ref
|
||||
if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:
|
||||
if getdate(self.doc.contact_date_ref) < getdate(self.doc.contact_date):
|
||||
self.doc.last_contact_date=self.doc.contact_date_ref
|
||||
else:
|
||||
msgprint("Contact Date Cannot be before Last Contact Date")
|
||||
raise Exception
|
||||
#set(self.doc, 'contact_date_ref',self.doc.contact_date)
|
||||
|
||||
|
||||
# Validate
|
||||
# --------
|
||||
def validate(self):
|
||||
self.validate_fiscal_year()
|
||||
self.validate_mandatory()
|
||||
self.set_last_contact_date()
|
||||
self.validate_order_type()
|
||||
self.validate_for_items()
|
||||
sales_com_obj = get_obj('Sales Common')
|
||||
sales_com_obj.check_active_sales_items(self)
|
||||
sales_com_obj.validate_max_discount(self,'quotation_details') #verify whether rate is not greater than max_discount
|
||||
sales_com_obj.check_conversion_rate(self)
|
||||
|
||||
# Get total in words
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
||||
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||
|
||||
def on_update(self):
|
||||
# Add to calendar
|
||||
#if self.doc.contact_date and self.doc.last_contact_date != self.doc.contact_date:
|
||||
if self.doc.contact_date and self.doc.contact_date_ref != self.doc.contact_date:
|
||||
if self.doc.contact_by:
|
||||
self.add_calendar_event()
|
||||
set(self.doc, 'contact_date_ref',self.doc.contact_date)
|
||||
|
||||
# Set Quotation Status
|
||||
set(self.doc, 'status', 'Draft')
|
||||
|
||||
# subject for follow
|
||||
self.doc.subject = '[%(status)s] To %(customer)s worth %(currency)s %(grand_total)s' % self.doc.fields
|
||||
|
||||
|
||||
# Add to Calendar
|
||||
# ====================================================================================================================
|
||||
def add_calendar_event(self):
|
||||
desc=''
|
||||
user_lst =[]
|
||||
if self.doc.customer:
|
||||
if self.doc.contact_person:
|
||||
desc = 'Contact '+cstr(self.doc.contact_person)
|
||||
else:
|
||||
desc = 'Contact customer '+cstr(self.doc.customer)
|
||||
elif self.doc.lead:
|
||||
if self.doc.lead_name:
|
||||
desc = 'Contact '+cstr(self.doc.lead_name)
|
||||
else:
|
||||
desc = 'Contact lead '+cstr(self.doc.lead)
|
||||
desc = desc+ '.By : ' + cstr(self.doc.contact_by)
|
||||
|
||||
if self.doc.to_discuss:
|
||||
desc = desc+' To Discuss : ' + cstr(self.doc.to_discuss)
|
||||
|
||||
ev = Document('Event')
|
||||
ev.description = desc
|
||||
ev.event_date = self.doc.contact_date
|
||||
ev.event_hour = '10:00'
|
||||
ev.event_type = 'Private'
|
||||
ev.ref_type = 'Enquiry'
|
||||
ev.ref_name = self.doc.name
|
||||
ev.save(1)
|
||||
|
||||
user_lst.append(self.doc.owner)
|
||||
|
||||
chk = sql("select t1.name from `tabProfile` t1, `tabSales Person` t2 where t2.email_id = t1.name and t2.name=%s",self.doc.contact_by)
|
||||
if chk:
|
||||
user_lst.append(chk[0][0])
|
||||
|
||||
for d in user_lst:
|
||||
ch = addchild(ev, 'event_individuals', 'Event User', 0)
|
||||
ch.person = d
|
||||
ch.save(1)
|
||||
|
||||
#update enquiry
|
||||
#------------------
|
||||
def update_enquiry(self, flag):
|
||||
prevdoc=''
|
||||
for d in getlist(self.doclist, 'quotation_details'):
|
||||
if d.prevdoc_docname:
|
||||
prevdoc = d.prevdoc_docname
|
||||
|
||||
if prevdoc:
|
||||
if flag == 'submit': #on submit
|
||||
sql("update `tabEnquiry` set status = 'Quotation Sent' where name = %s", prevdoc)
|
||||
elif flag == 'cancel': #on cancel
|
||||
sql("update `tabEnquiry` set status = 'Open' where name = %s", prevdoc)
|
||||
elif flag == 'order lost': #order lost
|
||||
sql("update `tabEnquiry` set status = 'Enquiry Lost' where name=%s", prevdoc)
|
||||
elif flag == 'order confirm': #order confirm
|
||||
sql("update `tabEnquiry` set status='Order Confirmed' where name=%s", prevdoc)
|
||||
|
||||
# declare as order lost
|
||||
#-------------------------
|
||||
def declare_order_lost(self,arg):
|
||||
chk = sql("select t1.name from `tabSales Order` t1, `tabSales Order Detail` t2 where t2.parent = t1.name and t1.docstatus=1 and t2.prevdoc_docname = %s",self.doc.name)
|
||||
if chk:
|
||||
msgprint("Sales Order No. "+cstr(chk[0][0])+" is submitted against this Quotation. Thus 'Order Lost' can not be declared against it.")
|
||||
raise Exception
|
||||
else:
|
||||
set(self.doc, 'status', 'Order Lost')
|
||||
set(self.doc, 'order_lost_reason', arg)
|
||||
self.update_enquiry('order lost')
|
||||
return cstr('true')
|
||||
|
||||
#check if value entered in item table
|
||||
#--------------------------------------
|
||||
def check_item_table(self):
|
||||
if not getlist(self.doclist, 'quotation_details'):
|
||||
msgprint("Please enter item details")
|
||||
raise Exception
|
||||
|
||||
# ON SUBMIT
|
||||
# =========================================================================
|
||||
def on_submit(self):
|
||||
self.check_item_table()
|
||||
if not self.doc.amended_from:
|
||||
set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been sent')
|
||||
else:
|
||||
set(self.doc, 'message', 'Quotation has been amended. New Quotation no:'+self.doc.name)
|
||||
|
||||
# Check for Approving Authority
|
||||
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self)
|
||||
|
||||
# Set Quotation Status
|
||||
set(self.doc, 'status', 'Submitted')
|
||||
|
||||
#update enquiry status
|
||||
self.update_enquiry('submit')
|
||||
|
||||
# on submit notification
|
||||
self.notify_obj.notify_contact('Quotation', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.contact_person)
|
||||
|
||||
# ON CANCEL
|
||||
# ==========================================================================
|
||||
def on_cancel(self):
|
||||
set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been cancelled')
|
||||
|
||||
#update enquiry status
|
||||
self.update_enquiry('cancel')
|
||||
|
||||
set(self.doc,'status','Cancelled')
|
||||
|
||||
|
||||
# SEND SMS
|
||||
# =============================================================================
|
||||
def send_sms(self):
|
||||
if not self.doc.customer_mobile_no:
|
||||
msgprint("Please enter customer mobile no")
|
||||
elif not self.doc.message:
|
||||
msgprint("Please enter the message you want to send")
|
||||
else:
|
||||
msgprint(get_obj("SMS Control", "SMS Control").send_sms([self.doc.contact_mobile,], self.doc.message))
|
||||
|
||||
# Print other charges
|
||||
# ===========================================================================
|
||||
def print_other_charges(self,docname):
|
||||
print_lst = []
|
||||
for d in getlist(self.doclist,'other_charges'):
|
||||
lst1 = []
|
||||
lst1.append(d.description)
|
||||
lst1.append(d.total)
|
||||
print_lst.append(lst1)
|
||||
return print_lst
|
||||
|
||||
def update_followup_details(self):
|
||||
sql("delete from `tabFollow up` where parent = '%s'"%self.doc.name)
|
||||
for d in getlist(self.doclist, 'follow_up'):
|
||||
d.save()
|
||||
1274
selling/doctype/quotation/quotation.txt
Normal file
1274
selling/doctype/quotation/quotation.txt
Normal file
File diff suppressed because it is too large
Load Diff
0
selling/doctype/quotation_detail/__init__.py
Normal file
0
selling/doctype/quotation_detail/__init__.py
Normal file
347
selling/doctype/quotation_detail/quotation_detail.txt
Normal file
347
selling/doctype/quotation_detail/quotation_detail.txt
Normal file
@@ -0,0 +1,347 @@
|
||||
# DocType, Quotation Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:18',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-02-23 11:28:36',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'QUOD/.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'is_transaction_doc': 0,
|
||||
'istable': 1,
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tray',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 26
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Quotation Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, Quotation Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Quotation Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 1,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Name',
|
||||
'oldfieldname': 'item_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 3,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 4,
|
||||
'in_filter': 0,
|
||||
'label': 'Quantity',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 5,
|
||||
'label': 'UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'reqd': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'ref_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 6,
|
||||
'label': 'Ref Rate',
|
||||
'oldfieldname': 'ref_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'adj_rate',
|
||||
'fieldtype': 'Float',
|
||||
'idx': 7,
|
||||
'label': 'Discount (%)',
|
||||
'oldfieldname': 'adj_rate',
|
||||
'oldfieldtype': 'Float',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'export_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'in_filter': 0,
|
||||
'label': 'Rate',
|
||||
'oldfieldname': 'export_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'export_amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'in_filter': 0,
|
||||
'label': 'Amount',
|
||||
'oldfieldname': 'export_amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'base_ref_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 10,
|
||||
'label': 'Ref Rate*',
|
||||
'oldfieldname': 'base_ref_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'basic_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 11,
|
||||
'in_filter': 0,
|
||||
'label': 'Basic Rate*',
|
||||
'oldfieldname': 'basic_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'search_index': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 12,
|
||||
'in_filter': 0,
|
||||
'label': 'Amount*',
|
||||
'oldfieldname': 'amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'search_index': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_group',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 13,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Group',
|
||||
'oldfieldname': 'item_group',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item Group',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'brand',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 14,
|
||||
'in_filter': 1,
|
||||
'label': 'Brand',
|
||||
'oldfieldname': 'brand',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Brand',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'page_break',
|
||||
'fieldtype': 'Check',
|
||||
'hidden': 0,
|
||||
'idx': 15,
|
||||
'label': 'Page Break',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'page_break',
|
||||
'oldfieldtype': 'Check',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_tax_rate',
|
||||
'fieldtype': 'Small Text',
|
||||
'hidden': 1,
|
||||
'idx': 16,
|
||||
'label': 'Item Tax Rate',
|
||||
'oldfieldname': 'item_tax_rate',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_docname',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 17,
|
||||
'label': 'Against Docname',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'prevdoc_docname',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 0,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_doctype',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 18,
|
||||
'label': 'Against Doctype',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'prevdoc_doctype',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 0,
|
||||
'width': '150px'
|
||||
}
|
||||
]
|
||||
0
selling/doctype/return_detail/__init__.py
Normal file
0
selling/doctype/return_detail/__init__.py
Normal file
150
selling/doctype/return_detail/return_detail.txt
Normal file
150
selling/doctype/return_detail/return_detail.txt
Normal file
@@ -0,0 +1,150 @@
|
||||
# DocType, Return Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:19',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-02-23 19:09:05',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'wasim@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 8
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Return Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, Return Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Return Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'uom',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'UOM',
|
||||
'oldfieldname': 'uom',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'UOM',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 4,
|
||||
'label': 'Rate',
|
||||
'oldfieldname': 'rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 5,
|
||||
'label': 'Qty',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'returned_qty',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 6,
|
||||
'label': 'Returned Qty',
|
||||
'oldfieldname': 'returned_qty',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'serial_no',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 7,
|
||||
'label': 'Serial No',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'batch_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 8,
|
||||
'label': 'Batch No',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'detail_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 9,
|
||||
'label': 'Detail Name',
|
||||
'oldfieldname': 'detail_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
0
selling/doctype/sales_common/__init__.py
Normal file
0
selling/doctype/sales_common/__init__.py
Normal file
479
selling/doctype/sales_common/sales_common.js
Normal file
479
selling/doctype/sales_common/sales_common.js
Normal file
@@ -0,0 +1,479 @@
|
||||
// Preset
|
||||
// ------
|
||||
// cur_frm.cscript.tname - Details table name
|
||||
// cur_frm.cscript.fname - Details fieldname
|
||||
// cur_frm.cscript.other_fname - Other Charges fieldname
|
||||
// cur_frm.cscript.sales_team_fname - Sales Team fieldname
|
||||
|
||||
|
||||
// ============== Load Default Taxes ===================
|
||||
cur_frm.cscript.load_taxes = function(doc, cdt, cdn) {
|
||||
// run if this is not executed from dt_map...
|
||||
if(doc.customer) return;
|
||||
$c_obj([doc],'load_default_taxes','',function(r,rt){
|
||||
refresh_field('other_charges');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// -----------------
|
||||
// Shipping Address
|
||||
// -----------------
|
||||
//cur_frm.add_fetch('ship_det_no', 'shipping_address', 'shipping_address');
|
||||
//cur_frm.add_fetch('ship_det_no', 'ship_to', 'ship_to');
|
||||
cur_frm.add_fetch('company', 'default_currency', 'currency');
|
||||
|
||||
|
||||
// ============== Customer and its primary contact Details ============================
|
||||
cur_frm.cscript.customer = function(doc, cdt, cdn) {
|
||||
if(doc.customer){
|
||||
if (!doc.company) {
|
||||
msgprint("Please select company to proceed");
|
||||
doc.customer = '';
|
||||
refresh_field('customer');
|
||||
} else {
|
||||
var callback = function(r, rt){
|
||||
cur_frm.refresh();
|
||||
}
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_customer_details', '',callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//====================opens territory tree page ==================
|
||||
cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
|
||||
var call_back = function(){
|
||||
|
||||
var sb_obj = new SalesBrowser();
|
||||
sb_obj.set_val('Territory');
|
||||
}
|
||||
loadpage('Sales Browser',call_back);
|
||||
}
|
||||
|
||||
//====================opens customer group tree page ==================
|
||||
cur_frm.cscript.CGHelp = function(doc,dt,dn){
|
||||
var call_back = function(){
|
||||
var sb_obj = new SalesBrowser();
|
||||
sb_obj.set_val('Customer Group');
|
||||
}
|
||||
loadpage('Sales Browser',call_back);
|
||||
}
|
||||
|
||||
/*
|
||||
// ============= Customer's Contact Person Details =====================================
|
||||
cur_frm.cscript.contact_person = function(doc, cdt, cdn) {
|
||||
var callback = function(){
|
||||
refresh_many(['contact_no','email_id','customer_mobile_no','customer_address']);
|
||||
}
|
||||
get_server_fields('get_contact_details','','',doc, cdt, cdn, 1, callback);
|
||||
}
|
||||
*/
|
||||
|
||||
// TRIGGERS FOR CALCULATIONS
|
||||
// =====================================================================================================
|
||||
|
||||
// ********************* CURRENCY ******************************
|
||||
cur_frm.cscript.currency = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.price_list_name(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
// ******************** PRICE LIST ******************************
|
||||
cur_frm.cscript.price_list_name = function(doc, cdt, cdn) {
|
||||
var fname = cur_frm.cscript.fname;
|
||||
if(doc.price_list_name && doc.currency) {
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_adj_percent', '',
|
||||
function(r, rt) {
|
||||
refresh_field(fname);
|
||||
var doc = locals[cdt][cdn];
|
||||
cur_frm.cscript.recalc(doc,3); //this is to re-calculate BASIC RATE and AMOUNT on basis of changed REF RATE
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ******************* CONVERSION RATE ***************************
|
||||
cur_frm.cscript.conversion_rate = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 3);/*cur_frm.cscript.price_list_name(doc, cdt, cdn);*/ }
|
||||
|
||||
// ******************** ITEM CODE ********************************
|
||||
cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
|
||||
if (doc.order_type == 'Maintenance')
|
||||
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
|
||||
else
|
||||
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") 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) {
|
||||
if (!doc.company) {
|
||||
msgprint("Please select company to proceed");
|
||||
d.item_code = '';
|
||||
refresh_field('item_code', d.name, fname);
|
||||
} else {
|
||||
var callback = function(r, rt){
|
||||
cur_frm.cscript.recalc(doc, 1);
|
||||
}
|
||||
get_server_fields('get_item_details',d.item_code, fname,doc,cdt,cdn,1,callback);
|
||||
}
|
||||
}
|
||||
if(cur_frm.cscript.custom_item_code){
|
||||
cur_frm.cscript.custom_item_code(doc, cdt, cdn);
|
||||
}
|
||||
}
|
||||
|
||||
// *********************** QUANTITY ***************************
|
||||
cur_frm.cscript.qty = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 1); }
|
||||
|
||||
// ************************ DISCOUNT (%) ***********************
|
||||
cur_frm.cscript.adj_rate = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 1); }
|
||||
|
||||
// ************************ REF RATE ****************************
|
||||
cur_frm.cscript.ref_rate = function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
set_multiple(cur_frm.cscript.tname, d.name, {'export_rate': flt(d.ref_rate) * (100 - flt(d.adj_rate)) / 100}, cur_frm.cscript.fname);
|
||||
cur_frm.cscript.recalc(doc, 3);
|
||||
}
|
||||
|
||||
// *********************** BASIC RATE **************************
|
||||
cur_frm.cscript.basic_rate = function(doc, cdt, cdn) {
|
||||
var fname = cur_frm.cscript.fname;
|
||||
var d = locals[cdt][cdn];;
|
||||
if(!d.qty)
|
||||
{
|
||||
d.qty = 1;
|
||||
refresh_field('qty', d.name, fname);
|
||||
|
||||
}
|
||||
cur_frm.cscript.recalc(doc, 2);
|
||||
}
|
||||
|
||||
// ************************ EXPORT RATE *************************
|
||||
cur_frm.cscript.export_rate = function(doc,cdt,cdn) { cur_frm.cscript.recalc(doc, 3);}
|
||||
|
||||
// ************* GET OTHER CHARGES BASED ON COMPANY *************
|
||||
cur_frm.fields_dict.charge.get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.docstatus != 2 AND `tabOther Charges`.%(key)s LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50';
|
||||
}
|
||||
|
||||
// ********************* Get Charges ****************************
|
||||
cur_frm.cscript['Get Charges'] = function(doc, cdt, cdn) {
|
||||
$c_obj(make_doclist(doc.doctype,doc.name),'get_other_charges','', function(r, rt) { cur_frm.cscript['Calculate Charges'](doc, cdt, cdn);});
|
||||
}
|
||||
|
||||
|
||||
// CALCULATION OF TOTAL AMOUNTS
|
||||
// ========================================================================================================
|
||||
cur_frm.cscript.recalc = function(doc, n) {
|
||||
if(!n)n=0;
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
var tname = cur_frm.cscript.tname;
|
||||
var fname = cur_frm.cscript.fname;
|
||||
var sales_team = cur_frm.cscript.sales_team_fname;
|
||||
var other_fname = cur_frm.cscript.other_fname;
|
||||
|
||||
if(!flt(doc.conversion_rate)) { doc.conversion_rate = 1; refresh_field('conversion_rate'); }
|
||||
|
||||
if(n > 0) cur_frm.cscript.update_fname_table(doc , tname , fname , n); // updates all values in table (i.e. amount, export amount, net total etc.)
|
||||
|
||||
if(flt(doc.net_total) > 0) {
|
||||
var cl = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
|
||||
for(var i = 0; i<cl.length; i++){
|
||||
cl[i].total_tax_amount = 0;
|
||||
cl[i].total_amount = 0;
|
||||
cl[i].tax_amount = 0; // this is done to calculate other charges
|
||||
cl[i].total = 0;
|
||||
cl[i].item_wise_tax_detail = "";
|
||||
if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type) && !cl[i].row_id){
|
||||
alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
cur_frm.cscript.calc_other_charges(doc , tname , fname , other_fname); // calculate other charges
|
||||
}
|
||||
cur_frm.cscript.calc_doc_values(doc, cdt, cdn, tname, fname, other_fname); // calculates total amounts
|
||||
|
||||
// ******************* calculate allocated amount of sales person ************************
|
||||
cl = getchildren('Sales Team', doc.name, sales_team);
|
||||
for(var i=0;i<cl.length;i++) {
|
||||
if (cl[i].allocated_percentage) {
|
||||
cl[i].allocated_amount = flt(flt(doc.net_total)*flt(cl[i].allocated_percentage)/100);
|
||||
refresh_field('allocated_amount', cl[i].name, sales_team);
|
||||
}
|
||||
}
|
||||
doc.in_words = '';
|
||||
doc.in_words_export = '';
|
||||
refresh_many(['total_discount_rate','total_discount','net_total','total_commission','grand_total','rounded_total','grand_total_export','rounded_total_export','in_words','in_words_export','other_charges','other_charges_total']);
|
||||
if(cur_frm.cscript.custom_recalc)cur_frm.cscript.custom_recalc(doc);
|
||||
}
|
||||
|
||||
// ******* Calculation of total amounts of document (item amount + other charges)****************
|
||||
cur_frm.cscript.calc_doc_values = function(doc, cdt, cdn, tname, fname, other_fname) {
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
var net_total = 0; var other_charges_total = 0;
|
||||
var cl = getchildren(tname, doc.name, fname);
|
||||
for(var i = 0; i<cl.length; i++){
|
||||
net_total += flt(cl[i].amount);
|
||||
}
|
||||
var d = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
|
||||
for(var j = 0; j<d.length; j++){
|
||||
other_charges_total += flt(d[j].amount);
|
||||
}
|
||||
doc.net_total = flt(net_total);
|
||||
doc.other_charges_total = flt(other_charges_total);
|
||||
doc.grand_total = flt(flt(net_total) + flt(other_charges_total));
|
||||
doc.rounded_total = Math.round(doc.grand_total);
|
||||
doc.grand_total_export = flt(flt(doc.grand_total) / flt(doc.conversion_rate));
|
||||
doc.rounded_total_export = Math.round(doc.grand_total_export);
|
||||
doc.total_commission = flt(flt(net_total) * flt(doc.commission_rate) / 100);
|
||||
}
|
||||
|
||||
// ******************************* OTHER CHARGES *************************************
|
||||
cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname) {
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
// make display area
|
||||
// ------------------
|
||||
|
||||
cur_frm.fields_dict['Other Charges Calculation'].disp_area.innerHTML = '<b style="padding: 8px 0px;">Calculation Details for Other Charges:</b>';
|
||||
var cl = getchildren(tname, doc.name, fname);
|
||||
var tax = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
|
||||
// make display table
|
||||
// ------------------
|
||||
var otc = make_table(cur_frm.fields_dict['Other Charges Calculation'].disp_area, cl.length + 1, tax.length + 1, '90%',[],{border:'1px solid #AAA',padding:'2px'});
|
||||
$y(otc,{marginTop:'8px'});
|
||||
|
||||
var tax_desc = {}; var tax_desc_rates = []; var net_total = 0;
|
||||
|
||||
|
||||
for(var i=0;i<cl.length;i++) {
|
||||
net_total += flt(flt(cl[i].qty) * flt(cl[i].basic_rate));
|
||||
var prev_total = flt(cl[i].amount);
|
||||
if(cl[i].item_tax_rate)
|
||||
var check_tax = eval('var a='+cl[i].item_tax_rate+';a'); //to get in dictionary
|
||||
|
||||
// Add Item Code in new Row
|
||||
//--------------------------
|
||||
$td(otc,i+1,0).innerHTML = cl[i].item_code ? cl[i].item_code : cl[i].description;
|
||||
|
||||
var tax = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
|
||||
var total = net_total;
|
||||
|
||||
for(var t=0;t<tax.length;t++){
|
||||
|
||||
var account = tax[t].account_head;
|
||||
$td(otc,0,t+1).innerHTML = account?account:'';
|
||||
//Check For Rate
|
||||
if(cl[i].item_tax_rate && check_tax[account]!=null) {rate = flt(check_tax[account]);}
|
||||
else // if particular item doesn't have particular rate it will take other charges rate
|
||||
rate = flt(tax[t].rate);
|
||||
//Check For Rate and get tax amount
|
||||
var tax_amount = cur_frm.cscript.check_charge_type_and_get_tax_amount(doc,tax,t, cl[i], rate);
|
||||
|
||||
//enter item_wise_tax_detail i.e. tax rate on each item
|
||||
|
||||
item_wise_tax_detail = cur_frm.cscript.get_item_wise_tax_detail( doc, rate, cl, i, tax, t);
|
||||
|
||||
// this is calculation part for all types
|
||||
if(tax[t].charge_type != "Actual") tax[t].item_wise_tax_detail += item_wise_tax_detail;
|
||||
tax[t].total_amount = flt(tax_amount.toFixed(2)); //stores actual tax amount in virtual field
|
||||
tax[t].total_tax_amount = flt(prev_total.toFixed(2)); //stores total amount in virtual field
|
||||
tax[t].tax_amount += flt(tax_amount.toFixed(2));
|
||||
var total_amount = flt(tax[t].tax_amount);
|
||||
total_tax_amount = flt(tax[t].total_tax_amount) + flt(total_amount);
|
||||
set_multiple('RV Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt(total)+flt(tax[t].tax_amount)/*_tax_amount)*/}, other_fname);
|
||||
prev_total += flt(tax[t].total_amount); // for previous row total
|
||||
total += flt(tax[t].tax_amount); // for adding total to previous amount
|
||||
|
||||
if(tax[t].charge_type == 'Actual')
|
||||
$td(otc,i+1,t+1).innerHTML = fmt_money(tax[t].total_amount);
|
||||
else
|
||||
$td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
cur_frm.cscript.check_charge_type_and_get_tax_amount = function( doc, tax, t, cl, rate, print_amt) {
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
if (! print_amt) print_amt = 0;
|
||||
var tax_amount = 0;
|
||||
if(tax[t].charge_type == 'Actual') {
|
||||
var value = flt(tax[t].rate) / flt(doc.net_total); // this give the ratio in which all items are divided
|
||||
return tax_amount = flt(value) * flt(cl.amount);
|
||||
}
|
||||
else if(tax[t].charge_type == 'On Net Total') {
|
||||
if (flt(print_amt) == 1) {
|
||||
doc.excise_rate = flt(rate);
|
||||
doc.total_excise_rate += flt(rate);
|
||||
refresh_field('excise_rate');
|
||||
refresh_field('total_excise_rate');
|
||||
return
|
||||
}
|
||||
return tax_amount = (flt(rate) * flt(cl.amount) / 100);
|
||||
}
|
||||
else if(tax[t].charge_type == 'On Previous Row Amount'){
|
||||
if(flt(print_amt) == 1) {
|
||||
doc.total_excise_rate += flt(flt(doc.excise_rate) * 0.01 * flt(rate));
|
||||
refresh_field('total_excise_rate');
|
||||
return
|
||||
}
|
||||
var row_no = (tax[t].row_id).toString();
|
||||
var row = (row_no).split("+"); // splits the values and stores in an array
|
||||
for(var r = 0;r<row.length;r++){
|
||||
var id = cint(row[r].replace(/^\s+|\s+$/g,""));
|
||||
tax_amount += (flt(rate) * flt(tax[id-1].total_amount) / 100);
|
||||
}
|
||||
var row_id = row_no.indexOf("/");
|
||||
if(row_id != -1) {
|
||||
rate = '';
|
||||
var row = (row_no).split("/"); // splits the values and stores in an array
|
||||
if(row.length>2) alert("You cannot enter more than 2 nos. for division");
|
||||
var id1 = cint(row[0].replace(/^\s+|\s+$/g,""));
|
||||
var id2 = cint(row[1].replace(/^\s+|\s+$/g,""));
|
||||
tax_amount = flt(tax[id1-1].total_amount) / flt(tax[id2-1].total_amount);
|
||||
}
|
||||
return tax_amount
|
||||
}
|
||||
else if(tax[t].charge_type == 'On Previous Row Total') {
|
||||
if(flt(print_amt) == 1) {
|
||||
doc.sales_tax_rate += flt(rate);
|
||||
refresh_field('sales_tax_rate');
|
||||
return
|
||||
}
|
||||
var row = cint(tax[t].row_id);
|
||||
return tax_amount = flt(rate) * (flt(tax[row-1].total_tax_amount)+flt(tax[row-1].total_amount)) / 100;
|
||||
}
|
||||
}
|
||||
|
||||
// ********************** Update values in table ******************************
|
||||
cur_frm.cscript.update_fname_table = function(doc , tname , fname , n) {
|
||||
doc = locals[doc.doctype][doc.name]
|
||||
var net_total = 0
|
||||
var cl = getchildren(tname, doc.name, fname);
|
||||
for(var i=0;i<cl.length;i++) {
|
||||
if(n == 1){
|
||||
if(flt(cl[i].ref_rate) > 0)
|
||||
set_multiple(tname, cl[i].name, {'export_rate': flt(flt(cl[i].ref_rate) * (100 - flt(cl[i].adj_rate)) / 100)}, fname);
|
||||
set_multiple(tname, cl[i].name, {'export_amount': flt(flt(cl[i].qty) * flt(cl[i].export_rate)), 'basic_rate': flt(flt(cl[i].export_rate) * flt(doc.conversion_rate)), 'amount': flt((flt(cl[i].export_rate) * flt(doc.conversion_rate)) * flt(cl[i].qty)) }, fname);
|
||||
}
|
||||
else if(n == 2){
|
||||
if(flt(cl[i].ref_rate) > 0)
|
||||
set_multiple(tname, cl[i].name, {'adj_rate': 100 - flt(flt(cl[i].basic_rate) * 100 / (flt(cl[i].ref_rate) * flt(doc.conversion_rate)))}, fname);
|
||||
set_multiple(tname, cl[i].name, {'amount': flt(flt(cl[i].qty) * flt(cl[i].basic_rate)), 'export_rate': flt(flt(cl[i].basic_rate) / flt(doc.conversion_rate)), 'export_amount': flt((flt(cl[i].basic_rate) / flt(doc.conversion_rate)) * flt(cl[i].qty)) }, fname);
|
||||
}
|
||||
else if(n == 3){
|
||||
set_multiple(tname, cl[i].name, {'basic_rate': flt(flt(cl[i].export_rate) * flt(doc.conversion_rate))}, fname);
|
||||
set_multiple(tname, cl[i].name, {'amount' : flt(flt(cl[i].basic_rate) * flt(cl[i].qty)), 'export_amount': flt(flt(cl[i].export_rate) * flt(cl[i].qty))}, fname);
|
||||
if(cl[i].ref_rate > 0)
|
||||
set_multiple(tname, cl[i].name, {'adj_rate': 100 - flt(flt(cl[i].export_rate) * 100 / flt(cl[i].ref_rate)), 'base_ref_rate': flt(flt(cl[i].ref_rate) * flt(doc.conversion_rate)) }, fname);
|
||||
}
|
||||
net_total += flt(flt(cl[i].qty) * flt(cl[i].basic_rate));
|
||||
}
|
||||
doc.net_total = net_total;
|
||||
refresh_field('net_total');
|
||||
}
|
||||
|
||||
cur_frm.cscript.get_item_wise_tax_detail = function( doc, rate, cl, i, tax, t) {
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
var detail = '';
|
||||
detail = cl[i].item_code + " : " + cstr(rate) + NEWLINE;
|
||||
return detail;
|
||||
}
|
||||
|
||||
// **************** RE-CALCULATE VALUES ***************************
|
||||
|
||||
cur_frm.cscript['Re-Calculate Values'] = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript['Calculate Charges'](doc,cdt,cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript['Calculate Charges'] = function(doc, cdt, cdn) {
|
||||
var other_fname = cur_frm.cscript.other_fname;
|
||||
|
||||
var cl = getchildren('RV Tax Detail', doc.name, other_fname, doc.doctype);
|
||||
for(var i = 0; i<cl.length; i++){
|
||||
cl[i].total_tax_amount = 0;
|
||||
cl[i].total_amount = 0;
|
||||
cl[i].tax_amount = 0; // this is done to calculate other charges
|
||||
cl[i].total = 0;
|
||||
if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type) && !cl[i].row_id){
|
||||
alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
cur_frm.cscript.recalc(doc, 1);
|
||||
}
|
||||
|
||||
// Get Sales Partner Commission
|
||||
// =================================================================================
|
||||
cur_frm.cscript.sales_partner = function(doc, cdt, cdn){
|
||||
if(doc.sales_partner){
|
||||
|
||||
get_server_fields('get_comm_rate', doc.sales_partner, '', doc, cdt, cdn, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// *******Commission Rate Trigger (calculates total commission amount)*********
|
||||
cur_frm.cscript.commission_rate = function(doc, cdt, cdn) {
|
||||
if(doc.commission_rate > 100){
|
||||
alert("Commision rate cannot be greater than 100.");
|
||||
doc.total_commission = 0;
|
||||
doc.commission_rate = 0;
|
||||
}
|
||||
else
|
||||
doc.total_commission = doc.net_total * doc.commission_rate / 100;
|
||||
refresh_many(['total_commission','commission_rate']);
|
||||
|
||||
}
|
||||
|
||||
// *******Total Commission Trigger (calculates commission rate)*********
|
||||
cur_frm.cscript.total_commission = function(doc, cdt, cdn) {
|
||||
if(doc.net_total){
|
||||
if(doc.net_total < doc.total_commission){
|
||||
alert("Total commission cannot be greater than net total.");
|
||||
doc.total_commission = 0;
|
||||
doc.commission_rate = 0;
|
||||
}
|
||||
else
|
||||
doc.commission_rate = doc.total_commission * 100 / doc.net_total;
|
||||
refresh_many(['total_commission','commission_rate']);
|
||||
}
|
||||
}
|
||||
// Sales Person Allocated % trigger
|
||||
// ==============================================================================
|
||||
cur_frm.cscript.allocated_percentage = function(doc, cdt, cdn) {
|
||||
var fname = cur_frm.cscript.sales_team_fname;
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.allocated_percentage) {
|
||||
d.allocated_amount = flt(flt(doc.net_total)*flt(d.allocated_percentage)/100);
|
||||
refresh_field('allocated_amount', d.name, fname);
|
||||
}
|
||||
}
|
||||
|
||||
// Client Side Validation
|
||||
// =================================================================================
|
||||
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.validate_items(doc);
|
||||
var cl = getchildren('Other Charges', doc.name, 'other_charges');
|
||||
for(var i =0;i<cl.length;i++) {
|
||||
if(!cl[i].amount) {
|
||||
alert("Please Enter Amount in Row no. "+cl[i].idx+" in Other Charges table");
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
cur_frm.cscript['Calculate Charges'] (doc, cdt, cdn);
|
||||
|
||||
if (cur_frm.cscript.calc_adjustment_amount) cur_frm.cscript.calc_adjustment_amount(doc);
|
||||
}
|
||||
|
||||
|
||||
// ************** Atleast one item in document ****************
|
||||
cur_frm.cscript.validate_items = function(doc) {
|
||||
var cl = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
||||
if(!cl.length){
|
||||
alert("Please enter Items for " + doc.doctype);
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
|
||||
741
selling/doctype/sales_common/sales_common.py
Normal file
741
selling/doctype/sales_common/sales_common.py
Normal file
@@ -0,0 +1,741 @@
|
||||
# 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
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d,dl
|
||||
|
||||
self.doctype_dict = {
|
||||
'Sales Order' : 'Sales Order Detail',
|
||||
'Delivery Note' : 'Delivery Note Detail',
|
||||
'Receivable Voucher':'RV Detail',
|
||||
'Installation Note' : 'Installed Item Details'
|
||||
}
|
||||
|
||||
self.ref_doctype_dict= {}
|
||||
|
||||
self.next_dt_detail = {
|
||||
'delivered_qty' : 'Delivery Note Detail',
|
||||
'billed_qty' : 'RV Detail',
|
||||
'installed_qty' : 'Installed Item Details'}
|
||||
|
||||
self.msg = []
|
||||
|
||||
|
||||
# Get Sales Person Details
|
||||
# ==========================
|
||||
def get_sales_person_details(self, obj):
|
||||
if obj.doc.doctype != 'Quotation':
|
||||
obj.doc.clear_table(obj.doclist,'sales_team')
|
||||
idx = 0
|
||||
for d in sql("select sales_person, allocated_percentage, allocated_amount, incentives from `tabSales Team` where parent = '%s'" % obj.doc.customer):
|
||||
ch = addchild(obj.doc, 'sales_team', 'Sales Team', 1, obj.doclist)
|
||||
ch.sales_person = d and cstr(d[0]) or ''
|
||||
ch.allocated_percentage = d and flt(d[1]) or 0
|
||||
ch.allocated_amount = d and flt(d[2]) or 0
|
||||
ch.incentives = d and flt(d[3]) or 0
|
||||
ch.idx = idx
|
||||
idx += 1
|
||||
|
||||
|
||||
# Get customer's contact person details
|
||||
# ==============================================================
|
||||
def get_contact_details(self, obj = '', primary = 0):
|
||||
cond = " and contact_name = '"+cstr(obj.doc.contact_person)+"'"
|
||||
if primary: cond = " and is_primary_contact = 'Yes'"
|
||||
contact = sql("select contact_name, contact_no, email_id, contact_address from `tabContact` where customer = '%s' and docstatus != 2 %s" %(obj.doc.customer, cond), as_dict = 1)
|
||||
if not contact:
|
||||
return
|
||||
c = contact[0]
|
||||
obj.doc.contact_person = c['contact_name'] or ''
|
||||
obj.doc.contact_no = c['contact_no'] or ''
|
||||
obj.doc.email_id = c['email_id'] or ''
|
||||
obj.doc.customer_mobile_no = c['contact_no'] or ''
|
||||
if c['contact_address']:
|
||||
obj.doc.customer_address = c['contact_address']
|
||||
|
||||
|
||||
# Get customer's primary shipping details
|
||||
# ==============================================================
|
||||
def get_shipping_details(self, obj = ''):
|
||||
det = sql("select name, ship_to, shipping_address from `tabShipping Address` where customer = '%s' and docstatus != 2 and ifnull(is_primary_address, 'Yes') = 'Yes'" %(obj.doc.customer), as_dict = 1)
|
||||
obj.doc.ship_det_no = det and det[0]['name'] or ''
|
||||
obj.doc.ship_to = det and det[0]['ship_to'] or ''
|
||||
obj.doc.shipping_address = det and det[0]['shipping_address'] or ''
|
||||
|
||||
|
||||
# get invoice details
|
||||
# ====================
|
||||
def get_invoice_details(self, obj = ''):
|
||||
if obj.doc.company:
|
||||
acc_head = sql("select name from `tabAccount` where name = '%s' and docstatus != 2" % (cstr(obj.doc.customer) + " - " + get_value('Company', obj.doc.company, 'abbr')))
|
||||
obj.doc.debit_to = acc_head and acc_head[0][0] or ''
|
||||
|
||||
|
||||
# Get Customer Details along with its primary contact details
|
||||
# ==============================================================
|
||||
def get_customer_details(self, obj = '', inv_det_reqd = 1):
|
||||
details = sql("select customer_name,address, territory, customer_group, default_sales_partner, default_commission_rate from `tabCustomer` where name = '%s' and docstatus != 2" %(obj.doc.customer), as_dict = 1)
|
||||
obj.doc.customer_name = details and details[0]['customer_name'] or ''
|
||||
obj.doc.customer_address = details and details[0]['address'] or ''
|
||||
obj.doc.territory = details and details[0]['territory'] or ''
|
||||
obj.doc.customer_group = details and details[0]['customer_group'] or ''
|
||||
obj.doc.sales_partner = details and details[0]['default_sales_partner'] or ''
|
||||
obj.doc.commission_rate = details and flt(details[0]['default_commission_rate']) or ''
|
||||
if obj.doc.doctype != 'Receivable Voucher':
|
||||
obj.doc.delivery_address = details and details[0]['address'] or ''
|
||||
self.get_contact_details(obj,primary = 1) # get primary contact details
|
||||
self.get_sales_person_details(obj) # get default sales person details
|
||||
|
||||
if obj.doc.doctype == 'Receivable Voucher' and inv_det_reqd:
|
||||
self.get_invoice_details(obj) # get invoice details
|
||||
|
||||
|
||||
# Get Item Details
|
||||
# ===============================================================
|
||||
def get_item_details(self, item_code, obj):
|
||||
if not obj.doc.price_list_name:
|
||||
msgprint("Please Select Price List before selecting Items")
|
||||
raise Exception
|
||||
item = sql("select description, item_name, brand, item_group, stock_uom, default_warehouse, default_income_account, default_sales_cost_center, description_html from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life > now() or end_of_life = '0000-00-00') and (is_sales_item = 'Yes' or is_service_item = 'Yes')" %(item_code), as_dict=1)
|
||||
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
|
||||
t = {}
|
||||
for x in tax: t[x[0]] = flt(x[1])
|
||||
ret = {
|
||||
'description' : item and item[0]['description_html'] or item[0]['description'],
|
||||
'item_group' : item and item[0]['item_group'] or '',
|
||||
'item_name' : item and item[0]['item_name'] or '',
|
||||
'brand' : item and item[0]['brand'] or '',
|
||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||
'reserved_warehouse' : item and item[0]['default_warehouse'] or '',
|
||||
'warehouse' : item and item[0]['default_warehouse'] or '',
|
||||
'income_account' : item and item[0]['default_income_account'] or '',
|
||||
'cost_center' : item and item[0]['default_sales_cost_center'] or '',
|
||||
'qty' : 1.00, # this is done coz if item once fetched is fetched again thn its qty shld be reset to 1
|
||||
'adj_rate' : 0,
|
||||
'amount' : 0,
|
||||
'export_amount' : 0,
|
||||
'item_tax_rate' : str(t),
|
||||
'batch_no' : ''
|
||||
}
|
||||
if(obj.doc.price_list_name and item): #this is done to fetch the changed BASIC RATE and REF RATE based on PRICE LIST
|
||||
ref_rate = self.get_ref_rate(item_code, obj.doc.price_list_name, obj.doc.currency)
|
||||
ret['ref_rate'] = flt(ref_rate)
|
||||
ret['export_rate'] = flt(ref_rate)
|
||||
ret['base_ref_rate'] = flt(ref_rate) * flt(obj.doc.conversion_rate)
|
||||
ret['basic_rate'] = flt(ref_rate) * flt(obj.doc.conversion_rate)
|
||||
|
||||
if obj.doc.doctype == 'Receivable Voucher':
|
||||
return ret
|
||||
return str(ret)
|
||||
|
||||
# ***************** Get Ref rate as entered in Item Master ********************
|
||||
def get_ref_rate(self, item_code, price_list_name, currency):
|
||||
ref_rate = sql("select ref_rate from `tabRef Rate Detail` where parent = %s and price_list_name = %s and ref_currency = %s", (item_code, price_list_name, currency))
|
||||
return ref_rate and ref_rate[0][0] or 0
|
||||
|
||||
|
||||
# ****** Re-calculates Basic Rate & amount based on Price List Selected ******
|
||||
def get_adj_percent(self, obj):
|
||||
for d in getlist(obj.doclist, obj.fname):
|
||||
ref_rate = self.get_ref_rate(d.item_code,obj.doc.price_list_name,obj.doc.currency)
|
||||
d.adj_rate = 0
|
||||
d.ref_rate = flt(ref_rate)
|
||||
d.basic_rate = flt(ref_rate) * flt(obj.doc.conversion_rate)
|
||||
d.base_ref_rate = flt(ref_rate) * flt(obj.doc.conversion_rate)
|
||||
d.export_rate = flt(ref_rate)
|
||||
|
||||
|
||||
# Load Default Taxes
|
||||
# ====================
|
||||
def load_default_taxes(self, obj):
|
||||
self.get_other_charges(obj,1)
|
||||
|
||||
|
||||
# Get other charges from Master
|
||||
# =================================================================================
|
||||
def get_other_charges(self,obj,default = 0):
|
||||
obj.doc.clear_table(obj.doclist,'other_charges')
|
||||
if not getlist(obj.doclist, 'other_charges'):
|
||||
if default: add_cond = 'ifnull(t2.is_default,0) = 1'
|
||||
else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
|
||||
idx = 0
|
||||
other_charge = sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
|
||||
for other in other_charge:
|
||||
d = addchild(obj.doc, 'other_charges', 'RV Tax Detail', 1, obj.doclist)
|
||||
d.charge_type = other['charge_type']
|
||||
d.row_id = other['row_id']
|
||||
d.description = other['description']
|
||||
d.account_head = other['account_head']
|
||||
d.rate = flt(other['rate'])
|
||||
d.tax_amount = flt(other['tax_amount'])
|
||||
d.idx = idx
|
||||
idx += 1
|
||||
|
||||
|
||||
# Get TERMS AND CONDITIONS
|
||||
# =======================================================================================
|
||||
def get_tc_details(self,obj):
|
||||
r = sql("select terms from `tabTerm` where name = %s", obj.doc.tc_name)
|
||||
if r: obj.doc.terms = r[0][0]
|
||||
|
||||
#---------------------------------------- Get Tax Details -------------------------------#
|
||||
def get_tax_details(self, item_code, obj):
|
||||
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
|
||||
t = {}
|
||||
for x in tax: t[x[0]] = flt(x[1])
|
||||
ret = {
|
||||
'item_tax_rate' : tax and str(t) or ''
|
||||
}
|
||||
return str(ret)
|
||||
|
||||
# Get Serial No Details
|
||||
# ==========================================================================
|
||||
def get_serial_details(self, serial_no, obj):
|
||||
item = sql("select item_code, make, label,brand, description from `tabSerial No` where name = '%s' and docstatus != 2" %(serial_no), as_dict=1)
|
||||
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item[0]['item_code'])
|
||||
t = {}
|
||||
for x in tax: t[x[0]] = flt(x[1])
|
||||
ret = {
|
||||
'item_code' : item and item[0]['item_code'] or '',
|
||||
'make' : item and item[0]['make'] or '',
|
||||
'label' : item and item[0]['label'] or '',
|
||||
'brand' : item and item[0]['brand'] or '',
|
||||
'description' : item and item[0]['description'] or '',
|
||||
'item_tax_rate' : str(t)
|
||||
}
|
||||
return str(ret)
|
||||
|
||||
# Get Commission rate
|
||||
# =======================================================================
|
||||
def get_comm_rate(self, sales_partner, obj):
|
||||
|
||||
comm_rate = sql("select commission_rate from `tabSales Partner` where name = '%s' and docstatus != 2" %(sales_partner), as_dict=1)
|
||||
if comm_rate:
|
||||
total_comm = flt(comm_rate[0]['commission_rate']) * flt(obj.doc.net_total) / 100
|
||||
ret = {
|
||||
'commission_rate' : comm_rate and flt(comm_rate[0]['commission_rate']) or 0,
|
||||
'total_commission' : flt(total_comm)
|
||||
}
|
||||
return str(ret)
|
||||
else:
|
||||
msgprint("Business Associate : %s does not exist in the system." % (sales_partner))
|
||||
raise Exception
|
||||
|
||||
|
||||
# To verify whether rate entered in details table does not exceed max discount %
|
||||
# =======================================================================================
|
||||
def validate_max_discount(self,obj, detail_table):
|
||||
for d in getlist(obj.doclist, detail_table):
|
||||
discount = sql("select max_discount from tabItem where name = '%s'" %(d.item_code),as_dict = 1)
|
||||
if discount and discount[0]['max_discount'] and (flt(d.adj_rate)>flt(discount[0]['max_discount'])):
|
||||
msgprint("You cannot give more than " + cstr(discount[0]['max_discount']) + " % discount on Item Code : "+cstr(d.item_code))
|
||||
raise Exception
|
||||
|
||||
|
||||
# Get sum of allocated % of sales person (it should be 100%)
|
||||
# ========================================================================
|
||||
# it indicates % contribution of sales person in sales
|
||||
def get_allocated_sum(self,obj):
|
||||
sum = 0
|
||||
for d in getlist(obj.doclist,'sales_team'):
|
||||
sum += flt(d.allocated_percentage)
|
||||
if (flt(sum) != 100) and getlist(obj.doclist,'sales_team'):
|
||||
msgprint("Total Allocated % of Sales Persons should be 100%")
|
||||
raise Exception
|
||||
|
||||
# Check Conversion Rate (i.e. it will not allow conversion rate to be 1 for Currency other than default currency set in Global Defaults)
|
||||
# ===========================================================================
|
||||
def check_conversion_rate(self, obj):
|
||||
default_currency = get_obj('Manage Account').doc.default_currency
|
||||
company_currency = sql("select default_currency from `tabCompany` where name = '%s'" % obj.doc.company)
|
||||
curr = company_currency and cstr(company_currency[0][0]) or default_currency
|
||||
if (obj.doc.currency == curr and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != curr and flt(obj.doc.conversion_rate) == 1.00):
|
||||
msgprint("Please Enter Appropriate Conversion Rate.")
|
||||
raise Exception
|
||||
|
||||
|
||||
# Get Tax rate if account type is TAX
|
||||
# =========================================================================
|
||||
def get_rate(self, arg):
|
||||
arg = eval(arg)
|
||||
rate = sql("select account_type, tax_rate from `tabAccount` where name = '%s' and docstatus != 2" %(arg['account_head']), as_dict=1)
|
||||
ret = {'rate' : 0}
|
||||
if arg['charge_type'] == 'Actual' and rate[0]['account_type'] == 'Tax':
|
||||
msgprint("You cannot select ACCOUNT HEAD of type TAX as your CHARGE TYPE is 'ACTUAL'")
|
||||
ret = {
|
||||
'account_head' : ''
|
||||
}
|
||||
elif rate[0]['account_type'] in ['Tax', 'Chargeable'] and not arg['charge_type'] == 'Actual':
|
||||
ret = {
|
||||
'rate' : rate and flt(rate[0]['tax_rate']) or 0
|
||||
}
|
||||
return cstr(ret)
|
||||
|
||||
|
||||
# Make Packing List from Sales BOM
|
||||
# =======================================================================
|
||||
def has_sales_bom(self, item_code):
|
||||
return sql("select name from `tabSales BOM` where name=%s and docstatus != 2", item_code)
|
||||
|
||||
def get_sales_bom_items(self, item_code):
|
||||
return sql("select item_code, qty, uom from `tabSales BOM Detail` where parent=%s", item_code)
|
||||
|
||||
|
||||
# --------------
|
||||
# get item list
|
||||
# --------------
|
||||
def get_item_list(self, obj, is_stopped):
|
||||
il = []
|
||||
for d in getlist(obj.doclist,obj.fname):
|
||||
reserved_qty = 0 # used for delivery note
|
||||
qty = flt(d.qty)
|
||||
if is_stopped:
|
||||
qty = flt(d.qty) > flt(d.delivered_qty) and flt(flt(d.qty) - flt(d.delivered_qty)) or 0
|
||||
|
||||
if d.prevdoc_doctype == 'Sales Order': # used in delivery note to reduce reserved_qty
|
||||
# Eg.: if SO qty is 10 and there is tolerance of 20%, then it will allow DN of 12.
|
||||
# But in this case reserved qty should only be reduced by 10 and not 12.
|
||||
|
||||
tot_qty, max_qty, tot_amt, max_amt = self.get_curr_and_ref_doc_details(d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'Sales Order Detail', obj.doc.name, obj.doc.doctype)
|
||||
if((flt(tot_qty) + flt(qty) > flt(max_qty))):
|
||||
reserved_qty = -(flt(max_qty)-flt(tot_qty))
|
||||
else:
|
||||
reserved_qty = - flt(qty)
|
||||
|
||||
warehouse = (obj.fname == "sales_order_details") and d.reserved_warehouse or d.warehouse
|
||||
|
||||
if self.has_sales_bom(d.item_code):
|
||||
for i in self.get_sales_bom_items(d.item_code):
|
||||
il.append([warehouse, i[0], flt(flt(i[1])* qty), reserved_qty, i[2], d.batch_no, d.serial_no])
|
||||
else:
|
||||
il.append([warehouse, d.item_code, qty, reserved_qty, d.stock_uom, d.batch_no, d.serial_no])
|
||||
return il
|
||||
|
||||
|
||||
# -----------------------
|
||||
# add packing list items
|
||||
# -----------------------
|
||||
def get_packing_item_details(self, item):
|
||||
return sql("select item_name, description, stock_uom from `tabItem` where name = %s", item, as_dict = 1)[0]
|
||||
|
||||
def get_bin_qty(self, item, warehouse):
|
||||
det = sql("select actual_qty, projected_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (item, warehouse), as_dict = 1)
|
||||
return det and det[0] or ''
|
||||
|
||||
def add_packing_list_item(self,obj, item_code, qty, warehouse, line):
|
||||
bin = self.get_bin_qty(item_code, warehouse)
|
||||
item = self.get_packing_item_details(item_code)
|
||||
pi = addchild(obj.doc, 'packing_details', 'Delivery Note Packing Detail', 1, obj.doclist)
|
||||
pi.parent_item = item_code
|
||||
pi.item_code = item_code
|
||||
pi.item_name = item['item_name']
|
||||
pi.parent_detail_docname = line.name
|
||||
pi.description = item['description']
|
||||
pi.uom = item['stock_uom']
|
||||
pi.qty = flt(qty)
|
||||
pi.actual_qty = bin and flt(bin['actual_qty']) or 0
|
||||
pi.projected_qty = bin and flt(bin['projected_qty']) or 0
|
||||
pi.warehouse = warehouse
|
||||
pi.prevdoc_doctype = line.prevdoc_doctype
|
||||
pi.serial_no = cstr(line.serial_no)
|
||||
pi.idx = self.packing_list_idx
|
||||
self.packing_list_idx += 1
|
||||
|
||||
|
||||
# ------------------
|
||||
# make packing list from sales bom if exists or directly copy item with balance
|
||||
# ------------------
|
||||
def make_packing_list(self, obj, fname):
|
||||
obj.doc.clear_table(obj.doclist, 'packing_details')
|
||||
self.packing_list_idx = 0
|
||||
for d in getlist(obj.doclist, fname):
|
||||
warehouse = fname == "sales_order_details" and d.reserved_warehouse or d.warehouse
|
||||
if self.has_sales_bom(d.item_code):
|
||||
for i in self.get_sales_bom_items(d.item_code):
|
||||
self.add_packing_list_item(obj, i[0], flt(i[1])*flt(d.qty), warehouse, d)
|
||||
else:
|
||||
self.add_packing_list_item(obj, d.item_code, d.qty, warehouse, d)
|
||||
|
||||
|
||||
# Get total in words
|
||||
# ==================================================================
|
||||
def get_total_in_words(self, currency, amount):
|
||||
from webnotes.utils import money_in_words
|
||||
return money_in_words(amount, currency)
|
||||
|
||||
|
||||
# Get month based on date (required in sales person and sales partner)
|
||||
# ========================================================================
|
||||
def get_month(self,date):
|
||||
month_list = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
||||
month_idx = cint(cstr(date).split('-')[1])-1
|
||||
return month_list[month_idx]
|
||||
|
||||
|
||||
# **** Check for Stop SO as no transactions can be made against Stopped SO. Need to unstop it. ***
|
||||
def check_stop_sales_order(self,obj):
|
||||
for d in getlist(obj.doclist,obj.fname):
|
||||
ref_doc_name = ''
|
||||
if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_doctype == 'Sales Order':
|
||||
ref_doc_name = d.prevdoc_docname
|
||||
elif d.fields.has_key('sales_order') and d.sales_order and not d.delivery_note:
|
||||
ref_doc_name = d.sales_order
|
||||
if ref_doc_name:
|
||||
so_status = sql("select status from `tabSales Order` where name = %s",ref_doc_name)
|
||||
so_status = so_status and so_status[0][0] or ''
|
||||
if so_status == 'Stopped':
|
||||
msgprint("You cannot do any transaction against Sales Order : '%s' as it is Stopped." %(ref_doc_name))
|
||||
raise Exception
|
||||
|
||||
|
||||
# ****** Check for Item.is_sales_item = 'Yes' and Item.docstatus != 2 *******
|
||||
def check_active_sales_items(self,obj):
|
||||
for d in getlist(obj.doclist, obj.fname):
|
||||
if d.item_code: # extra condn coz item_code is not mandatory in RV
|
||||
valid_item = sql("select docstatus,is_sales_item, is_service_item from tabItem where name = %s",d.item_code)
|
||||
if valid_item and valid_item[0][0] == 2:
|
||||
msgprint("Item : '%s' does not exist in system." %(d.item_code))
|
||||
raise Exception
|
||||
sales_item = valid_item and valid_item[0][1] or 'No'
|
||||
service_item = valid_item and valid_item[0][2] or 'No'
|
||||
if sales_item == 'No' and service_item == 'No':
|
||||
msgprint("Item : '%s' is neither Sales nor Service Item"%(d.item_code))
|
||||
raise Exception
|
||||
|
||||
|
||||
# **************************************************************************************************************************************************
|
||||
|
||||
def check_credit(self,obj,grand_total):
|
||||
acc_head = sql("select name from `tabAccount` where company = '%s' and master_name = '%s'"%(obj.doc.company, obj.doc.customer))
|
||||
if acc_head:
|
||||
tot_outstanding = 0
|
||||
dbcr = sql("select sum(debit), sum(credit) from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No')='No'" % acc_head[0][0])
|
||||
if dbcr:
|
||||
tot_outstanding = flt(dbcr[0][0])-flt(dbcr[0][1])
|
||||
|
||||
exact_outstanding = flt(tot_outstanding) + flt(grand_total)
|
||||
get_obj('Account',acc_head[0][0]).check_credit_limit(acc_head[0][0], obj.doc.company, exact_outstanding)
|
||||
|
||||
def validate_fiscal_year(self,fiscal_year,transaction_date,dn):
|
||||
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%fiscal_year)
|
||||
ysd=fy and fy[0][0] or ""
|
||||
yed=add_days(str(ysd),365)
|
||||
if str(transaction_date) < str(ysd) or str(transaction_date) > str(yed):
|
||||
msgprint("%s not within the fiscal year"%(dn))
|
||||
raise Exception
|
||||
|
||||
# Check Approving Authority
|
||||
# -------------------------
|
||||
def check_approving_authority(self, doctype_name, grand_total):
|
||||
det = sql("select amount from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount <= '%s'" % (doctype_name, grand_total))
|
||||
amt_list, auth_users = [], []
|
||||
if det:
|
||||
for x in det:
|
||||
amt_list.append(flt(x[0]))
|
||||
max_amount = max(amt_list)
|
||||
# Get names of all approving authority with max amount
|
||||
for d in sql("select approving_authority from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount = '%s'" % (doctype_name, flt(max_amount))): auth_users.append(d[0])
|
||||
for x in sql("select approving_authority from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount > '%s'" % (doctype_name, grand_total)): auth_users.append(x[0])
|
||||
if not has_common(auth_users, session['data']['profile']['roles']):
|
||||
msgprint("You do not have an authority to submit this %s. Only %s can submit since amount exceeds %s. %s" % (doctype_name, auth_users, get_defaults()['currency'], flt(max_amount)))
|
||||
raise Exception
|
||||
|
||||
# get against document date self.prevdoc_date_field
|
||||
#-----------------------------
|
||||
def get_prevdoc_date(self, obj):
|
||||
import datetime
|
||||
for d in getlist(obj.doclist, obj.fname):
|
||||
if d.prevdoc_doctype and d.prevdoc_docname:
|
||||
if d.prevdoc_doctype == 'Receivable Voucher':
|
||||
dt = sql("select posting_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
|
||||
else:
|
||||
dt = sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
|
||||
d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or ''
|
||||
|
||||
def update_prevdoc_detail(self, is_submit, obj):
|
||||
StatusUpdater(obj, is_submit).update()
|
||||
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
# get qty, amount already billed or delivered against curr line item for current doctype
|
||||
# For Eg: SO-RV get total qty, amount from SO and also total qty, amount against that SO in RV
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
def get_curr_and_ref_doc_details(self, curr_doctype, ref_tab_fname, ref_tab_dn, ref_doc_tname, curr_parent_name, curr_parent_doctype):
|
||||
# Get total qty, amt of current doctype (eg RV) except for qty, amt of this transaction
|
||||
if curr_parent_doctype == 'Installation Note':
|
||||
curr_det = sql("select sum(qty) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
|
||||
qty, amt = curr_det and flt(curr_det[0][0]) or 0, 0
|
||||
else:
|
||||
curr_det = sql("select sum(qty), sum(amount) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
|
||||
qty, amt = curr_det and flt(curr_det[0][0]) or 0, curr_det and flt(curr_det[0][1]) or 0
|
||||
|
||||
# get total qty of ref doctype
|
||||
ref_det = sql("select qty, amount from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn))
|
||||
max_qty, max_amt = ref_det and flt(ref_det[0][0]) or 0, ref_det and flt(ref_det[0][1]) or 0
|
||||
|
||||
return qty, max_qty, amt, max_amt
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# make item code readonly if (detail no is set)
|
||||
#
|
||||
|
||||
|
||||
class StatusUpdater:
|
||||
"""
|
||||
Updates the status of the calling records
|
||||
|
||||
From Delivery Note
|
||||
- Update Delivered Qty
|
||||
- Update Percent
|
||||
- Validate over delivery
|
||||
|
||||
From Receivable Voucher
|
||||
- Update Billed Qty
|
||||
- Update Percent
|
||||
- Validate over billing
|
||||
|
||||
From Installation Note
|
||||
- Update Installed Qty
|
||||
- Update Percent Qty
|
||||
- Validate over installation
|
||||
"""
|
||||
def __init__(self, obj, is_submit):
|
||||
self.obj = obj # caller object
|
||||
self.is_submit = is_submit
|
||||
self.tolerance = {}
|
||||
self.global_tolerance = None
|
||||
|
||||
def update(self):
|
||||
self.update_all_qty()
|
||||
self.validate_all_qty()
|
||||
|
||||
def validate_all_qty(self):
|
||||
"""
|
||||
Validates over-billing / delivery / installation in Delivery Note, Receivable Voucher, Installation Note
|
||||
To called after update_all_qty
|
||||
"""
|
||||
if self.obj.doc.doctype=='Delivery Note':
|
||||
self.validate_qty({
|
||||
'source_dt' :'Delivery Note Detail',
|
||||
'compare_field' :'delivered_qty',
|
||||
'target_dt' :'Sales Order Detail',
|
||||
'join_field' :'prevdoc_detail_docname'
|
||||
})
|
||||
elif self.obj.doc.doctype=='Receivable Voucher':
|
||||
self.validate_qty({
|
||||
'source_dt' :'RV Detail',
|
||||
'compare_field' :'billed_qty',
|
||||
'target_dt' :'Sales Order Detail',
|
||||
'join_field' :'so_detail'
|
||||
})
|
||||
elif self.obj.doc.doctype=='Installation Note':
|
||||
self.validate_qty({
|
||||
'source_dt' :'Installation Item Details',
|
||||
'compare_field' :'installed_qty',
|
||||
'target_dt' :'Delivery Note Detail',
|
||||
'join_field' :'dn_detail'
|
||||
}, no_tolerance =1);
|
||||
|
||||
|
||||
def get_tolerance_for(self, item_code):
|
||||
"""
|
||||
Returns the tolerance for the item, if not set, returns global tolerance
|
||||
"""
|
||||
if self.tolerance.get(item_code):
|
||||
return self.tolerance[item_code]
|
||||
|
||||
tolerance = flt(get_value('Item',item_code,'tolerance') or 0)
|
||||
|
||||
if not(tolerance):
|
||||
if self.global_tolerance == None:
|
||||
self.global_tolerance = flt(get_value('Manage Account',None,'tolerance') or 0)
|
||||
tolerance = self.global_tolerance
|
||||
|
||||
self.tolerance[item_code] = tolerance
|
||||
return tolerance
|
||||
|
||||
def check_overflow_with_tolerance(self, item, args):
|
||||
"""
|
||||
Checks if there is overflow condering a relaxation tolerance
|
||||
"""
|
||||
|
||||
# check if overflow is within tolerance
|
||||
tolerance = self.get_tolerance_for(item['item_code'])
|
||||
overflow_percent = ((item[args['compare_field']] - item['qty']) / item['qty'] * 100)
|
||||
|
||||
if overflow_percent - tolerance > 0.0001:
|
||||
item['max_allowed'] = flt(item['qty'] * (100+tolerance)/100)
|
||||
item['reduce_by'] = item[args['compare_field']] - item['max_allowed']
|
||||
|
||||
msgprint("""
|
||||
Row #%(idx)s: Max qty allowed for <b>Item %(item_code)s</b> against <b>%(parenttype)s %(parent)s</b> is <b>%(max_allowed)s</b>.
|
||||
|
||||
If you want to increase your overflow tolerance, please increase tolerance %% in Global Defaults or Item master.
|
||||
|
||||
Or, you must reduce the qty by %(reduce_by)s""" % item, raise_exception=1)
|
||||
|
||||
def validate_qty(self, args, no_tolerance=None):
|
||||
"""
|
||||
Updates qty at row level
|
||||
"""
|
||||
# get unique transactions to update
|
||||
for d in self.obj.doclist:
|
||||
if d.doctype == args['source_dt']:
|
||||
args['name'] = d.fields[args['join_field']]
|
||||
|
||||
# get all qty where qty > compare_field
|
||||
item = sql("""
|
||||
select item_code, qty, `%(compare_field)s`, parenttype, parent from `tab%(target_dt)s`
|
||||
where qty < `%(compare_field)s` and name="%(name)s" and docstatus=1
|
||||
""" % args, as_dict=1)
|
||||
|
||||
if item:
|
||||
item = item[0]
|
||||
item['idx'] = d.idx
|
||||
|
||||
if no_tolerance:
|
||||
item['reduce_by'] = item[args['compare_field']] - item['qty']
|
||||
msgprint("""
|
||||
Row #%(idx)s: Max qty allowed for <b>Item %(item_code)s</b> against
|
||||
<b>%(parenttype)s %(parent)s</b> is <b>%(qty)s</b>.
|
||||
|
||||
You must reduce the qty by %(reduce_by)s""" % item, raise_exception=1)
|
||||
|
||||
else:
|
||||
self.check_overflow_with_tolerance(item, args)
|
||||
|
||||
|
||||
def update_all_qty(self):
|
||||
"""
|
||||
Updates delivered / billed / installed qty in Sales Order & Delivery Note
|
||||
"""
|
||||
if self.obj.doc.doctype=='Delivery Note':
|
||||
self.update_qty({
|
||||
'target_field' :'delivered_qty',
|
||||
'target_dt' :'Sales Order Detail',
|
||||
'target_parent_dt' :'Sales Order',
|
||||
'target_parent_field' :'per_delivered',
|
||||
'source_dt' :'Delivery Note Detail',
|
||||
'source_field' :'qty',
|
||||
'join_field' :'prevdoc_detail_docname',
|
||||
'percent_join_field' :'prevdoc_docname',
|
||||
'status_field' :'delivery_status',
|
||||
'keyword' :'Delivered'
|
||||
})
|
||||
|
||||
elif self.obj.doc.doctype=='Receivable Voucher':
|
||||
self.update_qty({
|
||||
'target_field' :'billed_qty',
|
||||
'target_dt' :'Sales Order Detail',
|
||||
'target_parent_dt' :'Sales Order',
|
||||
'target_parent_field' :'per_billed',
|
||||
'source_dt' :'RV Detail',
|
||||
'source_field' :'qty',
|
||||
'join_field' :'so_detail',
|
||||
'percent_join_field' :'sales_order',
|
||||
'status_field' :'billing_status',
|
||||
'keyword' :'Billed'
|
||||
})
|
||||
|
||||
self.update_qty({
|
||||
'target_field' :'billed_qty',
|
||||
'target_dt' :'Delivery Note Detail',
|
||||
'target_parent_dt' :'Delivery Note',
|
||||
'target_parent_field' :'per_billed',
|
||||
'source_dt' :'RV Detail',
|
||||
'source_field' :'qty',
|
||||
'join_field' :'dn_detail',
|
||||
'percent_join_field' :'delivery_note',
|
||||
'status_field' :'billing_status',
|
||||
'keyword' :'Billed'
|
||||
})
|
||||
|
||||
if self.obj.doc.doctype=='Installation Note':
|
||||
self.update_qty({
|
||||
'target_field' :'installed_qty',
|
||||
'target_dt' :'Delivery Note Detail',
|
||||
'target_parent_dt' :'Delivery Note',
|
||||
'target_parent_field' :'per_installed',
|
||||
'source_dt' :'Installed Item Details',
|
||||
'source_field' :'qty',
|
||||
'join_field' :'prevdoc_detail_docname',
|
||||
'percent_join_field' :'prevdoc_docname',
|
||||
'status_field' :'installation_status',
|
||||
'keyword' :'Installed'
|
||||
})
|
||||
|
||||
|
||||
def update_qty(self, args):
|
||||
"""
|
||||
Updates qty at row level
|
||||
"""
|
||||
# condition to include current record (if submit or no if cancel)
|
||||
if self.is_submit:
|
||||
args['cond'] = ' or parent="%s"' % self.obj.doc.name
|
||||
else:
|
||||
args['cond'] = ' and parent!="%s"' % self.obj.doc.name
|
||||
|
||||
# update quantities in child table
|
||||
for d in self.obj.doclist:
|
||||
if d.doctype == args['source_dt']:
|
||||
# updates qty in the child table
|
||||
args['detail_id'] = d.fields.get(args['join_field'])
|
||||
|
||||
if args['detail_id']:
|
||||
sql("""
|
||||
update
|
||||
`tab%(target_dt)s`
|
||||
set
|
||||
%(target_field)s = (select sum(qty) from `tab%(source_dt)s` where `%(join_field)s`="%(detail_id)s" and (docstatus=1 %(cond)s))
|
||||
where
|
||||
name="%(detail_id)s"
|
||||
""" % args)
|
||||
|
||||
# get unique transactions to update
|
||||
for name in set([d.fields.get(args['percent_join_field']) for d in self.obj.doclist if d.doctype == args['source_dt']]):
|
||||
if name:
|
||||
args['name'] = name
|
||||
|
||||
# update percent complete in the parent table
|
||||
sql("""
|
||||
update
|
||||
`tab%(target_parent_dt)s`
|
||||
set
|
||||
%(target_parent_field)s =
|
||||
(select sum(if(qty > ifnull(%(target_field)s, 0), %(target_field)s, qty))/sum(qty)*100 from `tab%(target_dt)s` where parent="%(name)s"),
|
||||
modified = now()
|
||||
where
|
||||
name="%(name)s"
|
||||
""" % args)
|
||||
|
||||
# update field
|
||||
if args['status_field']:
|
||||
sql("""
|
||||
update
|
||||
`tab%(target_parent_dt)s`
|
||||
set
|
||||
%(status_field)s = if(ifnull(%(target_parent_field)s,0)<0.001, 'Not %(keyword)s',
|
||||
if(%(target_parent_field)s>=99.99, 'Fully %(keyword)s', 'Partly %(keyword)s')
|
||||
)
|
||||
where
|
||||
name="%(name)s"
|
||||
""" % args)
|
||||
31
selling/doctype/sales_common/sales_common.txt
Normal file
31
selling/doctype/sales_common/sales_common.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
# DocType, Sales Common
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:21',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-01-03 11:21:04',
|
||||
'modified_by': 'nabin@webnotestech.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 290
|
||||
},
|
||||
|
||||
# DocType, Sales Common
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Sales Common'
|
||||
}
|
||||
]
|
||||
0
selling/doctype/sales_order/__init__.py
Normal file
0
selling/doctype/sales_order/__init__.py
Normal file
338
selling/doctype/sales_order/sales_order.js
Normal file
338
selling/doctype/sales_order/sales_order.js
Normal file
@@ -0,0 +1,338 @@
|
||||
// Module CRM
|
||||
|
||||
cur_frm.cscript.tname = "Sales Order Detail";
|
||||
cur_frm.cscript.fname = "sales_order_details";
|
||||
cur_frm.cscript.other_fname = "other_charges";
|
||||
cur_frm.cscript.sales_team_fname = "sales_team";
|
||||
|
||||
|
||||
$import(Sales Common)
|
||||
$import(Other Charges)
|
||||
$import(SMS Control)
|
||||
|
||||
|
||||
// ONLOAD
|
||||
// ================================================================================================
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
||||
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
|
||||
// load default charges
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
if(doc.__islocal) {
|
||||
if(doc.quotation) cur_frm.cscript['Pull Quotation Details'](doc,cdt,cdn);
|
||||
} else {
|
||||
cur_frm.cscript.load_taxes(doc, cdt, cdn);
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh
|
||||
//==================
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.clear_custom_buttons();
|
||||
|
||||
if(doc.docstatus==1) {
|
||||
if(doc.status != 'Stopped') {
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
|
||||
// delivery note
|
||||
if(doc.per_delivered < 100 && doc.order_type!='Maintenance')
|
||||
cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
|
||||
|
||||
// maintenance
|
||||
if(doc.per_delivered < 100 && doc.order_type=='Maintenance') {
|
||||
cur_frm.add_custom_button('Make Maint. Visit', cur_frm.cscript['Make Maintenance Visit']);
|
||||
cur_frm.add_custom_button('Make Maint. Schedule', cur_frm.cscript['Make Maintenance Schedule']);
|
||||
}
|
||||
|
||||
// indent
|
||||
if(doc.order_type != 'Maintenance')
|
||||
cur_frm.add_custom_button('Make Indent', cur_frm.cscript['Make Indent']);
|
||||
|
||||
// sales invoice
|
||||
if(doc.per_billed < 100)
|
||||
cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']);
|
||||
|
||||
// stop
|
||||
if(doc.per_delivered < 100 || doc.per_billed < 100)
|
||||
cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Sales Order']);
|
||||
} else {
|
||||
|
||||
// un-stop
|
||||
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']);
|
||||
}
|
||||
|
||||
unhide_field(['Repair Sales Order', 'Send SMS', 'message', 'customer_mobile_no'])
|
||||
} else {
|
||||
hide_field(['Repair Sales Order', 'Send SMS', 'message', 'customer_mobile_no'])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//customer
|
||||
cur_frm.cscript.customer = function(doc,dt,dn) {
|
||||
var callback = function(r,rt) {
|
||||
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
||||
get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0);
|
||||
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','shipping_address']);
|
||||
}
|
||||
|
||||
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['Pull Quotation Details'] = function(doc,dt,dn) {
|
||||
var callback = function(r,rt){
|
||||
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
||||
if(r.message){
|
||||
doc.quotation_no = r.message;
|
||||
if(doc.quotation_no) {
|
||||
unhide_field(['quotation_date','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
|
||||
if(doc.customer) get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0);
|
||||
}
|
||||
cur_frm.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'pull_quotation_details','',callback);
|
||||
}
|
||||
|
||||
|
||||
//================ create new contact ============================================================================
|
||||
cur_frm.cscript.new_contact = function(){
|
||||
tn = createLocal('Contact');
|
||||
locals['Contact'][tn].is_customer = 1;
|
||||
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
|
||||
loaddoc('Contact', tn);
|
||||
}
|
||||
|
||||
// DOCTYPE TRIGGERS
|
||||
// ================================================================================================
|
||||
|
||||
/*
|
||||
// ***************** get shipping address based on customer selected *****************
|
||||
cur_frm.fields_dict['ship_det_no'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabShipping Address`.`name`, `tabShipping Address`.`ship_to`, `tabShipping Address`.`shipping_address` FROM `tabShipping Address` WHERE `tabShipping Address`.customer = "'+ doc.customer+'" AND `tabShipping Address`.`docstatus` != 2 AND `tabShipping Address`.`name` LIKE "%s" ORDER BY `tabShipping Address`.name ASC LIMIT 50';
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// ***************** Get project name *****************
|
||||
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
||||
var cond = '';
|
||||
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
|
||||
return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
|
||||
}
|
||||
|
||||
//---- get customer details ----------------------------
|
||||
cur_frm.cscript.project_name = function(doc,cdt,cdn){
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'pull_project_customer','', function(r,rt){
|
||||
refresh_many(['customer','customer_name', 'customer_address', 'contact_person', 'territory', 'contact_no', 'email_id', 'customer_group']);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// *************** Customized link query for QUOTATION *****************************
|
||||
cur_frm.fields_dict['quotation_no'].get_query = function(doc) {
|
||||
var cond='';
|
||||
if(doc.order_type) cond = ' ifnull(`tabQuotation`.order_type, "") = "'+doc.order_type+'" and';
|
||||
if(doc.customer) cond += ' ifnull(`tabQuotation`.customer, "") = "'+doc.customer+'" and';
|
||||
|
||||
return repl('SELECT DISTINCT name, customer, transaction_date FROM `tabQuotation` WHERE `tabQuotation`.company = "' + doc.company + '" and `tabQuotation`.`docstatus` = 1 and `tabQuotation`.status != "Order Lost" and %(cond)s `tabQuotation`.%(key)s LIKE "%s" ORDER BY `tabQuotation`.`name` DESC LIMIT 50', {cond:cond});
|
||||
}
|
||||
|
||||
|
||||
// SALES ORDER DETAILS TRIGGERS
|
||||
// ================================================================================================
|
||||
|
||||
// ***************** Get available qty in warehouse of item selected ****************
|
||||
cur_frm.cscript.reserved_warehouse = function(doc, cdt , cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.reserved_warehouse) {
|
||||
arg = "{'item_code':'" + d.item_code + "','warehouse':'" + d.reserved_warehouse +"'}";
|
||||
get_server_fields('get_available_qty',arg,'sales_order_details',doc,cdt,cdn,1);
|
||||
}
|
||||
}
|
||||
|
||||
//----------- make maintenance schedule----------
|
||||
cur_frm.cscript['Make Maintenance Schedule'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
|
||||
if (doc.docstatus == 1) {
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_schedule','',
|
||||
function(r,rt){
|
||||
if(r.message == 'No'){
|
||||
n = createLocal("Maintenance Schedule");
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals["Maintenance Schedule"][n]]),
|
||||
'from_doctype':'Sales Order',
|
||||
'to_doctype':'Maintenance Schedule',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Sales Order', 'Maintenance Schedule'], ['Sales Order Detail', 'Item Maintenance Detail']]"
|
||||
}
|
||||
, function(r,rt) {
|
||||
loaddoc("Maintenance Schedule", n);
|
||||
}
|
||||
);
|
||||
}
|
||||
else{
|
||||
msgprint("You have already created Maintenance Schedule against this Sales Order");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//------------ make maintenance visit ------------
|
||||
cur_frm.cscript['Make Maintenance Visit'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
|
||||
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':'Sales Order',
|
||||
'to_doctype':'Maintenance Visit',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Sales Order', 'Maintenance Visit'], ['Sales Order Detail', 'Maintenance Visit Detail']]"
|
||||
}
|
||||
, function(r,rt) {
|
||||
loaddoc("Maintenance Visit", n);
|
||||
}
|
||||
);
|
||||
}
|
||||
else{
|
||||
msgprint("You have already completed maintenance against this Sales Order");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// make indent
|
||||
// ================================================================================================
|
||||
cur_frm.cscript['Make Indent'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
if (doc.docstatus == 1) {
|
||||
n = createLocal("Indent");
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals["Indent"][n]]),
|
||||
'from_doctype':'Sales Order',
|
||||
'to_doctype':'Indent',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Sales Order', 'Indent'], ['Sales Order Detail', 'Indent Detail']]"
|
||||
}
|
||||
, function(r,rt) {
|
||||
loaddoc("Indent", n);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MAKE DELIVERY NOTE
|
||||
// ================================================================================================
|
||||
cur_frm.cscript['Make Delivery Note'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
if (doc.docstatus == 1) {
|
||||
n = createLocal("Delivery Note");
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals["Delivery Note"][n]]),
|
||||
'from_doctype':'Sales Order',
|
||||
'to_doctype':'Delivery Note',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Sales Order', 'Delivery Note'], ['Sales Order Detail', 'Delivery Note Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]"
|
||||
}
|
||||
, function(r,rt) {
|
||||
loaddoc("Delivery Note", n);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MAKE SALES INVOICE
|
||||
// ================================================================================================
|
||||
cur_frm.cscript['Make Sales Invoice'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
|
||||
n = createLocal('Receivable Voucher');
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals['Receivable Voucher'][n]]),
|
||||
'from_doctype':doc.doctype,
|
||||
'to_doctype':'Receivable Voucher',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Sales Order','Receivable Voucher'],['Sales Order Detail','RV Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]"
|
||||
}, function(r,rt) {
|
||||
loaddoc('Receivable Voucher', n);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// STOP SALES ORDER
|
||||
// ==================================================================================================
|
||||
cur_frm.cscript['Stop Sales Order'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
|
||||
var check = confirm("Are you sure you want to STOP " + doc.name);
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'stop_sales_order', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// UNSTOP SALES ORDER
|
||||
// ==================================================================================================
|
||||
cur_frm.cscript['Unstop Sales Order'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
|
||||
var check = confirm("Are you sure you want to UNSTOP " + doc.name);
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'unstop_sales_order', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//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';
|
||||
}
|
||||
|
||||
|
||||
488
selling/doctype/sales_order/sales_order.py
Normal file
488
selling/doctype/sales_order/sales_order.py
Normal file
@@ -0,0 +1,488 @@
|
||||
# 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.tname = 'Sales Order Detail'
|
||||
self.fname = 'sales_order_details'
|
||||
self.person_tname = 'Target Detail'
|
||||
self.partner_tname = 'Partner Target Detail'
|
||||
self.territory_tname = 'Territory Target Detail'
|
||||
|
||||
# Autoname
|
||||
# ===============
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
|
||||
# DOCTYPE TRIGGER FUNCTIONS
|
||||
# =============================
|
||||
# Pull Quotation Details
|
||||
# -----------------------
|
||||
def pull_quotation_details(self):
|
||||
self.doc.clear_table(self.doclist, 'other_charges')
|
||||
self.doc.clear_table(self.doclist, 'sales_order_details')
|
||||
self.doc.clear_table(self.doclist, 'sales_team')
|
||||
self.doc.clear_table(self.doclist, 'tc_details')
|
||||
if self.doc.quotation_no:
|
||||
get_obj('DocType Mapper', 'Quotation-Sales Order').dt_map('Quotation', 'Sales Order', self.doc.quotation_no, self.doc, self.doclist, "[['Quotation', 'Sales Order'],['Quotation Detail', 'Sales Order Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team'],['TC Detail','TC Detail']]")
|
||||
else:
|
||||
msgprint("Please select Quotation whose details need to pull")
|
||||
|
||||
return cstr(self.doc.quotation_no)
|
||||
|
||||
#pull project customer
|
||||
#-------------------------
|
||||
def pull_project_customer(self):
|
||||
res = sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name)
|
||||
if res:
|
||||
get_obj('DocType Mapper', 'Project-Sales Order').dt_map('Project', 'Sales Order', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Order']]")
|
||||
|
||||
|
||||
# Get Customer Details
|
||||
# ---------------------
|
||||
#def get_customer_details(self):
|
||||
# sales_com_obj = get_obj('Sales Common')
|
||||
# sales_com_obj.get_customer_details(self)
|
||||
# sales_com_obj.get_shipping_details(self)
|
||||
|
||||
# Get contact person details based on customer selected
|
||||
# ------------------------------------------------------
|
||||
def get_contact_details(self):
|
||||
get_obj('Sales Common').get_contact_details(self,0)
|
||||
|
||||
# Get Commission rate of Sales Partner
|
||||
# -------------------------------------
|
||||
def get_comm_rate(self, sales_partner):
|
||||
return get_obj('Sales Common').get_comm_rate(sales_partner, self)
|
||||
|
||||
# Clear Sales Order Details Table
|
||||
# --------------------------------
|
||||
def clear_sales_order_details(self):
|
||||
self.doc.clear_table(self.doclist, 'sales_order_details')
|
||||
|
||||
|
||||
# SALES ORDER DETAILS TRIGGER FUNCTIONS
|
||||
# ================================================================================
|
||||
# Get Item Details
|
||||
# ----------------
|
||||
def get_item_details(self, item_code):
|
||||
return get_obj('Sales Common').get_item_details(item_code, self)
|
||||
|
||||
# Re-calculates Basic Rate & amount based on Price List Selected
|
||||
# --------------------------------------------------------------
|
||||
def get_adj_percent(self, arg=''):
|
||||
get_obj('Sales Common').get_adj_percent(self)
|
||||
|
||||
# Get projected qty of item based on warehouse selected
|
||||
# -----------------------------------------------------
|
||||
def get_available_qty(self,args):
|
||||
args = eval(args)
|
||||
tot_avail_qty = sql("select projected_qty, actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
|
||||
ret = {
|
||||
'projected_qty' : tot_avail_qty and flt(tot_avail_qty[0]['projected_qty']) or 0,
|
||||
'actual_qty' : tot_avail_qty and flt(tot_avail_qty[0]['actual_qty']) or 0
|
||||
}
|
||||
return cstr(ret)
|
||||
|
||||
|
||||
# OTHER CHARGES TRIGGER FUNCTIONS
|
||||
# ====================================================================================
|
||||
|
||||
# Get Tax rate if account type is TAX
|
||||
# ------------------------------------
|
||||
def get_rate(self,arg):
|
||||
return get_obj('Sales Common').get_rate(arg)
|
||||
|
||||
# Load Default Charges
|
||||
# ----------------------------------------------------------
|
||||
def load_default_taxes(self):
|
||||
return get_obj('Sales Common').load_default_taxes(self)
|
||||
|
||||
# Pull details from other charges master (Get Other Charges)
|
||||
# ----------------------------------------------------------
|
||||
def get_other_charges(self):
|
||||
return get_obj('Sales Common').get_other_charges(self)
|
||||
|
||||
|
||||
# GET TERMS & CONDITIONS
|
||||
# =====================================================================================
|
||||
def get_tc_details(self):
|
||||
return get_obj('Sales Common').get_tc_details(self)
|
||||
|
||||
#check if maintenance schedule already generated
|
||||
#============================================
|
||||
def check_maintenance_schedule(self):
|
||||
nm = 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", self.doc.name)
|
||||
nm = nm and nm[0][0] or ''
|
||||
|
||||
if not nm:
|
||||
return cstr('No')
|
||||
|
||||
#check if maintenance visit 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')
|
||||
|
||||
# VALIDATE
|
||||
# =====================================================================================
|
||||
# Fiscal Year Validation
|
||||
# ----------------------
|
||||
def validate_fiscal_year(self):
|
||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Sales Order Date')
|
||||
|
||||
# Validate values with reference document
|
||||
#----------------------------------------
|
||||
def validate_reference_value(self):
|
||||
get_obj('DocType Mapper', 'Quotation-Sales Order', with_children = 1).validate_reference_value(self, self.doc.name)
|
||||
|
||||
# Validate Mandatory
|
||||
# -------------------
|
||||
def validate_mandatory(self):
|
||||
# validate transaction date v/s delivery date
|
||||
if self.doc.delivery_date:
|
||||
if getdate(self.doc.transaction_date) > getdate(self.doc.delivery_date):
|
||||
msgprint("Expected Delivery Date cannot be before Sales Order Date")
|
||||
raise Exception
|
||||
|
||||
# Validate P.O Date
|
||||
# ------------------
|
||||
def validate_po_date(self):
|
||||
# validate p.o date v/s delivery date
|
||||
if self.doc.po_date and self.doc.delivery_date and getdate(self.doc.po_date) >= getdate(self.doc.delivery_date):
|
||||
msgprint("Expected Delivery Date cannot be before Purchase Order Date")
|
||||
raise Exception
|
||||
# amendment date is necessary if document is amended
|
||||
if self.doc.amended_from and not self.doc.amendment_date:
|
||||
msgprint("Please Enter Amendment Date")
|
||||
raise Exception
|
||||
|
||||
# Validations of Details Table
|
||||
# -----------------------------
|
||||
def validate_for_items(self):
|
||||
check_list,flag = [],0
|
||||
chk_dupl_itm = []
|
||||
# Sales Order Details Validations
|
||||
for d in getlist(self.doclist, 'sales_order_details'):
|
||||
if cstr(self.doc.quotation_no) == cstr(d.prevdoc_docname):
|
||||
flag = 1
|
||||
if d.prevdoc_docname:
|
||||
if self.doc.quotation_date and getdate(self.doc.quotation_date) > getdate(self.doc.transaction_date):
|
||||
msgprint("Sales Order Date cannot be before Quotation Date")
|
||||
raise Exception
|
||||
# validates whether quotation no in doctype and in table is same
|
||||
if not cstr(d.prevdoc_docname) == cstr(self.doc.quotation_no):
|
||||
msgprint("Items in table does not belong to the Quotation No mentioned.")
|
||||
raise Exception
|
||||
|
||||
# validates whether item is not entered twice
|
||||
e = [d.item_code, d.description, d.reserved_warehouse, d.prevdoc_docname or '']
|
||||
f = [d.item_code, d.description]
|
||||
|
||||
#check item is stock item
|
||||
st_itm = sql("select is_stock_item from `tabItem` where name = '%s'"%d.item_code)
|
||||
|
||||
if st_itm and st_itm[0][0] == 'Yes':
|
||||
if e in check_list:
|
||||
msgprint("Item %s has been entered twice." % d.item_code)
|
||||
else:
|
||||
check_list.append(e)
|
||||
elif st_itm and st_itm[0][0]== 'No':
|
||||
if f in chk_dupl_itm:
|
||||
msgprint("Item %s has been entered twice." % d.item_code)
|
||||
else:
|
||||
chk_dupl_itm.append(f)
|
||||
|
||||
# used for production plan
|
||||
d.transaction_date = self.doc.transaction_date
|
||||
d.delivery_date = self.doc.delivery_date
|
||||
|
||||
# gets total projected qty of item in warehouse selected (this case arises when warehouse is selected b4 item)
|
||||
tot_avail_qty = sql("select projected_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.reserved_warehouse))
|
||||
d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
|
||||
|
||||
if flag == 0:
|
||||
msgprint("There are no items of the quotation selected.")
|
||||
raise Exception
|
||||
|
||||
# validate sales/ service item against order type
|
||||
#----------------------------------------------------
|
||||
def validate_sales_mntc_item(self):
|
||||
if self.doc.order_type == 'Maintenance':
|
||||
item_field = 'is_service_item'
|
||||
order_type = 'Maintenance Order'
|
||||
item_type = 'service item'
|
||||
else :
|
||||
item_field = 'is_sales_item'
|
||||
order_type = 'Sales Order'
|
||||
item_type = 'sales item'
|
||||
|
||||
for d in getlist(self.doclist, 'sales_order_details'):
|
||||
res = sql("select %s from `tabItem` where name='%s'"% (item_field,d.item_code))
|
||||
res = res and res[0][0] or 'No'
|
||||
|
||||
if res == 'No':
|
||||
msgprint("You can not select non "+item_type+" "+d.item_code+" in "+order_type)
|
||||
raise Exception
|
||||
|
||||
# validate sales/ maintenance quotation against order type
|
||||
#------------------------------------------------------------------
|
||||
def validate_sales_mntc_quotation(self):
|
||||
for d in getlist(self.doclist, 'sales_order_details'):
|
||||
if d.prevdoc_docname:
|
||||
res = sql("select order_type from `tabQuotation` where name=%s", (d.prevdoc_docname))
|
||||
res = res and res[0][0] or ''
|
||||
|
||||
if self.doc.order_type== 'Maintenance' and res != 'Maintenance':
|
||||
msgprint("You can not select non Maintenance Quotation against Maintenance Order")
|
||||
raise Exception
|
||||
elif self.doc.order_type != 'Maintenance' and res == 'Maintenance':
|
||||
msgprint("You can not select non Sales Quotation against Sales Order")
|
||||
raise Exception
|
||||
|
||||
#do not allow sales item/quotation in maintenance order and service item/quotation in sales order
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
def validate_order_type(self):
|
||||
#validate delivery date
|
||||
if self.doc.order_type != 'Maintenance' and not self.doc.delivery_date:
|
||||
msgprint("Please enter 'Expected Delivery Date'")
|
||||
raise Exception
|
||||
|
||||
self.validate_sales_mntc_quotation()
|
||||
self.validate_sales_mntc_item()
|
||||
|
||||
#check for does customer belong to same project as entered..
|
||||
#-------------------------------------------------------------------------------------------------
|
||||
def validate_proj_cust(self):
|
||||
if self.doc.project_name and self.doc.customer_name:
|
||||
res = sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
|
||||
if not res:
|
||||
msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in project - %s."%(self.doc.customer,self.doc.project_name,self.doc.project_name))
|
||||
raise Exception
|
||||
|
||||
|
||||
# Validate
|
||||
# ---------
|
||||
def validate(self):
|
||||
self.validate_fiscal_year()
|
||||
self.validate_order_type()
|
||||
self.validate_mandatory()
|
||||
self.validate_proj_cust()
|
||||
self.validate_po_date()
|
||||
#self.validate_reference_value()
|
||||
self.validate_for_items()
|
||||
sales_com_obj = get_obj(dt = 'Sales Common')
|
||||
sales_com_obj.check_active_sales_items(self)
|
||||
sales_com_obj.check_conversion_rate(self)
|
||||
|
||||
# verify whether rate is not greater than max_discount
|
||||
sales_com_obj.validate_max_discount(self,'sales_order_details')
|
||||
# this is to verify that the allocated % of sales persons is 100%
|
||||
sales_com_obj.get_allocated_sum(self)
|
||||
sales_com_obj.make_packing_list(self,'sales_order_details')
|
||||
|
||||
# get total in words
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
||||
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||
|
||||
# set SO status
|
||||
self.doc.status='Draft'
|
||||
if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
|
||||
if not self.doc.delivery_status: self.doc.delivery_status = 'Not Delivered'
|
||||
|
||||
|
||||
# ON SUBMIT
|
||||
# ===============================================================================================
|
||||
# Checks Quotation Status
|
||||
# ------------------------
|
||||
def check_prev_docstatus(self):
|
||||
for d in getlist(self.doclist, 'sales_order_details'):
|
||||
cancel_quo = sql("select name from `tabQuotation` where docstatus = 2 and name = '%s'" % d.prevdoc_docname)
|
||||
if cancel_quo:
|
||||
msgprint("Quotation :" + cstr(cancel_quo[0][0]) + " is already cancelled !")
|
||||
raise Exception , "Validation Error. "
|
||||
|
||||
def update_enquiry_status(self, prevdoc, flag):
|
||||
enq = sql("select t2.prevdoc_docname from `tabQuotation` t1, `tabQuotation Detail` t2 where t2.parent = t1.name and t1.name=%s", prevdoc)
|
||||
if enq:
|
||||
sql("update `tabEnquiry` set status = %s where name=%s",(flag,enq[0][0]))
|
||||
|
||||
#update status of quotation, enquiry
|
||||
#----------------------------------------
|
||||
def update_prevdoc_status(self, flag):
|
||||
for d in getlist(self.doclist, 'sales_order_details'):
|
||||
if d.prevdoc_docname:
|
||||
if flag=='submit':
|
||||
sql("update `tabQuotation` set status = 'Order Confirmed' where name=%s",d.prevdoc_docname)
|
||||
|
||||
#update enquiry
|
||||
self.update_enquiry_status(d.prevdoc_docname, 'Order Confirmed')
|
||||
elif flag == 'cancel':
|
||||
chk = sql("select t1.name from `tabSales Order` t1, `tabSales Order Detail` t2 where t2.parent = t1.name and t2.prevdoc_docname=%s and t1.name!=%s and t1.docstatus=1", (d.prevdoc_docname,self.doc.name))
|
||||
if not chk:
|
||||
sql("update `tabQuotation` set status = 'Submitted' where name=%s",d.prevdoc_docname)
|
||||
|
||||
#update enquiry
|
||||
self.update_enquiry_status(d.prevdoc_docname, 'Quotation Sent')
|
||||
|
||||
# Submit
|
||||
# -------
|
||||
def on_submit(self):
|
||||
self.check_prev_docstatus()
|
||||
self.update_stock_ledger(update_stock = 1)
|
||||
self.set_sms_msg(1)
|
||||
# update customer's last sales order no.
|
||||
update_customer = sql("update `tabCustomer` set last_sales_order = '%s', modified = '%s' where name = '%s'" %(self.doc.name, self.doc.modified, self.doc.customer))
|
||||
get_obj('Sales Common').check_credit(self,self.doc.grand_total)
|
||||
|
||||
# Check for Approving Authority
|
||||
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.grand_total, self)
|
||||
|
||||
#update prevdoc status
|
||||
self.update_prevdoc_status('submit')
|
||||
# set SO status
|
||||
set(self.doc, 'status', 'Submitted')
|
||||
|
||||
# on submit notification
|
||||
if self.doc.email_id:
|
||||
get_obj('Notification Control').notify_contact('Sales Order',self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person)
|
||||
|
||||
|
||||
# ON CANCEL
|
||||
# ===============================================================================================
|
||||
def on_cancel(self):
|
||||
# Cannot cancel stopped SO
|
||||
if self.doc.status == 'Stopped':
|
||||
msgprint("Sales Order : '%s' cannot be cancelled as it is Stopped. Unstop it for any further transactions" %(self.doc.name))
|
||||
raise Exception
|
||||
self.check_nextdoc_docstatus()
|
||||
self.update_stock_ledger(update_stock = -1)
|
||||
self.set_sms_msg()
|
||||
|
||||
#update prevdoc status
|
||||
self.update_prevdoc_status('cancel')
|
||||
|
||||
# ::::::::: SET SO STATUS ::::::::::
|
||||
set(self.doc, 'status', 'Cancelled')
|
||||
|
||||
# CHECK NEXT DOCSTATUS
|
||||
# does not allow to cancel document if DN or RV made against it is SUBMITTED
|
||||
# ----------------------------------------------------------------------------
|
||||
def check_nextdoc_docstatus(self):
|
||||
# Checks Delivery Note
|
||||
submit_dn = sql("select t1.name from `tabDelivery Note` t1,`tabDelivery Note Detail` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
|
||||
if submit_dn:
|
||||
msgprint("Delivery Note : " + cstr(submit_dn[0][0]) + " has been submitted against " + cstr(self.doc.doctype) + ". Please cancel Delivery Note : " + cstr(submit_dn[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
|
||||
# Checks Receivable Voucher
|
||||
submit_rv = sql("select t1.name from `tabReceivable Voucher` t1,`tabRV Detail` t2 where t1.name = t2.parent and t2.sales_order = '%s' and t1.docstatus = 1" % (self.doc.name))
|
||||
if submit_rv:
|
||||
msgprint("Sales Invoice : " + cstr(submit_rv[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Sales Invoice : "+ cstr(submit_rv[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
|
||||
#check maintenance schedule
|
||||
submit_ms = 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",self.doc.name)
|
||||
if submit_ms:
|
||||
msgprint("Maintenance Schedule : " + cstr(submit_ms[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Maintenance Schedule : "+ cstr(submit_ms[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
|
||||
submit_mv = 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",self.doc.name)
|
||||
if submit_mv:
|
||||
msgprint("Maintenance Visit : " + cstr(submit_mv[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Maintenance Visit : " + cstr(submit_mv[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
|
||||
|
||||
|
||||
def check_modified_date(self):
|
||||
mod_db = sql("select modified from `tabSales Order` where name = '%s'" % self.doc.name)
|
||||
date_diff = sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
|
||||
|
||||
if date_diff and date_diff[0][0]:
|
||||
msgprint(cstr(self.doc.doctype) +" => "+ cstr(self.doc.name) +" has been modified. Please Refresh. ")
|
||||
raise Exception
|
||||
|
||||
# STOP SALES ORDER
|
||||
# ==============================================================================================
|
||||
# Stops Sales Order & no more transactions will be created against this Sales Order
|
||||
def stop_sales_order(self):
|
||||
self.check_modified_date()
|
||||
self.update_stock_ledger(update_stock = -1,clear = 1)
|
||||
# ::::::::: SET SO STATUS ::::::::::
|
||||
set(self.doc, 'status', 'Stopped')
|
||||
msgprint(self.doc.doctype + ": " + self.doc.name + " has been Stopped. To make transactions against this Sales Order you need to Unstop it.")
|
||||
|
||||
# UNSTOP SALES ORDER
|
||||
# ==============================================================================================
|
||||
# Unstops Sales Order & now transactions can be continued against this Sales Order
|
||||
def unstop_sales_order(self):
|
||||
self.check_modified_date()
|
||||
self.update_stock_ledger(update_stock = 1,clear = 1)
|
||||
# ::::::::: SET SO STATUS ::::::::::
|
||||
set(self.doc, 'status', 'Submitted')
|
||||
msgprint(self.doc.doctype + ": " + self.doc.name + " has been Unstopped.")
|
||||
|
||||
# UPDATE STOCK LEDGER
|
||||
# ===============================================================================================
|
||||
def update_stock_ledger(self, update_stock, clear = 0):
|
||||
for d in self.get_item_list(clear):
|
||||
stock_item = sql("SELECT is_stock_item FROM tabItem where name = '%s'"%(d[1]),as_dict = 1) # stock ledger will be updated only if it is a stock item
|
||||
if stock_item and stock_item[0]['is_stock_item'] == "Yes":
|
||||
if not d[0]:
|
||||
msgprint("Message: Please enter Reserved Warehouse for item %s as it is stock item."% d[1])
|
||||
raise Exception
|
||||
bin = get_obj('Warehouse', d[0]).update_bin( 0, flt(update_stock) * flt(d[2]), 0, 0, 0, d[1], self.doc.transaction_date)
|
||||
|
||||
# Gets Items from packing list
|
||||
#=================================
|
||||
def get_item_list(self, clear):
|
||||
return get_obj('Sales Common').get_item_list( self, clear)
|
||||
|
||||
# SET MESSAGE FOR SMS
|
||||
#======================
|
||||
def set_sms_msg(self, is_submitted = 0):
|
||||
if is_submitted:
|
||||
if not self.doc.amended_from:
|
||||
msg = 'Sales Order: '+self.doc.name+' has been made against PO no: '+cstr(self.doc.po_no)
|
||||
set(self.doc, 'message', msg)
|
||||
else:
|
||||
msg = 'Sales Order has been amended. New SO no:'+self.doc.name
|
||||
set(self.doc, 'message', msg)
|
||||
else:
|
||||
msg = 'Sales Order: '+self.doc.name+' has been cancelled.'
|
||||
set(self.doc, 'message', msg)
|
||||
|
||||
# SEND SMS
|
||||
# =========
|
||||
def send_sms(self):
|
||||
if not self.doc.customer_mobile_no:
|
||||
msgprint("Please enter customer mobile no")
|
||||
elif not self.doc.message:
|
||||
msgprint("Please enter the message you want to send")
|
||||
else:
|
||||
msgprint(get_obj("SMS Control", "SMS Control").send_sms([self.doc.customer_mobile_no,], self.doc.message))
|
||||
|
||||
# on update
|
||||
def on_update(self):
|
||||
pass
|
||||
|
||||
# Repair Sales Order
|
||||
# ===========================================
|
||||
def repair_sales_order(self):
|
||||
get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self)
|
||||
1371
selling/doctype/sales_order/sales_order.txt
Normal file
1371
selling/doctype/sales_order/sales_order.txt
Normal file
File diff suppressed because it is too large
Load Diff
0
selling/doctype/sales_order_detail/__init__.py
Normal file
0
selling/doctype/sales_order_detail/__init__.py
Normal file
515
selling/doctype/sales_order_detail/sales_order_detail.txt
Normal file
515
selling/doctype/sales_order_detail/sales_order_detail.txt
Normal file
@@ -0,0 +1,515 @@
|
||||
# DocType, Sales Order Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:22',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-04-12 14:08:58',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'SOD/.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tray',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 52
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Sales Order Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, Sales Order Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Sales Order Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'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',
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Item Name',
|
||||
'oldfieldname': 'item_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'width': '150'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 3,
|
||||
'in_filter': 1,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 4,
|
||||
'label': 'Quantity',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 5,
|
||||
'label': 'UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'reqd': 0,
|
||||
'width': '70px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'ref_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 6,
|
||||
'label': 'Ref Rate',
|
||||
'oldfieldname': 'ref_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '70px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'adj_rate',
|
||||
'fieldtype': 'Float',
|
||||
'idx': 7,
|
||||
'label': 'Discount(%)',
|
||||
'oldfieldname': 'adj_rate',
|
||||
'oldfieldtype': 'Float',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '70px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'export_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Rate',
|
||||
'oldfieldname': 'export_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'export_amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Amount',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': 'export_amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'reqd': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'base_ref_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 10,
|
||||
'label': 'Ref Rate*',
|
||||
'oldfieldname': 'base_ref_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'basic_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 11,
|
||||
'label': 'Basic Rate*',
|
||||
'oldfieldname': 'basic_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 12,
|
||||
'label': 'Amount*',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': 'amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reserved_warehouse',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 13,
|
||||
'label': 'Reserved Warehouse',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'reserved_warehouse',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Warehouse',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'projected_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 14,
|
||||
'label': 'Projected Qty',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'projected_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'width': '70px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'actual_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 15,
|
||||
'label': 'Actual Qty',
|
||||
'no_copy': 1,
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'width': '70px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'indented_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 16,
|
||||
'label': 'Indented Qty',
|
||||
'no_copy': 1,
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'width': '70px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'delivered_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 0,
|
||||
'idx': 17,
|
||||
'in_filter': 0,
|
||||
'label': 'Delivered Qty',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'delivered_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'billed_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 18,
|
||||
'in_filter': 0,
|
||||
'label': 'Billed Qty',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'billed_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'billed_amt',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 19,
|
||||
'label': 'Billed Amt',
|
||||
'no_copy': 1,
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'For Production',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'planned_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 1,
|
||||
'idx': 20,
|
||||
'label': 'Planned Quantity',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'planned_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'width': '50px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'For Production',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'produced_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 1,
|
||||
'idx': 21,
|
||||
'label': 'Produced Quantity',
|
||||
'oldfieldname': 'produced_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'width': '50px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'brand',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 22,
|
||||
'in_filter': 1,
|
||||
'label': 'Brand Name',
|
||||
'oldfieldname': 'brand',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Brand',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_group',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 23,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Group',
|
||||
'oldfieldname': 'item_group',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item Group',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_docname',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 24,
|
||||
'in_filter': 1,
|
||||
'label': 'Quotation No.',
|
||||
'oldfieldname': 'prevdoc_docname',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Quotation',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'page_break',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 25,
|
||||
'label': 'Page Break',
|
||||
'oldfieldname': 'page_break',
|
||||
'oldfieldtype': 'Check',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'required for production. will be used later.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'delivery_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 0,
|
||||
'idx': 26,
|
||||
'label': 'Expected Delivery Date',
|
||||
'oldfieldname': 'delivery_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'description': 'required for production. will be used later.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'confirmation_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 0,
|
||||
'idx': 27,
|
||||
'in_filter': 1,
|
||||
'label': 'Confirmed Delivery Date',
|
||||
'oldfieldname': 'confirmation_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_tax_rate',
|
||||
'fieldtype': 'Small Text',
|
||||
'hidden': 1,
|
||||
'idx': 28,
|
||||
'label': 'Item Tax Rate',
|
||||
'oldfieldname': 'item_tax_rate',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'The date at which current entry is made in system.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'transaction_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 29,
|
||||
'in_filter': 0,
|
||||
'label': 'Sales Order Date',
|
||||
'oldfieldname': 'transaction_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'search_index': 0
|
||||
}
|
||||
]
|
||||
0
selling/doctype/sales_team/__init__.py
Normal file
0
selling/doctype/sales_team/__init__.py
Normal file
135
selling/doctype/sales_team/sales_team.txt
Normal file
135
selling/doctype/sales_team/sales_team.txt
Normal file
@@ -0,0 +1,135 @@
|
||||
# DocType, Sales Team
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:23',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-11-24 09:09:57',
|
||||
'modified_by': 'nabin@webnotestech.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tray',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 5
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Sales Team',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, Sales Team
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Sales Team'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_person',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'in_filter': 1,
|
||||
'label': 'Sales Person',
|
||||
'oldfieldname': 'sales_person',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Sales Person',
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'width': '200px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_designation',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Designation',
|
||||
'oldfieldname': 'sales_designation',
|
||||
'oldfieldtype': 'Data',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_no',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 3,
|
||||
'label': 'Contact No.',
|
||||
'oldfieldname': 'contact_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'allocated_percentage',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 4,
|
||||
'label': 'Allocated (%)',
|
||||
'oldfieldname': 'allocated_percentage',
|
||||
'oldfieldtype': 'Currency',
|
||||
'reqd': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'allocated_amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 5,
|
||||
'label': 'Allocated Amount',
|
||||
'oldfieldname': 'allocated_amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'reqd': 0,
|
||||
'width': '120px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'parenttype',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 6,
|
||||
'in_filter': 1,
|
||||
'label': 'Parenttype',
|
||||
'oldfieldname': 'parenttype',
|
||||
'oldfieldtype': 'Data',
|
||||
'print_hide': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'incentives',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Incentives',
|
||||
'oldfieldname': 'incentives',
|
||||
'oldfieldtype': 'Currency'
|
||||
}
|
||||
]
|
||||
0
selling/doctype/shipping_address/__init__.py
Executable file
0
selling/doctype/shipping_address/__init__.py
Executable file
4
selling/doctype/shipping_address/shipping_address.js
Executable file
4
selling/doctype/shipping_address/shipping_address.js
Executable file
@@ -0,0 +1,4 @@
|
||||
// Get Customer Details
|
||||
// =====================================================================
|
||||
cur_frm.add_fetch('customer','customer_name','customer_name');
|
||||
cur_frm.add_fetch('customer','address','customer_address');
|
||||
25
selling/doctype/shipping_address/shipping_address.py
Executable file
25
selling/doctype/shipping_address/shipping_address.py
Executable file
@@ -0,0 +1,25 @@
|
||||
import webnotes
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
# on update
|
||||
# ----------
|
||||
def on_update(self):
|
||||
self.update_primary_shipping_address()
|
||||
self.get_customer_details()
|
||||
|
||||
# set is_primary_address for other shipping addresses belonging to same customer
|
||||
# -------------------------------------------------------------------------------
|
||||
def update_primary_shipping_address(self):
|
||||
if self.doc.is_primary_address == 'Yes':
|
||||
sql("update `tabShipping Address` set is_primary_address = 'No' where customer = %s and is_primary_address = 'Yes' and name != %s",(self.doc.customer, self.doc.name))
|
||||
|
||||
# Get Customer Details
|
||||
# ---------------------
|
||||
def get_customer_details(self):
|
||||
det = sql("select customer_name, address from tabCustomer where name = '%s'" % (self.doc.customer))
|
||||
self.doc.customer_name = det and det[0][0] or ''
|
||||
self.doc.customer_address = det and det[0][1] or ''
|
||||
193
selling/doctype/shipping_address/shipping_address.txt
Executable file
193
selling/doctype/shipping_address/shipping_address.txt
Executable file
@@ -0,0 +1,193 @@
|
||||
# DocType, Shipping Address
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-03-23 10:39:45',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-03-24 10:39:09',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'allow_trash': 1,
|
||||
'autoname': 'SA.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'search_fields': 'customer, ship_to, shipping_address',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 8
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Shipping Address',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Shipping Address',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Shipping Address
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Shipping Address'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Master Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Master Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Manager'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 2,
|
||||
'label': 'Customer',
|
||||
'options': 'Customer',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'label': 'Customer Name',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_address',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 4,
|
||||
'label': 'Customer Address',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'ship_to',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 5,
|
||||
'label': 'Ship To',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'shipping_address',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 6,
|
||||
'label': 'Shipping Address',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 7,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_primary_address',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 8,
|
||||
'label': 'Is Primary Address',
|
||||
'options': 'Yes\nNo',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'shipping_details',
|
||||
'fieldtype': 'Text Editor',
|
||||
'idx': 9,
|
||||
'label': 'Shipping Details',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 10,
|
||||
'label': 'Trash Reason',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
0
selling/doctype/sms_center/__init__.py
Normal file
0
selling/doctype/sms_center/__init__.py
Normal file
0
selling/doctype/sms_center/sms_center.js
Normal file
0
selling/doctype/sms_center/sms_center.js
Normal file
67
selling/doctype/sms_center/sms_center.py
Normal file
67
selling/doctype/sms_center/sms_center.py
Normal file
@@ -0,0 +1,67 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
# ----------
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def create_receiver_list(self):
|
||||
rec, where_clause = '', ''
|
||||
if self.doc.send_to == 'All Customer Contact':
|
||||
where_clause = self.doc.customer and " and customer = '%s'" % self.doc.customer or " and ifnull(is_customer, 0) = 1"
|
||||
if self.doc.send_to == 'All Supplier Contact':
|
||||
where_clause = self.doc.supplier and " and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % self.doc.supplier or " and ifnull(is_supplier, 0) = 1"
|
||||
if self.doc.send_to == 'All Sales Partner Contact':
|
||||
where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_aprtner = '%s'" % self.doc.sales_partner or " and ifnull(is_sales_partner, 0) = 1"
|
||||
msgprint(1)
|
||||
if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']:
|
||||
msgprint("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause)
|
||||
rec = sql("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause)
|
||||
elif self.doc.send_to == 'All Lead (Open)':
|
||||
rec = sql("select lead_name, mobile_no from tabLead where ifnull(mobile_no,'')!='' and docstatus != 2 and status = 'Open'")
|
||||
elif self.doc.send_to == 'All Employee (Active)':
|
||||
where_clause = self.doc.department and " and t1.department = '%s'" % self.doc.department or ""
|
||||
where_clause += self.doc.branch and " and t1.branch = '%s'" % self.doc.branch or ""
|
||||
rec = sql("select t1.employee_name, t2.cell_number from `tabEmployee` t1, `tabEmployee Profile` t2 where t2.employee = t1.name and t1.status = 'Active' and t1.docstatus != 2 and ifnull(t2.cell_number,'')!='' %s" % where_clause)
|
||||
elif self.doc.send_to == 'All Sales Person':
|
||||
rec = sql("select sales_person_name, mobile_no from `tabSales Person` where docstatus != 2 and ifnull(mobile_no,'')!=''")
|
||||
|
||||
rec_list = ''
|
||||
for d in rec:
|
||||
rec_list += d[0] + ' - ' + d[1] + '\n'
|
||||
self.doc.receiver_list = rec_list
|
||||
|
||||
def get_receiver_nos(self):
|
||||
receiver_nos = []
|
||||
for d in self.doc.receiver_list.split('\n'):
|
||||
receiver_no = d
|
||||
if '-' in d:
|
||||
receiver_no = receiver_no.split('-')[1]
|
||||
if receiver_no.strip():
|
||||
receiver_nos.append(cstr(receiver_no).strip())
|
||||
return receiver_nos
|
||||
|
||||
def send_sms(self):
|
||||
if not self.doc.message:
|
||||
msgprint("Please enter message before sending")
|
||||
else:
|
||||
receiver_list = self.get_receiver_nos()
|
||||
if receiver_list:
|
||||
msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, cstr(self.doc.message)))
|
||||
195
selling/doctype/sms_center/sms_center.txt
Normal file
195
selling/doctype/sms_center/sms_center.txt
Normal file
@@ -0,0 +1,195 @@
|
||||
# DocType, SMS Center
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-01-11 17:52:26',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-02-15 17:06:33',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1300788634',
|
||||
'allow_attach': 0,
|
||||
'allow_copy': 1,
|
||||
'allow_email': 1,
|
||||
'allow_print': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'hide_heading': 0,
|
||||
'hide_toolbar': 0,
|
||||
'in_create': 0,
|
||||
'issingle': 1,
|
||||
'menu_index': 4,
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'read_only': 1,
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 1,
|
||||
'version': 39
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'SMS Center',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'SMS Center',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocType, SMS Center
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'SMS Center'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'column_break1',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 1,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'send_to',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 2,
|
||||
'label': 'Send To',
|
||||
'options': '\nAll Contact\nAll Customer Contact\nAll Supplier Contact\nAll Sales Partner Contact\nAll Lead (Open)\nAll Employee (Active)\nAll Sales Person',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': "eval:doc.send_to=='All Customer Contact'",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'Customer',
|
||||
'options': 'Customer'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': "eval:doc.send_to=='All Supplier Contact'",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 4,
|
||||
'label': 'Supplier',
|
||||
'options': 'Supplier'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': "eval:doc.send_to=='All Employee (Active)'",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'department',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 5,
|
||||
'label': 'Department',
|
||||
'options': 'link:Department'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': "eval:doc.send_to=='All Employee (Active)'",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'branch',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 6,
|
||||
'label': 'Branch',
|
||||
'options': 'link:Branch'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 7,
|
||||
'label': 'Create Receiver List',
|
||||
'options': 'create_receiver_list'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'receiver_list',
|
||||
'fieldtype': 'Code',
|
||||
'idx': 8,
|
||||
'label': 'Receiver List'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'column_break9',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 9,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'Message greater than 160 character will be splitted into multiple mesage',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'message',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 10,
|
||||
'label': 'Message',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 11,
|
||||
'label': 'Send SMS',
|
||||
'options': 'send_sms'
|
||||
}
|
||||
]
|
||||
0
selling/page/__init__.py
Normal file
0
selling/page/__init__.py
Normal file
0
selling/page/customers/__init__.py
Normal file
0
selling/page/customers/__init__.py
Normal file
1
selling/page/customers/customers.html
Normal file
1
selling/page/customers/customers.html
Normal file
@@ -0,0 +1 @@
|
||||
<div id="dcv_customers"></div>
|
||||
34
selling/page/customers/customers.js
Normal file
34
selling/page/customers/customers.js
Normal file
@@ -0,0 +1,34 @@
|
||||
//make tabs
|
||||
|
||||
pscript.onload_customers = function() {
|
||||
make_customer_tab($i('dcv_customers'));
|
||||
}
|
||||
|
||||
function make_customer_tab(parent) {
|
||||
pscript.dcv_customers = new wn.widgets.DocColumnView('Customers', parent,
|
||||
['Customer Group', 'Customer', 'Contact'], {
|
||||
'Customer Group': {
|
||||
show_fields : ['name'],
|
||||
create_fields : ['name'],
|
||||
search_fields : ['name'],
|
||||
next_col: 'Customer'
|
||||
},
|
||||
'Customer': {
|
||||
show_fields : ['name', 'customer_name'],
|
||||
create_fields : ['name', 'customer_name'],
|
||||
search_fields : ['customer_name'],
|
||||
filter_by : ['Customer Group', 'customer_group'],
|
||||
next_col: 'Contact'
|
||||
},
|
||||
'Contact': {
|
||||
show_fields : ['name', 'first_name', 'last_name'],
|
||||
create_fields : ['name','first_name', 'last_name'],
|
||||
search_fields : ['first_name', 'last_name'],
|
||||
conditions: ['is_customer=1'],
|
||||
set_values: {'is_customer': 1 },
|
||||
filter_by : ['Customer', 'customer']
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
26
selling/page/customers/customers.txt
Normal file
26
selling/page/customers/customers.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
'content': None,
|
||||
'creation': '2011-03-25 13:48:50',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Page',
|
||||
'icon': None,
|
||||
'idx': None,
|
||||
'menu_index': None,
|
||||
'modified': '2011-03-25 13:48:50',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'CRM',
|
||||
'name': 'customers',
|
||||
'owner': 'Administrator',
|
||||
'page_name': 'Customers',
|
||||
'parent': None,
|
||||
'parent_node': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'script': None,
|
||||
'show_in_menu': None,
|
||||
'standard': 'Yes',
|
||||
'static_content': None,
|
||||
'style': None
|
||||
}
|
||||
]
|
||||
0
selling/page/sales_browser/__init__.py
Normal file
0
selling/page/sales_browser/__init__.py
Normal file
4
selling/page/sales_browser/sales_browser.html
Normal file
4
selling/page/sales_browser/sales_browser.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class="layout_wrapper">
|
||||
<div id="tr_header"></div>
|
||||
<div id="tr_body" style="margin: 16px"></div>
|
||||
</div>
|
||||
421
selling/page/sales_browser/sales_browser.js
Normal file
421
selling/page/sales_browser/sales_browser.js
Normal file
@@ -0,0 +1,421 @@
|
||||
pscript['onload_Sales Browser'] = function(){
|
||||
var parent = $i('tr_body');
|
||||
parent.innerHTML = 'Please select your chart: '
|
||||
var sel = $a(parent,'select');
|
||||
add_sel_options(sel, ['Territory', 'Customer Group', 'Item Group', 'Sales Person'], 'Territory');
|
||||
var btn = $btn(parent, 'Go', function() { new SalesBrowser().set_val(sel_val(sel)) }, {marginTop:'8px'});
|
||||
}
|
||||
|
||||
//================================= SalesBrowser Class ======================================
|
||||
SalesBrowser = function(){
|
||||
|
||||
this.make_body = function(){
|
||||
|
||||
$i('tr_header').innerHTML = '';
|
||||
$i('tr_body').innerHTML = '';
|
||||
//make header
|
||||
var desc = this.sel;
|
||||
var me = this;
|
||||
var h = new PageHeader($i('tr_header'),desc);
|
||||
h.add_button('New '+this.sel, function() { me.set_dialog(1); }, 0, 'ui-icon-plus', 1);
|
||||
h.add_button('Refresh', function() { me.refresh_tree(); }, 0, 'ui-icon-refresh');
|
||||
|
||||
var div_body = $a($i('tr_body'),'div');
|
||||
var tr_main_grid = make_table(div_body,1,2,'100%',['60%','40%'],{width: "100%", tableLayout: "fixed", borderCollapse: "collapse", border:"0px", padding:"4px 4px 4px 4px"});
|
||||
|
||||
$y($td(tr_main_grid,0,0),{border: "1px solid #dddddd", padding: "8px", width: "60%"});
|
||||
this.tree_area = $a($td(tr_main_grid,0,0),'div');
|
||||
|
||||
$y($td(tr_main_grid,0,1),{border: "1px solid #DDD"});
|
||||
this.detail_area = $a($td(tr_main_grid,0,1),'div');
|
||||
|
||||
this.make_tree_body(this.tree_area);
|
||||
this.refresh_tree();
|
||||
}
|
||||
|
||||
this.set_val = function(b){
|
||||
var me = this;
|
||||
me.sel = b;
|
||||
me.make_body();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================================================
|
||||
SalesBrowser.prototype.make_tree_body = function(parent){
|
||||
|
||||
//this.tab2 =make_table(this.wrapper,1,2,'100%',['60%','40%']);
|
||||
this.make_tree();
|
||||
this.make_rgt_sect();
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================================================================
|
||||
SalesBrowser.prototype.make_rgt_sect=function(){
|
||||
//var d = $a($td(this.tab2,0,1),'div','',{border:'1px solid #000'});
|
||||
|
||||
this.rgt_tab =make_table(this.detail_area,4,1,'','',{padding:"4px",spacing:"4px"});
|
||||
this.dtl = $a($td(this.rgt_tab,0,0),'div');
|
||||
this.btn = $a($td(this.rgt_tab,1,0),'div','span');
|
||||
this.help = $a($td(this.rgt_tab,2,0),'div');
|
||||
this.help.innerHTML = "Note: Explore and click on the tree node to see details."
|
||||
|
||||
this.set_btn();
|
||||
}
|
||||
//=================================================================================================================================
|
||||
SalesBrowser.prototype.set_btn = function(){
|
||||
var me = this;
|
||||
this.edit_btn = $btn(this.btn,'Edit',function(){ me.set_dialog(2); });
|
||||
|
||||
this.trash_btn = $btn(this.btn,'Trash',null);
|
||||
this.trash_btn.onclick = function(){
|
||||
var check = confirm("Are you sure you want to trash "+me.cur_node.rec.name+" node?");
|
||||
|
||||
if(check){
|
||||
var arg = [me.cur_node.rec.name, me.sel];
|
||||
$c_obj('Sales Browser Control','trash_record',arg.join(','),function(r,rt){ me.refresh_tree();});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=====================================================
|
||||
SalesBrowser.prototype.set_dialog = function(f){
|
||||
|
||||
|
||||
if(this.sel == 'Territory')
|
||||
new MakeDialog('Territory','territory',f,this); //Territory Dialog
|
||||
if(this.sel == 'Customer Group')
|
||||
new MakeDialog('Customer Group','customer_group',f,this); //Customer Group Dialog
|
||||
if(this.sel == 'Item Group')
|
||||
new MakeDialog('Item Group','item_group',f,this); //Item Group Dialog
|
||||
if(this.sel == 'Sales Person')
|
||||
new MakeDialog('Sales Person','sales_person',f,this);//Sales Person Dialog
|
||||
|
||||
}
|
||||
//=====================================================Make Tree============================================================================
|
||||
SalesBrowser.prototype.make_tree = function() {
|
||||
var me = this;
|
||||
|
||||
this.tree = new Tree(this.tree_area, '100%');
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------------
|
||||
// on click
|
||||
this.tree.std_onclick = function(node) {
|
||||
|
||||
me.cur_node = node;
|
||||
if(node.rec.name =='All Customer Groups' || node.rec.name =='All Sales Persons' || node.rec.name =='All Item Groups' || node.rec.name =='All Territories'){
|
||||
//$di(me.add_btn);
|
||||
|
||||
$dh(me.edit_btn);
|
||||
$dh(me.trash_btn);
|
||||
}
|
||||
else{
|
||||
//$di(me.add_btn);
|
||||
//if(node.has_children == false)
|
||||
//$dh(me.add_btn);
|
||||
|
||||
$di(me.edit_btn);
|
||||
$di(me.trash_btn);
|
||||
|
||||
}
|
||||
me.make_details();
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------------------
|
||||
// on expand
|
||||
this.tree.std_onexp = function(node) {
|
||||
|
||||
if(node.expanded_once)return;
|
||||
$di(node.loading_div);
|
||||
|
||||
var callback = function(r,rt) {
|
||||
|
||||
$dh(node.loading_div);
|
||||
var n = me.tree.allnodes[r.message.parent];
|
||||
var cl = r.message.cl;
|
||||
|
||||
for(var i=0;i<cl.length;i++) {
|
||||
var imgsrc=null;
|
||||
var has_children = true;
|
||||
|
||||
if(cl[i].is_group=='No') {
|
||||
var imgsrc = 'images/icons/page.gif';
|
||||
has_children = false;
|
||||
}
|
||||
var t = me.tree.addNode(n, cl[i].name, imgsrc,me.tree.std_onclick, has_children ? me.tree.std_onexp : null);
|
||||
t.rec = cl[i];
|
||||
t.parent_account = r.message.parent;
|
||||
t.has_children = has_children;
|
||||
}
|
||||
|
||||
}
|
||||
var arg = [node.rec.name, me.sel];
|
||||
$c_obj('Sales Browser Control','get_record_list',arg.join(','),callback);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================================================================
|
||||
SalesBrowser.prototype.make_details = function(){
|
||||
var me = this;
|
||||
var callback = function(r,rt){
|
||||
|
||||
me.dtl.innerHTML = "";
|
||||
//me.dtl_tab = make_table(me.dtl,3,2,'','',{tableLayout:'fixed',borderCollapse: 'collapse'})
|
||||
|
||||
var h = $a(me.dtl,'h3','',{padding:'4px', margin:'0px',backgroundColor:'#EEEEEE',borderBottom:'1px solid #AAAAAA'});
|
||||
$(h).html(r.message.name);
|
||||
|
||||
var d = $a(me.dtl,'div');
|
||||
me.dtl_tab = make_table(me.dtl,3,2,'','',{tableLayout:'fixed',borderCollapse: 'collapse',padding:'4px'})
|
||||
$td(me.dtl_tab,0,0).innerHTML="Parent";
|
||||
if(r.message.parent != '')
|
||||
$td(me.dtl_tab,0,1).innerHTML=": "+r.message.parent;
|
||||
else
|
||||
$td(me.dtl_tab,0,1).innerHTML=": ----";
|
||||
$td(me.dtl_tab,1,0).innerHTML="Has Child Node";
|
||||
$td(me.dtl_tab,1,1).innerHTML=": "+r.message.is_group;
|
||||
|
||||
|
||||
me.open_doc = $a(me.dtl,'div','link_type',{paddingTop:'14px'});
|
||||
me.open_doc.innerHTML = "Click here to open "+r.message.name;
|
||||
|
||||
me.open_doc.onclick = function(){
|
||||
loaddoc(me.sel,r.message.name );
|
||||
}
|
||||
}
|
||||
|
||||
var arg = [this.cur_node.rec.name, this.sel];
|
||||
|
||||
$c_obj('Sales Browser Control','get_record',arg.join(','),callback);
|
||||
|
||||
}
|
||||
//=================================================================================================================================
|
||||
SalesBrowser.prototype.refresh_tree=function(){
|
||||
|
||||
this.tree_area.innerHTML = '';
|
||||
this.dtl.innerHTML = '';
|
||||
this.first_level_node(); //set root
|
||||
//hide add, edit, trash buttons
|
||||
//$dh(this.add_btn);
|
||||
$dh(this.edit_btn);
|
||||
$dh(this.trash_btn);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//=============================== make first level node ================================================
|
||||
SalesBrowser.prototype.first_level_node = function(){
|
||||
|
||||
var me = this;
|
||||
var callback = function(r,rt) {
|
||||
|
||||
var cl = r.message.cl;
|
||||
|
||||
for(var i=0;i<cl.length;i++) {
|
||||
var imgsrc=null;
|
||||
var has_children = true;
|
||||
|
||||
if(cl[i].is_group=='No') {
|
||||
var imgsrc = 'images/icons/page.gif';
|
||||
has_children = false;
|
||||
}
|
||||
me.tree_area.innerHTML = '';
|
||||
if(me.tree) {
|
||||
|
||||
me.tree.innerHTML = '';
|
||||
me.tree.body.innerHTML = '';
|
||||
|
||||
me.make_tree();
|
||||
}
|
||||
|
||||
var t = me.tree.addNode(null, cl[i].name, imgsrc,me.tree.std_onclick, has_children ? me.tree.std_onexp : null);
|
||||
t.rec ={};
|
||||
t.rec.name = cl[i].name;
|
||||
t.has_children = has_children;
|
||||
}
|
||||
}
|
||||
|
||||
$c_obj('Sales Browser Control','get_fl_node',this.sel,callback);
|
||||
|
||||
}
|
||||
|
||||
//========================================= Dialog Section ===================================================================
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
//========================================================================
|
||||
MakeDialog=function(label,field_name,n,cls_obj){
|
||||
|
||||
var new_head = 'Create A New '+label;
|
||||
|
||||
this.label = label;
|
||||
|
||||
this.lbl_rec = label+' Name';
|
||||
this.field_name = field_name;
|
||||
this.n = n;
|
||||
this.cls_obj=cls_obj;
|
||||
//-----------------------------------------------
|
||||
|
||||
this.main_dialog = new Dialog(400,300,new_head);
|
||||
this.set_dg_fields();
|
||||
this.set_dg_values();
|
||||
//-----------------------------------------------
|
||||
this.new_main_dialog = this.main_dialog;
|
||||
|
||||
this.new_main_dialog.show();
|
||||
|
||||
}
|
||||
//=================================================================================================================================
|
||||
MakeDialog.prototype.set_dg_fields = function(){
|
||||
|
||||
var bd_lst = [];
|
||||
bd_lst.push(['HTML','Heading'],['Data',this.lbl_rec],['Select','Parent'],['Select','Has Child Node']);
|
||||
if(this.cls_obj.sel == 'Sales Person')
|
||||
bd_lst.push(['HTML','','All nodes are allowed in transaction.']);
|
||||
else
|
||||
bd_lst.push(['HTML','','Only leaf nodes are allowed in transaction.']);
|
||||
if(this.n==1)
|
||||
bd_lst.push(['Button','Create']);
|
||||
|
||||
if(this.n==2){
|
||||
bd_lst.push(['Button','Update']);
|
||||
this.set_edit_fields();
|
||||
}
|
||||
|
||||
this.main_dialog.make_body(bd_lst);
|
||||
|
||||
//-----------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
//====================================================================================================================================
|
||||
MakeDialog.prototype.set_edit_fields=function(){
|
||||
var me = this;
|
||||
var callback = function(r,rt){
|
||||
|
||||
me.main_dialog.widgets[me.lbl_rec].value = r.message.name;
|
||||
|
||||
add_sel_options(me.main_dialog.widgets['Parent'], r.message.parent_lst,r.message.parent);
|
||||
me.main_dialog.widgets['Has Child Node'].value = r.message.is_group;
|
||||
}
|
||||
|
||||
var arg = [this.cls_obj.cur_node.rec.name, this.cls_obj.sel];
|
||||
|
||||
$c_obj('Sales Browser Control','get_record',arg.join(','),callback);
|
||||
}
|
||||
//======================================= Validation - fields entered or not =================================================
|
||||
MakeDialog.prototype.validate = function(){
|
||||
|
||||
if(!this.main_dialog.widgets[this.lbl_rec].value) {
|
||||
err_msg1 ='Please enter '+this.label +' Name'
|
||||
alert(err_msg1);
|
||||
return 1;
|
||||
}
|
||||
if(!this.main_dialog.widgets['Parent'].value){
|
||||
alert('Please enter Parent Name' );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================================
|
||||
MakeDialog.prototype.set_dg_values = function(){
|
||||
if(this.n==1){
|
||||
var me = this;
|
||||
var callback = function(r,rt){
|
||||
me.main_dialog.widgets[me.lbl_rec].disabled = 0;
|
||||
me.main_dialog.widgets['Parent'].disabled = 0;
|
||||
|
||||
add_sel_options(me.main_dialog.widgets['Parent'],r.message);
|
||||
//add_sel_options(this.main_dialog.widgets['Parent'], [this.cls_obj.cur_node.rec.name]);
|
||||
me.btn_onclick('Create',me.cls_obj);
|
||||
}
|
||||
|
||||
$c_obj('Sales Browser Control','get_parent_lst',this.cls_obj.sel,callback);
|
||||
|
||||
}
|
||||
if(this.n == 2){
|
||||
this.main_dialog.widgets[this.lbl_rec].disabled = 1;
|
||||
this.main_dialog.widgets['Parent'].disabled = 0;
|
||||
this.btn_onclick('Update');
|
||||
this.old_value = sel_val(this.main_dialog.widgets['Parent']);
|
||||
}
|
||||
|
||||
add_sel_options(this.main_dialog.widgets['Has Child Node'], ['Yes','No'], 'No');
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================================================================
|
||||
//-----------------------------------------Dialog button onclick event----------------------------------------------
|
||||
MakeDialog.prototype.btn_onclick=function(btn_name){
|
||||
var me = this;
|
||||
this.btn_name = btn_name;
|
||||
this.main_dialog.widgets[this.btn_name].onclick = function() {
|
||||
|
||||
var callback=function(r,rt){
|
||||
if(r.message == 'true'){
|
||||
me.main_dialog.hide();
|
||||
}
|
||||
else{
|
||||
flag = me.validate();
|
||||
if(flag == 1) return;
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
||||
var arg2 = me.make_args();
|
||||
|
||||
//create Sales Person -- server to Sales Browser Control
|
||||
if(me.btn_name == "Create")
|
||||
method_name = "add_node";
|
||||
else
|
||||
method_name = "edit_node";
|
||||
|
||||
$c_obj('Sales Browser Control',method_name, docstring(arg2), function(r,rt) {
|
||||
me.main_dialog.widgets[me.lbl_rec].value='';
|
||||
me.main_dialog.hide();
|
||||
/*if(me.btn_name == "Create"){
|
||||
me.cls_obj.cur_node.clear_child_nodes();
|
||||
me.cls_obj.dtl.innerHTML = '';
|
||||
me.cls_obj.cur_node.expand();
|
||||
}
|
||||
else{
|
||||
me.cls_obj.refresh_tree();
|
||||
}*/
|
||||
me.cls_obj.refresh_tree();
|
||||
});
|
||||
}
|
||||
}
|
||||
var arg1 = {'node_title':me.cls_obj.sel,'is_group':sel_val(me.main_dialog.widgets['Has Child Node']),'lft':0,'rgt':0,'nm':me.main_dialog.widgets[me.lbl_rec].value,'parent_nm':sel_val(me.main_dialog.widgets['Parent']),'action':me.btn_name};
|
||||
$c_obj('Sales Browser Control','mvalidate',docstring(arg1),callback);
|
||||
}
|
||||
}
|
||||
//=================================================================================================================================
|
||||
|
||||
MakeDialog.prototype.make_args = function(){
|
||||
var args ={}; //args making
|
||||
var nt = this.cls_obj.sel;
|
||||
var nm = this.main_dialog.widgets[this.lbl_rec].value;
|
||||
var pnm = sel_val(this.main_dialog.widgets['Parent']);
|
||||
var grp = sel_val(this.main_dialog.widgets['Has Child Node']);
|
||||
|
||||
if(this.n==1)
|
||||
var old_prt ='';
|
||||
else if(this.n==2){
|
||||
if(this.old_value == sel_val(this.main_dialog.widgets['Parent']))
|
||||
var old_prt = '';
|
||||
else
|
||||
var old_prt = this.old_value;
|
||||
}
|
||||
|
||||
if(this.cls_obj.sel == 'Territory')
|
||||
return {'node_title':nt,'territory_name':nm,'parent_territory':pnm,'is_group':grp,'old_parent':old_prt}
|
||||
|
||||
else if(this.cls_obj.sel == 'Customer Group')
|
||||
return {'node_title':nt,'customer_group_name':nm,'parent_customer_group':pnm,'is_group':grp,'old_parent':old_prt}
|
||||
|
||||
else if(this.cls_obj.sel == 'Item Group')
|
||||
return {'node_title':nt,'item_group_name':nm,'parent_item_group':pnm,'is_group':grp,'old_parent':old_prt}
|
||||
|
||||
else if(this.cls_obj.sel == 'Sales Person')
|
||||
return {'node_title':nt,'sales_person_name':nm,'parent_sales_person':pnm,'is_group':grp,'old_parent':old_prt}
|
||||
|
||||
}
|
||||
51
selling/page/sales_browser/sales_browser.txt
Normal file
51
selling/page/sales_browser/sales_browser.txt
Normal file
@@ -0,0 +1,51 @@
|
||||
# Page, Sales Browser
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-12-14 10:23:21',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-24 11:56:34',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'page_name': 'Sales Browser',
|
||||
'show_in_menu': 0,
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# These values are common for all Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'name': '__common__',
|
||||
'parent': 'Sales Browser',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Page'
|
||||
},
|
||||
|
||||
# Page, Sales Browser
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': 'Sales Browser'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'idx': 1,
|
||||
'role': 'Sales Master Manager'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'idx': 2,
|
||||
'role': 'Material Master Manager'
|
||||
}
|
||||
]
|
||||
0
selling/page/sales_dashboard/__init__.py
Normal file
0
selling/page/sales_dashboard/__init__.py
Normal file
6
selling/page/sales_dashboard/sales_dashboard.html
Normal file
6
selling/page/sales_dashboard/sales_dashboard.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="layout_wrapper">
|
||||
<div id="pt_header"></div>
|
||||
<div id="pt_filters"></div>
|
||||
<p> </p>
|
||||
<div id="plot_test"></div>
|
||||
</div>
|
||||
301
selling/page/sales_dashboard/sales_dashboard.js
Normal file
301
selling/page/sales_dashboard/sales_dashboard.js
Normal file
@@ -0,0 +1,301 @@
|
||||
pscript['onload_Sales Dashboard'] = function() {
|
||||
var h = new PageHeader('pt_header','Sales Dashboard');
|
||||
|
||||
pscript.make_filters();
|
||||
$dh(pscript.mnt_div);
|
||||
$dh(pscript.mnt_div1);
|
||||
//pscript.dx_axis = [];
|
||||
|
||||
if($.jqplot) pscript.all_onchnge();
|
||||
else
|
||||
// import the library
|
||||
$c_js('jquery/jquery.jqplot.min.js', pscript.all_onchnge);
|
||||
}
|
||||
//=======================================================================
|
||||
pscript.make_filters = function(){
|
||||
this.tab = make_table('pt_filters', 2, 4, '800px', ['200px','200px','200px','200px'], {padding: '2px'});
|
||||
pscript.fiscal_year();
|
||||
pscript.report_type();
|
||||
pscript.item_grp();
|
||||
pscript.month_lst();
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
pscript.fiscal_year=function(){
|
||||
var me = this;
|
||||
$td(this.tab,0,0).innerHTML = "Select Year";
|
||||
this.sel_fy = $a($td(this.tab,1,0), 'select', null, {width:'120px'});
|
||||
$c_obj('Plot Control', 'get_fiscal_year', '', function(r,rt){
|
||||
if(r.message) fy_lst = r.message;
|
||||
else fy_lst = [];
|
||||
empty_select(me.sel_fy);
|
||||
add_sel_options(me.sel_fy,fy_lst);
|
||||
me.sel_fy.value = sys_defaults.fiscal_year;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
pscript.report_type=function(){
|
||||
$td(this.tab,0,1).innerHTML = "Select Report";
|
||||
this.sel_rpt = $a($td(this.tab,1,1), 'select', null, {width:'120px'});
|
||||
rpt_lst = ['Monthly','Weekly'];
|
||||
add_sel_options(this.sel_rpt,rpt_lst);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
pscript.item_grp=function(){
|
||||
var me = this;
|
||||
|
||||
$td(this.tab,0,2).innerHTML = "Select Item Group";
|
||||
|
||||
this.sel_grp = $a($td(this.tab,1,2), 'select', null, {width:'120px'});
|
||||
$c_obj('Plot Control', 'get_item_groups', '', function(r,rt){
|
||||
|
||||
itg_lst = r.message;
|
||||
itg_lst.push('All');
|
||||
|
||||
empty_select(me.sel_grp);
|
||||
add_sel_options(me.sel_grp, itg_lst.reverse());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
pscript.month_lst=function(){
|
||||
pscript.mnt_div1 = $a($td(this.tab,0,3));
|
||||
pscript.mnt_div1.innerHTML = "Select Month";
|
||||
pscript.mnt_div = $a($td(this.tab,1,3));
|
||||
this.sel_mnt = $a(pscript.mnt_div, 'select', null, {width:'120px'});
|
||||
mnt_lst = ['All','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
|
||||
add_sel_options(this.sel_mnt,mnt_lst);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
pscript.all_onchnge = function(){
|
||||
pscript.report_change();
|
||||
pscript.fiscal_year_onchnage();
|
||||
pscript.month_onchange();
|
||||
pscript.item_grp_onchange();
|
||||
pscript.monthly();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
pscript.report_change = function(){
|
||||
var me = this;
|
||||
this.sel_rpt.onchange = function(){
|
||||
|
||||
$dh(pscript.mnt_div);
|
||||
$dh(pscript.mnt_div1);
|
||||
if(me.sel_rpt.value == 'Monthly'){
|
||||
|
||||
pscript.monthly();
|
||||
}
|
||||
|
||||
else if(me.sel_rpt.value == 'Weekly'){
|
||||
$ds(pscript.mnt_div);
|
||||
$ds(pscript.mnt_div1);
|
||||
me.sel_mnt.value = 'All';
|
||||
pscript.get_x_dates();
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
me.sel_mnt.value = 'All';
|
||||
$i('plot_test').innerHTML = '';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
pscript.fiscal_year_onchnage = function(){
|
||||
var me = this;
|
||||
this.sel_fy.onchange = function(){
|
||||
|
||||
if(me.sel_rpt.value == 'Monthly'){
|
||||
|
||||
me.sel_mnt.value = 'All';
|
||||
$dh(pscript.mnt_div);
|
||||
$dh(pscript.mnt_div1);
|
||||
pscript.monthly();
|
||||
}
|
||||
else if(me.sel_rpt.value == 'Weekly' && me.sel_mnt.value){
|
||||
|
||||
pscript.get_x_dates();
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
me.sel_mnt.value = 'All';
|
||||
me.sel_rpt.value == '';
|
||||
$i('plot_test').innerHTML = '';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
pscript.month_onchange = function(){
|
||||
this.sel_mnt.onchange = function(){
|
||||
pscript.get_x_dates();
|
||||
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
pscript.item_grp_onchange=function(){
|
||||
var me = this;
|
||||
this.sel_grp.onchange = function(){
|
||||
|
||||
if(me.sel_rpt.value == 'Monthly'){
|
||||
|
||||
me.sel_mnt.value = 'All';
|
||||
$dh(pscript.mnt_div);
|
||||
$dh(pscript.mnt_div1);
|
||||
pscript.monthly();
|
||||
}
|
||||
else if(me.sel_rpt.value == 'Weekly' && me.sel_mnt.value){
|
||||
|
||||
pscript.get_x_dates();
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
me.sel_mnt.value = 'All';
|
||||
me.sel_rpt.value == '';
|
||||
$i('plot_test').innerHTML = '';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
pscript.get_x_dates=function(){
|
||||
|
||||
if(this.sel_mnt.value !='All'){
|
||||
|
||||
pscript.weekly();
|
||||
}
|
||||
else{
|
||||
|
||||
$c_obj('Plot Control','yr_wk_dates',this.sel_fy.value,
|
||||
function(r,rt){
|
||||
|
||||
pscript.dx_axis = r.message[0];
|
||||
|
||||
pscript.x_axis = r.message[1];
|
||||
|
||||
pscript.yearly();
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
pscript.draw_graph1 = function(x_axis,line1,t) {
|
||||
|
||||
t = t + " ("+sys_defaults.currency +")";
|
||||
$i('plot_test').innerHTML = '';
|
||||
// div plot_test contains the container div
|
||||
$.jqplot('plot_test', [line1],{
|
||||
title:t,
|
||||
axesDefaults: {
|
||||
min:0
|
||||
},
|
||||
|
||||
axes:{
|
||||
xaxis:{ticks:x_axis}
|
||||
}
|
||||
});
|
||||
}
|
||||
//=======================================================================
|
||||
pscript.monthly = function(){
|
||||
var callback = function(r,rt){
|
||||
x_axis = r.message.x_axis;
|
||||
msg_data = r.message.msg_data;
|
||||
|
||||
var line1 = [];
|
||||
for(var i=0; i<x_axis.length;i++){
|
||||
var f =0
|
||||
for(var j=0; j<msg_data.length;j++){
|
||||
if(msg_data[j] && x_axis[i]){
|
||||
if(x_axis[i][1] == msg_data[j][1])
|
||||
{
|
||||
line1.push([i+1,flt(msg_data[j][0])]);
|
||||
f = 1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(f == 0){
|
||||
line1.push([i+1,0]);
|
||||
}
|
||||
}
|
||||
pscript.draw_graph1(x_axis,line1,'Monthly Sales');
|
||||
}
|
||||
var val2 = '';
|
||||
if(this.sel_grp.value != 'All') val2 = this.sel_grp.value;
|
||||
$c_obj('Plot Control','get_monthwise_amount',[this.sel_fy.value,val2],callback);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
pscript.weekly = function(){
|
||||
|
||||
var callback = function(r,rt){
|
||||
|
||||
x_axis =[[1,'Week1'],[2,'Week2'],[3,'Week3'],[4,'Week4'],[5,'Week5'],[6,'Week6']];
|
||||
var line1 = [];
|
||||
for(var i=0; i<x_axis.length;i++){
|
||||
var f = 0;
|
||||
for(var j=0; j<r.message.length;j++){
|
||||
if(r.message[j]){
|
||||
if(r.message[j][1] == x_axis[i][1]){ line1.push([i+1,flt(r.message[j][0])]); f=1;}}
|
||||
}
|
||||
if(f == 0){
|
||||
line1.push([i+1,0]);
|
||||
}
|
||||
}
|
||||
|
||||
pscript.draw_graph1(x_axis,line1,'Weekly Sales');
|
||||
}
|
||||
dict_mnt={'Jan':1,'Feb':2,'Mar':3,'Apr':4,'May':5,'Jun':6,'Jul':7,'Aug':8,'Sep':9,'Oct':10,'Nov':11,'Dec':12};
|
||||
var val3 = '';
|
||||
if(this.sel_grp.value != 'All') val3 = this.sel_grp.value;
|
||||
$c_obj('Plot Control','get_weekwise_amount',[dict_mnt[this.sel_mnt.value],this.sel_fy.value,val3],callback);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
pscript.yearly = function(){
|
||||
|
||||
var callback = function(r,rt){
|
||||
|
||||
var line1 = [];
|
||||
for(var i=0; i<pscript.x_axis.length;i++){
|
||||
var f = 0
|
||||
for(var j=0; j<r.message.length;j++){
|
||||
if(r.message[j]){
|
||||
|
||||
if((r.message[j][1] == pscript.x_axis[i][1]) && (r.message[j][2] == pscript.x_axis[i][2])){ line1.push([pscript.x_axis[i][0],r.message[j][0]]); break; f =1;}
|
||||
}
|
||||
}
|
||||
if(f == 0){
|
||||
line1.push([pscript.x_axis[i][0],0]);
|
||||
}
|
||||
}
|
||||
|
||||
pscript.draw_graph1(pscript.dx_axis,line1,'Year-Weekly Sales');
|
||||
}
|
||||
var val2 = '';
|
||||
if(this.sel_grp.value != 'All') val2 = this.sel_grp.value;
|
||||
|
||||
|
||||
$c_obj('Plot Control','get_year_weekwise_amount',[this.sel_fy.value,val2],callback);
|
||||
}
|
||||
44
selling/page/sales_dashboard/sales_dashboard.txt
Normal file
44
selling/page/sales_dashboard/sales_dashboard.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
# Page, Sales Dashboard
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-10-12 15:19:32',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-25 00:00:00',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'harshada@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'page_name': 'Sales Dashboard',
|
||||
'show_in_menu': 0,
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# These values are common for all Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'idx': 1,
|
||||
'name': '__common__',
|
||||
'parent': 'Sales Dashboard',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Page',
|
||||
'role': 'Sales Manager'
|
||||
},
|
||||
|
||||
# Page, Sales Dashboard
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': 'Sales Dashboard'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role'
|
||||
}
|
||||
]
|
||||
0
selling/search_criteria/__init__.py
Normal file
0
selling/search_criteria/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
report.customize_filters = function() {
|
||||
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
'add_col': "(`tabDelivery Note Detail`.`qty`- ifnull(`tabDelivery Note Detail`.`installed_qty`, 0)) AS 'Pending to Install'",
|
||||
'add_cond': '`tabDelivery Note Detail`.`qty` > ifnull(`tabDelivery Note Detail`.`installed_qty`, 0)',
|
||||
'add_tab': None,
|
||||
'columns': 'Delivery Note\x01ID,Delivery Note\x01Status,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note\x01Contact Person,Delivery Note\x01Voucher Date,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Installed Qty,Delivery Note\x01% Installed',
|
||||
'creation': '2011-05-09 11:04:19',
|
||||
'criteria_name': 'Delivered Items to be Install',
|
||||
'custom_query': '',
|
||||
'description': 'Delivered Items to be Install',
|
||||
'dis_filters': None,
|
||||
'disabled': None,
|
||||
'doc_type': 'Delivery Note Detail',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
|
||||
'graph_series': None,
|
||||
'graph_values': None,
|
||||
'group_by': None,
|
||||
'idx': None,
|
||||
'modified': '2011-03-29 14:08:46',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'CRM',
|
||||
'name': 'delivered_items_to_be_install',
|
||||
'owner': 'Administrator',
|
||||
'page_len': 50,
|
||||
'parent': None,
|
||||
'parent_doc_type': 'Delivery Note',
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'report_script': None,
|
||||
'server_script': None,
|
||||
'sort_by': '`tabDelivery Note`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
'add_col': "SUM(`tabDelivery Note Detail`.`qty` - `tabDelivery Note Detail`.`billed_qty`) AS 'Pending Qty'\nSUM((`tabDelivery Note Detail`.`qty` - `tabDelivery Note Detail`.`billed_qty`) * `tabDelivery Note Detail`.`basic_rate`) AS 'Pending Amount'",
|
||||
'add_cond': "`tabDelivery Note`.status != 'Stopped'\nCASE WHEN `tabDelivery Note`.`per_billed` IS NULL OR `tabDelivery Note`.per_billed = '' THEN 0 < 100 ELSE `tabDelivery Note`.per_billed <100 END",
|
||||
'add_tab': None,
|
||||
'columns': 'Delivery Note\x01ID,Delivery Note\x01Owner,Delivery Note\x01Status,Delivery Note\x01Customer Name,Delivery Note\x01Voucher Date,Delivery Note\x01% Billed,Delivery Note\x01Posting Date,Delivery Note\x01Company Name,Delivery Note\x01Fiscal Year,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Against Document No,Delivery Note Detail\x01Document Type,Delivery Note Detail\x01Against Document Detail No',
|
||||
'creation': '2010-08-08 17:09:31',
|
||||
'criteria_name': 'Delivery Note Itemwise Pending To Bill',
|
||||
'custom_query': '',
|
||||
'description': None,
|
||||
'dis_filters': None,
|
||||
'disabled': None,
|
||||
'doc_type': 'Delivery Note Detail',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Company Name':'','Delivery Note\x01Fiscal Year':''}",
|
||||
'graph_series': None,
|
||||
'graph_values': None,
|
||||
'group_by': '`tabDelivery Note Detail`.item_code, `tabDelivery Note`.`name`',
|
||||
'idx': None,
|
||||
'modified': '2010-04-06 17:22:13',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'CRM',
|
||||
'name': 'delivery_note_itemwise_pending_to_bill',
|
||||
'owner': 'jai@webnotestech.com',
|
||||
'page_len': 50,
|
||||
'parent': None,
|
||||
'parent_doc_type': 'Delivery Note',
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'report_script': '',
|
||||
'server_script': None,
|
||||
'sort_by': '`tabDelivery Note`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
}
|
||||
]
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user