We're working in Odoo 15, utilizing the OdooRPC library running in AWS Lambda. I have a custom method built into a model, and I'm trying to figure out how to call that method (to update a lot of the record's attributes) through the OdooRPC library.
# defined variables:
# there is a dictionary of values assigned to "model_values"
# this dictionary is used for creating the record to begin with
# assigning the Model variable
Model = api.env['custom.model']
# creating the new record with the model_values dict
new_record = Model.create(model_values)
# grabbing the Recordset object of this new record
new_record = Model.browse(new_record)
# trying to call the function to update the new record's values based on calculations in the method
new_record.driver_fxn()
This is the code I tried, with company-specific information removed/renamed. I'm getting an operand error, and upon further inspection in the Odoo.sh logs, it appears that it's trying to run driver_fxn()
on an empty recordset, despite the new_record
variable pointing at the correct record.