예제 #1
0
	def setUp(self):
		frappe.set_user("Administrator")

		# use the fixture data
		import_doc(frappe.get_app_path("erpnext", "erpnext_integrations/doctype/shopify_settings/test_data/custom_field.json"))

		frappe.reload_doctype("Customer")
		frappe.reload_doctype("Sales Order")
		frappe.reload_doctype("Delivery Note")
		frappe.reload_doctype("Sales Invoice")

		self.setup_shopify()
예제 #2
0
파일: utils.py 프로젝트: yered1/frappe
def import_doc(context, path, force=False):
	"Import (insert/update) doclist. If the argument is a directory, all files ending with .json are imported"
	from frappe.core.doctype.data_import import data_import

	if not os.path.exists(path):
		path = os.path.join('..', path)
	if not os.path.exists(path):
		print('Invalid path {0}'.format(path))
		sys.exit(1)

	for site in context.sites:
		try:
			frappe.init(site=site)
			frappe.connect()
			data_import.import_doc(path, overwrite=context.force)
		finally:
			frappe.destroy()
예제 #3
0
파일: utils.py 프로젝트: ESS-LLP/frappe
def import_doc(context, path, force=False):
	"Import (insert/update) doclist. If the argument is a directory, all files ending with .json are imported"
	from frappe.core.doctype.data_import import data_import

	if not os.path.exists(path):
		path = os.path.join('..', path)
	if not os.path.exists(path):
		print('Invalid path {0}'.format(path))
		sys.exit(1)

	for site in context.sites:
		try:
			frappe.init(site=site)
			frappe.connect()
			data_import.import_doc(path, overwrite=context.force)
		finally:
			frappe.destroy()
예제 #4
0
    def setUp(self):
        frappe.set_user("Administrator")

        # use the fixture data
        import_doc(path=frappe.get_app_path(
            "erpbee",
            "erpbee_integrations/doctype/shopify_settings/test_data/custom_field.json"
        ),
                   ignore_links=True,
                   overwrite=True)

        frappe.reload_doctype("Customer")
        frappe.reload_doctype("Sales Order")
        frappe.reload_doctype("Delivery Note")
        frappe.reload_doctype("Sales Invoice")

        self.setup_shopify()
예제 #5
0
    def setUp(self):
        frappe.set_user("Administrator")

        #Import custom fields
        import_doc(path=frappe.get_app_path(
            "metactical",
            "metactical/doctype/shipstation_settings/test_data/custom_field.json"
        ),
                   ignore_links=True,
                   overwrite=True)

        frappe.reload_doctype("Delivery Note")

        #So it doesn't raise insuficient stock error
        frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)

        self.setup_shipstation()
        self.create_delivery_note()
예제 #6
0
def sync_fixtures(app=None):
    """Import, overwrite fixtures from `[app]/fixtures`"""
    if app:
        apps = [app]
    else:
        apps = frappe.get_installed_apps()

    frappe.flags.in_fixtures = True

    for app in apps:
        fixtures_path = frappe.get_app_path(app, "fixtures")
        if os.path.exists(fixtures_path):
            import_doc(fixtures_path)

        import_custom_scripts(app)

    frappe.flags.in_fixtures = False

    frappe.db.commit()
예제 #7
0
파일: utils.py 프로젝트: erpnext-tm/frappe
def import_doc(context, path, force=False):
	"Import (insert/update) doclist. If the argument is a directory, all files ending with .json are imported"
	from frappe.core.doctype.data_import.data_import import import_doc

	if not os.path.exists(path):
		path = os.path.join("..", path)
	if not os.path.exists(path):
		print("Invalid path {0}".format(path))
		sys.exit(1)

	for site in context.sites:
		try:
			frappe.init(site=site)
			frappe.connect()
			import_doc(path)
		finally:
			frappe.destroy()
	if not context.sites:
		raise SiteNotSpecifiedError
예제 #8
0
def sync_fixtures(app=None):
	"""Import, overwrite fixtures from `[app]/fixtures`"""
	if app:
		apps = [app]
	else:
		apps = frappe.get_installed_apps()

	frappe.flags.in_fixtures = True

	for app in apps:
		if os.path.exists(frappe.get_app_path(app, "fixtures")):
			fixture_files = sorted(os.listdir(frappe.get_app_path(app, "fixtures")))
			for fname in fixture_files:
				if fname.endswith(".json") or fname.endswith(".csv"):
					import_doc(frappe.get_app_path(app, "fixtures", fname))

		import_custom_scripts(app)

	frappe.flags.in_fixtures = False

	frappe.db.commit()
예제 #9
0
파일: fixtures.py 프로젝트: ESS-LLP/frappe
def sync_fixtures(app=None):
	"""Import, overwrite fixtures from `[app]/fixtures`"""
	if app:
		apps = [app]
	else:
		apps = frappe.get_installed_apps()

	frappe.flags.in_fixtures = True

	for app in apps:
		if os.path.exists(frappe.get_app_path(app, "fixtures")):
			fixture_files = sorted(os.listdir(frappe.get_app_path(app, "fixtures")))
			for fname in fixture_files:
				if fname.endswith(".json") or fname.endswith(".csv"):
					import_doc(frappe.get_app_path(app, "fixtures", fname),
						ignore_links=True, overwrite=True)

		import_custom_scripts(app)

	frappe.flags.in_fixtures = False

	frappe.db.commit()
예제 #10
0
    def setUpClass(cls):
        frappe.set_user("Administrator")

        cls.allow_negative_stock = cint(
            frappe.db.get_value('Stock Settings', None,
                                'allow_negative_stock'))
        if not cls.allow_negative_stock:
            frappe.db.set_value('Stock Settings', None, 'allow_negative_stock',
                                1)

        # use the fixture data
        import_doc(path=frappe.get_app_path(
            "erpnext",
            "erpnext_integrations/doctype/shopify_settings/test_data/custom_field.json"
        ))

        frappe.reload_doctype("Customer")
        frappe.reload_doctype("Sales Order")
        frappe.reload_doctype("Delivery Note")
        frappe.reload_doctype("Sales Invoice")

        cls.setup_shopify()
예제 #11
0
def import_doc(path, ignore_links=False, ignore_insert=False, insert=False):
	"""Import a file using Data Import."""
	from frappe.core.doctype.data_import import data_import
	data_import.import_doc(path, ignore_links=ignore_links, ignore_insert=ignore_insert, insert=insert)
예제 #12
0
def import_doc(path, ignore_links=False, ignore_insert=False, insert=False):
	"""Import a file using Data Import."""
	from frappe.core.doctype.data_import import data_import
	data_import.import_doc(path, ignore_links=ignore_links, ignore_insert=ignore_insert, insert=insert)
예제 #13
0
def import_fixtures():
    import_doc(frappe.get_app_path("my_account", "fixtures",
                                   "setup_wizard_system_manager.json"),
               ignore_links=False,
               overwrite=True)