I'm looking for some help with the code for the following requirement. This is for V11 CE.
In Vendor Bill (account.invoice) I have added a custom selection field named "coordinator_approval". The selection options are 'Not yet approved' and 'Approved'. The reason I have this field is so that a team member can approve an invoice BEFORE the accounting person validates it and permanently places it in the system.
Currently I have the default value for the field set to 'Not yet approved'.
What I would like is to make the default value 'Approved' IF the Vendor Bill is created from a Purchase Order, in which case the field: 'origin' (Source Doucment) would have a value in it taken from the source Purchase Order.
To summarise, the logic would be something like this:
On creation of a new Vendor Bill,
if field:'origin' = True,
then set field:'coordinator_approval' to 'Approved,
otherwise set field:'coordinator_approval' to 'Not yet approved' BUT allow the field to be manually changed by a user to 'Approved' even if the field:'origin' = False.
Apologies for my homespun logic format above, but can anyone help me with how to achieve this? Some combination of determining a default value within a computed field perhaps?