It is currently Sun Feb 12, 2012 8:36 am

All times are UTC + 2 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Setting date to dd/mm/yyyy
PostPosted: Sat Sep 05, 2009 7:47 am 
Offline

Joined: Sun Nov 06, 2005 9:57 am
Posts: 25
Location: Melbourne, Austrtalia
This is driving me crazy. I don't know how anyone outside the US or Europe is expected to use OpenERP if it not easier to change the date format. I've read all the previous posts and have had limited and unpredictable success.

I've tried the following:

1) Change the date format and language code in admin=>translations=>app terms=>all terms=>languages.
This worked once in the windows version, but I have not been able to get it to work under Ubuntu

2) changed the LANG item in .openerprc - this works until the client is exited when it is automatically changed back to en_US

How can you have different users logged in with different date formats if none of the modules recognize the date format specified for the language nominated for the user? Surely this issue must have been solved by version 5! Or am I the only person outside Europe/US using the product! (i hope not). Please can someone give me a definitive answer to this so I can get on to some decent testing.

Sorry for the rant but I'm totally frustrated. :(


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 07, 2009 3:12 pm 
Offline

Joined: Tue Jul 29, 2008 8:58 am
Posts: 188
Location: delhi
Hi,
try to use like this...if you want to change in report & you are getting value from wizard make method.............
1-report.py
def get_date_format(self,form):
#comp_obj=pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr,self.uid,form['company_id'])
end_date = mx.DateTime.strptime(form['date_to'],"%Y-%m-%d").strftime("%d-%m-%Y")
print "BEFORE CHANGE DATE*******",end_date
return end_date

2- def __init__(self, cr, uid, name, context):
super(report_trial_balance, self).__init__(cr, uid, name, context)
'start_date':self.get_date_format,

})
self.context = context


3-call this method in rml
<td>
<para style="terp_header_Centre">From : [[ get_company(data['form']) ]] To : [[ start_date(data['form']) ]]</para>
</td>

_________________
jitu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 07, 2009 10:50 pm 
Offline

Joined: Sun Nov 06, 2005 9:57 am
Posts: 25
Location: Melbourne, Austrtalia
I'm not sure the last reply was an answer to my question.

I have managed to resolve the issue but I don't understand why it worked. The problem was that changing it in the LANG item in the .openerprc file had no effect since when the client exited it changed it back to its original value. However, when I changed the language in the admin settings in OpenERP to en_AU, exited the client, changed the LANG item again in the .openerprc file then ran the client again, then LANG item in .openerprc was no longer overridden. It was also possible to then have different users using different languages with different date formats.

This seems a bit strange to me an I would like it if some one could give a definitive explanation.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 08, 2009 6:48 am 
Offline

Joined: Tue Jul 29, 2008 8:58 am
Posts: 188
Location: delhi
Hello,
I am not giving you solution for hit & trial........I am using it in my report.

regards

_________________
jitu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 09, 2009 1:38 am 
Offline

Joined: Sun Nov 06, 2005 9:57 am
Posts: 25
Location: Melbourne, Austrtalia
Thanks for the reply Jitu.

It looks like you are solving the problem for reports and at quite a low level. I am no expert at the module/report development level yet (hope to be later though), and was looking for a definitive solution at the application level without resorting to Python or OpenObject code.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 09, 2009 8:25 am 
Offline

Joined: Mon Dec 03, 2007 8:22 am
Posts: 1472
Location: Belgium
Try to run your client with
LANG=en_US ./openerp-client.py

en_US is locale for US. you can set your locale there. It will display date and amounts in your locale format.

_________________
OpenERP=Easier, Adaptable, Affordable, Modular


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 29, 2009 10:41 pm 
Offline

Joined: Thu Aug 20, 2009 9:47 pm
Posts: 148
I am noticing the same thing. I can change the language in .openerprc, but it gets changed back when you exit the client.

What's the point in a configuration file that the client changes back to ITS preferred settings instead of YOUR defined settings?

The only way I can think of to set the locale is to edit this file and then chmod so that your user can no longer edit it. which is absurd.

BTW using "LANG=en_US ./openerp-client.py" prevents the client from opening at all.

MattLG


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 01, 2009 1:35 pm 
Offline

Joined: Tue Jul 29, 2008 8:58 am
Posts: 188
Location: delhi
Hi,
can you try in this function....in return[return '%d/%m/%Y'] put what ever format you want e.g. I needed indian format so "%d/%m/%Y"
fikename: datetime_util.py
function
def get_date_format():
"""Return locale date format string. If format string doesn't contain
any of the `%Y, %m or %d` then returns default datetime format `%Y/%m/%d`
"""

fmt = locale.nl_langinfo(locale.D_FMT)
for x,y in [('%y','%Y'),('%B',''),('%A','')]:
fmt = fmt.replace(x, y)

if not (fmt.count('%Y') == 1 and fmt.count('%m') == 1 and fmt.count('%d') == 1):
return '%d/%m/%Y'

return fmt

_________________
jitu


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 01, 2009 11:16 pm 
Offline

Joined: Sun Nov 06, 2005 9:57 am
Posts: 25
Location: Melbourne, Austrtalia
The first thing to note is that the date format specified in the language dialog (administration->translations->application terms->languages) is referring to the format to be used in reports and not on the data entry forms. The data entry forms date format is determined firstly by the language code specified in the language dialog with the proviso that the language code must be the code of a language that is installed on the server's machine. To find out all the languages installed on your machine go to the command prompt and enter "locale -a". It is also a good idea to restart the client after changing the language code - I've had to restart a couple of times occasionally.

I've had no trouble using different date formats using the above information.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 12, 2009 1:14 pm 
Offline

Joined: Sat Jan 03, 2009 12:25 pm
Posts: 45
Changing the date for the form does not work as it should be in OpenERP.

When does it work?
It works if you switch the language of the user to the appropriate language, which has been installed in OpenERP. Using the menu Preferences in the client application will change all language preferences and it show the date formatted the appropriate way.

When does it fail?
If you wish to have the language English, but you wish to have different date format. This is like having the menues in English, but the date should be formatted the german way. In this case the formatting will still remain the english way.

Editing .openerprc in your home directory does not help, since it will be overwritten, whenever you close the client application.

This is a clear feature request.

It has by the way nothing to do with the regional settings of the system.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 12, 2009 1:19 pm 
Offline

Joined: Sat Jan 03, 2009 12:25 pm
Posts: 45
A small workaround for english with a european format would be:

1. Go to Administration -> Translations -> Application terms -> Languages
2. Edit the english language
3. Change en_US to en_GB


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 17, 2009 1:44 pm 
Offline

Joined: Fri Apr 06, 2007 4:20 am
Posts: 216
Location: Beijing
Mgazel, that one was easy to follow and perfectly solved the issue.

Just one remark: Check that the user accounts have Language = English, with an empty field as in my case it did not work.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 17, 2009 2:35 pm 
Offline

Joined: Sat Jan 03, 2009 12:25 pm
Posts: 45
That is correct.

The better solution would be even to create two languages English US and English GB, because sometimes OpenERP will default to en_US and in this case it will not find it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 30, 2009 12:51 pm 
Offline

Joined: Tue Nov 03, 2009 11:02 am
Posts: 15
Location: Braine
Yumi wrote:
Mgazel, that one was easy to follow and perfectly solved the issue.

Just one remark: Check that the user accounts have Language = English, with an empty field as in my case it did not work.


Hello this solution is working for me only on the client but when I use a report for example the invoice report, I have a bug that the report is looking for format en_US.

Any idea?

André


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 30, 2009 12:59 pm 
Offline

Joined: Sat Jan 03, 2009 12:25 pm
Posts: 45
Please change the format for reports in the Administration -> Translation and set the date values to what you want.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP