I'm tying to get the field "next number (number_next_actual)" of a product sequence and auto set it everytime i create a new product, i need to autofill the field before saving the new product.
something like this picture
https://drive.google.com/file/d/1UviCXw-3nRBdjNygOvMuLAaCsWfgYOCO/view?usp=sharing
i have coded this, it fill the sequence when i save the new product, but i need to load the sequence when i press the button create
@api.model
def create(self, values):
values['ref_sequence'] = self.env['ir.sequence'].next_by_code('ref.seq')
return super(ProductTemplate, self).create(values)
do someone have any idea of how to achieve this, if is there any similar in odoo, or any method i could use to get it.
See this example showing the same: https://www.youtube.com/watch?v=ZfKzmfiqeg0&list=PLqRRLx0cl0hoJhjFWkFYowveq2Zn55dhM&index=10
Add sequence number using python code: https://learnopenerp.blogspot.com/2020/08/generate-create-sequence-number-odoo.html