Schema and backend improvements for Physical Inventory
Description
Attachments
relates to
Confluence content
Web links
QAlity Plus - Test Management
Checklists
Activity
@Joanna Bebak @Nikodem Graczewski for testing this I suggest executing some pre-existing test cases related to the physical inventory (make sure to add adjustments). Try also to approve a requisition with adjustments and make sure that didn't break. Finally, make sure print-outs in stock are still working.

Thanks for the comment! I struck out that last bullet.
@Chongsun Ahn I'd prefer to not change the quantity field name in stock management, I don't think its that confusing after the rename. It's also consistent with the requisition service. We can change it, but for reference, this will have to change:
1) Field name in the db and class
2) Stockmanagement-ui, since the adjustment object is actually a field of the Dto (we send the domain to the UI)
3) Field name in ui-components, since from what I can see our reusable adjustment component uses this field name
4) The name of the quantity field of the StockAdjustment class in the requisition service, since it reuses the component from 3
5) The requisition ui, since we just changed the field name in the requisition backend
6) Jasper reports
Details
Details
Assignee
Reporter

Labels
Story Points
Original estimate
Time tracking
Components
Sprint
Fix versions
Priority
Time Assistant
Open Time Assistant
Time Assistant

There appears to be some incomplete and confusing parts to stock management in the schema and in the backend Java code. Notably:
physical_inventory_line_item_reasons is not actually a table of reasons (that is stock_card_line_item_reasons), but is actually a table of adjustments to a physical inventory line item. Therefore, a better name would be physical_inventory_line_item_adjustments. The Java code has the name StockAdjustment, which would be better named PhysicalInventoryLineItemAdjustment.
physical_inventory_line_item_reasons should have id as primary key
physical_inventory_line_item_reasons should have foreign keys for all attributes that make sense (reasonid, physicalinventorylineitemid, stockcardlineitemid, stockeventlineitemid)
The quantity field for StockAdjustment is a bit confusing, since there is a quantity field in the PhysicalInventoryLineItem; it would be better named something like quantityOfDifference or adjustmentQuantity (in both the backend code and schema); if the class is better named, I might be open to leaving this, as long as it's clear the quantity is the quantity of adjustment, not the quantity of the line item
Acceptance Criteria
Make schema and code changes recommended above
Make sure there are no regressions with these changes