跳至内容
菜单
此问题已终结
4 回复
4120 查看
Python code:
class chatter(models.Model):
_name = 'mail.chatter'
_inherit = ['stock.scrap','mail.thread','mail.activity.mixin','mail.alias.mixin']
_description = 'chatter for scrap form'
XML code:
<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>


形象
丢弃
编写者 最佳答案

i edit model name to stock.scrap just and it works like a charm

class chatter(models.Model):

_name = 'stock.scrap'

_inherit = ['stock.scrap','mail.thread','mail.activity.mixin']

形象
丢弃
最佳答案

Hi,

Remove the name given for the model, 

class chatter(models.Model):
_inherit = ['stock.scrap', 'mail.thread', 'mail.activity.mixin', 'mail.alias.mixin']
_description = 'chatter for scrap form'

Then in the XML file, give model as stock.scrap instead of mail.chatter.


<field name="model">stock.scrap</field>

Thanks

形象
丢弃
编写者

it gives me this error:

Field `message_follower_ids` does not exist

Error context:

View `Chatter`

[view_id: 1654, xml_id: custom_inv.view_chatter_inherited, model: stock.scrap, parent_id: 794]

None" while parsing /home/instructor/DAL _Agriculture/custom_inv/view/custom_inv_view.xml:4, near

<record id="view_chatter_inherited" model="ir.ui.view">

<field name="name">Chatter</field>

<field name="model">stock.scrap</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>

相关帖文 回复 查看 活动
0
10月 20
3313
2
2月 22
8515
0
8月 20
3948
2
1月 20
4019
1
5月 24
2265