Fixes Issue 29982:Cannot create a sales order from a project phase if the
authorAtul Gaware <atul.gaware@openbravo.com>
Fri, 29 May 2015 18:13:33 +0530
changeset 26873 9660c62a65e2
parent 26872 0d48aea6e4c8
child 26874 6f5bd72a9789
Fixes Issue 29982:Cannot create a sales order from a project phase if the
price list of the project is not defined

ChangeProjectStatusToOrder function takes care to check whether pricelist in
project is null in case of multiphase project category 'S'.

Query used in for loop did not fetched records in GenerateSoFromProjectPhase as
pricelist was null. Now query returns results with null pricelists also so
that proper error message is shown.
src-db/database/model/functions/C_CHANGEPROJECTSTATUSTOORDER.xml
src-db/database/model/functions/C_GENERATESOFROMPROJECTPHASE.xml
--- a/src-db/database/model/functions/C_CHANGEPROJECTSTATUSTOORDER.xml	Thu May 21 17:09:29 2015 +0200
+++ b/src-db/database/model/functions/C_CHANGEPROJECTSTATUSTOORDER.xml	Fri May 29 18:13:33 2015 +0530
@@ -16,7 +16,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2001-2012 Openbravo SLU
+* All portions are Copyright (C) 2001-2015 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -118,6 +118,8 @@
             RAISE_APPLICATION_ERROR(-20000, '@ProjectWarehouseNotFound@');
           ELSIF Cur_SO.SALESREP_ID IS NULL THEN
             RAISE_APPLICATION_ERROR(-20000, '@ProjectSalesRepNotFound@');
+          ELSIF Cur_SO.M_PRICELIST_ID IS NULL AND Cur_SO.PROJECTCATEGORY='S' THEN
+              RAISE_APPLICATION_ERROR(-20000, '@ThebusinessPartner@'||' '||' @PricelistNotdefined@');
           END IF;
           /*Added in order to work with Multiphase Project*/
           IF (Cur_SO.PROJECTCATEGORY is null OR Cur_SO.PROJECTCATEGORY<>'S') THEN
--- a/src-db/database/model/functions/C_GENERATESOFROMPROJECTPHASE.xml	Thu May 21 17:09:29 2015 +0200
+++ b/src-db/database/model/functions/C_GENERATESOFROMPROJECTPHASE.xml	Fri May 29 18:13:33 2015 +0530
@@ -16,7 +16,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2001-2013 Openbravo SLU
+* All portions are Copyright (C) 2001-2015 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -80,13 +80,11 @@
           P.BILLTO_ID, P.C_CAMPAIGN_ID, P.C_PROJECT_ID, P.AD_USER_ID, P.DESCRIPTION, P.PROJECTSTATUS,
           PP.NAME AS PHASE_NAME, PP.AD_CLIENT_ID, PP.AD_ORG_ID, OI.C_LOCATION_ID AS ORGLOCATIONID,
           P.FIN_PAYMENTMETHOD_ID, P.POREFERENCE
-        FROM C_PROJECT P,
+        FROM C_PROJECT P LEFT JOIN M_PRICELIST PL ON P.M_PRICELIST_ID = PL.M_PRICELIST_ID,
           C_PROJECTPHASE PP,
-          M_PRICELIST PL,
           AD_ORGINFO OI
         WHERE P.C_PROJECT_ID=PP.C_PROJECT_ID
           AND PP.C_PROJECTPHASE_ID=v_Record_ID
-          AND P.M_PRICELIST_ID = PL.M_PRICELIST_ID
           AND PP.AD_ORG_ID = OI.AD_ORG_ID
         )
       LOOP