示例#1
0
	def test_3_create_new_docfields(self):
	
		self.f1 = self.test_doc.addchild('fields', 'DocField')
		self.f1.label = 'Test Account Name'
		self.f1.fieldname = 'test_ac_name'
		self.f1.fieldtype = 'Data'
		self.f1.save()
	
	
		self.f2 = self.test_doc.addchild('fields', 'DocField')
		self.f2.label = 'Database Name'
		self.f2.fieldname = 'test_db_name'
		self.f2.fieldtype = 'Data'
		self.f2.save()

		self.f3 = self.test_doc.addchild('fields', 'DocField')
		self.f3.label = 'Database Login'
		self.f3.fieldname = 'test_db_login'
		self.f3.fieldtype = 'Data'
		self.f3.save()

		self.f4 = self.test_doc.addchild('fields', 'DocField')
		self.f4.label = 'App Login' 
		self.f4.fieldname = 'test_app_login'
		self.f4.fieldtype = 'Data'
		self.f4.save()
		

		updatedb((testlib.test_doctype))
		webnotes.conn.commit()
		assert (testlib.test_conn.sql("select count(*) from tabDocField where name = '%s'"%self.f1.fieldname)[0][0])
		assert (testlib.test_conn.sql("select count(*) from tabDocField where name = '%s'"%self.f2.fieldname)[0][0])
		assert (testlib.test_conn.sql("select count(*) from tabDocField where name = '%s'"%self.f3.fieldname)[0][0])
		assert (testlib.test_conn.sql("select count(*) from tabDocField where name = '%s'"%self.f4.fieldname)[0][0])
示例#2
0
def create_file_list():
    should_exist = [
        'Website Settings', 'Web Page', 'Timesheet', 'Task', 'Support Ticket',
        'Supplier', 'Style Settings', 'Stock Reconciliation', 'Stock Entry',
        'Serial No', 'Sales Order', 'Sales Invoice', 'Quotation', 'Question',
        'Purchase Receipt', 'Purchase Order', 'Project', 'Profile',
        'Production Order', 'Product', 'Print Format', 'Price List',
        'Purchase Invoice', 'Page', 'Maintenance Visit',
        'Maintenance Schedule', 'Letter Head', 'Leave Application', 'Lead',
        'Journal Voucher', 'Item', 'Purchase Request', 'Expense Claim',
        'Opportunity', 'Employee', 'Delivery Note', 'Customer Issue',
        'Customer', 'Contact Us Settings', 'Company', 'Bulk Rename Tool',
        'Blog', 'BOM', 'About Us Settings'
    ]

    from webnotes.model.code import get_obj

    for dt in should_exist:
        obj = get_obj('DocType', dt, with_children=1)
        obj.doc.allow_attach = 1
        obj.doc.save()
        obj.make_file_list()
        from webnotes.model.db_schema import updatedb
        updatedb(obj.doc.name)

        webnotes.clear_cache(doctype=obj.doc.name)
示例#3
0
    def validate(self):
        self.set_fieldname()
        self.validate_field()
        self.idx = cint((self.doc.insert_after).split(' - ')[1])
        self.add_field()

        # update the schema
        from webnotes.model.db_schema import updatedb
        updatedb(self.doc.dt)
示例#4
0
def sync_one_doc(d, dt, ts):
	import webnotes
	from webnotes.model.db_schema import updatedb
	reload_doc(d[0], dt, d[1])
		
	# update schema(s)
	if dt=='DocType':
		updatedb(d[1])
	webnotes.conn.sql("update `tab%s` set _last_update=%s where name=%s" % (dt, '%s', '%s'), (ts, d[1]))
示例#5
0
	def validate(self):
		self.set_fieldname()
		self.validate_field()
		self.idx = cint((self.doc.insert_after).split(' - ')[1])
		self.add_field()
		
		# update the schema
		from webnotes.model.db_schema import updatedb
		updatedb(self.doc.dt)
示例#6
0
	def on_update(self):
		# update the schema
		from webnotes.model.db_schema import updatedb
		updatedb(self.doc.dt)

		# create property setter to emulate insert after
		self.create_property_setter()

		from webnotes.utils.cache import CacheItem
		CacheItem(self.doc.dt).clear()
示例#7
0
	def on_update(self):
		# make schma changes
		from webnotes.model.db_schema import updatedb
		updatedb(self.doc.name)

		self.change_modified_of_parent()
		
		import webnotes.defs
		if hasattr(webnotes.defs, 'developer_mode') and webnotes.defs.developer_mode:
			self.export_doc()
		sql("delete from __DocTypeCache")
示例#8
0
def insert_record(doctype, tar_tab, name):
	try:
		insert_record_name(tar_tab, name)
	except Exception, e:
		if e.args[0]==1146: 
			# missing table - create it
			from webnotes.model.db_schema import updatedb
			updatedb(doctype, 1)
			
			# again
			insert_record_name(tar_tab, name)
		else:
			raise e
示例#9
0
	def on_update(self):
		# make schma changes
		from webnotes.model.db_schema import updatedb
		updatedb(self.doc.name)

		self.change_modified_of_parent()
		
		from webnotes import defs
		from webnotes.utils.transfer import in_transfer

		if (not in_transfer) and getattr(webnotes.defs,'developer_mode', 0):
			self.export_doc()
		sql("delete from __DocTypeCache")
示例#10
0
    def on_update(self):
        # make schma changes
        from webnotes.model.db_schema import updatedb
        updatedb(self.doc.name)

        self.change_modified_of_parent()

        from webnotes import defs
        from webnotes.utils.transfer import in_transfer

        if (not in_transfer) and getattr(webnotes.defs, 'developer_mode', 0):
            self.export_doc()
        sql("delete from __DocTypeCache")
示例#11
0
    def on_update(self):
        from webnotes.model.db_schema import updatedb
        updatedb(self.doc.name)

        self.change_modified_of_parent()

        import conf
        from webnotes.modules.import_file import in_import

        if (not in_import) and getattr(conf, 'developer_mode', 0):
            self.export_doc()
            self.make_controller_template()

        webnotes.clear_cache(doctype=self.doc.name)
示例#12
0
    def on_update(self):
        # validate field
        from core.doctype.doctype.doctype import validate_fields_for_doctype

        validate_fields_for_doctype(self.doc.dt)

        webnotes.clear_cache(doctype=self.doc.dt)

        # create property setter to emulate insert after
        self.create_property_setter()

        # update the schema
        from webnotes.model.db_schema import updatedb
        updatedb(self.doc.dt)
示例#13
0
	def on_update(self):
		from webnotes.model.db_schema import updatedb
		updatedb(self.doc.name)

		self.change_modified_of_parent()
		
		import conf
		from webnotes.modules.import_file import in_import

		if (not in_import) and getattr(conf,'developer_mode', 0):
			self.export_doc()
			self.make_controller_template()

		webnotes.clear_cache(doctype=self.doc.name)
示例#14
0
	def on_update(self):
		# validate field
		from core.doctype.doctype.doctype import validate_fields_for_doctype

		validate_fields_for_doctype(self.doc.dt)

		webnotes.clear_cache(doctype=self.doc.dt)
				
		# create property setter to emulate insert after
		self.create_property_setter()

		# update the schema
		from webnotes.model.db_schema import updatedb
		updatedb(self.doc.dt)
示例#15
0
	def on_update(self):
		sql = webnotes.conn.sql
		# make schma changes
		from webnotes.model.db_schema import updatedb
		updatedb(self.doc.name)

		self.change_modified_of_parent()
		
		import conf
		from webnotes.utils.transfer import in_transfer

		if (not in_transfer) and getattr(conf,'developer_mode', 0):
			self.export_doc()

		from webnotes.utils.cache import CacheItem
		CacheItem(self.doc.name).clear()
示例#16
0
	def on_update(self):
		self.make_amendable()
		self.make_file_list()
		
		sql = webnotes.conn.sql
		# make schma changes
		from webnotes.model.db_schema import updatedb
		updatedb(self.doc.name)

		self.change_modified_of_parent()
		
		import conf
		from webnotes.modules.import_merge import in_transfer

		if (not in_transfer) and getattr(conf,'developer_mode', 0):
			self.export_doc()

		webnotes.clear_cache(doctype=self.doc.name)
示例#17
0
    def on_update(self):
        self.make_amendable()
        self.make_file_list()

        sql = webnotes.conn.sql
        # make schma changes
        from webnotes.model.db_schema import updatedb
        updatedb(self.doc.name)

        self.change_modified_of_parent()

        import conf
        from webnotes.modules.import_merge import in_transfer

        if (not in_transfer) and getattr(conf, 'developer_mode', 0):
            self.export_doc()

        webnotes.clear_cache(doctype=self.doc.name)
示例#18
0
	def on_update(self):
		from webnotes.model.db_schema import updatedb
		updatedb(self.doc.name)

		self.change_modified_of_parent()
		make_module_and_roles(self.doclist)
		
		import conf
		if (not webnotes.in_import) and getattr(conf, 'developer_mode', 0):
			self.export_doc()
			self.make_controller_template()
		
		# update index
		if not self.doc.custom:
			from webnotes.model.code import load_doctype_module
			module = load_doctype_module( self.doc.name, self.doc.module)
			if hasattr(module, "on_doctype_update"):
				module.on_doctype_update()
		webnotes.clear_cache(doctype=self.doc.name)
示例#19
0
    def on_update(self):
        from webnotes.model.db_schema import updatedb
        updatedb(self.doc.name)

        self.change_modified_of_parent()
        make_module_and_roles(self.doclist)

        import conf
        if (not webnotes.in_import) and getattr(conf, 'developer_mode', 0):
            self.export_doc()
            self.make_controller_template()

        # update index
        if not self.doc.custom:
            from webnotes.model.code import load_doctype_module
            module = load_doctype_module(self.doc.name, self.doc.module)
            if hasattr(module, "on_doctype_update"):
                module.on_doctype_update()
        webnotes.clear_cache(doctype=self.doc.name)
示例#20
0
	def on_update(self):
		from webnotes.model.db_schema import updatedb
		updatedb(self.doc.name)

		self.change_modified_of_parent()
		
		import conf
		if (not webnotes.in_import) and getattr(conf, 'developer_mode', 0):
			self.export_doc()
			self.make_controller_template()
		
		# update index
		if not self.doc.custom:
			from webnotes.modules import scrub
			doctype = scrub(self.doc.name)
			module = __import__(scrub(self.doc.module) + ".doctype." + doctype + "." + doctype,
				fromlist=[""])
			if hasattr(module, "on_doctype_update"):
				module.on_doctype_update()
		
		webnotes.clear_cache(doctype=self.doc.name)
示例#21
0
    def on_update(self):
        from webnotes.model.db_schema import updatedb
        updatedb(self.doc.name)

        self.change_modified_of_parent()

        import conf
        if (not webnotes.in_import) and getattr(conf, 'developer_mode', 0):
            self.export_doc()
            self.make_controller_template()

        # update index
        if not self.doc.custom:
            from webnotes.modules import scrub
            doctype = scrub(self.doc.name)
            module = __import__(scrub(self.doc.module) + ".doctype." +
                                doctype + "." + doctype,
                                fromlist=[""])
            if hasattr(module, "on_doctype_update"):
                module.on_doctype_update()

        webnotes.clear_cache(doctype=self.doc.name)
示例#22
0
def move_customizations():
    import webnotes.model.doc
    import webnotes.model.doctype

    res = webnotes.conn.sql("""\
		delete from `tabProperty Setter`
		where property='previous_field'
		and doc_type = 'Communication Log'""")

    res = webnotes.conn.sql("""\
		select name from `tabCustom Field`
		where dt='Communication Log'""")
    for r in res:
        d = webnotes.model.doc.Document('Custom Field', r[0])
        d.dt = 'Communication'
        d.save()
    from webnotes.model.db_schema import updatedb
    updatedb('Communication')

    res = webnotes.conn.sql("""\
		select field_name from `tabProperty Setter`
		where doc_type='Communication Log' and field_name is not null""")

    doclist = webnotes.model.doctype.get('Communication', 0)
    field_list = [d.fieldname for d in doclist if d.doctype == 'DocField']
    for r in res:
        if r[0] in field_list:
            webnotes.conn.sql(
                """\
				update `tabProperty Setter`
				set doc_type = 'Communication'
				where field_name=%s and doc_type='Communication Log'""", r[0])

    webnotes.conn.sql("""\
		delete from `tabProperty Setter`
		where doc_type='Communication Log'""")

    from webnotes.utils.cache import CacheItem
    CacheItem('Communication').clear()
def move_customizations():
	import webnotes.model.doc
	import webnotes.model.doctype

	res = webnotes.conn.sql("""\
		delete from `tabProperty Setter`
		where property='previous_field'
		and doc_type = 'Communication Log'""")
	
	res = webnotes.conn.sql("""\
		select name from `tabCustom Field`
		where dt='Communication Log'""")
	for r in res:
		d = webnotes.model.doc.Document('Custom Field', r[0])
		d.dt = 'Communication'
		d.save()
	from webnotes.model.db_schema import updatedb
	updatedb('Communication')

	res = webnotes.conn.sql("""\
		select field_name from `tabProperty Setter`
		where doc_type='Communication Log' and field_name is not null""")
	
	doclist = webnotes.model.doctype.get('Communication', 0)
	field_list = [d.fieldname for d in doclist if d.doctype=='DocField']
	for r in res:
		if r[0] in field_list:
			webnotes.conn.sql("""\
				update `tabProperty Setter`
				set doc_type = 'Communication'
				where field_name=%s and doc_type='Communication Log'""", r[0])
				
	webnotes.conn.sql("""\
		delete from `tabProperty Setter`
		where doc_type='Communication Log'""")
		
	from webnotes.utils.cache import CacheItem
	CacheItem('Communication').clear()
def create_file_list():
	should_exist = ['Website Settings', 'Web Page', 'Timesheet', 'Task',
		'Support Ticket', 'Supplier', 'Style Settings', 'Stock Reconciliation',
		'Stock Entry', 'Serial No', 'Sales Order', 'Sales Invoice',
		'Quotation', 'Question', 'Purchase Receipt', 'Purchase Order',
		'Project', 'Profile', 'Production Order', 'Product', 'Print Format',
		'Price List', 'Purchase Invoice', 'Page', 
		'Maintenance Visit', 'Maintenance Schedule', 'Letter Head',
		'Leave Application', 'Lead', 'Journal Voucher', 'Item', 'Purchase Request',
		'Expense Claim', 'Opportunity', 'Employee', 'Delivery Note',
		'Customer Issue', 'Customer', 'Contact Us Settings', 'Company',
		'Bulk Rename Tool', 'Blog', 'BOM', 'About Us Settings']

	from webnotes.model.code import get_obj

	for dt in should_exist:
		obj = get_obj('DocType', dt, with_children=1)
		obj.doc.allow_attach = 1
		obj.doc.save()
		obj.make_file_list()
		from webnotes.model.db_schema import updatedb
		updatedb(obj.doc.name)

		webnotes.clear_cache(doctype=obj.doc.name)
示例#25
0
def update_schema(docname):
    from webnotes.model.db_schema import updatedb
    updatedb(docname)

    webnotes.clear_cache(doctype=docname)
示例#26
0
def make_address():
    from webnotes.modules.module_manager import reload_doc
    reload_doc('utilities', 'doctype', 'address')

    from webnotes.model.db_schema import updatedb
    updatedb('Address')
示例#27
0
	def test_2_create_new_doctype_table(self):
		updatedb((testlib.test_doctype))
		table_list = self.dbman.get_tables_list(testlib.test_db)
		webnotes.conn.commit()
		assert ('tab'+testlib.test_doctype in table_list)
示例#28
0
文件: sync.py 项目: jacara/erpclone
def update_schema(docname):
	from webnotes.model.db_schema import updatedb
	updatedb(docname)

	webnotes.clear_cache(doctype=docname)
示例#29
0
def create_file_list():
    should_exist = [
        "Website Settings",
        "Web Page",
        "Timesheet",
        "Task",
        "Support Ticket",
        "Supplier",
        "Style Settings",
        "Stock Reconciliation",
        "Stock Entry",
        "Serial No",
        "Sales Order",
        "Sales Invoice",
        "Quotation",
        "Question",
        "Purchase Receipt",
        "Purchase Order",
        "Project",
        "Profile",
        "Production Order",
        "Product",
        "Print Format",
        "Price List",
        "Purchase Invoice",
        "Page",
        "Maintenance Visit",
        "Maintenance Schedule",
        "Letter Head",
        "Leave Application",
        "Lead",
        "Journal Voucher",
        "Item",
        "Purchase Request",
        "Expense Claim",
        "Opportunity",
        "Employee",
        "Delivery Note",
        "Customer Issue",
        "Customer",
        "Contact Us Settings",
        "Company",
        "Bulk Rename Tool",
        "Blog",
        "BOM",
        "About Us Settings",
    ]

    from webnotes.model.code import get_obj

    for dt in should_exist:
        obj = get_obj("DocType", dt, with_children=1)
        obj.doc.allow_attach = 1
        obj.doc.save()
        obj.make_file_list()
        from webnotes.model.db_schema import updatedb

        updatedb(obj.doc.name)
        from webnotes.utils.cache import CacheItem

        CacheItem(obj.doc.name).clear()
示例#30
0
def update_schema(docname):
	from webnotes.model.db_schema import updatedb
	updatedb(docname)

	from webnotes.utils.cache import CacheItem
	CacheItem(docname).clear()
示例#31
0
def make_address():
	from webnotes.modules.module_manager import reload_doc
	reload_doc('tools','doctype','address')
	
	from webnotes.model.db_schema import updatedb
	updatedb('Address')