我和odoo 9一起工作.在系统中存在每种类型字段的render_value方法:
/odoo/addons/web/static/src/js/views/form_widgets.js
/odoo/addons/web/static/src/js/views/form_relational_widgets.js
Run Code Online (Sandbox Code Playgroud)
如何为所有表单使用我的自定义方法render_value(例如在FieldChar中)?以及如何为一个表单或一个模块使用特定的render_value?
我form_widgets.js
在我的模块中创建,但我不明白如何正确覆盖Field.
odoo.define('my_module.form_widgets', function (require) {
"use strict";
// what I should do here???
});
Run Code Online (Sandbox Code Playgroud)
你能提供一些小例子吗?预先感谢.
我的销售订单中的日期当前显示为:
Fecha: 21/11/2014 16:59:15
Run Code Online (Sandbox Code Playgroud)
我想展示这样的东西:
Fecha: Surco, 21 de Noviembre del 2014
Run Code Online (Sandbox Code Playgroud)
我试着用t-esc
用strftime
,但不工作:
<span t-esc="o.date_order.strftime('%Y')" />
Run Code Online (Sandbox Code Playgroud) 我在Odoo 8中使用qWeb进行报告.这些生成的PDF文件以"默认"名称保存.我想为每个生成的文件设置一个特定的名称(不是在保存文件之后,而是在"生成"时间内).
那可能吗?如果是的话,该怎么做?
提前致谢.
我想制作一个循环来精确打印元素.像这样的东西:
<t t-for="o.label_qty" >
...
</t>
Run Code Online (Sandbox Code Playgroud)
哪里o.label_qty
是整数.
但我只能t-foreach
在qweb中使用循环:
<t t-foreach="o.pack_operation_ids" t-as="l" >
...
</t>
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点?
如果不是,我认为唯一的解决方案是创建一个带有o.label_qty
元素的虚拟列表并将其写入foreach.
我想以本地化格式输出odoo 8 datetime字段,但没有时间.
我扩展t-field
了选项hide_time
.有一个更简单的内置解决方案吗?
我正在尝试创建一种形式,这将简化我尚未注册的产品的添加到我的小商店的命名法.为此,我创建了以下形式的模块:
<t t-extend="ConfirmPopupWidget">
<t t-jquery="p.body" t-operation="replace">
<div class="product-container">
<div id="search_row" style="padding-bottom: 12px;padding-top: 11px;border-bottom: 1px solid gray;">
<label>Barcode </label>
<input style="height: 18px;" type="text" id="is_ean13" class="search" placeholder="EAN13 Barcode"/>
</div>
<div class="form-group">
<label for="is_name" class="col-sm-2 control-label">Product Name </label>
<div class="col-sm-10">
<input type="text" id="is_name" class="form-control" placeholder="Product name" style="height: 32px;background-color:#D2D2FF"/>
</div>
</div>
<div class="form-group">
<label for="is_sale_price" class="col-sm-2 control-label">Sale price</label>
<div class="col-sm-10">
<input type="text" id="is_sale_price" class="form-control" placeholder="Sale Price"/>
</div>
</div>
<div class="form-group">
<label for="is_internal_reference" class="col-sm-2 control-label">Internal Reference</label>
<div class="col-sm-10">
<input type="text" id="is_internal_reference" class="form-control" placeholder="Internal Reference"/>
</div> …
Run Code Online (Sandbox Code Playgroud) 我有服装模型,为发票报告添加一些字段,但我需要向上移动税表.我需要删除行.做这样的事情是完成的吗?
<xpath expr="//div[@class='row mt32 mb32']" position="attributes">
<attribute name="class">row mt8 mb8</attribute>
</xpath>
Run Code Online (Sandbox Code Playgroud)
编辑: 我正在扩展帐户发票报告插件/帐户/ report_invoice.xml以下是我要提升的表格.我不能通过这里的所有报告,因为它是大的.
EDIT2
https://github.com/odoo/odoo/blob/9.0/addons/account/views/report_invoice.xml链接到原始报告.我想沿着小计表向上移动税表.:)
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td><strong>Subtotal</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed" t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>
</tr>
<t t-foreach="o._get_tax_amount_by_group()" t-as="amount_by_group">
<tr>
<td><span t-esc="amount_by_group[0]"/></td>
<td class="text-right">
<span t-esc="amount_by_group[1]"/>
</td>
</tr>
</t>
<tr class="border-black">
<td><strong>Total</strong></td>
<td class="text-right">
<span t-field="o.amount_total" t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>
</tr>
</table>
</div>
</div>
<div class="row" t-if="o.tax_line_ids">
<div class="col-xs-6">
<table class="table table-condensed">
<thead>
<tr>
<th>Tax</th>
<th class="text-right">Base</th> …
Run Code Online (Sandbox Code Playgroud) 我想从odoo打印标签.为此,我创建了一个自定义纸张格式,并找到了将其链接到我的标签报告的方法.我的标签报告是pdf报告.(当我创建报告时,我可以以默认纸张格式查看它.)
这是自定义纸张格式的代码
<openerp>
<data>
<record id="mymodule_label" model="report.paperformat">
<field name="name">Item Label</field>
<field name="default" eval="True"/>
<field name="format">custom</field>
<field name="page_height">50</field>
<field name="page_width">100</field>
<field name="orientation">Portrait</field>
<field name="margin_top">3</field>
<field name="margin_bottom">3</field>
<field name="margin_left">3</field>
<field name="margin_right">3</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">3</field>
<field name="dpi">80</field>
</record>
</data>
</openerp>
Run Code Online (Sandbox Code Playgroud)
我重复我的问题是如何将这种纸张格式与我的pdf报告联系起来
如何在页脚外显示页数?
嘿,
我正在为客户建立一份报告.一切都很好,除了他想在页面上显示页码(在地址栏附近)而不是页脚,这根本不起作用.
据我所知,到目前为止,报告模块中使用的subst.js负责用页码替换page
和topage
类.
如果,则在report/minimal_layout模板中调用subst.js subst is True
.布尔值get_pdf
在页眉和页脚的方法的report.py中设置True
,而对于reportcontent
.如果我正在应用不良做法并编辑Odoo核心并设置subst=True
为reportcontent
,则报表引擎不再呈现报表的正文部分并返回undefined.
有没有人为这个问题找到合适的解决方案?
我想,并显示current login user name
在qweb report
在odoo。有人可以告诉我,我该怎么做或给我一些示例代码。我会非常感谢...!