跳至內容
選單
此問題已被標幟
4 回覆
4000 瀏覽次數
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
3185
2
2月 22
8364
0
8月 20
3814
2
1月 20
3920
1
5月 24
2104