0
我是Odoo中的neewby,并且与calendar.event对象存在关系One2many的问题。
我已经定义了一个新对象,“调查”这样的:Odoo One2many与calendar.event对象的关系
class Investigation(models.Model):
_name = 'investigation'
calendar_event_ids = fields.One2many('calendar.event', 'investigation_id', help="Meetings")
和我修改calendar.event对象是这样的:
class CalendarEvent(models.Model):
_name = 'calendar.event'
_inherit = 'calendar.event'
investigation_id = fields.Many2one(comodel_name='investigation', inverse_name='investigation_id', help="Investigation")
我定义我的对象视图:
...
<page string="Calendar">
<group>
<field name="calendar_event_ids" string="Meetings"></field>
</group>
</page>
...
,这是新的calendar.event形式:
<record model="ir.ui.view" id="investigation_view_calendar_event_form">
<field name="name">Calendar - Event Form</field>
<field name="model">calendar.event</field>
<field name="priority" eval="1"/>
<field name="inherit_id" ref="calendar.view_calendar_event_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="/form/sheet/notebook/page[1]" position="replace">
<page string="Meeting Details">
<group>
<group>
<field name="start_date" string="Date" on_change="onchange_dates('start', start_date, stop_date, allday, True)" />
</group>
</group>
<field name="message_needaction" invisible="1"/>
</page>
</xpath>
</data>
</field>
</record>
添加新calendar.event对象到我的调查对象获得我下面的错误:
......\workspace\odoo\addons\calendar\calendar.py(47)calendar_id2real_id()
-> return calendar_id and int(calendar_id) or calendar_id
(Pdb)
在调试模式下,我看到的是,在calendar.py类方法get_real_ids(IDS),我有一个IDS值像“u'one2many_v_id_92”,但我想这个ID必须是长类型的。
任何人都可以帮助我吗?
在此先感谢。
好的,我已经应用了您的更改,但没有任何更改。调试信息“return calendar_id and int(calendar_id)or calendar_id”persist and gui remain blocked –
我在代码中看不到其他问题。在我看来,Odoo无法处理'calendar.event'上的虚拟ID。可能是一个错误。在[Odoo问题]上打开一个问题(https://github.com/odoo/odoo/issues) – CZoellner