Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANGOLASUP-909: resolving first request #174

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,13 @@
});
}

function setItemsWithUnit() {
var itemsWithUnit = draft.lineItems.filter(function(item) {
return item.unit;
});
draft.lineItems = itemsWithUnit;
}

/**
* @ngdoc method
* @methodOf stock-physical-inventory-draft.controller:PhysicalInventoryDraftController
Expand All @@ -488,6 +495,7 @@
* Save physical inventory draft.
*/
vm.saveDraft = function(withNotification) {
setItemsWithUnit();
multiplyUnitsByFactor(draft.lineItems);
loadingModalService.open();
return physicalInventoryFactory.saveDraft(draft).then(function() {
Expand Down Expand Up @@ -614,7 +622,7 @@

draft.occurredDate = resolvedData.occurredDate;
draft.signature = resolvedData.signature;

setItemsWithUnit();
return saveLots(draft, function() {
physicalInventoryService.submitPhysicalInventory(draft).then(function() {
notificationService.success('stockPhysicalInventoryDraft.submitted');
Expand Down Expand Up @@ -888,10 +896,7 @@

function getUnitById(unitId) {
if (!unitId) {
return {
name: '-',
factor: 1
};
return undefined;
}

return vm.unitsOfOrderable.find(function(unit) {
Expand Down
Loading