Skip to Content
Menu
This question has been flagged
3 Replies
16962 Views

Current output.

http://prnt.sc/f683l7

This is my code

<template id="wishlist_quotation">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="customer_details">
<t t-call="report.external_layout">
<div class="page" style="height: 2px;">
<div class="oe_structure" />

<br></br>

<div class="row" style="margin-left:5px;">

<h4>
<h5><b> Customer Name: </b><span t-esc="customer_details.partner_id.name"> </span> </h5>
<h5><b> Order No:</b> <span t-esc="customer_details.name"> </span> </h5>
<h5><b> Deposited Amount:</b> <span t-esc="customer_details.deposited_amount_total"> </span> </h5>
<h5><b> Date.:</b> <span t-esc="customer_details.date_order"> </span> </h5>

<br></br>

<div class="text-center">
<h4>wishlist Quotation Details</h4>
</div>

<t t-if="customer_details.order_line">

<table class="table table-condensed">
<thead>
<tr>
<th>Product :</th>
<th>Quantity:</th>
<th>Discount(%):</th>
<th>Total:</th>
</tr>
</thead>
<tbody class="sale_tbody">
<tr t-foreach="customer_details.order_line" t-as="wishlist_data">
<t t-if="wishlist_data.is_selected">
<th>
<span t-field="wishlist_data.product_id.name"/></th>
<th><span t-field="wishlist_data.product_uom_qty"/></th>
<th><span t-field="wishlist_data.wishlist_discount"/></th>
<th><span t-field="wishlist_data.price_total"/></th>



</t>




</tr>


</tbody>



</table>
#Here I got issue

<div class="row" name="total">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td><strong>Total:</strong></td>

<t t-esc="sum(l.price_total for l in customer_details.order_line) " />

</tr>

</table>
</div>

</div>


<br></br>

</t>


<h5>Remarks:</h5>
<h5>Customer Signature :</h5>

<t>

<br> <h5> <b>Note:</b> This Customer Remarks .
terms and condition here we can add if any...</h5></br><br></br><br></br>

</t>
</h4>

</div>




</div>
</t>
</t>
</t>
</template>

I want to print only selected lines total in PDF Like below image:
Here I am selecting only 3 lines ,But it prints sum of 4 lines in the Total
How to print only selected lines Total in PDF?
Need a help


http://prnt.sc/f684pc
Avatar
Discard
Best Answer

Hello,

Just replace this line

<t t-esc="sum(l.price_total for l in customer_details.order_line) " />

with this one 

<t t-esc="sum(l.price_total for l in customer_details.order_line.filtered(lambda x: x.is_selected)) " />

So It will calculate only selected sale order lines.



Avatar
Discard
Author

Thanks.......

Best Answer

Thanks Parth.

Avatar
Discard