Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: Migration to Odoo 14: replacing size attribute of Char field

by
Tecnativa. S. L., Pedro M. Baeza
- 21/05/2021 14:58:47
The warning is from Odoo, not from linters, so #noqa is not valid.

El vie., 21 may. 2021 14:52, Graeme Gellatly <gdgellatly@gmail.com> escribió:
I think if the use case is valid and no convenient good alternative exists then the easiest solution is

# noqa 

with a note.

On Sat, May 22, 2021 at 12:16 AM Dominique k <dominique.k@elico-corp.com.sg> wrote:
how about api.onchange ?
it would work on form modification.



On Fri, 21 May 2021 at 6:57 PM, Simone Rubino <simone.rubino@agilebg.com> wrote:
Hi all,
I am migrating some modules to version 14 following https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-14.0 but there is:
Remove size=X attribute in Char fields, as it's no longer valid for restricting the size of the strings.
that I don't know how to satisfy.

The attribute size=X still works fine in Odoo 14 with also the UI limitation so I believe this comes from https://github.com/odoo/odoo/blob/1c39814bd729cc08882f1545c7d88b0592e63f9a/odoo/fields.py#L1608 but as far I can see, it has always been deprecated (at least from https://github.com/odoo/odoo/commit/524bb0a52027ec81245750bb5f0a9e5320faf922), so is there any reason for this to be explicitly mentioned in Odoo 14 migration?

I know I could add an `api.constrains` but this looks to me like overkill since I believe constraints should be used for more complex conditions.
Moreover: `api.constrains` does not add any limitation in the UI, so it is not as user-friendly as the attribute size=X that does not allow the user to input more than X characters.
I should then add also something in every view showing the Char field (hopefully just an option for the Char widget), but it still seems too much work for such an easy requirement.

This said, what is a valid alternative to the size=X attribute?


Thanks,
Simone Rubino

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

--
Dominique KON-SUN-TACK  [Project Manager]
Odoo Gold Partner, best Odoo Partner 2014 for APAC

Mobile: + 65 8502 2399
Skype: dominique_elico


_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

Reference