How can I change the way that VAT number is show using QWeb in Odoo - odoo

I have the view report_invoice_document showing the VAT client number, using next code:
<span t-field="o.partner_id.vat"/>
However, the number that appears is CO8000000001 and I need just the number without letters and if it's possible formatted this way 800.000.000-1.
I was trying to find documentation about t-field-options to customize the field but I didn't have luck with that.
Thanks.

Try:
<span t-esc="o.partner_id.vat[2:]"/>
t-esc supports Python code.

Related

How to use scriptAll to grab all values when the intended value is not text type

I have a page with multiple textboxes and dropdowns with values that I am trying to validate. The values in them will be dynamic in each run.
The HTML looks something like:
<input readonly="readonly" class="form-control valid" data-val="true" data="ABC" aria-invalid="false" xpath="1">
What I want to do is grab the value of "data" for each textbox. I have used scriptAll before in such a case when I was grabbing text by using innerText. However, that won't work with a regular value such as in the HTML above.
I did try one solution that worked:
driver.value(//input[#data])
However, that just grabs the first textbox value, is there a way I can combine scriptAll with driver.value? OR would I be better off doing some JS here?
Thank you in advance!
Yes, refer the docs for scriptAll(): https://github.com/karatelabs/karate/tree/master/karate-core#scriptall
Use whatever JS works to get an attribute value. Haven't tried, but this should work, you get the idea:
* def list = scriptAll('input', "_.getAttribute('data')")

Trying to use Selenium to find a specific entry in a list when what you type highlights that word

DOM:
<span class="item">Does not <span class="highlight">match</span>.</span>
<span class="item">Also not <span class="highlight">match</span>ing.</span>
<span class="item"><span class="highlight">match</span></span>
Issue:
I've got a list of items. When I type into a text box, it eliminates items that do not match, and highlights the ones that do inside a /span. The issue is that if I type something that matches multiple things, I want to select the EXACT String, and not the ones that partially match (see above DOM example... the ideal match would be the 3rd one).
So, is my only hope here to go one by one until I find my perfect match, or is there something else that I've been missing?
You are trying to find a span that has no text, with an inner span that has some highlighted text. Here is an XPath selector for that:
//span[#class='item'][not(text())]/span[#class='highlight'][‌​text()='match']

Adding Custom Product Detail Fields in BigCommerce Stencil?

We want to add custom fields that can be modified on the back end, yet also populate on the front end using custom fields. We have tried following, yet the fields didn't populate on the front end. See below for examples of the code and corresponding output:
Example Code
Result
How can we get these fields to properly populate on the front end?
I would start by reading the BigCommerce Stencil Documentation. The way you are calling the custom field values is not how they suggest calling these values.
The custom_fields are only accessible on the product detail page at this time in Stencil.
To display them on the product detail page, you can loop through each custom_field value with the following code.
{{#each product.custom_fields}}
<dt class="productView-info-name">{{name}}:</dt>
<dd class="productView-info-value">{{{value}}}</dd>
{{/each}}
You can check to see what values are available on each page by either reading the Stencil docs linked above, or debugging your page by removing the closing '/' and adding '?debug=bar' to the end of your localhost URL. Refresh your page and you will see all available store data in JSON format below the rendered page.
For more control over which custom field you output where you can create a reusable loop.
i.e. Create templates/components/products/custom-fields.html
{{#each product.custom_fields}}
{{#if name '===' ../custom_field}}
{{{value}}}
{{/if}}
{{/each}}
Then from your product_view.html you can specify the field value to output with a single line:
{{> components/products/custom-field custom_fields='custom field name'}}

Can I add the custom fields to the product listing page in BigCommerce

Each product has the custom fields options. Can I output those custom fields on each product item in the product list page? If so, how? I have tried adding the ProductOtherDetails and the %%SNIPPET_ProductCustomFieldItem%% in the CategoryProductsItem.html, but got no output at all of any of the items I have tried. Any suggestions or pointers on how and if this is possible?
As of September 2015, you can now access %%GLOBAL_ProductCustomFields%% on any template file that renders a particular panel's individual items. For example:
-Snippets/CategoryProductsItem.html for category list pages
-Snippets/HomeFeaturedProductsItem.html for the featured products panel
I recommend adding the custom field name as a class to each field for easy hiding, and accessing of the value in case the custom fields ever change you won't be accessing them via :nth-child CSS which would break. You can do so by modify Snippets/ProductCustomFieldItem.html to add the custom field name to the CSS class or ID like this:
<div class="DetailRow %%GLOBAL_CustomFieldName%%">
<div class="Label">%%GLOBAL_CustomFieldName%%:</div>
<div class="Value">
%%GLOBAL_CustomFieldValue%%
</div>
</div>​
Doing so, will output like this in each item in the category list.
Above, I am using the custom fields to send through shipping time, as well as "Starting At" to prepend to the list page price if the item is a parent which has children of higher prices. In my opinion, these features greatly increase the user experience.
For Faceted Search (handlebars.js)
I recommend adding this to Panels/FacetedSearchProductGrid.html:
{{#each product.custom_fields}}
{{ id }} : {{ name }} : {{ value }}
{{/each}}
Those filters will be limited to the Product pages specifically. The only way around it is to hash together a solution using jQuery to go and fetch items in question from the product page. A pain, but do-able with unnecessary effort.

How to verify a £ symbol in Selenium IDE?

So trying to get to grips with selenium, and for my first test case I'm trying to write a test case to ensure stock feeds have loaded. Therefore I want to verify that there are page numbers, and that there are £ signs.
Pagination seems to work ok, but I can not get it to pick up the £ sign.
Here's what I got:
open -The page in question-
verifyElementPresent css=div.result_count result_count
verifyText id=boxed-container £
I'm sure there must be something simple I'm missing. Any helps appreciated :)
Please share a relevant part of your HTML code.
I've encountered similar problem with text inside an input maybe it's your case
VerifyText checks for the text inside a html node.
However as <input /> is a single tag and its value is stored in the value attribute you must use VerifyValue instead
EDIT
Use verifyText and target: xpath=//*[contains(text(),'£')]