diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/RequirementForm.java b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/RequirementForm.java index 2c36d4fe..1d7d4a0a 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/RequirementForm.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/RequirementForm.java @@ -1,5 +1,6 @@ package info.bukova.isspst.ui.main.orders.requirements; +import info.bukova.isspst.data.MUnitEmb; import info.bukova.isspst.data.Material; import info.bukova.isspst.data.Requirement; import info.bukova.isspst.data.RequirementItem; @@ -234,6 +235,15 @@ public class RequirementForm extends FormViewModel if (subject != null) { + boolean isMaterial = (subject instanceof Material); + + if (isMaterial) + { + Material materialItem = (Material) subject; + MUnitEmb munit = materialItem.getMunit(); + this.selectedItem.setMunit(munit); + } + // Skupina materiálu nebo služeb je propojená, nastavit k zadanému // kódu i správný název skupiny materiálu nebo služby this.selectedItem.setName(subject.getName()); @@ -254,7 +264,7 @@ public class RequirementForm extends FormViewModel item.setUnitPrice(BigDecimal.valueOf(0)); item.setTotal(BigDecimal.valueOf(0)); item.setDescription(""); - item.setMunit(null); + item.setMunit(new MUnitEmb()); this.setSelectedItem(item); this.getDataBean().addItem(item); diff --git a/src/main/webapp/main/orders/requirements/reqForm.zul b/src/main/webapp/main/orders/requirements/reqForm.zul index 9a2a10f2..4894234c 100644 --- a/src/main/webapp/main/orders/requirements/reqForm.zul +++ b/src/main/webapp/main/orders/requirements/reqForm.zul @@ -174,7 +174,7 @@