odoo chatter 不会以废料形式出现?
odoo chatter doesn't appear in scrap form?
Python代码
class chatter(models.Model):
_name = 'mail.chatter'
_inherit = ['stock.scrap','mail.thread','mail.activity.mixin','mail.alias.mixin']
_description = 'chatter for scrap form'
XML代码:
"<record id="view_chatter_inherited" model="ir.ui.view">
<field name="name">Chatter</field>
<field name="model">mail.chatter</field>
<field name="inherit_id" ref="stock.stock_scrap_form_view"/>
<field name="arch" type="xml">
<xpath expr="//form/sheet" position="after">
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</xpath>
</field>
</record>"
你扩展的方式不对。如果需要,应该实现聊天的模型应该继承 mail.thread
和其他 mixin。
class StockScrap(models.Model):
_name = 'stock.scrap'
_inherit = ['stock.scrap', 'mail.thread']
# and so on
您的视图扩展几乎是正确的,但是您需要再次使用正确的模型:stock.scrap
而不是 mail.chatter
。
Python代码
class chatter(models.Model):
_name = 'mail.chatter'
_inherit = ['stock.scrap','mail.thread','mail.activity.mixin','mail.alias.mixin']
_description = 'chatter for scrap form'
XML代码:
"<record id="view_chatter_inherited" model="ir.ui.view">
<field name="name">Chatter</field>
<field name="model">mail.chatter</field>
<field name="inherit_id" ref="stock.stock_scrap_form_view"/>
<field name="arch" type="xml">
<xpath expr="//form/sheet" position="after">
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</xpath>
</field>
</record>"
你扩展的方式不对。如果需要,应该实现聊天的模型应该继承 mail.thread
和其他 mixin。
class StockScrap(models.Model):
_name = 'stock.scrap'
_inherit = ['stock.scrap', 'mail.thread']
# and so on
您的视图扩展几乎是正确的,但是您需要再次使用正确的模型:stock.scrap
而不是 mail.chatter
。