NOTE: Trivore ID Documentation has moved to https://trivoreid.com
The content on this site IS OUT OF DATE!
This space has been archived!
Please go ahead to the new site!
Contract Service (python)
If you need more information on contracts, please, see Contracts.
List of all options:
Contracts management
Contract's Parties management
Party's Signers management
Party's Contacts management
Appendix management
Contract body's file management
Appendix file management
Contract Status
DRAFT - new contract has been created.
SIGNABLE - contract has been finalized. NB! Even if the allowed action modifyFinalised is True, after contract is finalized user can modify only notes.
SIGNED - every signer has signed.
EXPIRED - contract passes expiration dates.
TERMINATED - contract termination conditions are passed
ARCHIVED - expired or terminated contract will eventually be archived
Contract Actions
Finalize - to finalize contract following conditions should be fulfilled:
current user must have read access to contract
current user must be owner of contract
contract's state must be DRAFT
contract must have an owner
contract must have at least one party
each party must have at least one signer
Sign
Terminate
Contracts management
from trivoreid.models.contract import Contract, TerminationMode
from trivoreid.utils.criteria import Filter
# Get list of all contracts
page = api.contract_service.get_all()
# Apply filter
filt = Filter(Filter.EQUAL, 'code', 'examplecode')
page = api.contract_service.get_all(filt)
# Add new Contract
contract = Contract()
contract.termOfNoticeDays = 'Example Term of Notice'
contract.terminationMode = TerminationMode.AFTER_ALL_PARTIES_TERMINATE
contract.title = 'Example Title'
contract.version = '1.0.0'
contract.validFrom = '2018-04-26T08:38:02.730Z'
contract.validTo = '2022-04-26T08:38:02.730Z'
contract.code = 'examplecode'
contract.links = ['example1', 'example2']
contract.contractRefs = ['ref1', 'ref2']
contract.notes = 'Example contract notes.'
contract.financialTerms.billingTerms = 'Example Billing Terms.'
contract.financialTerms.paymentTerms = 'Example Payment Terms.'
# This method returns new contract object with the generated ID
contract = api.contract_service.create(contract)
contractId = contract.id
# Get one, Update and Delete
contract.scope = 'Modified scope'
contract.title = 'Modified Title'
api.contract_service.update(contract)
contract = api.contract_service.get(contractId)
api.contract_service.delete(contractId)
# Get all allowed actions, finalise, sign and terminate the contract
# returns dictionary with all actions
actions = api.contract_service.get_allowed_actions(contractId)
contract = api.contract_service.finalise(contractId)
contract = api.contract_service.sign(contractId)
contract = api.contract_service.terminate(contractId, reason='Termination Reason')
Contract's Party management
from trivoreid.models.contract import Party
# Get list of all contract's parties.
# Instead of Page returns list of parties. No pagination or filter can be applied.
parties = api.contract_service.get_all_parties(contractId)
# Add new Party
party = Party()
party.name = 'Example Name'
party.address = 'Example Address'
# This method returns new party object with the generated ID
party = api.contract_service.create_party(contractId, party)
partyId = party.id
# Get one, Update and Delete
party.mobile = '+358401234567'
party.email = 'example@example.com'
api.contract_service.update_party(contractId, party)
party = api.contract_service.get_party(contractId, partyId)
api.contract_service.delete_party(contractId, partyId)
Party's Signer management
from trivoreid.models.contract import Signer
# Get list of all contract's signers.
# Instead of Page returns list of signers. No pagination or filter can be applied.
signers = api.contract_service.get_all_party_signers(contractId, partyId)
# Add new Signer
signer = Signer()
signer.name = 'Example Name'
signer.address = 'Example Address'
# This method returns new signer object with the generated ID
signer = api.contract_service.create_party_signer(contractId, partyId, signer)
signerId = signer.id
# Get one, Update and Delete
signer.mobile = '+358401234567'
signer.email = 'example@example.com'
api.contract_service.update_party_signer(contractId, partyId, signer)
signer = api.contract_service.get_party_signer(contractId, partyId, signerId)
api.contract_service.delete_party_signer(contractId, partyId, signerId)