i am requesting to please help to get last element + 1 or greatest value for:
the field values are as follow:
1) field name: x_field1 value: ABC -- can have more values
2) field name: x_field2 value: XYZ -- can have more values
Model is approval.request.
the value in a field to store: ABC-XYZ-00090 (this value stored in 'name' field)
i want to add an Automated Rule or Automation Rule to get 00091 (last or greatest + 1) and concatenate as current x_field1-x_field2-00091, if there is no record exist for combination of x_field1-x_field2 then it will return 1... i know this is very basic for python experts but not for me.
i tried to search on net but still confused as per my knowledge level. please help to write python function.
note: during my search for it, i found code below but don't know how to implement for my requirement:
partner_ids = env['res.partner'].search([], order="create_date desc", limit=1)
last_partner = partner_model.browse(partner_ids)
regards