为什么以下代码不适用于odoo 9,但它适用于odoo 8 ......
openerp.petstore = function(instance, local) {
instance.web.form.widgets = instance.web.form.widgets.extend(
{
'test' : 'instance.web.form.message',
});
instance.web.form.message = instance.web.form.FieldChar.extend(
{
template: 'test',
start: function() {
alert('working');
}
});
}
Run Code Online (Sandbox Code Playgroud) 我需要总结公司总数,并在图像中显示为单行.
现在我只是使用看板视图来显示默认视图.
<kanban class="o_kanban_mobile">
<field name="name"/>
<field name="company"/>
<field name="actual_amount"/>
<field name="planned_amount"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
<table border="1" width="100%">
<tr>
<td rowspan="2"><t t-esc="record.name.value"/>-<t t-esc="record.company.value"/></td>
<td>Planned</td>
<td>Actual</td>
</tr>
<tr>
<td><t t-esc="record.planned_amount.value"/></td>
<td><t t-esc="record.actual_amount.value"/></td>
</tr>
</table>
</div>
</t>
</templates>
</kanban>
Run Code Online (Sandbox Code Playgroud) 在下面的代码适用于窗体视图
search_ids = self.env['sale.order'].search([])
last_id = search_ids and max(search_ids)
return {
'name': _('Revise Quote'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'sale.order',
'res_id': last_id.id,
'type': 'ir.actions.act_window',
}
Run Code Online (Sandbox Code Playgroud)
如何重定向到编辑视图?
要查找两个日期之间的天数,我们可以使用如下代码:
SELECT date_part('day',age('2017-01-31','2017-01-01')) as total_days;
Run Code Online (Sandbox Code Playgroud)
在上面的查询中,我们得到30作为输出,而不是31。为什么?
我还想找到除星期日外的天数。间隔的预期输出('2017-01-01', '2017-01-31'):
Total Days = 31
Total Days except Sundays = 26
Run Code Online (Sandbox Code Playgroud) 第一次运行 odoo 时显示ImportError: No module named openerp
C:\Python27\python.exe E:/workspaces/odoo-10.0-20170812/odoo.py -c
E:\workspaces\odoo-10.0-20170812\odoo.conf 回溯(最近一次调用):
文件“E:/workspaces/odoo-10.0-20170812/odoo.py”,第 160 行,在 main()
文件“E:/workspaces/odoo-10.0-20170812/odoo.py”,第 156 行,在 main 中导入openerp
导入错误:没有名为 openerp 的模块
进程已完成,退出代码为 1