fix: controller path for exporting types (#28251)

This commit is contained in:
Raffael Meyer 2024-10-25 03:13:28 +02:00 committed by GitHub
parent 46a0814287
commit ce01f8ada8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,6 +17,7 @@ from keyword import iskeyword
from pathlib import Path
import frappe
from frappe import scrub
from frappe.types import DF
field_template = "{field}: {type}"
@ -59,7 +60,12 @@ class TypeExporter:
self.imports = {"from frappe.types import DF"}
self.indent = "\t"
self.controller_path = Path(inspect.getfile(get_controller(self.doctype)))
self.controller_path = (
Path(frappe.get_module_path(doc.module))
/ "doctype"
/ scrub(self.doctype)
/ f"{scrub(self.doctype)}.py"
)
def export_types(self):
self._guess_indentation()