diff --git a/frontend_src/vstutils/fields/dynamic/DependFromFkField.ts b/frontend_src/vstutils/fields/dynamic/DependFromFkField.ts index de5b0813..63619149 100644 --- a/frontend_src/vstutils/fields/dynamic/DependFromFkField.ts +++ b/frontend_src/vstutils/fields/dynamic/DependFromFkField.ts @@ -52,6 +52,9 @@ export class DependFromFkField extends BaseField { mergeDeep({ format, callback_opt }), this.name, ); + if (!realField.model && this.model) { + realField.model = this.model; + } if (this.app.store.page) { realField.prepareFieldForView(this.app.store.page.view.path); } diff --git a/frontend_src/vstutils/fields/dynamic/__tests__/DependFromFkField.test.js b/frontend_src/vstutils/fields/dynamic/__tests__/DependFromFkField.test.js index 75376c7e..dd3cd36c 100644 --- a/frontend_src/vstutils/fields/dynamic/__tests__/DependFromFkField.test.js +++ b/frontend_src/vstutils/fields/dynamic/__tests__/DependFromFkField.test.js @@ -230,4 +230,14 @@ describe('DependFromFkField', () => { expect(fetchMock).toBeCalledTimes(2); expect(app.store.page.sandbox.value).toBe(true); }); + + test('model is set', () => { + const Attribute = app.modelsResolver.get('Attribute'); + const PredefinedAttribute = app.modelsResolver.get('PredefinedAttribute'); + expect( + Attribute.fields + .get('value') + .getRealField({ key: new PredefinedAttribute({ id: 1, field_type: 'boolean' }) }).model, + ).toBe(Attribute); + }); }); diff --git a/vstutils/__init__.py b/vstutils/__init__.py index b599cc3c..667dc189 100644 --- a/vstutils/__init__.py +++ b/vstutils/__init__.py @@ -1,2 +1,2 @@ # pylint: disable=django-not-available -__version__: str = '5.8.15' +__version__: str = '5.8.16'