diff --git a/accounts/doctype/fiscal_year/fiscal_year.py b/accounts/doctype/fiscal_year/fiscal_year.py index ca6bef2b2c..6dd4f2ca90 100644 --- a/accounts/doctype/fiscal_year/fiscal_year.py +++ b/accounts/doctype/fiscal_year/fiscal_year.py @@ -168,7 +168,7 @@ class DocType: against_voucher = sql("select against_voucher, against_voucher_type from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled, 'No')='No' and company=%s and ifnull(against_voucher, '') != '' and ifnull(against_voucher_type, '') != '' group by against_voucher, against_voucher_type", (self.doc.name, self.doc.company)) for d in against_voucher: # get voucher balance - bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled, 'No')='No'", (d[0], d[1])) + bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled, 'No') = 'No'", (d[0], d[1])) bal = bal and flt(bal[0][0]) or 0.0 if d[1] == 'Payable Voucher': bal = -bal diff --git a/home/__init__.py b/home/__init__.py index 4978791d72..bcfcbb7009 100644 --- a/home/__init__.py +++ b/home/__init__.py @@ -1,8 +1,9 @@ import webnotes +from webnotes import msgprint feed_dict = { # Project - 'Ticket': ['[%(status)s] %(subject)s', '#000080'], + 'Project': ['[%(status)s] %(subject)s', '#000080'], # Sales 'Lead': ['%(lead_name)s', '#000080'], @@ -29,12 +30,44 @@ feed_dict = { # Support 'Customer Issue': ['[%(status)s] %(description)s by %(customer_name)s', '#000080'], 'Maintenance Visit':['To %(customer_name)s', '#4169E1'], - 'Support Ticket': ['[%(status)s] %(subject)s', '#000080'] + 'Support Ticket': ['[%(status)s] %(subject)s', '#000080'] } +feed_dict_color = { + # Project + 'Project': '#000080', + + # Sales + 'Lead': '#000080', + 'Quotation': '#4169E1', + 'Sales Order': '#4169E1', + + # Purchase + 'Supplier': '#6495ED', + 'Purchase Order': '#4169E1', + + # Stock + 'Delivery Note': '#4169E1', + + # Accounts + 'Journal Voucher': '#4169E1', + 'Payable Voucher': '#4169E1', + 'Receivable Voucher': '#4169E1', + + # HR + 'Expense Voucher': '#4169E1', + 'Salary Slip': '#4169E1', + 'Leave Transaction': '#4169E1', + + # Support + 'Customer Issue': '#000080', + 'Maintenance Visit': '#4169E1', + 'Support Ticket': '#000080' +} def make_feed(doc, subject, color): "makes a new Feed record" + #msgprint(subject) from webnotes.model.doc import Document webnotes.conn.sql("delete from tabFeed where doc_type=%s and doc_name=%s", (doc.doctype, doc.name)) f = Document('Feed') @@ -43,11 +76,24 @@ def make_feed(doc, subject, color): f.subject = subject f.color = color f.save(1) + +def update_feed1(doc): + "adds a new feed" + prop_rec = webnotes.conn.sql("select value from `tabProperty Setter` where doc_type = %s and property = 'subject'", (doc.doctype)) + if prop_rec: + subject = prop_rec[0][0] + else: + rec = webnotes.conn.sql("select subject from tabDocType where name=%s", (doc.doctype)) + subject = rec[0][0] + subject, color = [subject, feed_dict_color.get(doc.doctype)] + if subject: + subject = subject % doc.fields + make_feed(doc, subject, color) + def update_feed(doc): "adds a new feed" subject, color = feed_dict.get(doc.doctype, [None, None]) if subject: subject = subject % doc.fields make_feed(doc, subject, color) - diff --git a/patches/patch.py b/patches/patch.py index f7953cbb87..53d7f10698 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1218,9 +1218,10 @@ def execute(patch_no): sql("delete from `tabDocField` where parent = 'company' and label = 'Trash Company' and fieldtype = 'Button'") reload_doc('setup', 'doctype', 'company') elif patch_no == 308: - from erpnext_structure_cleanup import run_patches - run_patches() + sql("update `tabDocField` set reqd = 0 where fieldname = 'select_item' and parent = 'Property Setter'") elif patch_no == 309: sql("delete from `tabDocField` where fieldname = 'item_attachments_details' and parent = 'Item'") - elif patch_no == 310: sql("delete from `tabModule Def Item` where parent = 'Stock' and doc_name = 'Landed Cost Wizard'") + elif patch_no == 310: + from erpnext_structure_cleanup import run_patches + run_patches() diff --git a/setup/doctype/sales_person/sales_person.py b/setup/doctype/sales_person/sales_person.py index 04a40bd6cd..fbcb83e58c 100644 --- a/setup/doctype/sales_person/sales_person.py +++ b/setup/doctype/sales_person/sales_person.py @@ -5,64 +5,60 @@ from webnotes.model.doc import Document from webnotes.model.doclist import getlist from webnotes.model.code import get_obj from webnotes import session, form, is_testing, msgprint, errprint - +from webnotes.utils import flt sql = webnotes.conn.sql convert_to_lists = webnotes.conn.convert_to_lists # ----------------------------------------------------------------------------------------- - class DocType: - def __init__(self, doc, doclist=[]): - self.doc = doc - self.doclist = doclist - self.nsm_parent_field = 'parent_sales_person'; - - 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)]) + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist + self.nsm_parent_field = 'parent_sales_person'; + + 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)]) - # update Node Set Model - def update_nsm_model(self): - import webnotes - import webnotes.utils.nestedset - webnotes.utils.nestedset.update_nsm(self) + # update Node Set Model + def update_nsm_model(self): + import webnotes + import webnotes.utils.nestedset + webnotes.utils.nestedset.update_nsm(self) - # ON UPDATE - #-------------------------------------- - def on_update(self): - # update nsm - self.update_nsm_model() + # ON UPDATE + #-------------------------------------- + def on_update(self): + # update nsm + self.update_nsm_model() - def validate(self): - from webnotes.utils import flt - for d in getlist(self.doclist, 'target_details'): - if not flt(d.target_qty) and not flt(d.target_amount): - msgprint("Either target qty or target amount is mandatory.") - raise Exception - - #self.sync_with_contact() - - def sync_with_contact(self): - cid = sql("select name from tabContact where sales_person_id = %s and is_sales_person=1", self.doc.name) - if cid: - d = Document('Contact', cid[0][0]) - else: - d = Document('Contact') - - name_split = self.doc.sales_person_name.split() - d.contact_name = self.doc.sales_person_name - d.first_name = name_split[0] - d.last_name = len(name_split) > 1 and name_split[1] or '' - d.email_id = self.doc.email_id - d.contact_no = d.mobile_no = self.doc.mobile_no - d.designation = self.doc.designation - d.department = self.doc.department - d.sales_person_id = self.doc.name - d.is_sales_person = 1 - - d.save(new = (not d.name)) - - + def validate(self): + for d in getlist(self.doclist, 'target_details'): + if not flt(d.target_qty) and not flt(d.target_amount): + msgprint("Either target qty or target amount is mandatory.") + raise Exception + + #self.sync_with_contact() + + def sync_with_contact(self): + cid = sql("select name from tabContact where sales_person_id = %s and is_sales_person=1", self.doc.name) + if cid: + d = Document('Contact', cid[0][0]) + else: + d = Document('Contact') + + name_split = self.doc.sales_person_name.split() + d.contact_name = self.doc.sales_person_name + d.first_name = name_split[0] + d.last_name = len(name_split) > 1 and name_split[1] or '' + d.email_id = self.doc.email_id + d.contact_no = d.mobile_no = self.doc.mobile_no + d.designation = self.doc.designation + d.department = self.doc.department + d.sales_person_id = self.doc.name + d.is_sales_person = 1 + + d.save(new = (not d.name)) diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py index 284e2a8a36..7cbf4d32fb 100644 --- a/setup/doctype/setup_control/setup_control.py +++ b/setup/doctype/setup_control/setup_control.py @@ -13,6 +13,8 @@ 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 server_tools.gateway_utils import update_client_control, get_total_users # ----------------------------------------------------------------------------------------- @@ -36,10 +38,10 @@ class DocType: #----------------------- def set_account_details(self, args): args = eval(args) - - self.set_cp_defaults(args['company_name'], args['industry'], args['time_zone'], args['country'], args['account_name']) + #webnotes.logger.error("args in set_account_details of setup_control: " + str(args)) + self.set_cp_defaults(args['company'], args['industry'], args['time_zone'], args['country'], args['account_name']) self.create_profile(args['user'], args['first_name'], args['last_name']) - self.update_client_control() + update_client_control(args['total_users']) # Account Setup @@ -163,19 +165,38 @@ class DocType: d = addchild(pr,'userroles', 'UserRole', 1) d.role = r d.save(1) - - # Update WN ERP Client Control - # ----------------------------- - def update_client_control(self): - cl = Document('WN ERP Client Control','WN ERP Client Control') - cl.account_start_date = nowdate() - cl.total_users = 1 - cl.is_trial_account = 1 - cl.save() + # Sync DB # ------- def sync_db(arg=''): import webnotes.model.db_schema sql("delete from `tabDocType Update Register`") - webnotes.model.db_schema.sync_all() \ No newline at end of file + webnotes.model.db_schema.sync_all() + + + def is_setup_okay(self, args): + """ + Validates if setup has been performed after database allocation + """ + + args = eval(args) + #webnotes.logger.error("args in set_account_details of setup_control: " + str(args)) + + cp_defaults = webnotes.conn.get_value('Control Panel', None, 'account_id') + + user_profile = webnotes.conn.get_value('Profile', args['user'], 'name') + + from webnotes.utils import cint + + total_users = get_total_users() + + #webnotes.logger.error("setup_control.is_setup_okay: " + cp_defaults + " " + user_profile + " " + str(total_users)) + + #webnotes.logger.error("setup_control.is_setup_okay: Passed Values:" + args['account_name'] + " " + args['user'] + " " + str(args['total_users'])) + + + if (cp_defaults==args['account_name']) and user_profile and \ + (total_users==cint(args['total_users'])): + return 'True' + \ No newline at end of file diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.py b/stock/doctype/stock_reconciliation/stock_reconciliation.py index febefd5bdf..69710f0eab 100644 --- a/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -127,15 +127,18 @@ class DocType: # update mar # ----------- def update_mar(self, d, qty_diff): + """ + update item valuation in previous date and also on post date if no qty diff + """ + + self.update_item_valuation_pre_date(d) + if not flt(d[self.label['qty']]) and not flt(d[self.label['actual_qty']]): - # seems like a special condition when there is no actual quanitity but there is a rate, may be only for setting a rate! + # seems like a special condition when there is no actual quanitity but there is a rate, may be only for setting a rate! self.make_sl_entry(1,d,1) self.make_sl_entry(1,d,-1) - else: - self.update_item_valuation_pre_date(d) - - if not qty_diff: - self.update_item_valuation_post_date(d) + elif not qty_diff: + self.update_item_valuation_post_date(d) # update valuation rate as csv file in all sle before reconciliation date # ------------------------------------------------------------------------ diff --git a/support/doctype/support_ticket/__init__.py b/support/doctype/support_ticket/__init__.py index 398ee7f5a4..959a751d47 100644 --- a/support/doctype/support_ticket/__init__.py +++ b/support/doctype/support_ticket/__init__.py @@ -54,7 +54,8 @@ class SupportMailbox(POP3Mailbox): d.save(1) # update feed - update_feed(d) + update_feed(d) + def get_support_mails(): """ diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js index 3e43edc4f7..584f41278a 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -33,8 +33,14 @@ $.extend(cur_frm.cscript, { refresh: function(doc) { cs.make_listing(doc); - if(!doc.__islocal) { - // can't change the main message & subject once set + if(!doc.__islocal) { + + if(doc.allocated_to) + set_field_permlevel('status',2); + if(user==doc.allocated_to && doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cs['Close Ticket']); + if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cs['Re-Open Ticket']); + + // can't change the main message & subject once set set_field_permlevel('subject',2); set_field_permlevel('description',2); set_field_permlevel('raised_by',2); @@ -87,10 +93,37 @@ $.extend(cur_frm.cscript, { } if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback); if(doc.customer) unhide_field(['customer_name','address_display','contact_display','contact_mobile','contact_email']); + }, + + 'Close Ticket': function() { + var doc = cur_frm.doc + + var answer = confirm("Close Ticket "+doc.name+"?\n\nAllocated To: "+doc.allocated_to+"\n\nSubject: "+doc.subject+""); + if(answer) { + if(doc.name) + $c_obj([doc],'close_ticket','',function(r,rt) { + cur_frm.refresh(); + }); + } + }, + + 'Re-Open Ticket': function() { + var doc = cur_frm.doc + + var answer = confirm("Re-Open Ticket "+doc.name+"?\n\nAllocated To: "+doc.allocated_to+"\n\nSubject: "+doc.subject+""); + if(answer) { + if(doc.name) + $c_obj([doc],'reopen_ticket','',function(r,rt) { + cur_frm.refresh(); + }); + } } + + }) + EmailMessage = function(parent, args, list, idx) { var me = this; $.extend(this, args); diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py index c4af0ed05f..75defbeb34 100644 --- a/support/doctype/support_ticket/support_ticket.py +++ b/support/doctype/support_ticket/support_ticket.py @@ -1,6 +1,7 @@ import webnotes from utilities.transaction_base import TransactionBase +from home import update_feed class DocType(TransactionBase): def __init__(self, doc, doclist=[]): @@ -46,3 +47,11 @@ class DocType(TransactionBase): d.mail = response d.content_type = content_type d.save(1) + + def close_ticket(self): + webnotes.conn.set(self.doc,'status','Closed') + update_feed(self.doc) + + def reopen_ticket(self): + webnotes.conn.set(self.doc,'status','Open') + update_feed(self.doc) diff --git a/support/doctype/support_ticket/support_ticket.txt b/support/doctype/support_ticket/support_ticket.txt index 57d3b3b5ee..362b3de522 100644 --- a/support/doctype/support_ticket/support_ticket.txt +++ b/support/doctype/support_ticket/support_ticket.txt @@ -1,419 +1,1037 @@ -# DocType, Support Ticket [ - - # These values are common in all dictionaries { - 'creation': '2011-05-23 14:50:46', - 'docstatus': 0, - 'modified': '2011-06-27 10:46:31', - 'modified_by': 'Administrator', - 'owner': 'Administrator' - }, - - # These values are common for all DocType - { - '_last_update': '1308898257', + '_last_update': '1309771514', + 'allow_attach': None, + 'allow_copy': None, + 'allow_email': None, + 'allow_print': None, + 'allow_rename': None, 'allow_trash': 1, 'autoname': 'SUP.######', + 'change_log': None, + 'client_script': None, + 'client_script_core': None, + 'client_string': None, 'colour': 'White:FFF', + 'creation': '2011-05-23 10:18:58', + 'description': None, + 'docstatus': 0, 'doctype': 'DocType', - 'module': 'Support', - 'name': '__common__', + 'document_type': None, + 'dt_template': None, + 'hide_heading': None, + 'hide_toolbar': None, + 'idx': None, + 'in_create': None, + 'in_dialog': None, + 'is_transaction_doc': None, + 'issingle': None, + 'istable': None, + 'max_attachments': None, + 'menu_index': None, + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'module': 'Maintenance', + 'name': 'Support Ticket', + 'name_case': None, + 'owner': 'Administrator', + 'parent': None, + 'parent_node': None, + 'parentfield': None, + 'parenttype': None, + 'print_outline': None, + 'read_only': None, + 'read_only_onload': None, 'search_fields': 'status,customer,allocated_to,subject,raised_by', 'section_style': 'Tray', + 'server_code': None, + 'server_code_compiled': None, + 'server_code_core': None, 'server_code_error': ' ', 'show_in_menu': 0, + 'smallicon': None, 'subject': '%(subject)s', - 'tag_fields': 'status', - 'version': 140 + 'tag_fields': 'status,allocated_to', + 'use_template': None, + 'version': 148 }, - - # These values are common for all DocField - { - 'doctype': 'DocField', - 'name': '__common__', - 'parent': 'Support Ticket', - 'parentfield': 'fields', - 'parenttype': 'DocType' - }, - - # These values are common for all DocPerm - { - 'doctype': 'DocPerm', - 'name': '__common__', - 'parent': 'Support Ticket', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'read': 1 - }, - - # DocType, Support Ticket - { - 'doctype': 'DocType', - 'name': 'Support Ticket' - }, - - # DocPerm { 'amend': 0, 'cancel': 0, 'create': 1, + 'creation': '2011-05-23 10:18:58', + 'docstatus': 0, 'doctype': 'DocPerm', + 'execute': None, 'idx': 1, + 'match': None, + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'PERM00823', + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'permissions', + 'parenttype': 'DocType', 'permlevel': 0, + 'read': 1, 'role': 'Guest', 'submit': 0, 'write': 1 }, - - # DocPerm { + 'amend': None, + 'cancel': None, 'create': 1, + 'creation': '2011-05-23 10:18:58', + 'docstatus': 0, 'doctype': 'DocPerm', + 'execute': None, 'idx': 2, 'match': 'customer', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'PERM00824', + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'permissions', + 'parenttype': 'DocType', 'permlevel': 0, + 'read': 1, 'role': 'Customer', + 'submit': None, 'write': 1 }, - - # DocPerm { + 'amend': None, 'cancel': 1, 'create': 1, + 'creation': '2011-05-23 10:18:58', + 'docstatus': 0, 'doctype': 'DocPerm', + 'execute': None, 'idx': 3, + 'match': None, + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'PERM00825', + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'permissions', + 'parenttype': 'DocType', 'permlevel': 0, + 'read': 1, 'role': 'Support Team', + 'submit': None, 'write': 1 }, - - # DocPerm { + 'amend': None, 'cancel': 0, 'create': 0, + 'creation': '2011-05-23 10:18:58', + 'docstatus': 0, 'doctype': 'DocPerm', + 'execute': None, 'idx': 4, 'match': 'allocated_to', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'PERM00826', + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'permissions', + 'parenttype': 'DocType', 'permlevel': 1, + 'read': 1, 'role': 'Support Team', + 'submit': None, 'write': 1 }, - - # DocPerm { + 'amend': None, + 'cancel': None, + 'create': None, + 'creation': '2011-05-23 10:18:58', + 'docstatus': 0, 'doctype': 'DocPerm', + 'execute': None, 'idx': 5, + 'match': None, + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'PERM00827', + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'permissions', + 'parenttype': 'DocType', 'permlevel': 2, - 'role': 'Support Team' + 'read': 1, + 'role': 'Support Team', + 'submit': None, + 'write': None }, - - # DocField { + 'allow_on_submit': None, 'colour': 'White:FFF', + 'creation': '2011-05-23 10:18:58', 'default': 'Open', + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'status', 'fieldtype': 'Select', + 'hidden': None, + 'icon': None, 'idx': 1, 'in_filter': 0, 'label': 'Status', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04803', + 'no_column': None, 'no_copy': 1, 'oldfieldname': 'status', 'oldfieldtype': 'Select', 'options': '\nOpen\nTo Reply\nWaiting for Customer\nHold\nClosed', + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', 'permlevel': 1, - 'reqd': 0, - 'search_index': 1 + 'print_hide': None, + 'report_hide': None, + 'reqd': 1, + 'search_index': 1, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-23 10:18:58', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'subject', - 'fieldtype': 'Text', + 'fieldtype': 'Small Text', + 'hidden': None, + 'icon': None, 'idx': 2, 'in_filter': 1, 'label': 'Subject', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04804', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, + 'oldfieldtype': None, + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', 'permlevel': 0, - 'reqd': 1 + 'print_hide': None, + 'report_hide': None, + 'reqd': 1, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-23 10:18:58', + 'default': None, 'depends_on': 'eval:doc.__islocal', + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'raised_by', 'fieldtype': 'Data', + 'hidden': None, + 'icon': None, 'idx': 3, 'in_filter': 1, 'label': 'Raised By (Email)', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04805', + 'no_column': None, + 'no_copy': None, 'oldfieldname': 'raised_by', 'oldfieldtype': 'Data', + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', 'permlevel': 0, - 'reqd': 1 + 'print_hide': None, + 'report_hide': None, + 'reqd': 1, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-23 10:18:58', + 'default': None, 'depends_on': 'eval:doc.__islocal', + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'description', 'fieldtype': 'Text', + 'hidden': None, + 'icon': None, 'idx': 4, + 'in_filter': None, 'label': 'Description', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04806', + 'no_column': None, + 'no_copy': None, 'oldfieldname': 'problem_description', 'oldfieldtype': 'Text', + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', 'permlevel': 0, - 'reqd': 0 + 'print_hide': None, + 'report_hide': None, + 'reqd': 0, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-27 13:07:26', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'problem_description', 'fieldtype': 'Text', + 'hidden': None, + 'icon': None, 'idx': 5, + 'in_filter': None, 'label': 'Problem Description', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL05248', + 'no_column': None, + 'no_copy': None, 'oldfieldname': 'problem_description', 'oldfieldtype': 'Text', - 'permlevel': 0 + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 0, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-06-29 17:28:05', + 'default': None, 'depends_on': 'eval:!doc.__islocal', + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', + 'fieldname': None, 'fieldtype': 'HTML', + 'hidden': None, + 'icon': None, 'idx': 6, + 'in_filter': None, 'label': 'Thread HTML', - 'permlevel': 1 + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL05360', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, + 'oldfieldtype': None, + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 1, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-23 10:18:58', + 'default': None, 'depends_on': 'eval:!doc.__islocal', + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'new_response', 'fieldtype': 'Text', + 'hidden': None, + 'icon': None, 'idx': 7, + 'in_filter': None, 'label': 'New Response', - 'permlevel': 0 + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04808', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, + 'oldfieldtype': None, + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 0, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-23 10:18:58', + 'default': None, 'depends_on': 'eval:!doc.__islocal', + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', + 'fieldname': None, 'fieldtype': 'Button', + 'hidden': None, + 'icon': None, 'idx': 8, + 'in_filter': None, 'label': 'Send', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04809', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, + 'oldfieldtype': None, 'options': 'send_response', - 'permlevel': 0 + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 0, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, 'colour': 'White:FFF', + 'creation': '2011-06-29 17:28:05', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', + 'fieldname': None, 'fieldtype': 'Section Break', + 'hidden': None, + 'icon': None, 'idx': 9, + 'in_filter': None, 'label': 'Additional Info', - 'permlevel': 1 - }, - - # DocField - { - 'depends_on': 'eval:!doc.__islocal', - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'idx': 10, - 'oldfieldtype': 'Column Break', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL05361', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, + 'oldfieldtype': None, + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', 'permlevel': 1, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None + }, + { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-06-29 17:28:05', + 'default': None, + 'depends_on': 'eval:!doc.__islocal', + 'description': None, + 'docstatus': 0, + 'doctype': 'DocField', + 'fieldname': None, + 'fieldtype': 'Column Break', + 'hidden': None, + 'icon': None, + 'idx': 10, + 'in_filter': None, + 'label': None, + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL05362', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, + 'oldfieldtype': 'Column Break', + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 1, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, 'width': '50%' }, - - # DocField { + 'allow_on_submit': None, 'colour': 'White:FFF', + 'creation': '2011-05-23 10:18:58', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'customer', 'fieldtype': 'Link', + 'hidden': None, + 'icon': None, 'idx': 11, 'in_filter': 1, 'label': 'Customer', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04812', + 'no_column': None, + 'no_copy': None, 'oldfieldname': 'customer', 'oldfieldtype': 'Link', 'options': 'Customer', + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', 'permlevel': 1, 'print_hide': 1, + 'report_hide': None, 'reqd': 0, 'search_index': 1, - 'trigger': 'Client' + 'trigger': 'Client', + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-23 10:18:58', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'customer_name', 'fieldtype': 'Data', + 'hidden': None, + 'icon': None, 'idx': 12, 'in_filter': 1, 'label': 'Customer Name', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04813', + 'no_column': None, + 'no_copy': None, 'oldfieldname': 'customer_name', 'oldfieldtype': 'Data', + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', 'permlevel': 2, + 'print_hide': None, + 'report_hide': None, 'reqd': 0, - 'search_index': 1 + 'search_index': 1, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-06-29 17:28:04', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'address_display', 'fieldtype': 'Small Text', + 'hidden': None, + 'icon': None, 'idx': 13, + 'in_filter': None, 'label': 'Address', - 'permlevel': 2 + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL05355', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, + 'oldfieldtype': None, + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 2, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-06-29 17:28:04', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'contact_display', 'fieldtype': 'Data', + 'hidden': None, + 'icon': None, 'idx': 14, + 'in_filter': None, 'label': 'Contact Name', - 'permlevel': 2 + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL05356', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, + 'oldfieldtype': None, + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 2, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-06-29 17:28:05', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'contact_mobile', 'fieldtype': 'Data', + 'hidden': None, + 'icon': None, 'idx': 15, + 'in_filter': None, 'label': 'Mobile No', - 'permlevel': 2 + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL05357', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, + 'oldfieldtype': None, + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 2, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-06-29 17:28:05', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'contact_email', 'fieldtype': 'Data', + 'hidden': None, + 'icon': None, 'idx': 16, + 'in_filter': None, 'label': 'Contact Email', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL05358', + 'no_column': None, + 'no_copy': None, 'oldfieldname': 'contact_no', 'oldfieldtype': 'Data', - 'permlevel': 2 + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 2, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-23 10:18:58', 'default': 'Today', + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'opening_date', 'fieldtype': 'Date', + 'hidden': None, + 'icon': None, 'idx': 17, + 'in_filter': None, 'label': 'Opening Date', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04815', + 'no_column': None, 'no_copy': 1, 'oldfieldname': 'opening_date', 'oldfieldtype': 'Date', - 'permlevel': 1 + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 1, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-23 10:18:58', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'opening_time', 'fieldtype': 'Time', + 'hidden': None, + 'icon': None, 'idx': 18, + 'in_filter': None, 'label': 'Opening Time', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04816', + 'no_column': None, 'no_copy': 1, 'oldfieldname': 'opening_time', 'oldfieldtype': 'Time', - 'permlevel': 1 + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 1, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-06-29 17:28:05', + 'default': None, 'depends_on': 'eval:!doc.__islocal', + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', + 'fieldname': None, 'fieldtype': 'Column Break', + 'hidden': None, + 'icon': None, 'idx': 19, + 'in_filter': None, + 'label': None, + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL05363', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, 'oldfieldtype': 'Column Break', - 'permlevel': 1 + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 1, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': 'White:FFF', + 'creation': '2011-05-23 10:18:58', + 'default': None, 'depends_on': 'eval:!doc.__islocal', + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'allocated_to', 'fieldtype': 'Link', + 'hidden': None, + 'icon': None, 'idx': 20, 'in_filter': 1, 'label': 'Allocated To', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04818', + 'no_column': None, + 'no_copy': None, 'oldfieldname': 'allocated_to', 'oldfieldtype': 'Link', 'options': 'Profile', + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', 'permlevel': 1, - 'search_index': 1 + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': 1, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-23 10:18:58', + 'default': None, 'depends_on': 'eval:!doc.__islocal', + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'resolution_details', - 'fieldtype': 'Text', + 'fieldtype': 'Small Text', + 'hidden': None, + 'icon': None, 'idx': 21, + 'in_filter': None, 'label': 'Resolution Details', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04819', + 'no_column': None, 'no_copy': 1, 'oldfieldname': 'resolution_details', 'oldfieldtype': 'Text', - 'permlevel': 1 + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 1, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': 'White:FFF', + 'creation': '2011-05-23 10:18:58', + 'default': None, 'depends_on': 'eval:!doc.__islocal', + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'resolution_date', 'fieldtype': 'Date', + 'hidden': None, + 'icon': None, 'idx': 22, 'in_filter': 0, 'label': 'Resolution Date', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04820', + 'no_column': None, 'no_copy': 1, 'oldfieldname': 'resolution_date', 'oldfieldtype': 'Date', + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', 'permlevel': 1, - 'search_index': 1 + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': 1, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, + 'colour': None, + 'creation': '2011-05-23 10:18:58', + 'default': None, 'depends_on': 'eval:!doc.__islocal', + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'resolution_time', 'fieldtype': 'Time', + 'hidden': None, + 'icon': None, 'idx': 23, + 'in_filter': None, 'label': 'Resolution Time', + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL04821', + 'no_column': None, + 'no_copy': None, 'oldfieldname': 'resolution_time', 'oldfieldtype': 'Time', - 'permlevel': 1 + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 1, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None }, - - # DocField { + 'allow_on_submit': None, 'colour': 'White:FFF', + 'creation': '2011-05-27 13:07:26', + 'default': None, + 'depends_on': None, + 'description': None, + 'docstatus': 0, 'doctype': 'DocField', 'fieldname': 'content_type', 'fieldtype': 'Data', 'hidden': 1, + 'icon': None, 'idx': 24, + 'in_filter': None, 'label': 'Content Type', - 'permlevel': 0 + 'modified': '2011-07-04 15:13:48', + 'modified_by': 'Administrator', + 'name': 'FL05251', + 'no_column': None, + 'no_copy': None, + 'oldfieldname': None, + 'oldfieldtype': None, + 'options': None, + 'owner': 'Administrator', + 'parent': 'Support Ticket', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 0, + 'print_hide': None, + 'report_hide': None, + 'reqd': None, + 'search_index': None, + 'trigger': None, + 'width': None } -] \ No newline at end of file +] diff --git a/utilities/doctype/reposting_tool/reposting_tool.py b/utilities/doctype/reposting_tool/reposting_tool.py index 34bf8cc321..bda9afdb80 100644 --- a/utilities/doctype/reposting_tool/reposting_tool.py +++ b/utilities/doctype/reposting_tool/reposting_tool.py @@ -48,16 +48,16 @@ class DocType: act_qty = act_qty and flt(act_qty[0][0]) or 0 # get indented_qty - ind_qty = sql("select sum(if( ifnull(t2.qty, 0) > ifnull(t2.ordered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.ordered_qty, 0), 0) ) from `tabIndent` t1, `tabIndent Detail`t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s'" % (wh, item)) + ind_qty = sql("select sum(if( ifnull(t2.qty, 0) > ifnull(t2.ordered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.ordered_qty, 0), 0) ) from `tabIndent` t1, `tabIndent Detail`t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item)) ind_qty = ind_qty and flt(ind_qty[0][0]) or 0 # get ordered_qty - ord_qty = sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.received_qty, 0), (ifnull(t2.qty, 0) - ifnull(t2.received_qty, 0)) * ifnull(t2.conversion_factor, 0) , 0) ) from `tabPurchase Order` t1, `tabPO Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s'" % (wh, item)) + ord_qty = sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.received_qty, 0), (ifnull(t2.qty, 0) - ifnull(t2.received_qty, 0)) * ifnull(t2.conversion_factor, 0) , 0) ) from `tabPurchase Order` t1, `tabPO Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item)) ord_qty = ord_qty and flt(ord_qty[0][0]) or 0 # get reserved_qty - res_qty =sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.delivered_qty, 0) , 0) ) from `tabSales Order` t1, `tabSales Order Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.reserved_warehouse = '%s' and t2.item_code = '%s' " % (wh, item)) + res_qty =sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.delivered_qty, 0) , 0) ) from `tabSales Order` t1, `tabSales Order Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.reserved_warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item)) res_qty = res_qty and flt(res_qty[0][0]) or 0 # get planned_qty