Adding field to Qweb report - odoo

There is field account.move.line.journal_id and i want it to be displayed in report.
i'm trying by
<tr t-foreach="p.account_move_line" t-as="p">
<span t-esc="p.journal_id"/>
</tr>
or something like this.
<tr t-foreach="p.account_invoice.payment_move_line_ids" t-as="p">
<span t-esc="p.journal_id"/>
but getting error
AttributeError: 'NoneType' object has no attribute 'account_move_line'
Error to render compiling AST
AttributeError: 'NoneType' object has no attribute 'account_move_line'
Template: account.report_invoice_document
Path: /templates/t/t/div/div[4]/div[2]/table/tr[2]/td[2]/tr
Node: <tr t-foreach="p.account_move_line" t-as="p">
<span t-esc="p.journal_id"/>
</tr>

In t-foreach you must have the list you want to iterate. I think the error is that you are assigning the value to p and at the same time you are iterating by this variable.
Try changing the variable (this is taking into account that p is your account_invoice record, otherwise you can access directly without the t-foreach):
<tr t-foreach="p.account_move_line" t-as="j">
<span t-esc="j.journal_id"/>
</tr>
I hope I've helped ;)

Related

How to bind getting data with value in input type - file?

I am getting object's data from api and need show it in the input (so that i can change it later). With text values i made it with v-model. But how can i show getting file's name in input type file (and how can i change this file on future)
<tr v-for="item in this.$store.state.allItems" :key="item.id">
<td><input type="text" v-model="item.name"></td>
<td><input type="file" :value=""item.src></td>
</tr>
There is a simple typeo in your code :value="item.src" => :value="item.src"
I hope this helps.

BeautifulSoup returning 'None' when trying to find value of input

I have been attempting to use BS to find the value of an input field on a webpage. However, no matter what I try, it always returns as 'None' although the element certainly exists. Here is a sample of the HTML.
<td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
<tr>
<td class="main">Street Address:</td>
<td class="main">
<input type="text" name="entry_street_address" id="entry_street_address" value="1234 Example Ln" maxlength="64" required> <span class="fieldRequired">* Required</span></td>
So I attempt to use BS4 to grab the value of 'entry_street_address':
r = session.get("sampleurl.com/wheremydataisstored")
time.sleep(3)
soup = bs4(r.content,'html5lib')
info = soup.find('input', {'id': 'entry_street_address'}).get('value')
print(info)
Unfortunately, this always returns:
AttributeError: 'NoneType' object has no attribute 'get'
This always happens. No matter if I do html5lib, lxml, html.parser, no matter how long I .sleep() to wait for the page to load, etc. I'm not really sure where it's going wrong!

Web Automation - How do I input text into a rich text box on a website (textarea) defined by a class?

I have been trying this for a few days and am completely stuck. If anybody could help me out I would be very grateful; Im using VB.NET.
The HTML Code:
<tbody>
<tr>
<td class="chat-attachment-cell"></td>
<td class="chat-input-cell">
<textarea class="chat-message-input"></textarea>
</td>
<td class="chat-send-cell"><a href="#" class="chat-send-button"> alt="Send" width="66" height="66" border="0">
</a>
</td>
</tr>
</tbody>
The text box I need to input into is this bit
<textarea class="chat-message-input"></textarea>
Thankyou in advance for any help provided
You select the element then change the .innertext property with what you want.
There are multiple ways to do it, and I can't give you an example because I don't know what you are using nor the whole html, but for example it could look like this:
WebBrowser1.Document.GetElementById("someid").InnerText="Sometext"
For start, you can try looking how the collection of elements you get looks, then you should be able to figure out what to do next.
Dim test = WebBrowser1.Document.GetElementsByTagName("textarea")
For example on this page:
Dim test = WebBrowser1.Document.GetElementsByTagName("tbody")
test(1).InnerText = "Hi there"

VueJS - v-for and attributes on the parent Element

I'm working with a table display and am using vueJS to render a group of rows inside of a table. The bindings inside of the <tr> work fine, but I can't figure out how to bind say an attribute that lives on the parent <tr> that hosts the v-for directive:
<tr v-for="detailItem in itemList" data-key="{detailItem.pk}}">
<td>{{detailItem.cdesc}}</td>
<td>{{(detailItem.nnetunits * 1).toFixed(2)}}</td>
...
</tr>
In this code the inner items on the <td> bind just fine, but how would you get the data-key bound?
With Vue 2 you don't use interpolation in attributes, you use the attribute binding syntax.
<tr v-for="detailItem in itemList" v-bind:data-key="detailItem.pk">
Or the shortcut
<tr v-for="detailItem in itemList" :data-key="detailItem.pk">

Thymeleaf calling method on object

Is it possible to call a method on an object in an "each" loop in Thymeleaf? I'm trying to create a dynamic table where both rows and columns can be dynamic. A Table have a list of Rows and a list of Columns. Column have a method getValue that for a given Row can get the value. But I'm not able to call this getValue(Row row) from Thymeleaf.
I have this Thymeleaf code:
<table>
<tr th:each="row : ${table.rows}">
<td th:each="column : ${table.columns}">
<span th:text="${column.value(row)}"/>
</td>
</tr>
</table>
This causes an exception:
Exception evaluating SpringEL expression: "column.value(row)"
Is it even possible to do this in Thymeleaf, e.g. pass variables to methods on other variables?
I found the problem, since I'm passing in something to this method it's not a getter method so I have to provide the full method name: getValue not just value:
<table>
<tr th:each="row : ${table.rows}">
<td th:each="column : ${table.columns}">
<span th:text="${column.getValue(row)}"/>
</td>
</tr>
</table>