Code Monkey home page Code Monkey logo

Comments (7)

ankush avatar ankush commented on May 23, 2024 1

@mohsinalimat you're mostly running into this issue only. Perms exported via "Export customization" are forcefully synced.

from frappe.

ankush avatar ankush commented on May 23, 2024

What is the point of exporting a customisation if sync_on_migrate is not set?

Sync on install, but never again. It's useful in a lot of cases too.

from frappe.

casesolved-co-uk avatar casesolved-co-uk commented on May 23, 2024

What is the point of exporting a customisation if sync_on_migrate is not set?

Sync on install, but never again. It's useful in a lot of cases too.

On install of the app? So any additions in later versions are ignored.

from frappe.

ankush avatar ankush commented on May 23, 2024

Yeah.

from frappe.

ankush avatar ankush commented on May 23, 2024

Prop setters now sync by default instead of overriding: #25918

IDK if anyone really wants to delete all current prop setter and sync from code 😅

from frappe.

ankush avatar ankush commented on May 23, 2024

Idk any good solution for custom docperms yet, maybe best to remove it from this feature. Removal of docperm might actually mean it needs to be removed while syncing, so there's no way to guess intent from current version of code alone.

from frappe.

casesolved-co-uk avatar casesolved-co-uk commented on May 23, 2024

@ankush
Here's a patch I wrote to fix the behaviour, might be useful:

# for ensuring customisations exist instead of sync_on_migrate
import frappe
import os
import json


def insert(dt, doc):
	doc["doctype"] = dt
	d = frappe.get_doc(doc)
	d.insert()

def execute():
	path = frappe.get_app_path("app", "module", "custom")
	customs = [os.path.join(path, f) for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
	for custom in customs:
		with open(custom) as f:
			data = json.loads(f.read())
		for key, docs in data.items():
			if not isinstance(docs, list):
				continue
			for doc in docs:
				try:
					if key == "property_setters":
						insert("Property Setter", doc)
					if key == "custom_fields":
						insert("Custom Field", doc)
				except frappe.DuplicateEntryError:
					pass
	frappe.db.commit()

EDIT: needs to be a normal insert to create the db table!

from frappe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.