Skip to content

Commit

Permalink
CSTMM-43: Fix owner organization field on credit note creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Shahrukh committed Oct 24, 2024
1 parent 4ac74dc commit 041c1f5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ang/fe-creditnote/directives/creditnote-create.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,22 @@
return
}

let currentOwnerOrganization = $scope.creditnotes.owner_organization ? $scope.creditnotes.owner_organization
: String($scope.companies[0]?.contact_id);
let contributionOwnerOrganization = null;

$scope.companies.forEach((company) => {
if (company.contact_id !== null &&
String(contribution['financeextras_contribution_owner.owner_organization']) === String(company.contact_id)
) {
contributionOwnerOrganization = String(company.contact_id);
}
});

$scope.contactId = contribution.contact_id
$scope.creditnotes.contact_id = contribution.contact_id
$scope.creditnotes.owner_organization = String(contribution['financeextras_contribution_owner.owner_organization'])
$scope.creditnotes.owner_organization = contributionOwnerOrganization ?
contributionOwnerOrganization : currentOwnerOrganization;
$scope.creditnotes.currency = contribution.currency
$scope.disableCurrency = true
$scope.currencySymbol = CurrencyCodes.getSymbol(contribution.currency);
Expand Down

0 comments on commit 041c1f5

Please sign in to comment.