datetime - How Can I parse and convert Dates & Times? -


i met odoo first time little less month ago, and, dos systems analyst 90's, helping implement small fast growing local manufacturer. largely out of industry last 15 years, i'm not pro, fast learning python, html (some past exper) , java...

i've been through developer docs, developer's cookbook & essentials, , variety of online tutorials (just google come several search word combinations).

i read closed post asking , there's apparently no actual odoo reference...

can please tell me might find 'date/time' parse , conversion functions can access report using 'canned' 'hr.employee' model?

<?xml version="1.0"?> <t t-name="hr_attendance.report_attendancelog">     <t t-call="report.html_container">         <t t-call="report.external_layout">             <div class="page">                 <div class="oe_structure"/>                 <div class="row">                     <div class="col-xs-6">                         <h2><br/>attendance log: </h2>                     </div>                 </div>                 <table class="table table-condensed mt32">                     <thead>                         <th><strong>date / time</strong></th>                         <th><strong> operation</strong></th>                     </thead>                     <tbody>                         <t t-foreach="docs" t-as="o">                             <t t-set="dspdate" t-value="o.name"/>                             <t t-set="dsptime" t-value="o.name"/>  <!-- want parse 'o.name', 'date time' format (from              attendance record) separate 'date' , 'time' fields... -->                         <!-- t t-set="dspdate" t-value="func?(o.name)"/ -->                         <!-- t t-set="dsptime" t-value="func?(o.name)"/ --> <!-- , calcs date & time...) -->                         <!-- t t-set="clcdt1" t-value="func?('prvdt')"/ -->                         <!-- t t-set="clcdt2" t-value="func?(dspdate)"/ -->                         <!-- t t-set="clctm1" t-value="func?('prvtm')"/ -->                         <!-- t t-set="clctm2" t-value="func?(dsptime)"/ -->                              <tr>                                 <t t-if="clcdt1 == clcdt2">                                     <td><span t-esc="dspdate"/></td>                                     <td><span t-esc="dsptime"/></td>                                     <td><span t-esc="o.action"/></td>                                 </t                             </tr>                         </t>                         <tr class="border-black">                             <td colspan="3"><strong>total period</strong></td>                             <td><strong t-esc="o.worked_hours"/></td -->                         </tr>                     </tbody>                 </table>             </div>         </t>     </t> </t> 

i prefixed 'br/' h2 keep positioned (only shows on first page), subsequent pages obscure col headers behind layout header... obvious , i'm oblivious, how can adjust 'h2' position below 'header' setup 'report.external_layout'??

on qweb rendering can use python libs time, datetime , relativedelta. included in called qweb context used evaluation (python eval) of code in reports. can see in odoo code here.

that means this:

<t t-set="dspdate" t-value="datetime.datetime.strptime(o.name, '%y-%m-%d %h:%m:%s').strftime('%d/%m/%y')" /> 

i prefer parser classes reports define common functions. example: can define function getdate doing parsing or transforming stuff. report code better parser functions:

<t t-set="dspdate" t-value="getdate(o.name)" /> 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -