Odoo Help

Welcome!

This community 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.

0

date format or style error accordind to the language setting

By
Koffi KPONOUGLO
on 6/27/15, 10:18 AM 496 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">
<tr>
<td>
<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>
</td>
</tr>
</blockTable>


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

Thanks.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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