标签: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)
标签:one user super string def rip des class required
原文地址:https://www.cnblogs.com/xushuotec/p/13394933.html