I am trying to extend a screen in Purchasing to create our own unique number using the default attribute like below:
name = fields.Char( 'Lot/Serial Number', default=lambda self: self.get_serial_number(), required=True, help="Unique Lot/Serial Number")
However, the number is being generated every time the screen is "opened" for edit. This is after the data was saved to the database. I do not understand since I thought the default will only kicked in if there is no value.
Sorry, I was new to Odoo, this apparently is caused by something else. I was extending on existing code and didn't realize that there is an issue with existing code. I had posted a different question concerning that issue: https://www.odoo.com/forum/help-1/in-edit-mode-my-column-always-bring-up-the-new-form-instead-of-edit-form-209511