odoo write方法怎样设置事件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了odoo write方法怎样设置事件相关的知识,希望对你有一定的参考价值。
参考技术A 如果是调js可能相对麻烦一点需要继承修改js如果是后台方法,每个model有一个write方法,可以重写。
odoo遗留问题--无法重载write
class Team(models.Model): _name = ‘icbc.team‘ _description = ‘专业组‘ uid = fields.Integer(‘序号‘, required=1) name = fields.Char(‘专业组‘, required=1) team_leader_id = fields.Many2one(‘icbc.userinfo‘,‘组长‘) team_associate_leader_id = fields.Many2one(‘icbc.userinfo‘,‘副组长‘) team_member_ids = fields.One2many(comodel_name=‘icbc.userinfo‘, inverse_name=‘team_id‘, string=‘成员‘) @api.model def create(self, vals): # with pysnooper.snoop(): if 1: if vals.get(‘uid‘)==0: uid = self.env[‘ir.sequence‘].next_by_code(‘icbc.team‘) vals[‘uid‘] = uid return super(Team, self).create(vals)
# @pysnooper.snoop()
# @api.model
# def write(self, vals):
# print(vals)
# # with pysnooper.snoop():
# # if 1:
# # if ‘team_leader_id‘ in vals:
# # new_team_leader = vals.get(‘team_leader_id‘, False)
# # old_team_leader = self.team_leader_id.id
# return super(Team, self).write(vals)
以上是关于odoo write方法怎样设置事件的主要内容,如果未能解决你的问题,请参考以下文章
html网页中,ONCLICK事件时,在指定DIV中打开外部JS文件,怎样实现?