Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
#3215 Adds ability to create template from doctype editor #3366
I added a button for creating a new template in the template view of the doctype editor. The button uses the template resource to fetch a template scaffold, and then save a new template. After saving, the template gets selected as allowed, and if there is no default template selected, the new template will also be the default.
Hi @skttl ,
Thank you for the PR. I shall give your PR a spin and shall let you know.
I am going to try and test it for the following scenarios
If there are any cases you can think of let me know.
Hey @skttl ,
I have given the functionality a quick test. For a doc type with no default template it adds a new template and uses that as default. But when I try to add a new template to a doc type which already has a default one it creates a template and adds it as well which is fine but then I have got 2 templates with the same name and I think it could be confusing for someone who is doing it for the first time and not quite thorough with the functionality. Do you think you can append a "(1)" to the end of the template to make it more clear? Below is the screenshot for this.
Also I noticed that once you add a new template and click away from the doc type, the new template still remains in the tree and I am wondering whether this could lead to a situation where number of templates are created and left there doing nothing. One thing I can think of it to show the notification to say "Are you sure..?" but thats not something the templates screen does even otherwise when you choose another template and move away.
@nul800sebastiaan thoughts on all of the above?
nul800sebastiaan left a comment
We can accept this PR if you show the button only if you do NOT yet have a template for a document type.
Can you update this PR with that requirement in mind please?