fix: BIG-195 Allocate landed cost amount max number should be transaction remaining amount.

This commit is contained in:
a.bouhuolia
2021-12-30 12:30:02 +02:00
parent 81c81bd09f
commit 119e6fa216
5 changed files with 55 additions and 19 deletions

View File

@@ -116,15 +116,16 @@ export default function AllocateLandedCostFormFields() {
>
<ListSelect
items={transactionEntries}
onItemSelect={({ id, amount }) => {
onItemSelect={(entry) => {
const { id, unallocated_cost_amount: unallocatedAmount } = entry;
const { items, allocation_method } = form.values;
form.setFieldValue('amount', amount);
form.setFieldValue('amount', unallocatedAmount);
form.setFieldValue('transaction_entry_id', id);
form.setFieldValue(
'items',
allocateCostToEntries(amount, allocation_method, items),
allocateCostToEntries(unallocatedAmount, allocation_method, items),
);
}}
filterable={false}