First, I made changes to a model stock.production.lot
class ProductionLot(models.Model):
_inherit = "stock.production.lot"
# We are only overriding the default attribute of the name.
# In the base model, the default was getting the next number/code
# from sequence stock.lot.serial.
# We are adding a new field as well
name = fields.Char(default=lambda self: self.determine_serial_name(),)
vendor_serial = fields.Char( "Vendor Serial Number", required=False, help="Vendor Serial or Lot Number", )
The above seems to work since when I opened up the screen/form, the name field is populated.
However, there is another "extension" of the same model which overrides the create method to update an attribute based on this field:
@api.model_create_multi def create(self, vals_list):
_logger.info(f"CLEY: inside dynamics stock create with {vals_list}")
In the above method, I will see the vendor_serial being set (I type in "testing"):
CLEY: inside dynamics stock create with [{'product_id': 77127, 'vendor_serial': 'testing', 'ref': False, 'use_date': False, 'removal_date': False, 'life_date': False, 'alert_date': False, 'message_attachment_count': 0}]
Can someone suggests what I did wrong and/or if there is a way to fix/correct this?
Thanks...