Attached Files | forceUseLocatorProductionPlan.diff [^] (4,083 bytes) 2021-02-08 13:52 [Show Content] [Hide Content]diff -ru ORIGINAL/AD_REF_LIST.xml MODIFICADO/AD_REF_LIST.xml
--- a/src-db/database/sourcedata/AD_REF_LIST.xml 2021-02-08 09:45:36.000000000 +0100
+++ b/src-db/database/sourcedata/AD_REF_LIST.xml 2021-02-08 11:44:04.186134000 +0100
@@ -12,4 +12,16 @@
<!--64C8735D1C724266B5D3BD4D92B2DD95--> <AD_MODULE_ID><![CDATA[14569A2127AB4C8FACF7F68C41CAF516]]></AD_MODULE_ID>
<!--64C8735D1C724266B5D3BD4D92B2DD95--></AD_REF_LIST>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--><AD_REF_LIST>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--> <AD_REF_LIST_ID><![CDATA[C67E9AEBC98A4E4FABD6A4715B4659FD]]></AD_REF_LIST_ID>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--> <VALUE><![CDATA[OBBOM_force_locator_production_plan]]></VALUE>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--> <NAME><![CDATA[Auto BOM: Force use locator of production plan]]></NAME>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--> <DESCRIPTION><![CDATA[Force use locator of production plan to get stock]]></DESCRIPTION>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--> <AD_REFERENCE_ID><![CDATA[A26BA480E2014707B47257024C3CBFF7]]></AD_REFERENCE_ID>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--> <AD_MODULE_ID><![CDATA[14569A2127AB4C8FACF7F68C41CAF516]]></AD_MODULE_ID>
+<!--C67E9AEBC98A4E4FABD6A4715B4659FD--></AD_REF_LIST>
+
</data>
diff -ru ORIGINAL/BOMProcess.java MODIFICADO/BOMProcess.java
--- a/src/org/openbravo/retail/autobom/process/BOMProcess.java 2021-02-08 09:45:36.000000000 +0100
+++ b/src/org/openbravo/retail/autobom/process/BOMProcess.java 2021-02-08 11:42:32.469210000 +0100
@@ -370,7 +370,7 @@
}
private ScrollableResults getStockProposed(Product bomProduct, BigDecimal bomQuantity,
- Organization organization) {
+ Organization organization, Locator locator) {
// The M_GetStock function is used
@@ -379,8 +379,9 @@
String processId = SequenceIdData.getUUID();
String recordId = SequenceIdData.getUUID();
try {
- StockUtils.getStock(processId, recordId, bomQuantity, bomProduct.getId(), null, null, null,
- organization.getId(), null, OBContext.getOBContext().getUser().getId(),
+ StockUtils.getStock(processId, recordId, bomQuantity, bomProduct.getId(),
+ locator != null ? locator.getId() : null, null, null, organization.getId(), null,
+ OBContext.getOBContext().getUser().getId(),
OBContext.getOBContext().getCurrentClient().getId(), null, bomProduct.getUOM().getId(),
null, null, null, null, null, null, "N");
id = processId;
@@ -475,8 +476,21 @@
BigDecimal pendingQty = qty.multiply(bomQty);
boolean nonStockedProdAttSet = false;
+ String prefForceLocator = "N";
+ try {
+ prefForceLocator = Preferences.getPreferenceValue("OBBOM_force_locator_production_plan", true,
+ OBContext.getOBContext().getCurrentClient(), null, null, null, null);
+ } catch (PropertyException e) {
+ // It is not necessary to do anything
+ }
+
+ Locator locator = null;
+ if ("Y".equals(prefForceLocator)) {
+ locator = productionPlan.getStorageBin();
+ }
+
ScrollableResults scrollableStock = getStockProposed(bomProduct, bomQty,
- productionPlan.getOrganization());
+ productionPlan.getOrganization(), locator);
try {
while (pendingQty.compareTo(BigDecimal.ZERO) > 0 && scrollableStock.next()) {
@@ -520,7 +534,7 @@
productionLine.setMovementQuantity(pendingQty.negate());
pendingQty = BigDecimal.ZERO;
productionLine.setUOM(bomProduct.getUOM());
- productionLine.setStorageBin(getBestLocator(productionPlan));
+ productionLine.setStorageBin(locator != null ? locator : getBestLocator(productionPlan));
productionLine.setLineNo((counter + 1) * 10);
productionLine.setProductionPlan(productionPlan);
productionLine.setAttributeSetValue(bomProduct.getAttributeSetValue());
|