[FIX] website_blog: make removed custom tags reusable
Since [1] when the blog tags field option was refactored to use the m2m widget, the list of existing tags is not cleaned up anymore. This causes custom tags to remain in that list when they are removed. This commit adapts the existing condition to exclude custom tags that have been removed. Steps to reproduce: - edit blog - create custom tag 'test' - remove custom tag 'test' - create custom tag 'test' => was detecting the tag as already existing [1]: https://github.com/odoo/odoo/commit/4a603cd59c8a3f33d9515f28d99a0f68c381c5d2 task-2811746 X-original-commit: 7f58519b922264efb6b6180608fd5a461d30b9e8 Part-of: odoo/odoo#109479
This commit is contained in:
@@ -111,7 +111,12 @@ options.registry.BlogPostTagSelection = options.Class.extend({
|
||||
if (!widgetValue) {
|
||||
return;
|
||||
}
|
||||
const existing = Object.values(this.allTagsByID).some(tag => tag.name.toLowerCase() === widgetValue.toLowerCase());
|
||||
const existing = Object.values(this.allTagsByID).some(tag => {
|
||||
// A tag is already existing only if it was already defined (i.e.
|
||||
// id is a number) or if it appears in the current list of tags.
|
||||
return tag.name.toLowerCase() === widgetValue.toLowerCase()
|
||||
&& (typeof(tag.id) === 'number' || this.tagIDs.includes(tag.id));
|
||||
});
|
||||
if (existing) {
|
||||
return this.displayNotification({
|
||||
type: 'warning',
|
||||
|
||||
Reference in New Issue
Block a user