To auto-fill the new shift's opening balance with the previous shift's closing balance in Odoo Studio, you'll need to use a combination of automated actions and custom code.
Go to Settings > Technical > Actions > Server Actions.
create new
# Find the previous shift record
previous_shift = env['your.model'].search([], order='shift_date desc', limit=1)
if previous_shift:
# Set the opening balance to the previous shift's closing balance
record.opening_meter_reading = previous_shift.closing_meter_reading
Go to Settings > Technical > Automation > Automated Actions.
Create a New Automated Action
Click Create.
Name: Provide a name (e.g., "Set Opening Balance on Record Creation").
Model: Select the model where this should apply.
Trigger: Choose On Creation.
Action to Do: Choose Execute Server Action and select the server action you created earlier.