Skip to content

Instantly share code, notes, and snippets.

@elconde
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save elconde/fe3fe1d7b520c543af4d to your computer and use it in GitHub Desktop.

Select an option

Save elconde/fe3fe1d7b520c543af4d to your computer and use it in GitHub Desktop.
"""
Update the quotation to per 100 unit instead of Pound
Workaround for AR682829
"""
import acm,ael
import FLogger
logger = FLogger.FLogger(__name__)
POUND = ael.Quotation['Pound']
AMBA_DL_USERID = 'AMBA_DL'
# Only AMBA DL should be doing this
isAMBADL = ael.user().userid == AMBA_DL_USERID
def doit(e,op):
return \
isAMBADL and \
e.record_type == 'Instrument' and \
op != 'Delete'
def validate_transaction(transactionList):
newList = []
for e,op in transactionList:
if doit(e,op):
quotation = e.quotation_seqnbr.name
if quotation == 'Pound':
logger.LOG(
'Instrument %s: Updating quotation to Per 100 Units (was %s)',
e.insid,
quotation
)
e.quotation_seqnbr = POUND
e.quote_type = 'Other'
newList.append((e,op))
return newList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment