Odoo Help


date format or style error accordind to the language setting

on 6/27/15, 10:18 AM 983 views

Hi every body,

i need to set with the fonction formatLang() function the style of date according to the user's language. So in the module l10n_hr_in_payroll, when i am trying to print advice payment report i get error. I know it concern the above part of code, so please help me :

  • in report.py code i have this funtion

    def get_month(self, input_date):
payslip_pool = self.pool.get('hr.payslip')
res = {
'from_name': '', 'to_name': ''
slip_ids = payslip_pool.search(self.cr, self.uid, [('date_from','<=',input_date), ('date_to','>=',input_date)], context=self.context)
if slip_ids:
slip = payslip_pool.browse(self.cr, self.uid, slip_ids, context=self.context)[0]
from_date = datetime.strptime(slip.date_from, '%Y-%m-%d')
to_date = datetime.strptime(slip.date_to, '%Y-%m-%d')
res['from_name']= from_date.strftime('%d')+'-'+from_date.strftime('%B')+'-'+from_date.strftime('%Y')
res['to_name']= to_date.strftime('%d')+'-'+to_date.strftime('%B')+'-'+to_date.strftime('%Y')
return res
  • In the rml file i have :

    <blockTable colWidths="539.0" style="Table2">
<para style="P10">Payment Advice from [[ o.name ]] on our bank account N° [[ o.bank_account_id.acc_number ]] form period [[ get_month(o.date)['from_name'] ]] to [[ get_month(o.date)['to_name'] ]]</para>

So how can i obtain my report in french with date style (ex : 30 juin 2015)?


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/27/15, 10:18 AM
Seen: 983 times
Last updated: 6/27/15, 10:18 AM