Hi, i have created a sequence with following definition in .py file :
reference = fields.Char(string='Order Reference', required=True, copy=False, readonly=True,
default=lambda self: _('New'))
and in create method:
@api.model
def create(self, vals):
if vals.get('reference', _('New')) == _('New'):
vals['reference'] = self.env['ir.sequence'].next_by_code('hospital.patient') or _('New')
res = super(HospitalPatient, self).create(vals)
return res
i couldn't understand what i'm missing(using odoo14). would you help please ?
Thanks