继承qweb报告并替换字符串odoo 9

时间:2017-03-10 11:56:16

标签: openerp odoo-9 qweb

我继承了qweb报告,现在我要替换字符串Total Taxes,Taxes,Total

<div class="row" name="total">
            <div class="col-xs-4 pull-right">
                <table class="table table-condensed">
                    <tr class="border-black">
                        <td><strong>Total Without Taxes</strong></td>
                        <td class="text-right">
                            <span t-field="doc.amount_untaxed"
                                t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
                        </td>
                    </tr>
                    <tr>
                        <td>Taxes</td>
                        <td class="text-right">
                            <span t-field="doc.amount_tax"
                                t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
                        </td>
                    </tr>
                    <tr class="border-black">
                        <td><strong>Total</strong></td>
                        <td class="text-right">
                            <span t-field="doc.amount_total"
                                t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
                        </td>
                    </tr>
                </table>
            </div>
        </div>



<xpath expr="?????" position="replace">

</xpath>

任何简单的解决方案或在线示例?..................................

2 个答案:

答案 0 :(得分:1)

试试这个。没有机会测试它。

Declare @T1 Table(BUCode INT, ManagerID INT, B_Allocation Float,     AllocatedAmount Float);
Declare @T2 Table(BUCode INT, ManagerID INT, B_Allocation Float,     AllocatedAmount Float);
with cte as (**Add your Select statement here**)

Insert Into @T1
Select * from cte 

Insert Into @T2
Select BUCode, ManagerID, sum(B_Allocation) from @T1
Group By BUCode, ManagerID

Select t2.BUCode, t2.ManagerID, t2.B_Allocation, t1.AllocatedAmount   from @T1 as t1
left join @T2 as t2 on t1.BUCode = t2.BUCode AND t1.ManagerID = t2.ManagerID 

答案 1 :(得分:1)

请尝试以下代码: -

 <xpath expr="//div[@name='total']" position="replace">
       <div class="col-xs-4 pull-right">
            <table class="table table-condensed">
                <tr class="border-black">
                    <!--Add your Custom String-->
                    <td><strong>Custom String</strong></td>
                    <td class="text-right">
                        <span t-field="doc.amount_untaxed"
                            t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
                    </td>
                </tr>
                <tr>
                    <!--Add your Custom String for taxes-->
                    <td>Custom String</td>
                    <td class="text-right">
                        <span t-field="doc.amount_tax"
                            t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
                    </td>
                </tr>
                <tr class="border-black">
                    <!--Add your Custom String for Total-->
                    <td><strong>Custom String</strong></td>
                    <td class="text-right">
                        <span t-field="doc.amount_total"
                            t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
                    </td>
                </tr>
            </table>
        </div>
 </xpath>