axelor / axelor-open-platform

Open source Java framework for business application development
http://axelor.com
Other
391 stars 298 forks source link

[5.4.2] Custom fields : handle default value for boolean fields #104

Open laurentblue opened 2 years ago

laurentblue commented 2 years ago

Use Case – explain your use case Add a custom field with type = boolean and defaultValue = true

Overview of the issue – include stacktrace The default value for custom fields with boolean type is always false

Version – which version you are using? 5.4.2

Browsers and Operating System – is this a problem with all browsers? Tested with the latest chrome version

Reproduce the Error – provide a patch against app to reproduce the error Create a custom field for any model, set the default value as true. Open a form with json attributes, the custom field is set to false.

Related Issues – has a similar issue been reported before? N/A

Suggest a Fix – you can point to what might be causing the problem (line of code or commit) Boolean values are always evaluated as strings : https://github.com/axelor/axelor-open-platform/blob/cc0cc96b4ec0886b42e82867994db2aec70a3e7c/axelor-web/src/main/webapp/js/form/form.input.json.js#L88-L96