Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0019016Openbravo ERP05. Production managementpublic2011-11-08 13:002012-04-28 02:31
deepacp 
naiaramartinez 
normalminoralways
closedfixed 
20Ubuntu 10.04 LTS
2.50MP31 
3.0MP12 
Mozilla Firefox
Core
No
0019016: Process "Insert Maintenances" incorrectly calculates the weekend
Process "Insert Maintenances" checks for weekend as to_char (date, 'd') = 6 or 7. However, Sunday is defined as the first day of the week, ie. 1 and Saturday as the last, ie.7. Hence, it wrongly schedules the maintenances that fall on Friday to the coming Sunday, with "Exclude Weekend" option checked.
This issue is visible for periodicity types - daily, M1, M2, M3, M6

PS: Checked the NLS_TERRITORY to see if the day of the week varies as per this. Changed it to Spain, Germany, UK and America and it still behaved the same. In my case, NLS_TERRITORY is set to INDIA.
1. Production Management || Setup || Machine || Machine >> Maintenance: Define maintenance as Preventive
2. Production Management || Setup || Machine || Machine >> Maintenance >> Periodicity: Define periodicity as daily
3. Go to Production Management and run process "Insert Maintenances" setting dates that include a weekend, say 11/08/2011 to 11/15/2011.

Change the checks for weekend to
1. For Saturday, to_char (date, 'd') = '7'
2. For Sunday, to_char (date, 'd') = '1'
VMA-Reviewed
Issue History
2011-11-08 13:00deepacpNew Issue
2011-11-08 13:00deepacpAssigned To => jonalegriaesarte
2011-11-08 13:00deepacpWeb browser => Mozilla Firefox
2011-11-08 13:00deepacpModules => Core
2011-11-08 13:01deepacpIssue Monitored: deepacp
2011-12-27 11:41RenateNieuwkoopIssue Monitored: RenateNieuwkoop
2012-04-03 12:20jonalegriaesarteAssigned Tojonalegriaesarte => vmromanos
2012-04-11 09:23vmromanosTag Attached: VMA-Reviewed
2012-04-17 11:48naiaramartinezNote Added: 0047660
2012-04-17 11:48naiaramartinezAssigned Tovmromanos => naiaramartinez
2012-04-17 11:48naiaramartinezStatusnew => scheduled
2012-04-17 11:48naiaramartinezfix_in_branch => pi
2012-04-26 12:45hgbotCheckin
2012-04-26 12:45hgbotNote Added: 0048017
2012-04-26 12:45hgbotStatusscheduled => resolved
2012-04-26 12:45hgbotResolutionopen => fixed
2012-04-26 12:45hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/9f1665574f3582d6f1415e356ff0021fcff4aa4a [^]
2012-04-26 12:46miruritaNote Added: 0048018
2012-04-26 12:46miruritaStatusresolved => closed
2012-04-26 12:46miruritaFixed in Version => 3.0MP12
2012-04-26 13:37hgbotCheckin
2012-04-26 13:37hgbotNote Added: 0048027
2012-04-28 02:31hudsonbotCheckin
2012-04-28 02:31hudsonbotNote Added: 0048158
2012-04-28 02:31hudsonbotCheckin
2012-04-28 02:31hudsonbotNote Added: 0048160

Notes
(0047660)
naiaramartinez   
2012-04-17 11:48   
Test Plan:
  Go to Machine window.
  Create a new record.
  Go to Maintenance tab and create a new record. Set Maintenance type as preventive.
  Go to Periodicity tab and create a new record. Set Periodicity type as daily.
  Go to Insert Maintenance process. Set the startint day to 17-04-2012 and Ending date to 30-04-2012. Press OK.
  Go to Maintenance Plan. Notice that a record has been created for each day but for weekends (Saturday and Sunday).
(0048017)
hgbot   
2012-04-26 12:45   
Repository: erp/devel/pi
Changeset: 9f1665574f3582d6f1415e356ff0021fcff4aa4a
Author: Naiara Martinez <naiara.martinez <at> openbravo.com>
Date: Thu Apr 26 10:01:01 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/9f1665574f3582d6f1415e356ff0021fcff4aa4a [^]

fixed bug 19016 Calculate the weekends in Insert Maintenances

---
M src-db/database/model/functions/C_PAYMENTDUEDATE.xml
M src-db/database/model/functions/MA_MAINTENANCE_SCHEDULE.xml
A src-db/database/model/functions/C_GET_ISO_DAYS.xml
---
(0048018)
mirurita   
2012-04-26 12:46   
code review + testing OK

new function working in Oracle and PostgreSQL
(0048027)
hgbot   
2012-04-26 13:37   
Repository: erp/devel/pi
Changeset: c03f5142dd6067200aba8e4681f891f7ababdadc
Author: Mikel Irurita <mikel.irurita <at> openbravo.com>
Date: Thu Apr 26 13:35:37 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c03f5142dd6067200aba8e4681f891f7ababdadc [^]

Related to issue 19016: rename function to C_GET_ISOWEEK_DAY

---
M src-db/database/model/functions/C_PAYMENTDUEDATE.xml
M src-db/database/model/functions/MA_MAINTENANCE_SCHEDULE.xml
A src-db/database/model/functions/C_GET_ISOWEEK_DAY.xml
R src-db/database/model/functions/C_GET_ISO_DAYS.xml
---
(0048158)
hudsonbot   
2012-04-28 02:31   
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/cd923b317af4 [^]

Maturity status: Test
(0048160)
hudsonbot   
2012-04-28 02:31   
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/cd923b317af4 [^]

Maturity status: Test