Extend field of a existing model

33 views
Skip to first unread message

Manuel Marquez

unread,
Nov 20, 2016, 2:55:03 PM11/20/16
to tryto...@googlegroups.com
Hello, I am having a problem to extend a field of a model.
Can someone tell me the right way?

Thanks.

Jon Levy

unread,
Nov 20, 2016, 6:46:42 PM11/20/16
to tryton-dev


On Sunday, November 20, 2016 at 2:55:03 PM UTC-5, Manuel Alejandro Márquez Ortiz wrote:
I am having a problem to extend a field of a model.

I am not sure what you mean by "extend a field of a model."  If a model is defined in another module, and you want to change the attributes of one of its fields, the place to do it is in by overriding the model's __setup__ method.  For example, something like AModel.the_field.states.update({'readonly': True}).

Manuel Marquez

unread,
Nov 21, 2016, 3:59:05 AM11/21/16
to tryto...@googlegroups.com



El 20/11/16 a las 19:46, Jon Levy escribió:


On Sunday, November 20, 2016 at 2:55:03 PM UTC-5, Manuel Alejandro Márquez Ortiz wrote:
I am having a problem to extend a field of a model.

I am not sure what you mean by "extend a field of a model."  If a model is defined in another module, and you want to change the attributes of one of its fields, the place to do it is in by overriding the model's __setup__ method.  For example, something like AModel.the_field.states.update({'readonly': True}).
--
Thanks Jon, that's that I need!
I want to change the attributes of one field of one existing model.

Regards.
Reply all
Reply to author
Forward
0 new messages