blob: d368aa00c9a3f4f7497b311922bb3416ab571736 [file] [log] [blame]
Pratik Vyasc1e6e4c2011-06-08 14:37:15 +05301# long patches
2import webnotes
3
4def set_subjects_and_tagfields():
5 subject_dict = {
6 'Item':'%(item_name)s',
7 'Customer':' ',
8 'Contact':'%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(contact_no)s',
9 'Supplier':' ',
10 'Lead':'%(lead_name)s from %(company_name)s | To Discuss: %(to_discuss)s',
11 'Quotation':'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
12 'Enquiry':'To %(customer_name)s%(lead_name)s on %(transaction_date)s',
13 'Sales Order':'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed',
14 'Delivery Note':'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
15 'Indent':'%(per_ordered)s% ordered',
16 'Purchase Order':'To %(supplier_name)s on %(transaction_date)s | %(per_received)s% delivered',
17 'Purchase Receipt':'From %(supplier_name)s against %(purchase_order)s on %(transaction_date)s',
18 'Receivable Voucher':'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
19 'Payable Voucher':'From %(supplier_name)s due on %(due_date)s | %(outstanding_amount)s outstanding',
20 'Journal Voucher':' ',
21 'Serial No':'%(item_code)s',
22 'Project':' ',
23 'Ticket':'%(subject)s',
24 'Timesheet':'%(owner)s',
25 'Support Ticket':'%(problem_description)s',
26 'Installation Note':'At %(customer_name)s on %(inst_date)s',
27 'Maintenance Visit':'To %(customer_name)s on %(mntc_date)s',
28 'Customer Issue':'%(complaint)s By %(complaint_raised_by)s on %(issue_date)s',
29 'Employee':'%(employee_name)s',
30 'Expense Voucher':'From %(employee_name)s for %(total_claimed_amount)s (claimed)',
31 'Appraisal':'',
32 'Leave Application':'From %(employee_name)s, %(designation)s',
33 'Salary Structure':'For %(employee_name)s',
34 'Salary Slip':'For %(employee_name)s, %(designation)s',
35 'Bill of Materials':'%(item_code)s'
36 }
37
38 tags_dict = {
39 'Item':'item_group',
40 'Customer':'customer_group,customer_type',
41 #'Contact':'',
42 'Supplier':'supplier_type',
43 'Lead':'status,source',
44 'Quotation':'status',
45 'Enquiry':'',
46 'Sales Order':'status',
47 'Delivery Note':'',
48 'Indent':'',
49 'Purchase Order':'',
50 'Purchase Receipt':'',
51 'Receivable Voucher':'',
52 'Payable Voucher':'',
53 'Journal Voucher':'voucher_type',
54 'Serial No':'status',
55 'Project':'status',
56 'Ticket':'status',
57 'Timesheet':'',
58 'Support Ticket':'',
59 'Installation Note':'',
60 'Maintenance Visit':'completion_status,maintenance_type',
61 'Customer Issue':'status',
62 'Employee':'status',
63 'Expense Voucher':'approval_status',
64 'Appraisal':'',
65 'Leave Application':'leave_type',
66 'Salary Structure':'',
67 'Bill of Materials':''
68 }
69
70 description_dict = {
71 'Property Setter':'Property Setter overrides a standard DocType or Field property',
72 'Custom Field':'Adds a custom field to a DocType',
73 'Custom Script':'Adds a custom script (client or server) to a DocType'
74 }
75
76 alldt = []
77
78 for dt in subject_dict:
79 webnotes.conn.sql('update tabDocType set subject=%s where name=%s', (subject_dict[dt], dt))
80 if not dt in alldt: alldt.append(dt)
81
82 for dt in tags_dict:
83 webnotes.conn.sql('update tabDocType set tag_fields=%s where name=%s', (tags_dict[dt], dt))
84 if not dt in alldt: alldt.append(dt)
85
86 for dt in description_dict:
87 webnotes.conn.sql('update tabDocType set description=%s where name=%s', (description_dict[dt], dt))
88 if not dt in alldt: alldt.append(dt)
89
90 #from webnotes.modules.export_module import export_to_files
91 #for dt in alldt:
92 # export_to_files(record_list=[['DocType',dt]])
93
94def support_patch():
95 # relaod support and other doctypes
96
97 from webnotes.modules.module_manager import reload_doc
98
99 webnotes.model.delete_doc('DocType','Support Ticket')
100 reload_doc('setup','doctype','support_email_settings')
101 reload_doc('maintenance','doctype','support_ticket')
102 reload_doc('maintenance','doctype','support_ticket_response')
103