Syed Muhammad Ali
Syed Muhammad Ali

Reputation: 67

What does the following expression do?

What does the following expression do?

default=lambda self: ('New')

The exact expression is:

book_internal_code = fields.Char(
        string='Book Code', required=True, copy=False, readonly=True, index=True, default=lambda self: ('New'))

Upvotes: 1

Views: 42

Answers (1)

Paxmees
Paxmees

Reputation: 1590

It is same as default='New'

But it creates a lambta that is executed when record is created. For example default=lambda self: self.env.user sets default value as current user

Upvotes: 1

Related Questions