Hi guys;
My sequence increase the value when I save or cancel the process using this field.
name = fields.Char(string='Purchase Name',
default=lambda self: self.env['ir.sequence'].next_by_code('tjara.purchase_order.seq'))
I updated my code to the following but it pop up an error. Also this code don't display the name before saving, the name's field show only a blank espace :
@api.model
def create(self, vals):
vals['name'] = self.env['ir.sequence'].next_by_code('tjara.purchase_order.seq')
return super(purchase_order, self).create(vals)
I want to :
- Genrate the name using a sequence.
- Display it even before saving the record.
- When the user cancel and reopen the form the sequence generate the same name.
Thanks a lot :)
By python code: https://learnopenerp.blogspot.com/2020/08/generate-create-sequence-number-odoo.html