Odoo xpath roat - xpath

This is code from original report. my goal is to put my_field_name before Product. how can i reach it with xpath.
<table class="table table-condensed" t-if="o.pack_operation_ids">
<t t-set="has_barcode" t-value="any([pack_operation.product_id and pack_operation.product_id.sudo().barcode or pack_operation.package_id for pack_operation in o.pack_operation_ids])"/>
<t t-set="has_serial_number" t-value="o.pack_operation_ids.filtered('pack_lot_ids')" groups="stock.group_production_lot"/>
<thead>
<tr>
<th><strong>Product</strong></th>
<th class="text-right"><strong>Quantity</strong></th>
<t t-if="o.picking_type_id.code != 'incoming'"><th><strong>Source</strong></th></t>
<th t-if="has_barcode" class="text-center">
<strong>Barcode</strong>
</th>
<th t-if="has_serial_number">
<strong>Lot/Serial Number</strong>
</th>
<t t-if="o.picking_type_id.code != 'outgoing'"><th><strong>Destination</strong></th></t>
</tr>
</thead>
<tbody>

<xpath expr="//table[#t-if='o.pack_operation_ids']/thead/tr/th[1]" position="before">
------ your code goes here ------
</xpath
Please use above code for reference.

Related

Formating View in maatwebsite Excel Export

I am new to maatwebsite Excel Export i am using view Excel Export in laravel and would like to know how one can specify the cell number where the data should go like a h1 tag like below snippet
<h5>PURCHASE ORDER</h5>
<hr>
<div class="container-flow">
<table id="table" class="table table-hover table-bordered table-sm text-center">
<thead>
<tr>
<th scope="col">No.</th>
<th scope="col">Product_Code</th>
<th scope="col"> Item_Description </th>
<th scope="col">Qty</th>
<th scope="col">Unit Price</th>
<th scope="col" >Value</th>
<th scope="col">Stock Less 90 Days</th>
<th scope="col">Stock More 90 Days</th>
when i export i get this
i would like to specify the cell where that tag should go like say cell B3 instead of current position cell A1
You can put some empty tags / cells before.
Try
<table>
<tr></tr>
<tr></tr>
<tr>
<td></td>
<td></td>
<td><h5>PURCHASE ORDER</h5></td>
</tr>
</table>
<hr>
<div class="container-flow">
<table id="table" class="table table-hover table-bordered table-sm text-center">
<thead>
<tr>
<th scope="col">No.</th>
<th scope="col">Product_Code</th>
<th scope="col"> Item_Description </th>
<th scope="col">Qty</th>
<th scope="col">Unit Price</th>
<th scope="col" >Value</th>
<th scope="col">Stock Less 90 Days</th>
<th scope="col">Stock More 90 Days</th>

format nested object to table on thymeleaf

i build crm system,
i had object hes name users he hold also the data from details table (one to many realation)
lets says i had nested object name user and he had more than 1 object of details
i want to get this in the end in thymeleaf table
name | entry date
david | 5/6/22
david | 1/7/22
but i got
name | entry date
david | 5/6/22 , 1/7/22
this is table code on thymeleaf:
<table class="table w-75 table-striped table-dark table-hover">
<thead>
<tr>
<th scope="col" class="text-center">First name</th>
<th scope="col" class="text-center">Entry Date</th>
</tr>
</thead>
<tbody>
<tr th:each="users : ${ParkingUsers}">
<td class="text-center" th:text="${users.firstName}" />
<td class="text-center" th:each="date, i: ${users.parkingDetails}"
th:text="${(i.index > 0 ? '' : '') + date.entryDate}" />
</tr>
</tbody>
</table>
how can i fix that?
thanks
This is a good candidate for using the Thymeleaf th:block tag.
You can place the outer loop (for users) in this tag, and then place the inner loop (for parking details) in the <tr> tag.
Example:
Assume we have two classes:
public class User {
private String firstName;
private List<ParkingDetail> parkingDetails;
// getters and setters
}
And:
public class ParkingDetail {
private LocalDate entryDate;
// getters and setters
}
And assume we have a list of users: List<User>.
We can use the following in our Thymeleaf template:
<table class="table w-75 table-striped table-dark table-hover">
<thead>
<tr>
<th>First name</th>
<th>Entry Date</th>
</tr>
</thead>
<tbody>
<th:block th:each="user : ${users}">
<tr th:each="parkingDetail : ${user.parkingDetails}">
<td th:text="${user.firstName}"></td>
<td th:text="${parkingDetail.entryDate}"></td>
</tr>
</th:block>
</tbody>
</table>
This will generate the following HTML:
<table>
<thead>
<tr>
<th>First name</th>
<th>Entry Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>david</td>
<td>2022-06-05</td>
</tr>
<tr>
<td>david</td>
<td>2022-07-01</td>
</tr>
</tbody>
</table>
The th:block tag allowed Thymeleaf to iterate over the list of users, but it did not cause any HTML to be generated. The Thymeleaf ${user} variable created in the th:block tag can be referenced in all the child tags inside the th:block.
There are various other examples of how th:block can be used, in other questions on this site - so if this does not meet your needs, you can research those other questions.

How to select few columns by default in jQuery Bootgrid

I am trying to use http://www.jquery-bootgrid.com/examples#data-api
When table is loaded from SQL database, all columns show up as all check boxes are marked in drop down menu (image attached), I want that only selected columns show up by defult and user can mark the the realted column field in check box to make it visible.
.Image here
<table id="employee_grid" class="table table-condensed table-hover table-striped" width="70%" cellspacing="0" data-toggle="bootgrid">
<thead>
<tr>
<th data-column-id="id" data-type="numeric" data-identifier="true">id</th>
<th data-column-id="own_referrer">O_Refferer</th>
<th data-column-id="own_aact_status">own_aact_status</th>
<th data-column-id="rate">rate</th>
<th data-column-id="text_Details">text_Details</th>
<th data-column-id="remarks">remarks</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">Commands</th>
</tr>
</thead>
</table>
found the solution. Just add ( data-visible="false" ) (without brackets) to the respective th line in table.
<table id="employee_grid" class="table table-condensed table-hover table-striped" width="70%" cellspacing="0" data-toggle="bootgrid">
<thead>
<tr>
<th data-column-id="own_referrer" data-visible="false">O_Refferer</th>
<th data-column-id="own_referrer">O_Refferer</th>
<th data-column-id="own_aact_status">own_aact_status</th>
<th data-column-id="rate">rate</th>
<th data-column-id="text_Details">text_Details</th>
<th data-column-id="remarks">remarks</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">Commands</th>
</tr>
</thead>
</table>

"How to make a header fixed while content is scrolled in jquery bootgrid "

I am trying to make header fixed while the main content is scrolled in jquery bootgrid. how to make header fixed in its position?.
here is my code
<div class="table-responsive" style="display:block;height:500px;overflow:scroll ;width:100%;">
<table id="grid-data" class="table table-bordered table-sm table-striped table-hover " data-selection="true" data-multi-select="true" data-row-select="true" data-keep-selection="true">
<thead>
<tr>
<th data-column-id="ItemCode" data-sortable="false">Item Code</th>
<th data-column-id="ItemDescription" data-sortable="false">Item Description</th>
<th data-column-id="UnitName" data-formatter="UnitName" data-sortable="false">Unit Name</th>
<th data-column-id="QOH" data-formatter="Quantity" data-sortable="false">Quantity</th>
<th data-column-id="MaterialCost" data-formatter="Price" data-sortable="false">Price</th>
<th data-column-id="RowNumber" data-formatter="Amount" data-sortable="false">Amount</th>
</tr>
</thead>
</table>
</div>

firefox table border color problem

<table align="center" width="80%" border="1" cellspacing="0" bordercolor="#95F8FD">
<tr>
<th width="7%" rowspan="2" align="center"> </th>
<th colspan="3" align="center"> </th>
<th width="6%" rowspan="2" align="center"> </th>
<th colspan="2" align="center"> </th>
<th width="30%" rowspan="2" align="center"> </th>
<th width="5%" rowspan="2" align="center"> </th>
</tr>
</table><br>
border color is not showing correctly in firefox with this html block.but it works fine with chrome and IE.what's the problem with firefox?
You aught to use CSS for styling. With the exception of rowspan and colspan, just about all the other attributes you've used are deprecated.

Resources