Skip to Content
Menu
This question has been flagged
1 Reply
1794 Views

I am facing issue while showing records monthly. It shows records in proper way for 1 month but if i select 2-3 months then alignment get disturbed.
For dynamic rows I have sending a list from python function & using that for rowspan. And for getting record  also I am using other object. If anyone know this please help me out.
This is my code:
  <tbody t-foreach="ORDER_COUNT" t-as="count">                 
             <td style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000"  t-att-rowspan="count[2]+1" colspan="1">
                                        <center><span t-esc="count[1]"/></center>
               </td>
               <t t-foreach="PO_DATA" t-as="po">
                    <tr>
                         <td class="flx0" style="border-left:1px solid black;border-top:1px solid black;border-right:1px solid black;border-bottom:1px solid black;">
                               <t t-if="datetime.datetime.strptime(po.date_order, '%Y-%m-%d %H:%M:%S').strftime('%b') == count[1]">
                                      <t t-esc="po.date_order"/>
                                </t>  
                          </td>
                    </tr>
                 </t>

  </tbody>.

In Order Count data is like this :
[('2017-08-01 00:00:00', u'Aug', 13L), ('2017-09-01 00:00:00', u'Sep', 40L), ('2017-10-01 00:00:00', u'Oct', 24L), ('2017-11-01 00:00:00', u'Nov', 27L), ('2017-12-01 00:00:00', u'Dec', 17L)]

Avatar
Discard
Best Answer

Hello 

try with below updated code. May this will helps you

  <t t-foreach="ORDER_COUNT" t-as="count">                  
          <tr>
             <td style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000"  t-att-rowspan="count[2]+1" colspan="1">
                                        <center><span t-esc="count[1]"/></center>
               </td>
          </tr>
          <t t-foreach="PO_DATA" t-as="po">
              <t t-if="datetime.datetime.strptime(po.date_order, '%Y-%m-%d %H:%M:%S').strftime('%b') == count[1]">
                 <tr>
                     <td class="flx0" style="border-left:1px solid black;border-top:1px solid black;border-right:1px solid black;border-bottom:1px solid black;">
                        <t t-esc="po.date_order"/>   
                      </td>
                 </tr>
              </t>
          </t>
  </t>
Avatar
Discard
Author

Thank you so much, It worked. :-)