t字段选项不起作用。
我试过了
<span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>
Run Code Online (Sandbox Code Playgroud) 我是Odoo v10的新手.我正在使用带有URL的调试模式.但是在设置菜单上有激活开发者模式的链接.我想问一下,"激活开发者模式"和"激活开发者模式(带资产)"有什么区别?
我正在尝试使用AngularJS创建Web扩展,但是,我执行了以下操作:
似乎odoo只支持Marionnette.js的Backbone.js.我也尝试用React.JS做同样的事,但没有任何效果.
这是我的代码.
resources.xml中
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<!-- Adds all assets in Odoo -->
<template id="assets_backend" name="static_resources_demo assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/odoo_angular/static/src/js/lib/angular.min.js"></script>
<script type="text/javascript" src="/odoo_angular/static/src/js/controller/firstCtrl.js"></script>
<script type="text/javascript" src="/odoo_angular/static/src/js/angular_odoo.js"></script>
</xpath>
</template>
</data>
</odoo>
Run Code Online (Sandbox Code Playgroud)
angular_view.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates id="angular_view_odoo">
<div t-name="angular_view_test" class="container">
<div class="row box">
<div ng-app="myApp" ng-controller="myCtrl">
First Name:
<input type="text" ng-model="firstName"/>
<br/>
Last Name:
<input type="text" ng-model="lastName"/>
<br/>
<br/>
Full Name: {{firstName + " " + lastName}}
</div>
</div>
</div>
</templates>
Run Code Online (Sandbox Code Playgroud)
angular_odoo.js …
有人可以将以下波兰表示法转换为其SQL对应物:
['|', '&', ('is_company','=', True),('parent_id', '=', False),('company_name', '!=', False),('company_name', '!=', '')]
我的猜测是:
is_company = True OR parent_id = False AND company_name <> False AND company_name <> ''
无论我多么努力地理解它,我都无法得到这种符号的概念.请帮忙.
UPDATE
我试图将上述表示法扩展为:
((is_company = True AND parent_id = False) OR company_name <> False) AND company_name <> '' AND customer_type_id <> False
是否可以在 Odoo10 的看板视图中显示没有任何项目的组(列)?
我找到了一篇如何在 Odoo8 中执行此操作的文章,但那里描述的方法似乎不再有效。
我试过这个代码
raise odoo.osv.osv.except_osv('title', 'description')
Run Code Online (Sandbox Code Playgroud)
但是标题被忽略了。
我在我的视图中创建了一个按钮,它触发了模块内的一个方法。但是,单击该按钮后,临时编辑的字段将被保存,并且在单击“放弃”按钮时不会恢复。
这是我的观点的代码:
<form>
<sheet>
<group>
<field name="name" />
</group>
<button name="my_button" string="My Button" type="object" class="oe_edit_only" />
</sheet>
</form>
Run Code Online (Sandbox Code Playgroud)
单击my_button该字段后,该字段name将保存在数据库中,该按钮Discard不再起作用。
单击我的自定义按钮时,如何防止 Odoo 保存临时数据?
(我正在使用 Odoo10,但我想旧版本的 Odoo 也是如此)
这是我编写并从hr.holidays继承的程序 ,如果所选日期在当前日期之前,则应提供错误消息。代码-
from datetime import date
if self.date_from <= date.today():
print 'You cannot select the previous date'
Run Code Online (Sandbox Code Playgroud)
但它给出了错误 -
TypeError: can't compare datetime.date to bool
Run Code Online (Sandbox Code Playgroud)
谢谢
我将“location_id”字段添加到 res.user 以将用户连接到某个位置
类 ResUser(models.Model): _inherit='res.users'
current_location_id=fields.Many2one('physical.location',string="Current Loction")
allowed_location_ids=fields.Many2many('physical.location',string="Allowed Location")
Run Code Online (Sandbox Code Playgroud)
我只想过滤 current_location_id = user_current_location_id 的访问
<filter string="My visits" name="filter_my_visits"
domain="[('current_location_id','=',current_location_id)]"/>
Run Code Online (Sandbox Code Playgroud)
这给出了这个错误信息
Uncaught Error: Failed to evaluate search criterions:
{"code":400,"message":"Evaluation Error","data":{"type":"local_exception","debug":"Local evaluation failure\nNameError: name 'current_location_id' is not defined\n\n{\"domains\":[[],\"[('current_location_id','=',current_location_id)]\"],\"contexts\":[{\"lang\":\"en_US\",\"tz\":false,\"uid\":1,\"params\":{\"action\":354,\"min\":1,\"limit\":80,\"view_type\":\"list\",\"model\":\"visit.visit\",\"menu_id\":241,\"_push_me\":false}},{}],\"group_by_seq\":[]}"}}
Run Code Online (Sandbox Code Playgroud)
视图中可以直接调用的唯一字段是 uid lang ... 等 所以我试图覆盖读取方法来更新上下文,但它似乎没有在视图中更新,仍然给出未定义的“current_location_id”
@api.multi
def read(self, fields=None, load='_classic_read'):
ctx = self.env.context.copy()
ctx.update({ 'user_current_location_id':self.env.user.current_location_id.id})
return super(Visit,self.with_context(ctx)).read(fields=fields,load=load)
Run Code Online (Sandbox Code Playgroud)
访问树视图
<record id="visit_visit_tree_view" model="ir.ui.view">
<field name="name">visit.visit.tree</field>
<field name="model">visit.visit</field>
<field name="arch" type="xml">
<tree string="Visits">
<field name="name" />
<field name="date"/>
<field name="visit_type" />
<field name="patient_id"/>
<field name="hcp_id"/> …Run Code Online (Sandbox Code Playgroud) 我正在 odoo 10 的 crm 模块上制作一个 android 应用程序,我想通过我的应用程序在 odoo 中创建报价,我将这些不同的参数传递给ORecordValues并在之后调用createRecord()。所以当我单击“保存”按钮时,我正在调用python api 和 python api 给了我这个错误。
Database fetch misses ids (u'1') and has extra ids (1), may be caused by a type incoherence in a previous request
这是我在 odoo 中插入记录的代码。
ORecordValues values = new ORecordValues();
values.put("partner_id",resPartnerArrayList.get(idc).get_id());//parter id
values.put("date_order", binding.qOrderDate.getText().toString());
if(!expDate.isEmpty())
{
values.put("validity_date",
binding.qExpirationDate.getText().toString());
}
if(!paymentTerms.isEmpty())
{
values.put("payment_term_id",paymentTermArrayList.get(idP).get_id());//payment term id
}
if(!binding.qUntaxedAmount.getText().toString().isEmpty())
{
values.put("amount_untaxed",binding.qUntaxedAmount.getText().toString());
}
if(!binding.qTotal.getText().toString().isEmpty())
{
values.put("amount_total", binding.qTotal.getText().toString());
}
if(!binding.qTaxes.getText().toString().isEmpty())
{
values.put("amount_tax", binding.qTaxes.getText().toString());
}
return odoo.createRecord("sale.order", values);
Run Code Online (Sandbox Code Playgroud)