On Thu, 2014-04-10 at 13:45 -0700, Ivan Rodrigues wrote:

>         >
>          Hello, 
>         > 
>         > I want to know if there is a way to show only month and year
>         on screen, 
>         > like: 'mm/yyyy'. Is it possible? How do I do? 
>         
>         No because it is not a date and not a SQL type neither a
>         Python type. 
>         
>         
> And if I do a char field. Is there a way to format like "mm/yyyy" on
> screen?  Like a mask ____/______ for user knows what he has to enter.
> 

I haven't tried to implement a "masked field" yet but it should
certainly be a feature added to Tryton if it isn't already there...

As for the data type I would personally stick with the date type and
make the day always 1, and use views and function fields to hide the day
part (Python has a good date library for constructing date/time values
to do this).  After all it is still a date if not a complete one.

Failing that I would go with yyyy-mm or yyyy/mm (padding with leading
zeros, so 2014-04 not 2014-4) in formatting a character field that
represents part of a date.  Using mm/yyyy does not sort chronologically
and does not fit with international standards (ISO 8601).  Of course
maybe you have a reason for using a non-standard standard for example
sorting all the months together is easier.

In any case that is an example of why sticking with a date data in the
underlying model may be the best choice.  If it is a date with day
always 1 you can sort and search much easier using database's date and
time specific functions.


>         
>         -- 
>         Cédric Krier - B2CK SPRL 
>         Email/Jabber: [email protected] 
>         Tel: +32 472 54 46 59 
>         Website: http://www.b2ck.com/ 

Reply via email to