Hi,
I inherited res.patner model to add some fields (is_student and others), and I created a new form view with the new fields.
I would like to override a create method to set (True) as a default value for is_student filed only if I opened it from the new form view.
But when I create a new record from contact form, the default value is always True
Example:
class ResStudent(models.Model):
_inherit = 'res.partner'
is_student = fields.Boolean(string='Is Student')
@api.model
def create(self,values):
values['is_student'] = True
values['studentid'] = self.env['ir.sequence'].next_by_code('res.partner')
return super(ResStudent, self).create(values)
Thanks