This question has been flagged
2 Replies
8278 Views

Hi, I have one quick qeustion:

i have this code in python class:

_columns = { 
               'text':fields.char("blabla"),
               }

value= 'text'

 

and this one i XML file:

<field name="{value}"/>

 

Of course, I want to show text , so I have to tell OpenERP to read Python variable 'value' as variable, not as constant text. 

How to do this?

Avatar
Discard
Best Answer

Create a field for it and provide the field with a default value.

The (old) API of OpenERP (not based on model.Models) does not care about abything outside of the pre-set keywords to look for. It will look for things like _columns, _name etc. but will not use your "value" property.

Avatar
Discard
Best Answer

Not realy clear what you want to do... .
but based on your question there is few possible solutions:

1. you want some default value for the field... in that case:
_columns = { 'field_name':fields.text('Field_label') }  #define field in your model..
_defaults = { 'field_name' : 'Some default field value' } # will insert that default value upon creting new record in your model.. 

or,

2. for defined field you wand to show a hint what kind of value you expect in that field , Ž
but no default value is entered... then.. _columns is the same, 
and in xml defining view for that field put:

<field name='field_name' placeholder="Some hint text' />
<!-- this will show hint in field, but that is greyed out, and it is only visible until some value is entered in field -->

 

hope it helps,

may the source be with you : )
 

Avatar
Discard