[IMP] qweb: add option to allow duplicate templates

This commit is contained in:
Géry Debongnie
2019-06-24 22:41:02 +02:00
parent 34695883c2
commit 4a889b7b6b
3 changed files with 16 additions and 6 deletions
+4 -1
View File
@@ -173,7 +173,10 @@ export class QWeb extends EventBus {
* Add a template to the internal template map. Note that it is not
* immediately compiled.
*/
addTemplate(name: string, xmlString: string) {
addTemplate(name: string, xmlString: string, allowDuplicate?: boolean) {
if (allowDuplicate && name in this.templates) {
return;
}
const doc = parseXML(xmlString);
if (!doc.firstChild) {
throw new Error("Invalid template (should not be empty)");