Hi everyone,
I'm developping a small module for Odoo 8, and I need a field to be filled with current date.
I've been trying to do this through my python file but it raises this error "Expected singleton: test.test()"
On the forum I found this( https://www.odoo.com/fr_FR/forum/aide-1/question/expected-singleton-71132 ) topic but I couldnt get it. Below is my code. Thank you in advance for any help.
import time
class Test(models.Model):
_name = 'test.test'
@api.one
def a_fun(self):
self.date=time.strftime("%d/%m/%Y")
date = fields.Date(default=a_fun)
To solve my problem I used date = fields.Date(default=fields.datetime.now() , readonly=True),
but if someone can give me a few explanation about the error I raised and the use of decorators in Odoo, I'll be very glad ! (I read the documentation, but I really dont get it, I'm quite new to Python programming).