details: https://code.openbravo.com/erp/devel/pi/rev/e4ecb0f34be7 changeset: 35690:e4ecb0f34be7 user: Nono Carballo <nonofce <at> gmail.com> date: Wed Apr 17 11:42:09 2019 +0200 summary: Fixes issue 40539: Sets warehouse organization in physical inventories
When creating Physical Inventories (init/close) at processing Physical Inventory Amount Update, organization is set to the warehouse organization, instead of the document organization. details: https://code.openbravo.com/erp/devel/pi/rev/0436f5f5c68c changeset: 35691:0436f5f5c68c user: Sandra Huguet <sandra.huguet <at> openbravo.com> date: Wed Apr 17 12:39:05 2019 +0200 summary: related to issue 40539 code review changes Create a new variable for client and warehouse to use in all ocurrences diffstat: src/org/openbravo/costing/InventoryAmountUpdateProcess.java | 28 ++++++------ 1 files changed, 15 insertions(+), 13 deletions(-) diffs (55 lines): diff -r 5e010ec9da31 -r 0436f5f5c68c src/org/openbravo/costing/InventoryAmountUpdateProcess.java --- a/src/org/openbravo/costing/InventoryAmountUpdateProcess.java Wed Apr 17 11:25:20 2019 +0000 +++ b/src/org/openbravo/costing/InventoryAmountUpdateProcess.java Wed Apr 17 12:39:05 2019 +0200 @@ -340,36 +340,38 @@ if (localDate == null) { localDate = new Date(); } - String clientId = invLine.getClient().getId(); + Client client = (Client) OBDal.getInstance() + .getProxy(Client.ENTITY_NAME, invLine.getClient().getId()); String orgId = invLine.getOrganization().getId(); + Warehouse warehouse = (Warehouse) OBDal.getInstance() + .getProxy(Warehouse.ENTITY_NAME, warehouseId); InvAmtUpdLnInventories inv = OBProvider.getInstance().get(InvAmtUpdLnInventories.class); - inv.setClient((Client) OBDal.getInstance().getProxy(Client.ENTITY_NAME, clientId)); + inv.setClient(client); inv.setOrganization( (Organization) OBDal.getInstance().getProxy(Organization.ENTITY_NAME, orgId)); - inv.setWarehouse((Warehouse) OBDal.getInstance().getProxy(Warehouse.ENTITY_NAME, warehouseId)); + inv.setWarehouse(warehouse); + inv.setCaInventoryamtline(invLine); List<InvAmtUpdLnInventories> invList = invLine.getInventoryAmountUpdateLineInventoriesList(); invList.add(inv); invLine.setInventoryAmountUpdateLineInventoriesList(invList); InventoryCount closeInv = OBProvider.getInstance().get(InventoryCount.class); - closeInv.setClient((Client) OBDal.getInstance().getProxy(Client.ENTITY_NAME, clientId)); - closeInv.setOrganization( - (Organization) OBDal.getInstance().getProxy(Organization.ENTITY_NAME, orgId)); + closeInv.setClient(client); closeInv.setName(OBMessageUtils.messageBD("InvAmtUpdCloseInventory")); - closeInv - .setWarehouse((Warehouse) OBDal.getInstance().getProxy(Warehouse.ENTITY_NAME, warehouseId)); + + closeInv.setWarehouse(warehouse); + closeInv.setOrganization(warehouse.getOrganization()); + closeInv.setMovementDate(localDate); closeInv.setInventoryType("C"); inv.setCloseInventory(closeInv); InventoryCount initInv = OBProvider.getInstance().get(InventoryCount.class); - initInv.setClient((Client) OBDal.getInstance().getProxy(Client.ENTITY_NAME, clientId)); - initInv.setOrganization( - (Organization) OBDal.getInstance().getProxy(Organization.ENTITY_NAME, orgId)); + initInv.setClient(client); initInv.setName(OBMessageUtils.messageBD("InvAmtUpdInitInventory")); - initInv - .setWarehouse((Warehouse) OBDal.getInstance().getProxy(Warehouse.ENTITY_NAME, warehouseId)); + initInv.setWarehouse(warehouse); + initInv.setOrganization(warehouse.getOrganization()); initInv.setMovementDate(localDate); initInv.setInventoryType("O"); inv.setInitInventory(initInv); _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits