Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0017207Openbravo ERP08. Project and service managementpublic2011-05-17 16:532011-06-01 20:24
xabiermerino 
adrianromero 
urgentmajoralways
closedfixed 
5
3.0RC6.1 
3.0MP03.0MP0 
Core
No
0017207: It is not possible save a Project Line with Planned Price = 0
It is not possible save a Project Line with Planned Price = 0. This error appears:

ERROR: division by zero

In several cases products with price 0 are used.
- As Openbravo Admin go to Project & Service Management || Transactions || Service Project || Service Project >> Project Line
- Create a line with Planned Price = 0
- Save
In Trigger C_projectline_trg3: v_oldLine_PlannedMarginAmt:=COALESCE((COALESCE(old.PLANNEDPRICE,0)-COALESCE(old.PLANNEDPOPRICE,0))*100/COALESCE(old.PLANNEDPRICE,1),0);
-->
"IF (COALESCE(old.PLANNEDPRICE,0) <> 0) THEN
v_oldLine_PlannedMarginAmt:=COALESCE((COALESCE(old.PLANNEDPRICE,0)-COALESCE(old.PLANNEDPOPRICE,0))*100/old.PLANNEDPRICE,0);
END IF;"



v_newLine_PlannedMarginAmt:=COALESCE((COALESCE(new.PLANNEDPRICE,0)-COALESCE(new.PLANNEDPOPRICE,0))*100/COALESCE(new.PLANNEDPRICE,1),0);
-->
IF (COALESCE(new.PLANNEDPRICE,0) <> 0) THEN
v_newLine_PlannedMarginAmt:=COALESCE((COALESCE(new.PLANNEDPRICE,0)-COALESCE(new.PLANNEDPOPRICE,0))*100/new.PLANNEDPRICE,0);
END IF;

No tags attached.
depends on backport 00172082.50MP31 closed dalsasua It is not possible save a Project Line with Planned Price = 0 
Issue History
2011-05-17 16:53xabiermerinoNew Issue
2011-05-17 16:53xabiermerinoAssigned To => adrianromero
2011-05-17 16:53xabiermerinoModules => Core
2011-05-17 16:53xabiermerinoStatusnew => scheduled
2011-05-17 16:53xabiermerinofix_in_branch => pi
2011-05-17 17:46xabiermerinoIssue Monitored: networkb
2011-05-27 14:20hgbotCheckin
2011-05-27 14:20hgbotNote Added: 0037667
2011-05-27 14:20hgbotStatusscheduled => resolved
2011-05-27 14:20hgbotResolutionopen => fixed
2011-05-27 14:20hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/145fea0f45020f8605f410675ba77372d1ff3862 [^]
2011-05-27 14:25adrianromeroNote Added: 0037668
2011-05-31 09:44hudsonbotCheckin
2011-05-31 09:44hudsonbotNote Added: 0037785
2011-06-01 20:24jonalegriaesarteNote Added: 0037896
2011-06-01 20:24jonalegriaesarteStatusresolved => closed
2011-06-01 20:24jonalegriaesarteFixed in Version => 3.0MP0

Notes
(0037667)
hgbot   
2011-05-27 14:20   
Repository: erp/devel/pi
Changeset: 145fea0f45020f8605f410675ba77372d1ff3862
Author: Adrián Romero <adrianromero <at> openbravo.com>
Date: Fri May 27 14:20:14 2011 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/145fea0f45020f8605f410675ba77372d1ff3862 [^]

Fixes issue 0017207: It is not possible save a Project Line with Planned Price = 0
It has been modified the related triggers in order to verify that if planned price is zero, calculate properly related values

---
M src-db/database/model/triggers/C_PROJECTLINE_TRG.xml
M src-db/database/model/triggers/C_PROJECTLINE_TRG3.xml
---
(0037668)
adrianromero   
2011-05-27 14:25   
* Testing the issue

Follow carefully the steps to test and verify that the project line can be saved when planned price is 0 too.

Because it has been modified triggers in the project lines table, it must be verfied also that records can be inserted, updated and deleted. Also all actions must be tested in both database engines: postgresql and oracle.

Take into account that in 3.0 the application must be activated to show the Project & Service functionality.

* Other areas affected.

No other areas affected. Only the triggers of project lines has been modified.
(0037785)
hudsonbot   
2011-05-31 09:44   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/ea275e03a164 [^]

Maturity status: Test
(0037896)
jonalegriaesarte   
2011-06-01 20:24   
Verified