diff --git a/CHANGELOG.md b/CHANGELOG.md index c36dcf5..21aa741 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog Date format : day/month/year +## 1.9.1 - ??/??/2022 - ??? +- Fix for advancements fail to add new items ("_id" readonly error. see #42). + ## 1.9.0 - 01/09/2022 - Foundry v10 Compatibility __! Be certain to carefully back up any critical user data before installing this update !__ - Updated the System to FoundryVTT v10. diff --git a/README.md b/README.md index 82cf99e..5e726a3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ![Banner Legend of the Five Rings](./l5rBan.jpg) [![Buy Me a Coffee](./tags-bymecoffee.svg)](https://ko-fi.com/vlyan) +[![FoundryVTT version](https://img.shields.io/badge/FVTT-v10.x-informational)](https://foundryvtt.com/) [![Forge Installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Fl5r5e&colorB=4aa94a)](https://forge-vtt.com/bazaar#package=l5r5e) [![Foundry Hub Endorsements](https://img.shields.io/endpoint?logoColor=white&url=https%3A%2F%2Fwww.foundryvtt-hub.com%2Fwp-json%2Fhubapi%2Fv1%2Fpackage%2Fl5r5e%2Fshield%2Fendorsements)](https://www.foundryvtt-hub.com/package/l5r5e/) [![Foundry Hub Comments](https://img.shields.io/endpoint?logoColor=white&url=https%3A%2F%2Fwww.foundryvtt-hub.com%2Fwp-json%2Fhubapi%2Fv1%2Fpackage%2Fl5r5e%2Fshield%2Fcomments)](https://www.foundryvtt-hub.com/package/l5r5e/) diff --git a/system/scripts/item.js b/system/scripts/item.js index 18fad37..9586700 100644 --- a/system/scripts/item.js +++ b/system/scripts/item.js @@ -216,8 +216,11 @@ export class ItemL5r5e extends Item { } // New id - if (newId) { - item._id = foundry.utils.randomID(); + if (newId || !item._id) { + // Bypass the readonly for "_id" + const tmpData = item.toJSON(); + tmpData._id = foundry.utils.randomID(); + item = new ItemL5r5e(tmpData); } // Copy the parent permission to the sub item