码迷,mamicode.com
首页 > 其他好文 > 详细

【odoo】遗留问题--无法重载write

时间:2020-07-29 10:35:14      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:one   user   super   string   def   rip   des   class   required   

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

标签:one   user   super   string   def   rip   des   class   required   

原文地址:https://www.cnblogs.com/xushuotec/p/13394933.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!