问题描述
我在account.bank.statement.line中添加了一个新的many2one字段,称为(statement_user_id)和Char字段关系(user_statement_name):
class AccountBankStatementLine(models.Model):
_inherit = 'account.bank.statement.line'
statement_user_id = fields.Many2one('account.user.statement')
user_statement_name = fields.Char(relared="statement_user_id.name",string="User Statement Name")
然后,我将“ user_statement_name”字段添加到要显示的“基本” QWEB XML文件中
<t t-name="reconciliation.line.mv_line">
<tr t-if="line.display !== false" t-attf-class="mv_line #{line.already_paid ? ' already_reconciled' : ''} #{line.__invalid ? 'invalid' : ''} #{line.is_tax ? 'is_tax' : ''}" t-att-data-line-id="line.id" t-att-data-selected="selected">
<td class="cell_account_code"><t t-esc="line.account_code"/>​</td> <!-- zero width space to make empty lines the height of the text -->
<td class="cell_due_date">
<t t-if="typeof(line.id) != 'number' && line.id">
<span class="badge badge-secondary">New</span>
</t>
<t t-else="" t-esc="line.date_maturity || line.date"/>
</td>
<td class="cell_label">
<t t-if="line.partner_id && line.partner_id !== state.st_line.partner_id">
<t t-if="line.partner_name.length">
<span class="font-weight-bold" t-esc="line.partner_name"/>:
</t>
</t>
<t t-esc="line.label || line.name"/>
<t t-if="line.ref && line.ref.length"> : </t>
<t t-esc="line.ref"/>
</td>
<td class="cell_label">
<t t-esc="line.user_statement_name"/> <!-- field to be displayed-->
</td>
<td class="cell_left">
<t t-if="line.amount < 0">
<t t-call="reconciliation.line.mv_line.amount"/>
</t>
</td>
<td class="cell_right">
<t t-if="line.amount > 0">
<t t-call="reconciliation.line.mv_line.amount"/>
</t>
</td>
<td class="cell_info_popover"></td>
</tr>
我需要编写一些JavaScript代码才能显示。我不熟悉。我已经使用了基本的javascript代码,但对我没有任何帮助。
那么,如何执行javascript部分以在视图中显示(user_statement_name)字段?
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)