We have an issue where the lag calculation is using the project calendar, but we want it to use the predecessor activity's calendar instead. The schedule we imported from P6 uses the predecessor activity's calendar. Is there a way to achieve the same behavior?
Thanks,
Baseev
Attachments
Screenshot 2025-04-16 at 10.11.06 AM.png (448.96 KiB) Viewed 286 times
As far as I understand you want it to be changed for a particular task. Correct?
It's feasible but will require overriding DependencyModel class calculateCalendar method:
class Dependency extends DependencyModel {
* calculateCalendar(...args) {
const proposedValue = yield ProposedValueOf(this.$.calendar);
// If have a value assigned to the dependency.calendar field
// - use it
if (proposedValue) {
// if that's a calendar use it as is
return proposedValue.isCalendarModel ? proposedValue
// if not that must be a calendar identifier - find it in the calendar manager store
: this.getCalendarManagerStore()?.getById(proposedValue);
}
// otherwise fallback to the default logic
return yield* super.calculateCalendar(...args);
}
}
const gantt = new Gantt({
project : {
dependencyModelClass : Dependency,
P.S. Also if you spot some differences between P6 and the Gantt data you could provide us with a sample *.xer file (a small one ideally to not investigate a few thousand of tasks ) reproducing the issue.
Basically I've added importing of the dependenciesCalendar config I mentioned above.
Plus there was a bug in importing calendar exceptions (Primavera provides them in a bit different way comparing to MS Project so I had to adjust the code a bit).
Please let us know if it works for you when checked!