コード例 #1
0
def sync_roles():
    "Put Roles into corresponding module and delete Roles module"

    # roles
    roles = {
        'Accounts': "'Accounts Manager', 'Accounts User', 'Auditor'",
        'Selling':
        "'Customer', 'Sales User', 'Sales Manager', 'Sales Master Manager', 'Partner'",
        'Buying':
        "'Supplier', 'Purchase User', 'Purchase Manager', 'Purchase Master Manager'",
        'Stock':
        "'Material User', 'Material Master Manager', 'Material Manager', 'Quality Manager'",
        'Support':
        "'Support Team', 'Support Manager', 'Maintenance User', 'Maintenance Manager'",
        'Production':
        "'Production User', 'Production Manager', 'Production Master Manager'",
        'Setup': "'System Manager'",
        'Projects': "'Projects User'",
        'HR': "'HR User', 'HR Manager', 'Employee'",
        'Core': "'Administrator', 'All', 'Guest'"
    }
    for mod in roles.keys():
        sql("update `tabRole` set module = '%s' where name in (%s)" %
            (mod, roles[mod]))

    sql("update `tabDocType` set module = 'Setup' where name = 'Role'")
    try:

        delete_doc('Module Def', 'Roles')
    except:
        pass
コード例 #2
0
ファイル: questions.py プロジェクト: eric20201688/erpnext
def delete(arg):
    """
		delete a question or answer (called from kb toolbar)
	"""
    args = load_json(arg)
    from webnotes.model import delete_doc
    delete_doc(args['dt'], args['dn'])
コード例 #3
0
def rename_merge_modules():
    "Rename module as per users view and merge for removing confusion"

    rename_lst = [['CRM', 'Selling'], ['SRM', 'Buying'],
                  ['Material Management', 'Stock'], ['Payroll', 'HR'],
                  ['Maintenance', 'Support']]
    for d in rename_lst:
        # create new module manually and export to file???????
        reload_doc(d[1].lower(), 'Module Def', d[1])

    merge_lst = [['Tools', 'Utilities'], ['Application Internal', 'Utilities'],
                 ['Settings', 'Setup']]
    # settings hardcoded in my_company
    # module hardcoded in home_control
    # material_management hardcoded in installation note
    # maintenance hardcoded in support_email_settings

    lst = rename_lst + merge_lst
    for d in lst:
        update_module(d[0], d[1])
        try:
            delete_doc('Module Def', d[0])
        except:
            pass
    reload_doc('Utilities', 'Module Def', 'Utilities')
コード例 #4
0
ファイル: supplier.py プロジェクト: poses/erpnext
	def delete_supplier_account(self):
		"""delete supplier's ledger if exist and check balance before deletion"""
		acc = webnotes.conn.sql("select name from `tabAccount` where master_type = 'Supplier' \
			and master_name = %s and docstatus < 2", self.doc.name)
		if acc:
			from webnotes.model import delete_doc
			delete_doc('Account', acc[0][0])
コード例 #5
0
def execute():
    import webnotes
    from webnotes.model import delete_doc
    webnotes.conn.sql(
        "update `tabDocType` set module = 'Utilities' where name in ('Question', 'Answer')"
    )
    delete_doc('Module Def', 'Knowledge Base')
コード例 #6
0
def execute():
    from webnotes.model import delete_doc
    for d in [
            "Project-Sales Order", "Project-Delivery Note",
            "Project-Sales Invoice"
    ]:
        delete_doc("DocType Mapper", d)
コード例 #7
0
def sync_roles():
	"Put Roles into corresponding module and delete Roles module"
	
	# roles
	roles = {
		'Accounts'	:		"'Accounts Manager', 'Accounts User', 'Auditor'", 
		'Selling'	: 		"'Customer', 'Sales User', 'Sales Manager', 'Sales Master Manager', 'Partner'", 
		'Buying'	:		"'Supplier', 'Purchase User', 'Purchase Manager', 'Purchase Master Manager'", 
		'Stock'		:		"'Material User', 'Material Master Manager', 'Material Manager', 'Quality Manager'", 
		'Support'	:		"'Support Team', 'Support Manager', 'Maintenance User', 'Maintenance Manager'", 
		'Production':		"'Production User', 'Production Manager', 'Production Master Manager'", 
		'Setup'		:		"'System Manager'", 
		'Projects'	:		"'Projects User'", 
		'HR'		:		"'HR User', 'HR Manager', 'Employee'",
		'Core'		:		"'Administrator', 'All', 'Guest'"
	}
	for mod in roles.keys():
		sql("update `tabRole` set module = '%s' where name in (%s)" % (mod, roles[mod]))
		
	sql("update `tabDocType` set module = 'Setup' where name = 'Role'")
	try:
	
		delete_doc('Module Def', 'Roles')
	except:
		pass
コード例 #8
0
ファイル: questions.py プロジェクト: BillTheBest/erpnext
def delete(arg):
	"""
		delete a question or answer (called from kb toolbar)
	"""
	args = load_json(arg)
	from webnotes.model import delete_doc
	delete_doc(args['dt'], args['dn'])
コード例 #9
0
def execute():
	import webnotes
	from webnotes.modules import reload_doc
	reload_doc('stock', 'Search Criteria', 'Stock Ledger')

	from webnotes.model import delete_doc
	delete_doc("Report", "Stock Ledger")
コード例 #10
0
ファイル: supplier.py プロジェクト: masums/erpnext
	def delete_supplier_account(self):
		"""delete supplier's ledger if exist and check balance before deletion"""
		acc = sql("select name from `tabAccount` where master_type = 'Supplier' \
			and master_name = %s and docstatus < 2", self.doc.name)
		if acc:
			from webnotes.model import delete_doc
			delete_doc('Account', acc[0][0])
コード例 #11
0
ファイル: sync_ref_db.py プロジェクト: NorrWing/erpnext
def execute():
	del_rec = {
		'DocType'	:	['Update Series', 'File', 'File Browser Control', 'File Group',
			'Tag Detail', 'DocType Property Setter', 'Company Group', 'Widget Control', 
			'Update Delivery Date Detail', 'Update Delivery	Date',
			'Tag Detail', 'Supplier rating', 'Stylesheet', 'Question Tag',
			'PRO PP Detail', 'PRO Detail', 'PPW Detail', 'PF Detail',
			'Personalize', 'Patch Util', 'Page Template', 'Module Def Role',
			'Module Def Item', 'File Group', 'File Browser Control', 'File',
			'Educational Qualifications', 'Earn Deduction Detail',
			'DocType Property Setter', 'Contact Detail', 'BOM Report Detail', 
			'BOM Replace Utility Detail', 'BOM Replace Utility', 
			'Absent Days Detail', 'Activity Dashboard Control', 'Raw Materials Supplied',
			'Setup Wizard Control', 'Company Group', 'Lease Agreement', 'Lease Installment',
			'Terms and Conditions', 'Time Sheet', 'Time Sheet Detail', 'Naming Series Options',
			'Invest 80 Declaration Detail', 'IT Checklist', 'Chapter VI A Detail', 'Declaration Detail',
			'Personalize', 'Salary Slip Control Panel', 'Question Control'
			],
		'Page'		:	['File Browser', 'Bill of Materials', 'question-view'],
		'DocType Mapper': ['Production Forecast-Production Planning Tool', 'Production Forecast-Production Plan', 'Sales Order-Production Plan'],
	}

	for d in del_rec:
		for r in del_rec[d]:
			print 'Deleted', d, ' - ', r
			if d=='DocType':
				sql("delete from tabFeed where doc_type=%s", r)
			delete_doc(d, r)

	sql("delete from tabDocField where label='Repair Purchase Request' and parent = 'Purchase Request'")

	drop_tables()
コード例 #12
0
def execute():
	import webnotes
	from webnotes.model import delete_doc
	delete_doc('DocType', 'Bulk Rename Tool')
	webnotes.conn.commit()
	webnotes.conn.sql("drop table `tabBulk Rename Tool`")
	webnotes.conn.begin()
コード例 #13
0
def execute():
	import webnotes
	from webnotes.model import delete_doc
	delete_doc("Search Criteria", "sales_order_pending_items1")
	
	webnotes.conn.sql("update `tabSearch Criteria` set module = 'Selling' where module = 'CRM'")
	from webnotes.modules import reload_doc
	reload_doc('selling', 'search_criteria', 'sales_order_pending_items')
コード例 #14
0
def execute():
    # remove doctypes
    for dt in [
            "Period", "Account Balance", "Multi Ledger Report",
            "Multi Ledger Report Detail", "Period Control", "Reposting Tool",
            "Lease Agreement", "Lease Installment"
    ]:
        delete_doc("DocType", dt)
コード例 #15
0
def execute():
    import webnotes
    webnotes.conn.sql(
        "update `tabDocField` set `default` = 1 where fieldname = 'conversion_rate' and parent = 'POS Setting'"
    )

    from webnotes.model import delete_doc
    delete_doc('DocType', 'POS Settings')
コード例 #16
0
ファイル: menu_control.py プロジェクト: ant0nk/erpnext
 def delete_items(self, arg):
     il = eval(arg)
     from webnotes.model import delete_doc
     for d in il:
         dt_obj = get_obj(d[0], d[1])
         if hasattr(dt_obj, 'on_trash'):
             dt_obj.on_trash()
         delete_doc(d[0], d[1])
コード例 #17
0
	def delete_items(self,arg):
		il = eval(arg)
		from webnotes.model import delete_doc
		for d in il:
			dt_obj = get_obj(d[0], d[1])
			if hasattr(dt_obj, 'on_trash'):
				dt_obj.on_trash()
			delete_doc(d[0], d[1])
コード例 #18
0
def delete_unwanted_modules():
	"deletes unwanted modules"
	lst = ['Development', 'Recycle Bin', 'Testing', 'Testing System', 'Test', 'Partner Updates', 'My Company', 'Event Updates', 'E-Commerce']
	for d in lst:
		try:
			delete_doc('Module Def', d)
		except:
			pass
コード例 #19
0
def delete_unwanted_pages():
	"deletes pages which are not used anymore"
	lst = ['Transaction Authorization', 'Prduct Display', 'Data Import', 'Partner Home', 'Product Display', 'Module Settings', 'About Us', 'Custom Reports', 'MIS', 'MIS - Comparison Report', 'Monthly MIS', 'MyReports', 'Navigation Page', 'Point Race', 'Tag Widget', 'Widget Test', 'Yearly MIS']
	for d in lst:
		try:
			delete_doc('Page', d)
		except:
			pass
コード例 #20
0
def execute():
    import webnotes
    from webnotes.modules import reload_doc
    from webnotes.model import delete_doc

    delete_doc('DocType', 'Landed Cost Wizard')
    delete_doc('DocType', 'Landed Cost Purchase Receipt')
    reload_doc('stock', 'doctype', 'landed_cost_wizard')
    reload_doc('stock', 'doctype', 'lc_pr_detail')
コード例 #21
0
ファイル: reload_lc_wizard.py プロジェクト: NorrWing/erpnext
def execute():
	import webnotes
	from webnotes.modules import reload_doc
	from webnotes.model import delete_doc

	delete_doc('DocType', 'Landed Cost Wizard')
	delete_doc('DocType', 'Landed Cost Purchase Receipt')
	reload_doc('stock', 'doctype', 'landed_cost_wizard')
	reload_doc('stock', 'doctype', 'lc_pr_detail')
コード例 #22
0
def delete_unwanted_mappers():
	"deletes unwanted mappers"
	
	lst = ['Customer Issue-Maintenance Report', 'Enquiry-Service Quotation', 'Sales Order-Maintenance Report', 'Service Quotation-Service Order', 'Supplier Quotation-Purchase Order', 'Visit Schedule-Maintenance Report', 'RFQ-Supplier Quotation', 'Indent-RFQ']
	for d in lst:
		try:
			delete_doc('DocType Mapper', d)
		except:
			pass	
コード例 #23
0
def execute():
	import webnotes
	from webnotes.modules.module_manager import reload_doc
	from webnotes.model import delete_doc

	delete_doc('DocType', 'Landed Cost Wizard')
	delete_doc('DocType', 'LC PR Detail')
	reload_doc('stock', 'doctype', 'landed_cost_wizard')
	reload_doc('stock', 'doctype', 'lc_pr_detail')
コード例 #24
0
def execute():
	# remove doctypes
	for dt in ["Period", "Account Balance", "Multi Ledger Report", 
			"Multi Ledger Report Detail", "Period Control", "Reposting Tool", 
			"Lease Agreement", "Lease Installment"]:
		delete_doc("DocType", dt)
	
	# remove search criteria
	delete_doc("Search Criteria", "Trial Balance")
コード例 #25
0
ファイル: reload_lc_wizard.py プロジェクト: ant0nk/erpnext
def execute():
    import webnotes
    from webnotes.modules.module_manager import reload_doc
    from webnotes.model import delete_doc

    delete_doc('DocType', 'Landed Cost Wizard')
    delete_doc('DocType', 'LC PR Detail')
    reload_doc('stock', 'doctype', 'landed_cost_wizard')
    reload_doc('stock', 'doctype', 'lc_pr_detail')
コード例 #26
0
ファイル: deprecate_tds.py プロジェクト: AminfiBerlin/erpnext
def execute():
    import webnotes
    from webnotes.model import delete_doc
    from webnotes.model.code import get_obj
    from webnotes.model.doc import addchild

    # delete doctypes and tables
    for dt in [
        "TDS Payment",
        "TDS Return Acknowledgement",
        "Form 16A",
        "TDS Rate Chart",
        "TDS Category",
        "TDS Control",
        "TDS Detail",
        "TDS Payment Detail",
        "TDS Rate Detail",
        "TDS Category Account",
        "Form 16A Ack Detail",
        "Form 16A Tax Detail",
    ]:
        delete_doc("DocType", dt)

        webnotes.conn.commit()
        webnotes.conn.sql("drop table if exists `tab%s`" % dt)
        webnotes.conn.begin()

    delete_doc("Search Criteria", "tds_return")

    # Add tds entry in tax table for purchase invoice
    pi_list = webnotes.conn.sql(
        """select name from `tabPurchase Invoice` 
		where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0"""
    )
    for pi in pi_list:
        piobj = get_obj("Purchase Invoice", pi[0], with_children=1)
        ch = addchild(piobj.doc, "taxes_and_charges", "Purchase Taxes and Charges")
        ch.charge_type = "Actual"
        ch.account_head = piobj.doc.tax_code
        ch.description = piobj.doc.tax_code
        ch.rate = -1 * piobj.doc.ded_amount
        ch.tax_amount = -1 * piobj.doc.ded_amount
        ch.category = "Total"
        ch.save(1)

        # Add tds entry in entries table for journal voucher
    jv_list = webnotes.conn.sql(
        """select name from `tabJournal Voucher` 
		where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0"""
    )
    for jv in jv_list:
        jvobj = get_obj("Journal Voucher", jv[0], with_children=1)
        ch = addchild(jvobj.doc, "entries", "Journal Voucher Detail")
        ch.account = jvobj.doc.tax_code
        ch.credit = jvobj.doc.ded_amount
        ch.save(1)
コード例 #27
0
def del_packing_slip_pf():
	"""
		Delete Print Format: 'Delivery Note Packing List Wise'
	"""
	webnotes.conn.sql("""\
		DELETE FROM `tabDocFormat`
		WHERE parent='Delivery Note'
		AND format='Delivery Note Packing List Wise'""")
	from webnotes.model import delete_doc
	delete_doc('Print Format', 'Delivery Note Packing List Wise')
コード例 #28
0
def delete_items():
    il = eval(webnotes.form_dict.get('items'))
    from webnotes.model import delete_doc
    from webnotes.model.code import get_obj

    for d in il:
        dt_obj = get_obj(d[0], d[1])
        if hasattr(dt_obj, 'on_trash'):
            dt_obj.on_trash()
        delete_doc(d[0], d[1])
コード例 #29
0
def execute():
    import webnotes
    from webnotes.model import delete_doc
    delete_doc("Search Criteria", "sales_order_pending_items1")

    webnotes.conn.sql(
        "update `tabSearch Criteria` set module = 'Selling' where module = 'CRM'"
    )
    from webnotes.modules import reload_doc
    reload_doc('selling', 'search_criteria', 'sales_order_pending_items')
コード例 #30
0
def del_packing_slip_pf():
    """
		Delete Print Format: 'Delivery Note Packing List Wise'
	"""
    webnotes.conn.sql("""\
		DELETE FROM `tabDocFormat`
		WHERE parent='Delivery Note'
		AND format='Delivery Note Packing List Wise'""")
    from webnotes.model import delete_doc
    delete_doc('Print Format', 'Delivery Note Packing List Wise')
コード例 #31
0
ファイル: menus.py プロジェクト: Vichagserp/cimworks
def delete_items():
    il = eval(webnotes.form_dict.get("items"))
    from webnotes.model import delete_doc
    from webnotes.model.code import get_obj

    for d in il:
        dt_obj = get_obj(d[0], d[1])
        if hasattr(dt_obj, "on_trash"):
            dt_obj.on_trash()
        delete_doc(d[0], d[1])
コード例 #32
0
def execute():
	"""
		deprecate:
		* doctype - import data control
		* page - import data (old)
	"""
	import webnotes
	from webnotes.model import delete_doc
	delete_doc('DocType', 'Import Data Control')
	delete_doc('Page', 'Import Data')
コード例 #33
0
def delete_unwanted_modules():
    "deletes unwanted modules"
    lst = [
        'Development', 'Recycle Bin', 'Testing', 'Testing System', 'Test',
        'Partner Updates', 'My Company', 'Event Updates', 'E-Commerce'
    ]
    for d in lst:
        try:
            delete_doc('Module Def', d)
        except:
            pass
コード例 #34
0
def delete_unwanted_doctypes():
    "deletes doctypes which are not used anymore"

    try:
        sql("delete from `tabMenu Item`")
        sql("delete from tabDocField where fieldname = 'site_map_details' and parent ='Control Panel'"
            )
    except:
        pass

    lst = [
        'Zone', 'WN Account Control', 'Wiki Page', 'Wiki History',
        'Wiki Control', 'While You Were Out', 'Web Visitor', 'Tweet',
        'Transfer Utility', 'Transfer Module', 'Transfer Control',
        'Transfer Account', 'Tips Common', 'TestTabDT', 'TestDT', 'Test Type',
        'Test Run', 'Test Record Detail', 'Test Record', 'Test Case',
        'Supplier TDS Category Detail', 'Shopping Cart Control',
        'Service Series', 'Series Detail', 'Rule Engine', 'RFQ',
        'Report Filter Detail', 'Report Field Detail', 'Report Control',
        'Rating Widget Record', 'Rating Widget Control',
        'Rating Template Detail', 'Rating Template', 'PV Ded Tax Detail',
        'PV Add Tax Detail', 'Product Variant', 'Product Variance',
        'Product Group', 'Product Feature', 'Payroll Tips Common',
        'Payroll Rule', 'Password Control', 'Page Visit', 'Patch',
        'Multiple Transfer', 'Module Tip Control', 'Module Setter',
        'Module Manager', 'Module Import', 'Module Detail', 'Message Control',
        'Message', 'Mail Participant Details', 'Mail', 'Leave Type Detail',
        'Leave Detail', 'Leave Applicable Detail', 'Lead Item Detail',
        'Lead Attachment Detail', 'Item Attachments Detail', 'Instant Message',
        'Impact Analysis', 'Forum Topic', 'Forum Control', 'Form Settings',
        'Follower', 'ERP Setup', 'Enquiry Attachment Detail', 'Documentation',
        'Condition Detail', 'Complaint Note', 'Code History', 'Code Editor',
        'Code Backup Control', 'Code Backup', 'City', 'Change Log',
        'Business Letter Type', 'Business Letter Template', 'Business Letter',
        'Badge Settings Detail', 'Application Type', 'Application',
        'Action Detail', 'Accounts Setup', 'Stock Common', 'Job Application',
        'Service Schedule', 'Comment Control', 'Bank', 'Tag Widget Control',
        'Feature Update', 'RFQ Detail', 'Supplier Quotation Detail',
        'Supplier Quotation', 'Year Closing Voucher', 'Approval Structure',
        'Site Map Detail', 'Menu Control', 'Menu Item', 'Menu Item Role'
    ]  # bank
    for d in lst:
        try:
            sql("delete from `tabProperty Setter` where select_doctype = '%s'"
                % d)
            sql("delete from `tabCustom Script` where dt = '%s'" % d)
            sql("delete from `tabCustom Field` where dt = '%s'" % d)
            delete_doc('DocType', d)
        except:
            pass

    sql("commit")
    delete_tables(lst)
コード例 #35
0
def delete_unwanted_search_criteria():
	"deletes search criteria which are not used anymore"
	
	sql("update `tabSearch Criteria` set module = 'HR' where name = 'salary_structure_details'")
	
	lst = ['_SRCH00002', '_SRCH00001', 'warranty-amc_summary1', 'test_so4', 'test_so3', 'test_so2', 'test_so1', 'test_so', 'test5', 'target_variance_report1', 'STDSRCH/00006', 'STDSRCH/00005', 'STDSRCH/00004', 'STDSRCH/00003', 'STDSRCH/00002', 'STDSRCH/00001', 'so_pending_items_6', 'so_pending_items_5', 'so_pending_items_3', 'so_pending_items_34', 'scrap', 'sales_report_test', 'salary_structure_details1', 'salary_structure_details2', 'salary_structure_details3', 'salary_slips1', 'projectwise_pending_qty_and_costs2', 'projectwise_pending_qty_and_costs1', 'projectwise_delivered_qty_and_costs1', 'projectwise_delivered_qty_and_costs2', 'New Search Criteria 1', 'monthly_salary_register2', 'monthly_salary_register1', 'installed_items','follow_up_history', 'follow_up_report', 'employee_in_company_experience2', 'employee_in_company_experience1', 'employee_in_company_experience', 'employee_details', 'employee_details1', 'employee_details2', 'employees_birthday1', 'draft_so_pending_items', 'draft_sales_orders', 'delivery_notewise_pending_qty_to_install', 'datewise_leave_report2', 'datewise_leave_report1', 'datewise_leave_report', 'customer_issues1', 'cancelled_so_pending_items1', 'cancelled_so_pending_items', 'budget_variance_report3', 'budget_variance_report1', 'account_-_inputs_rg_23_a_-_part_ii_wrong_one', 'territory_item_group_wise_gp', 'sales_orderwise_pending_packing_item_summary', 'itemwise_trend', 'monthly_attendance_details_old', 'projectwise_contribution_report', 'projectwise_delivery_and_material_cost', 'projectwise_delivery_and_mat_cost_report', 'territorywise_trend', 'test_dn', 'rfq', 'rfq1']
	
	for d in lst:
		if sql("select name from `tabSearch Criteria` where ifnull(standard, 'Yes') = 'Yes' and name = '%s'" % d):
			try:
				delete_doc('Search Criteria', d)
			except:
				pass
コード例 #36
0
def delete_items():
    """delete selected items"""
    import json
    from webnotes.model import delete_doc
    from webnotes.model.code import get_obj

    il = json.loads(webnotes.form_dict.get('items'))
    doctype = webnotes.form_dict.get('doctype')

    for d in il:
        dt_obj = get_obj(doctype, d)
        if hasattr(dt_obj, 'on_trash'):
            dt_obj.on_trash()
        delete_doc(doctype, d)
コード例 #37
0
def delete_items():
	"""delete selected items"""
	import json
	from webnotes.model import delete_doc
	from webnotes.model.code import get_obj

	il = json.loads(webnotes.form_dict.get('items'))
	doctype = webnotes.form_dict.get('doctype')
	
	for d in il:
		dt_obj = get_obj(doctype, d)
		if hasattr(dt_obj, 'on_trash'):
			dt_obj.on_trash()
		delete_doc(doctype, d)
コード例 #38
0
def delete_unwanted_pages():
    "deletes pages which are not used anymore"
    lst = [
        'Transaction Authorization', 'Prduct Display', 'Data Import',
        'Partner Home', 'Product Display', 'Module Settings', 'About Us',
        'Custom Reports', 'MIS', 'MIS - Comparison Report', 'Monthly MIS',
        'MyReports', 'Navigation Page', 'Point Race', 'Tag Widget',
        'Widget Test', 'Yearly MIS'
    ]
    for d in lst:
        try:
            delete_doc('Page', d)
        except:
            pass
コード例 #39
0
ファイル: stock_entry.py プロジェクト: ravidey/erpnext
	def update_serial_no(self, is_submit):
		sl_obj = get_obj('Stock Ledger')
		for d in getlist(self.doclist, 'mtn_details'):
			if d.serial_no:
				serial_nos = sl_obj.get_sr_no_list(d.serial_no)
				for x in serial_nos:
					serial_no = x.strip()
					if d.s_warehouse:
						sl_obj.update_serial_delivery_details(self, d, serial_no, is_submit)
					if d.t_warehouse:
						sl_obj.update_serial_purchase_details(self, d, serial_no, is_submit, (self.doc.purpose in ['Material Transfer', 'Sales Return']) and 1 or 0)
					
					if self.doc.purpose == 'Purchase Return':
						delete_doc("Serial No", serial_no)
コード例 #40
0
def delete_unwanted_mappers():
    "deletes unwanted mappers"

    lst = [
        'Customer Issue-Maintenance Report', 'Enquiry-Service Quotation',
        'Sales Order-Maintenance Report', 'Service Quotation-Service Order',
        'Supplier Quotation-Purchase Order',
        'Visit Schedule-Maintenance Report', 'RFQ-Supplier Quotation',
        'Indent-RFQ'
    ]
    for d in lst:
        try:
            delete_doc('DocType Mapper', d)
        except:
            pass
コード例 #41
0
ファイル: label_cleanup.py プロジェクト: ant0nk/erpnext
def execute():
	import webnotes
	from webnotes.model import delete_doc
	from webnotes.modules.module_manager import reload_doc

	dt = {
		'selling':	['quotation', 'sales_order', 'quotation_detail', 'sales_order_detail'], 
		'stock':	['delivery_note', 'delivery_note_detail', 'purchase_receipt', 'purchase_receipt_detail'],
		'accounts': ['receivable_voucher', 'payable_voucher', 'rv_detail', 'pv_detail', 'rv_tax_detail', 'purchase_tax_detail'],
		'buying':	['purchase_order', 'po_detail']
	}
	for m in dt:
		for d in dt[m]:
			reload_doc(m, 'doctype', d)


	webnotes.conn.sql("""delete from `tabDocField` 
		where label in ('Note1', 'OT Notes', 'Note', 'Note HTML', 'Rates HTML') 
		and parent in ('Quotation', 'Sales Order', 'Delivery Note', 'Receivable Voucher', 'Purchase Order')""")


	del_flds = {
		'Sales Order Detail':	"'delivery_date', 'confirmation_date'", 
		'Delivery Note':		"'supplier', 'supplier_address', 'purchase_receipt_no', 'purchase_order_no', 'transaction_date'",
		'Receivable Voucher':	"'voucher_date'",
		'Payable Voucher':		"'voucher_date'",
		'Purchase Receipt':		"'transaction_date'"
	} 

	del_labels = {
		'Delivery Note':		"'Supplier Details'",
		'Purchase Receipt':		"'Get Currrent Stock'"
	}

	for d in del_flds:
		webnotes.conn.sql("delete from `tabDocField` where fieldname in (%s) and parent = '%s'"% (del_flds[d], d))

	for d in del_labels:
		webnotes.conn.sql("delete from `tabDocField` where label in (%s) and parent = '%s'"% (del_labels[d], d))

	delete_doc('DocType', 'Update Delivery Date Detail')

	# Reload print formats
	reload_doc('accounts', 'Print Format', 'Sales Invoice Classic')
	reload_doc('accounts', 'Print Format', 'Sales Invoice Modern')
	reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan')
コード例 #42
0
def execute():
    import webnotes
    from webnotes.model import delete_doc
    from webnotes.model.code import get_obj
    from webnotes.model.doc import addchild

    # delete doctypes and tables
    for dt in [
            "TDS Payment", "TDS Return Acknowledgement", "Form 16A",
            "TDS Rate Chart", "TDS Category", "TDS Control", "TDS Detail",
            "TDS Payment Detail", "TDS Rate Detail", "TDS Category Account",
            "Form 16A Ack Detail", "Form 16A Tax Detail"
    ]:
        delete_doc("DocType", dt)

        webnotes.conn.commit()
        webnotes.conn.sql("drop table if exists `tab%s`" % dt)
        webnotes.conn.begin()

    delete_doc("Search Criteria", "tds_return")

    # Add tds entry in tax table for purchase invoice
    pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice` 
		where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0""")
    for pi in pi_list:
        piobj = get_obj("Purchase Invoice", pi[0], with_children=1)
        ch = addchild(piobj.doc, 'taxes_and_charges',
                      'Purchase Taxes and Charges')
        ch.charge_type = "Actual"
        ch.account_head = piobj.doc.tax_code
        ch.description = piobj.doc.tax_code
        ch.rate = -1 * piobj.doc.ded_amount
        ch.tax_amount = -1 * piobj.doc.ded_amount
        ch.category = "Total"
        ch.save(1)

    # Add tds entry in entries table for journal voucher
    jv_list = webnotes.conn.sql("""select name from `tabJournal Voucher` 
		where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0""")
    for jv in jv_list:
        jvobj = get_obj("Journal Voucher", jv[0], with_children=1)
        ch = addchild(jvobj.doc, 'entries', 'Journal Voucher Detail')
        ch.account = jvobj.doc.tax_code
        ch.credit = jvobj.doc.ded_amount
        ch.save(1)
コード例 #43
0
def delete_unwanted_search_criteria():
    "deletes search criteria which are not used anymore"

    sql("update `tabSearch Criteria` set module = 'HR' where name = 'salary_structure_details'"
        )

    lst = [
        '_SRCH00002', '_SRCH00001', 'warranty-amc_summary1', 'test_so4',
        'test_so3', 'test_so2', 'test_so1', 'test_so', 'test5',
        'target_variance_report1', 'STDSRCH/00006', 'STDSRCH/00005',
        'STDSRCH/00004', 'STDSRCH/00003', 'STDSRCH/00002', 'STDSRCH/00001',
        'so_pending_items_6', 'so_pending_items_5', 'so_pending_items_3',
        'so_pending_items_34', 'scrap', 'sales_report_test',
        'salary_structure_details1', 'salary_structure_details2',
        'salary_structure_details3', 'salary_slips1',
        'projectwise_pending_qty_and_costs2',
        'projectwise_pending_qty_and_costs1',
        'projectwise_delivered_qty_and_costs1',
        'projectwise_delivered_qty_and_costs2', 'New Search Criteria 1',
        'monthly_salary_register2', 'monthly_salary_register1',
        'installed_items', 'follow_up_history', 'follow_up_report',
        'employee_in_company_experience2', 'employee_in_company_experience1',
        'employee_in_company_experience', 'employee_details',
        'employee_details1', 'employee_details2', 'employees_birthday1',
        'draft_so_pending_items', 'draft_sales_orders',
        'delivery_notewise_pending_qty_to_install', 'datewise_leave_report2',
        'datewise_leave_report1', 'datewise_leave_report', 'customer_issues1',
        'cancelled_so_pending_items1', 'cancelled_so_pending_items',
        'budget_variance_report3', 'budget_variance_report1',
        'account_-_inputs_rg_23_a_-_part_ii_wrong_one',
        'territory_item_group_wise_gp',
        'sales_orderwise_pending_packing_item_summary', 'itemwise_trend',
        'monthly_attendance_details_old', 'projectwise_contribution_report',
        'projectwise_delivery_and_material_cost',
        'projectwise_delivery_and_mat_cost_report', 'territorywise_trend',
        'test_dn', 'rfq', 'rfq1'
    ]

    for d in lst:
        if sql("select name from `tabSearch Criteria` where ifnull(standard, 'Yes') = 'Yes' and name = '%s'"
               % d):
            try:
                delete_doc('Search Criteria', d)
            except:
                pass
コード例 #44
0
ファイル: reportview.py プロジェクト: Halfnhav/wnframework
def delete_items():
	"""delete selected items"""
	import json
	from webnotes.model import delete_doc
	from webnotes.model.code import get_obj

	il = json.loads(webnotes.form_dict.get('items'))
	doctype = webnotes.form_dict.get('doctype')
	
	for d in il:
		try:
			dt_obj = get_obj(doctype, d)
			if hasattr(dt_obj, 'on_trash'):
				dt_obj.on_trash()
			delete_doc(doctype, d)
		except Exception, e:
			webnotes.errprint(webnotes.getTraceback())
			pass
コード例 #45
0
def delete_items():
    """delete selected items"""
    import json
    from webnotes.model import delete_doc
    from webnotes.model.code import get_obj

    il = json.loads(webnotes.form_dict.get('items'))
    doctype = webnotes.form_dict.get('doctype')

    for d in il:
        try:
            dt_obj = get_obj(doctype, d)
            if hasattr(dt_obj, 'on_trash'):
                dt_obj.on_trash()
            delete_doc(doctype, d)
        except Exception, e:
            webnotes.errprint(webnotes.getTraceback())
            pass
コード例 #46
0
def execute():
    add_website_manager()
    from webnotes.modules import reload_doc
    from webnotes.model import delete_doc

    # cleanup page
    delete_doc("DocType", "Page")
    reload_doc("core", "doctype", "page")

    reload_doc('setup', 'doctype', 'item_group')
    delete_doc('Website', 'Module Def', 'Website')
    reload_doc('website', 'Module Def', 'Website')
    reload_doc('website', 'Role', 'Website Manager')
    reload_doc('website', 'Role', 'Blogger')

    webnotes.conn.sql(
        """delete from `tabModule Def Role` where parent='Website'""")
    d = Document('Module Def Role')
    d.parent = 'Website'
    d.role = 'Website Manager'
    d.save()

    reload_doc('website', 'doctype', 'about_us_settings')
    reload_doc('website', 'doctype', 'about_us_team')
    reload_doc('website', 'doctype', 'blog')
    reload_doc('website', 'doctype', 'contact_us_settings')
    reload_doc('website', 'doctype', 'product')
    reload_doc('website', 'doctype', 'product_group')
    reload_doc('website', 'doctype', 'products_settings')
    reload_doc('website', 'doctype', 'related_page')
    reload_doc('website', 'doctype', 'style_settings')
    reload_doc('website', 'doctype', 'top_bar_item')
    reload_doc('website', 'doctype', 'web_page')
    reload_doc('website', 'doctype', 'website_settings')

    reload_doc('website', 'page', 'about')
    reload_doc('website', 'page', 'blog')
    reload_doc('website', 'page', 'contact')
    reload_doc('website', 'page', 'products')
    reload_doc('website', 'page', 'unsubscribe')

    create_home_page()
    add_website_manager()
コード例 #47
0
def sync_mapper():
	"Put mappers into corresponding module"
		
	mappers = {
		'Accounts':		('Delivery Note-Receivable Voucher', 'Project-Receivable Voucher', 'Purchase Order-Payable Voucher', 'Purchase Receipt-Payable Voucher', 'Sales Order-Receivable Voucher'), 
		'Selling': 		('Delivery Note-Installation Note', 'Enquiry-Quotation', 'Lead-Enquiry', 'Lead-Customer', 'Project-Sales Order', 'Quotation-Sales Order', ), 
		'Buying':		('Indent-Purchase Order', 'Sales Order-Indent'), 
		'Stock':		('Purchase Order-Purchase Receipt', 'Project-Delivery Note', 'Receivable Voucher-Delivery Note', 'Sales Order-Delivery Note'), 
		'Support':		('Customer Issue-Maintenance Visit', 'Sales Order-Maintenance Schedule', 'Sales Order-Maintenance Visit'), 
		'Production':	('Production Forecast-Production Plan', 'Production Forecast-Production Planning Tool', 'Sales Order-Production Plan'), 
		'HR':			('KRA Template-Appraisal', 'Salary Structure-Salary Slip')
	}
	
	for mod in mappers.keys():
		sql("update `tabDocType Mapper` set module = '%s' where name in %s" % (mod, mappers[mod]))
	try:
		delete_doc('Module Def', 'Mapper')
	except:
		pass
コード例 #48
0
ファイル: website.py プロジェクト: NorrWing/erpnext
def execute():	
	add_website_manager()
	from webnotes.modules import reload_doc
	from webnotes.model import delete_doc

	# cleanup page
	delete_doc("DocType", "Page")
	reload_doc("core", "doctype", "page")

	reload_doc('setup', 'doctype', 'item_group')
	delete_doc('Website', 'Module Def', 'Website')
	reload_doc('website', 'Module Def', 'Website')
	reload_doc('website', 'Role', 'Website Manager')
	reload_doc('website', 'Role', 'Blogger')

	webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""")
	d = Document('Module Def Role')
	d.parent = 'Website'
	d.role = 'Website Manager'
	d.save()
	
	reload_doc('website', 'doctype', 'about_us_settings')
	reload_doc('website', 'doctype', 'about_us_team')
	reload_doc('website', 'doctype', 'blog')
	reload_doc('website', 'doctype', 'contact_us_settings')
	reload_doc('website', 'doctype', 'product')
	reload_doc('website', 'doctype', 'product_group')
	reload_doc('website', 'doctype', 'products_settings')
	reload_doc('website', 'doctype', 'related_page')
	reload_doc('website', 'doctype', 'style_settings')
	reload_doc('website', 'doctype', 'top_bar_item')
	reload_doc('website', 'doctype', 'web_page')
	reload_doc('website', 'doctype', 'website_settings')

	reload_doc('website', 'page', 'about')
	reload_doc('website', 'page', 'blog')
	reload_doc('website', 'page', 'contact')
	reload_doc('website', 'page', 'products')
	reload_doc('website', 'page', 'unsubscribe')
		
	create_home_page()
	add_website_manager()
コード例 #49
0
def execute():
    del_rec = {
        'DocType': [
            'Update Series', 'File', 'File Browser Control', 'File Group',
            'Tag Detail', 'DocType Property Setter', 'Company Group',
            'Widget Control', 'Update Delivery Date Detail',
            'Update Delivery	Date', 'Tag Detail', 'Supplier rating',
            'Stylesheet', 'Question Tag', 'PRO PP Detail', 'PRO Detail',
            'PPW Detail', 'PF Detail', 'Personalize', 'Patch Util',
            'Page Template', 'Module Def Role', 'Module Def Item',
            'File Group', 'File Browser Control', 'File',
            'Educational Qualifications', 'Earn Deduction Detail',
            'DocType Property Setter', 'Contact Detail', 'BOM Report Detail',
            'BOM Replace Utility Detail', 'BOM Replace Utility',
            'Absent Days Detail', 'Activity Dashboard Control',
            'Raw Materials Supplied', 'Setup Wizard Control', 'Company Group',
            'Lease Agreement', 'Lease Installment', 'Terms and Conditions',
            'Time Sheet', 'Time Sheet Detail', 'Naming Series Options',
            'Invest 80 Declaration Detail', 'IT Checklist',
            'Chapter VI A Detail', 'Declaration Detail', 'Personalize',
            'Salary Slip Control Panel', 'Question Control'
        ],
        'Page': ['File Browser', 'Bill of Materials', 'question-view'],
        'DocType Mapper': [
            'Production Forecast-Production Planning Tool',
            'Production Forecast-Production Plan',
            'Sales Order-Production Plan'
        ],
    }

    for d in del_rec:
        for r in del_rec[d]:
            print 'Deleted', d, ' - ', r
            if d == 'DocType':
                sql("delete from tabFeed where doc_type=%s", r)
            delete_doc(d, r)

    sql("delete from tabDocField where label='Repair Purchase Request' and parent = 'Purchase Request'"
        )

    drop_tables()
コード例 #50
0
ファイル: label_cleanup.py プロジェクト: eric20201688/erpnext
def execute():
    import webnotes
    from webnotes.model import delete_doc
    from webnotes.modules import reload_doc

    webnotes.conn.sql("""delete from `tabDocField` 
		where label in ('Note1', 'OT Notes', 'Note', 'Note HTML', 'Rates HTML') 
		and parent in ('Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice', 'Purchase Order')"""
                      )

    del_flds = {
        'Sales Order Item': "'delivery_date', 'confirmation_date'",
        'Delivery Note':
        "'supplier', 'supplier_address', 'purchase_receipt_no', 'purchase_order_no', 'transaction_date'",
        'Sales Invoice': "'voucher_date'",
        'Purchase Invoice': "'voucher_date'",
        'Purchase Receipt': "'transaction_date'"
    }

    del_labels = {
        'Delivery Note': "'Supplier Details'",
        'Purchase Receipt': "'Get Currrent Stock'"
    }

    for d in del_flds:
        webnotes.conn.sql(
            "delete from `tabDocField` where fieldname in (%s) and parent = '%s'"
            % (del_flds[d], d))

    for d in del_labels:
        webnotes.conn.sql(
            "delete from `tabDocField` where label in (%s) and parent = '%s'" %
            (del_labels[d], d))

    delete_doc('DocType', 'Update Delivery Date Detail')

    # Reload print formats
    reload_doc('accounts', 'Print Format', 'Sales Invoice Classic')
    reload_doc('accounts', 'Print Format', 'Sales Invoice Modern')
    reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan')
コード例 #51
0
def rename_merge_modules():
	"Rename module as per users view and merge for removing confusion"
	
	rename_lst = [['CRM', 'Selling'], ['SRM','Buying'], ['Material Management', 'Stock'], ['Payroll','HR'], ['Maintenance', 'Support']]
	for d in rename_lst:
		# create new module manually and export to file???????
		reload_doc(d[1].lower(), 'Module Def', d[1])

	merge_lst = [['Tools', 'Utilities'], ['Application Internal', 'Utilities'], ['Settings', 'Setup']]
	# settings hardcoded in my_company
	# module hardcoded in home_control
	# material_management hardcoded in installation note
	# maintenance hardcoded in support_email_settings
	
	lst = rename_lst + merge_lst
	for d in lst:
		update_module(d[0], d[1])
		try:
			delete_doc('Module Def', d[0])
		except:
			pass
	reload_doc('Utilities', 'Module Def', 'Utilities')
コード例 #52
0
def delete_unwanted_doctypes():
	"deletes doctypes which are not used anymore"
	
	try:
		sql("delete from `tabMenu Item`")
		sql("delete from tabDocField where fieldname = 'site_map_details' and parent ='Control Panel'")
	except:
		pass
		
	lst = ['Zone',  'WN Account Control', 'Wiki Page', 'Wiki History', 'Wiki Control', 'While You Were Out', 'Web Visitor', 'Tweet', 'Transfer Utility', 'Transfer Module', 'Transfer Control', 'Transfer Account', 'Tips Common', 'TestTabDT', 'TestDT', 'Test Type', 'Test Run', 'Test Record Detail', 'Test Record', 'Test Case', 'Supplier TDS Category Detail', 'Shopping Cart Control', 'Service Series', 'Series Detail', 'Rule Engine', 'RFQ', 'Report Filter Detail', 'Report Field Detail','Report Control', 'Rating Widget Record', 'Rating Widget Control', 'Rating Template Detail', 'Rating Template', 'PV Ded Tax Detail', 'PV Add Tax Detail', 'Product Variant', 'Product Variance', 'Product Group', 'Product Feature', 'Payroll Tips Common', 'Payroll Rule', 'Password Control', 'Page Visit', 'Patch', 'Multiple Transfer', 'Module Tip Control', 'Module Setter', 'Module Manager', 'Module Import', 'Module Detail', 'Message Control', 'Message', 'Mail Participant Details', 'Mail', 'Leave Type Detail', 'Leave Detail', 'Leave Applicable Detail', 'Lead Item Detail', 'Lead Attachment Detail', 'Item Attachments Detail', 'Instant Message', 'Impact Analysis', 'Forum Topic', 'Forum Control', 'Form Settings', 'Follower', 'ERP Setup', 'Enquiry Attachment Detail', 'Documentation', 'Condition Detail', 'Complaint Note', 'Code History', 'Code Editor', 'Code Backup Control', 'Code Backup', 'City', 'Change Log', 'Business Letter Type', 'Business Letter Template', 'Business Letter', 'Badge Settings Detail', 'Application Type', 'Application', 'Action Detail', 'Accounts Setup', 'Stock Common', 'Job Application', 'Service Schedule', 'Comment Control', 'Bank', 'Tag Widget Control', 'Feature Update', 'RFQ Detail', 'Supplier Quotation Detail', 'Supplier Quotation', 'Year Closing Voucher', 'Approval Structure', 'Site Map Detail', 'Menu Control', 'Menu Item', 'Menu Item Role'] # bank
	for d in lst:
		try:
			sql("delete from `tabProperty Setter` where select_doctype = '%s'" % d)
			sql("delete from `tabCustom Script` where dt = '%s'" % d)
			sql("delete from `tabCustom Field` where dt = '%s'" % d)
			delete_doc('DocType', d)
		except:
			pass
	
		
	sql("commit")	
	delete_tables(lst)
コード例 #53
0
def sync_mapper():
    "Put mappers into corresponding module"

    mappers = {
        'Accounts':
        ('Delivery Note-Receivable Voucher', 'Project-Receivable Voucher',
         'Purchase Order-Payable Voucher', 'Purchase Receipt-Payable Voucher',
         'Sales Order-Receivable Voucher'),
        'Selling': (
            'Delivery Note-Installation Note',
            'Enquiry-Quotation',
            'Lead-Enquiry',
            'Lead-Customer',
            'Project-Sales Order',
            'Quotation-Sales Order',
        ),
        'Buying': ('Indent-Purchase Order', 'Sales Order-Indent'),
        'Stock':
        ('Purchase Order-Purchase Receipt', 'Project-Delivery Note',
         'Receivable Voucher-Delivery Note', 'Sales Order-Delivery Note'),
        'Support':
        ('Customer Issue-Maintenance Visit',
         'Sales Order-Maintenance Schedule', 'Sales Order-Maintenance Visit'),
        'Production': ('Production Forecast-Production Plan',
                       'Production Forecast-Production Planning Tool',
                       'Sales Order-Production Plan'),
        'HR': ('KRA Template-Appraisal', 'Salary Structure-Salary Slip')
    }

    for mod in mappers.keys():
        sql("update `tabDocType Mapper` set module = '%s' where name in %s" %
            (mod, mappers[mod]))
    try:
        delete_doc('Module Def', 'Mapper')
    except:
        pass
コード例 #54
0
ファイル: label_cleanup.py プロジェクト: AminfiBerlin/erpnext
def execute():
	import webnotes
	from webnotes.model import delete_doc
	from webnotes.modules import reload_doc


	webnotes.conn.sql("""delete from `tabDocField` 
		where label in ('Note1', 'OT Notes', 'Note', 'Note HTML', 'Rates HTML') 
		and parent in ('Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice', 'Purchase Order')""")


	del_flds = {
		'Sales Order Item':	"'delivery_date', 'confirmation_date'", 
		'Delivery Note':		"'supplier', 'supplier_address', 'purchase_receipt_no', 'purchase_order_no', 'transaction_date'",
		'Sales Invoice':	"'voucher_date'",
		'Purchase Invoice':		"'voucher_date'",
		'Purchase Receipt':		"'transaction_date'"
	} 

	del_labels = {
		'Delivery Note':		"'Supplier Details'",
		'Purchase Receipt':		"'Get Currrent Stock'"
	}

	for d in del_flds:
		webnotes.conn.sql("delete from `tabDocField` where fieldname in (%s) and parent = '%s'"% (del_flds[d], d))

	for d in del_labels:
		webnotes.conn.sql("delete from `tabDocField` where label in (%s) and parent = '%s'"% (del_labels[d], d))

	delete_doc('DocType', 'Update Delivery Date Detail')

	# Reload print formats
	reload_doc('accounts', 'Print Format', 'Sales Invoice Classic')
	reload_doc('accounts', 'Print Format', 'Sales Invoice Modern')
	reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan')
コード例 #55
0
ファイル: transfer.py プロジェクト: NorrWing/wnframework
	def delete_existing(self):
		from webnotes.model import delete_doc
		delete_doc(self.doc.doctype, self.doc.name, force=1)
コード例 #56
0
def execute():
	import webnotes
	from webnotes.model import delete_doc
	webnotes.conn.sql("update `tabDocType` set module = 'Utilities' where name in ('Question', 'Answer')")
	delete_doc('Module Def', 'Knowledge Base')
コード例 #57
0
	def delete_existing(self):
		from webnotes.model import delete_doc
		delete_doc(self.doc.doctype, self.doc.name, force=1)