odoo 二次开发小记-----不定时更新

一、odoo中 页面上字段变化引起其他字段范围变化-onchange

@api.onchange('company_id')
def onchange_parent_id(self):
    return {
        'domain': {'parent_id': [('company_id', '=', self.company_id.id)]},
    }

二、odoo中 mail.message 的使用

使用mail.message,分三步走:

 #在表的下面 继承这段话
_inherit = ['mail.thread']  

# 在字段里面 加上 track_visibility='onchange'   
department_id = fields.Many2one('hr.department', string='Department',track_visibility='onchange') 

#在xml中写入这段话
 <div class="oe_chatter">
            <field name="message_follower_ids" widget="mail_followers"/>
            <field name="message_ids" widget="mail_thread"/>
        </div>

实现效果如下图

猜你喜欢

转载自www.cnblogs.com/wanxiangIT/p/10508658.html