Override Invoice Line item Description
Posted: Tue Nov 19, 2019 12:47 am
Is there a way to retrieve the Policy Type for those Invoice Lines that are generated by the Title Insurance Premium Screen?
I am trying to create a COR that overrides the Owner's Policy Description, on the Invoice, when the Order's Product Type is "TSG" or "LITGNT" and the Invoice Line was created specifically by the Owner's Policy.
The following code is currently looking at the Invoice Line Description to make this determination and does change the code the 1st time it sees the Description contains "Owner's Policy", but it fails if the Product Type is switched between TSG and LITGNT because the Description no longer contains "Owner's Policy" and I do not have a field that will always identify the line that is tied to the Owner's Policy. If I could access the actual Policy Type associated with the Line Items, then I would be able to make an accurate determination regardless of what the description may currently contain.
Thank you.
I am trying to create a COR that overrides the Owner's Policy Description, on the Invoice, when the Order's Product Type is "TSG" or "LITGNT" and the Invoice Line was created specifically by the Owner's Policy.
The following code is currently looking at the Invoice Line Description to make this determination and does change the code the 1st time it sees the Description contains "Owner's Policy", but it fails if the Product Type is switched between TSG and LITGNT because the Description no longer contains "Owner's Policy" and I do not have a field that will always identify the line that is tied to the Owner's Policy. If I could access the actual Policy Type associated with the Line Items, then I would be able to make an accurate determination regardless of what the description may currently contain.
Thank you.
Code: Select all
def InvoiceLine_Description_Value(args):
# Exit if processing template.
if args.Context.Root.IsTemplate:
args.RunDefaultRule()
return
# Exit if not fully initialized
if (args.Context.Parent is None):
args.RunDefaultRule()
return
# Exit if the Product Type Code is Not TSG or LITGNT
listOfProductCds = ['TSG', 'LITGNT']
if (args.Context.Root.ProductType.Code.upper() not in listOfProductCds):
args.RunDefaultRule()
return
# If Assigned, get the Description
if (hasattr(args.Context,'Description')):
invLineDescription = args.Context.Description
else: invLineDescription = ''
# Exit if the Description does not contain Owner's Policy (*** This should be checking the Policy Type = OwnersPolicy)
if (invLineDescription is None or invLineDescription[0:14].upper() != "OWNER'S POLICY"):
#args.RunDefaultRule() #Only run this if I am able to check the actual Policy Type associated with the Line Item
return
if args.Context.Root.ProductType.Code.upper() == 'TSG': # Override the description for TSG
args.Value = str(invLineDescription.Replace("Owner's Policy","Trustee's Sale Guaranty"))
return
elif args.Context.Root.ProductType.Code.upper() == 'LITGNT': # Override the description for LITGNT
args.Value = str('Litigation Guarantee Conversion Fee')
return
else: # No Change
return