无法在qweb中设置宽度

时间:2018-05-09 08:47:09

标签: odoo odoo-10 qwebview 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>

上面是我的xml代码。我遇到的问题是,我无法为Sl No width="5%"th tdstyle中的style="width:5%"列设置宽度{}像message一样,但这也行不通。请帮忙 。 提前谢谢......

1 个答案:

答案 0 :(得分:1)

th的宽度将正确设置。问题应该是宽度值,5%可能不足以在同一行显示Sl No

尝试

<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>