Categorie: reference Bijgewerkt: 2026-04-08 actionfield workflow actionfield1581

ActionField1581

Beschrijving: Set Currency From Vendor and Calculate totals for all InvoiceLines of the Invoice. Custom: Nee

Propertiesbewerken

Property Type Accessor
Invoice Invoice Root

XMLbewerken

<Workflow Name="ActionField1581" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Set Currency From Vendor and Calculate totals for all InvoiceLines of the Invoice.</Description>
	<Properties>
		<Property	Name="Invoice"		Type="Invoice"				Accessor="Root"		Direction="In" />

		<Property	Name="InvoiceLines"	Type="List[InvoiceLine]"	Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Choose Name="Check UltimoSettings.InvoiceMorePurchaseAllowed">
			<When Name="When only one purchase allowed per invoice" Condition="#{UltimoSettings.InvoiceMorePurchaseAllowed} == False">
				<When Name="Invoice has Purchase and UseFixedExchangeRate is true" Condition="${Invoice.Purchase} != Empty &amp;&amp; ${Invoice.Purchase.UseFixedExchangeRate} == true">
					<Transaction>
						<Assign Name="Set Vendor from Purchase" Property="${Invoice.Vendor}" Value="${Invoice.Purchase.Vendor}" />
					</Transaction>

					<Message Name="Vendor may not be changed" MessageCode="2923">
						<Parameter	Name="Invoice"	Direction="In"		Value="${Invoice}" />
					</Message>

					<Stop Name="Stop" Mode="Abort" />
				</When>
			</When>

			<Otherwise Name="More then one purchase allowed per invoice">
				<Transaction>
					<GetList Name="Get invoicelines" Type="InvoiceLine" OutputProperty="${InvoiceLines}" OrderBy="Id" OrderDirection="Ascending">
						<Filters>
							<PropertyFilter	PropertyName="Id.Invoice"	Operator="="		PropertyValue="${Invoice}" />
						</Filters>
					</GetList>
				</Transaction>

				<ForEach Name="Foreach InvoiceLine" In="${InvoiceLines}" As="InvoiceLine">
					<When Name="InvoiceLine has Purchase and UseFixedExchangeRate is true" Condition="${InvoiceLine.PurchaseLine.Id.Purchase?} != Empty &amp;&amp; ${InvoiceLine.PurchaseLine.Id.Purchase.UseFixedExchangeRate} == true">
						<Transaction>
							<Assign Name="Set Vendor from Purchase" Property="${Invoice.Vendor}" Value="${InvoiceLine.PurchaseLine.Id.Purchase.Vendor}" />
						</Transaction>

						<Message Name="Vendor may not be changed" MessageCode="2925">
							<Parameter	Name="Invoice"		Direction="In"		Value="${Invoice}" />
							<Parameter	Name="InvoiceLine"	Direction="In"		Value="${InvoiceLine}" />
						</Message>

						<Stop Name="Stop" Mode="Abort" />
					</When>
				</ForEach>
			</Otherwise>
		</Choose>

		<Transaction>
			<Choose Name="Invoice has Vendor">
				<When Name="Invoice has Vendor" Condition="${Invoice.Vendor} != Empty">
					<Assign Name="Set Currency from vendor" Property="${Invoice.Currency}" Value="${Invoice.Vendor.Currency}" />

					<Command Name="FindExchangeRateForBookDate" CommandName="FindExchangeRateForBookDate">
						<Parameter	Name="CounterCurrency"	Direction="In"		Value="${Invoice.Currency}" />
						<Parameter	Name="Date"				Direction="In"		Value="${Invoice.BookDate}" />
						<Parameter	Name="ConversionFactor"	Direction="Out"									OutputProperty="${Invoice.CurrencyConversionFactor}" />
						<Parameter	Name="Rate"				Direction="Out"									OutputProperty="${Invoice.CurrencyRate}" />
					</Command>
				</When>

				<Otherwise Name="Invoice has No Vendor">
					<Assign Name="Set Currency to Empty" Property="${Invoice.Currency}" Value="#{Company.Currency}" />
					<Assign Name="Set CurrencyConversionFactor to 1" Property="${Invoice.CurrencyConversionFactor}" Value="1" />
					<Assign Name="Set CurrencyRate to 1" Property="${Invoice.CurrencyRate}" Value="1" />
				</Otherwise>
			</Choose>

			<WorkflowCall Name="Invoice_RecalculateInvoiceLines" WorkflowName="Invoice_RecalculateInvoiceLines">
				<Parameter	Name="Invoice"	Direction="In"		Value="${Invoice}" />
			</WorkflowCall>
		</Transaction>

		<UserContent Name="Post" />
	</Execution>
</Workflow>