How to remove 'product_code' field in sale order report qweb in Odoo-9? - odoo-9

In Odoo system, If you set the product_code (interal reference) in product template, the note also be showed on the qweb report. I would like to get only the product's name in sale order qweb report, Is it possible to remove(or hide) the product_code field report? If it is, please help me to specific the right steps to solve it. Thank you
my qweb code :
</tr>
<t t-set="index" t-value="0"/>
<t t-set="product" t-value="0"/>
<t t-foreach="doc.handle_orderline(doc.order_line)" t-as="product_line">
<t t-set="product_num" t-value="0"/>
<t t-set="index" t-value="index + 1"/>
<t t-foreach="product_line" t-as="l">
<t t-set="product_num" t-value="product_num+1"/>
<t t-if="not l.product_uom_qty">
<t t-set="index" t-value="index - 1"/>
</t>
<tr t-if="l.product_uom_qty">
<t t-if="product_num == 1">
<td class="text-center" t-att-rowspan="len(product_line)">
<span t-esc="index"/>
</td>
<td class="text-center" t-att-rowspan="len(product_line)">
<strong><span t-field="l.name"/></strong>
<br/>
<t t-if="l.width_id">( <span style="font-style:italic" t-field="l.width_id.name"/> )</t>
</td>
</t>

In sale.order.line object name field store value in combination of product name and code. name field value set on onchange of Product field.
So in QWEB report, we need to get value from product_id field to display product name.
Replace following code:
<strong><span t-field="l.name"/></strong>
with
<strong><span t-field="l.product_id.name"/></strong>

Related

Jmeter WebDriver Sampler - How to Select an Element from a table

So I'm using Jmeter WebDriver sampler and I have a table where each row has a Delete and Edit button.
The layout of the HTML table is as follows:
<tbody id=table_id>
<tr>
<td> name </td>
<td>
<a class="some random text" href="edit.php/20" role="button>edit>edit </a>
<a class="some random text" onclick="delete20"> Delete </a>
</td>
</tr>
<tr>
<td> name2 </td>
<td>
<a class="some random text" href="edit.php/21" role="button>edit>edit </a>
<a class="some random text" onclick="delete21"> Delete </a>
</td>
</tr>
I'm unsure how to tell the webdriver to click a button based on the product name without an ID to findByElementID. I was thinking maybe I can parse through the table but I'm unsure what the steps are to take that route.
Any advice would be much appreciated!
Thank you!
Identify the product by its name, i.e. name or name2 using text() function
//td[text()=' name2 ']
Locate it's following sibling
//td[text()=' name2 ']/following-sibling::td
Locate the button which you want to click, i.e. "edit" or "delete"
//td[text()=' name2 ']/following-sibling::td/a[text()=' Delete ']
Demo:
More information:
XPath Language Reference
XPath Tutorial
Using the XPath Extractor in JMeter

How do I bind a value to a TCustomAttribute in Aurelia?

I'm trying to achieve the following result: I have a set of values that are coming from an array which I iterate over in order to populate an HTML table. As well I have an icon that user can hoover-over and can see data in there coming from the array and a translation key coming from translation files.
I want to bind a second argument to the TCustomAttribute in order to display to the user another data that was edited by them.
How do I achieve this in Aurelia?
<template>
<table>
<thead>
<th><span>Id</span></th>
<th><span>Name</span></th>
<th><span>Description</span></th>
<th><span>Date</span></th>
</thead>
<tbody>
<tr repeat.for="item of data">
<td><span>${item.Id}</span></td>
<td><span>${item.Name}
<a data-toggle="popover" t="[data-content]pending_name ${data.Name}" data-trigger="hover">
<i class="fa fa-info-circle"></i>
</a>
</span></td>
<td><span>${item.Description}</span></td>
<td><span>${item.Date}</span></td>
</tr>
</tbody>
</table>
</template>
Take a look at the t-params attribute which allows you to pass in additional parameters. More about that in the official guide http://aurelia.io/docs/plugins/i18n#using-the-plugin

Why "checked" attribute doesn't apply to my Thymeleaf's checkboxes?

I was working with Spring and Thymeleaf when I've encountered the following problem: I need a Form object, which has a list of items (Item) as attribute; I'm using an html form to print the Name of the Item, and to generate a checkbox for each Item (any checkbox's value is the corresponding item's id).
The form works correctly, sending to the Controller a list of item's ids corresponding to the checked checkboxes.
However, now, I'm trying to check some checkbox upon the occurrence of a condition (if itemIds, which is a list, contains the current item's id). For that I'm using:
th:checked="${#lists.contains(itemIds, item.id)}"/>
But it doesn't work (checkbox are all unchecked).
I tried also with a "dummy test":
th:checked="${1 == 1 ? 'checked' : ''}"/>
But, again, all the checkbox remain unchecked; the "checked" attribute is ignored as you can see in this example of the rendered HTML:
<input type="checkbox" value="12" class="chkCheckBox" id="ids1" name="ids">
What am I doing wrong? What am I missing here?
form.html
<form th:action="#{${uriBase}+'/new/' + ${date}}"
method="POST" th:object="${form}">
<div class="table-responsive">
<table class="table">
<thead class=" text-primary">
<tr>
<th>Name</th>
<th><input type="checkbox" th:id="checkAll"/>Check</th>
</tr>
</thead>
<tbody>
<tr th:each="item : ${items}">
<td th:text="${item.name}"></td>
<td>
<input type="checkbox" th:field="*{ids}"
th:value="${item.id}" th:class="chkCheckBox"
th:checked="${#lists.contains(itemIds, item.id)}"/>
</td>
</tr>
</tbody>
</table>
<button type="submit" class="btn btn-primary pull-right">Submit</button>
<div class="clearfix"></div>
</div>
</form>
Form class
public class Form implements Serializable {
private List<Long> ids;
//getter and setter
}
Thank you in advance.
I have been struggling with this as well. If you use the th:field it will override the checked and value options, as Xaltotun mentions, because it is trying to get the value and checked option from the field/form.
If you change it to th:name it should work how you want...
But this forum seems to be helpful for doing it with th:feild.
As far as I understand there are 2 issues in your post:
The dummy example is incorrect.
th:checked="${1 == 1 ? 'checked' : ''}"
In fact the value must true or false not 'checked'. If you try with
th:checked="${1 == 1}"/>
It will work.
If you set th:field="*{ids}" then the checkbox should be trying to get the value from the field item.ids and will not use the "th:checked" or "th:value" properties. Does the item has the field ids?

Purchase Order - Supplier Code

I am trying to get Supplier code to show on the Purchase order.
I am able to make it show, as long as there is only a single vendor associated with the product, but if there is more I get the error: Unexpected singleton
<xpath expr="//table[#class='table table-condensed']//tbody//tr" position="replace">
<td>
<span t-f="line.product_id.seller_ids.product_code"/>
</td>
</xpath>
Is there a way to get the default or first seller code to show, if there is more than 2 vendors on the product?
The following is the simple way, using and operator.
Ex:
<xpath expr="//table[#class='table table-condensed']//tbody//tr" position="replace">
<td>
<span t-field="line.product_id.seller_ids and line.product_id.seller_ids[0].product_code"/>
</td>
</xpath>

Access cell in table and click

I am writing a script to automate certain tasks. I am at a point where I have a table and hyperlinked name written in its second row, first column ([2][1]). I want to access that cell and click on it to go to intended page. Structure of the page looks like this:
<table id="listViewTable" class="listview" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-top: 0px;">
<tbody></tbody>
<tbody id="lvTred">
<tr id="1381137000000078119" class="tdout">
<td width="10" data-cid="dummy"></td>
<td class="lvCB" data-cid="dummy"></td>
<td>
<a id="listView_1381137000000078119" class="link" href="/crm/EntityInfo.do?id=1381137000000078119&module=Potentials&relCntId=1381137000000078117" data-params="{"relContactId":"1381137000000078117","module":"Potentials",…id":"1381137000000075541","recordNum":"1","lookback":"true"}" data-cid="detailView"></a>
</td>
I have successfully accessed table with id 'listviewTable' but not able to access cell with id 'listView_1381137000000078119' which is at location [2][1] in table. I did something like this:
cell = table.cell(:id, 'listView_1381137000000078119')
where table is actual table with mentioned id. Can anyone help?
Based on your HTML, there is no <td> tag with an id attribute of listView_1381137000000078119. However, there is an <a> tag with an id attribute of listView_1381137000000078119.
puts b.table.td(:id, 'listView_1381137000000078119').exists?
puts b.table.link(:id, 'listView_1381137000000078119').exists?
#=> false
#=> true

Resources