odooodoo-10qwebviewqweb

Cannot set width in qweb


<div class="row" style="border:1px solid black;">
    <table class="table table-condensed" >
        <thead style="border: 1px solid black;">
            <tr>
                <th class="text-left" width="5%" style="border-left:1px solid black;">Sl no</th>
                <th class="text-center" style="border-left:1px solid black;">Account</th>
                <th class="text-center" style="border-left:1px solid black;">Partner</th>
                <th class="text-center" style="border-left:1px solid black;">Internal Reference</th>
                <th class="text-center" style="border-left:1px solid black;">Description</th>
                <th class="text-center" style="border-left:1px solid black;">Debit Amount(AED)</th>
                <th class="text-center" style="border-left:1px solid black;">Credit Amount(AED)</th> 
            </tr>
        </thead>
        <tbody style="border-bottom: 1px solid black;">
            <t t-set="count" t-value="1"/>
            <tr t-foreach="o.line_ids" t-as="l" style="border-top: 1px solid black;">
                <td  class="text-left" width="5%"><span t-esc="count"/> <t t-set="count" t-value="count + 1"/></td>
                <td class="text-left" style="border-left:1px solid black;"><span t-field="l.account_id.name"/></td>
                <td class="text-left" style="border-left:1px solid black;"><span t-field="l.partner_id"/></td>
                <td class="text-left" style="border-left:1px solid black;"><span t-field="l.account_id.code"/></td>
                <td  class="text-left" style="border-left:1px solid black;"><span t-field="l.name"/></td>
                <td  class="text-right" style="border-left:1px solid black;"><span t-field="l.debit"/></td>
                <td  class="text-right" style="border-left:1px solid black;"><span t-field="l.credit"/></td>
            </tr>
<tr>
    <td style="display:inline;border-left:1px solid black;border-top:1px solid black;">
        <span t-if="o.ref">
        <span>Reference:</span><span><span   t-field="o.ref"/></span>
        </span>
    </td>
    <td style="border-top:1px solid black;">
    </td>
    <td style="border-top:1px solid black;">
    </td>
    <td style="border-top:1px solid black;">
    </td>
    <td style="border-top:1px solid black;">
    </td>
    <td style="border-top:1px solid black;">
    </td>
    <td style="border-top:1px solid black;">
    </td>
</tr>

        </tbody>                            
    </table>
 </div>

Hi above is my xml code . Problem I face is that I cannot set a width for the column Sl No I tried by putting width="5%" in th and td and I also tried putting it in style like style="width:5%" but that also does n't work. Please Help . Thanks in advance...


Solution

  • The width of th will be set correctly. The issue should be in the value of width, 5% is maybe not enough to show Sl No on the same line.

    Try

    <tr>
        <td colspan="7" style="display:inline;border-left:1px solid black;border-top:1px solid black;">
            <span t-if="o.ref">
                <span>Reference:</span><span><span t-field="o.ref"/></span>
            </span>
        </td>
    </tr>