Skip to content

[16.0][FIX] contract: preserve manually set recurring_next_date on lines#1449

Closed
maisim wants to merge 1 commit into
OCA:16.0from
maisim:16.0-fix-recurring-next-date-reset
Closed

[16.0][FIX] contract: preserve manually set recurring_next_date on lines#1449
maisim wants to merge 1 commit into
OCA:16.0from
maisim:16.0-fix-recurring-next-date-reset

Conversation

@maisim

@maisim maisim commented Jun 9, 2026

Copy link
Copy Markdown

When a user manually modifies recurring_next_date on a contract line that belongs to a contract with line_recurrence=True, the value was overwritten by the cross-dependency recomputation chain:

  1. Writing line.recurring_next_date triggers contract._compute_recurring_next_date() (depends on contract_line_ids.recurring_next_date)
  2. Contract recomputation triggers line._compute_recurring_next_date() (depends on contract_id.recurring_next_date)
  3. super()._compute_recurring_next_date() unconditionally recomputes from next_period_date_start, overwriting the user's value

The fix adds a guard (similar to the existing one in the contract model for date_start) that detects manual modifications by comparing rec._origin.recurring_next_date with the current value, and skips the recomputation for records where the user has explicitly set the value.

Fixes #1411

@maisim maisim force-pushed the 16.0-fix-recurring-next-date-reset branch from 2599d3a to 6947997 Compare June 9, 2026 12:37
@maisim maisim marked this pull request as draft June 11, 2026 06:49
When a user manually modifies recurring_next_date on a contract line
that belongs to a contract with line_recurrence=True, the value was
overwritten by the cross-dependency recomputation chain:

1. Writing line.recurring_next_date triggers
   contract._compute_recurring_next_date() (depends on
   contract_line_ids.recurring_next_date)
2. Contract recomputation triggers
   line._compute_recurring_next_date() (depends on
   contract_id.recurring_next_date)
3. super()._compute_recurring_next_date() unconditionally recomputes
   from next_period_date_start, overwriting the user's value

The fix adds a guard (similar to the existing one in the contract
model for date_start) that detects manual modifications by comparing
rec._origin.recurring_next_date with the current value, and skips
the recomputation for records where the user has explicitly set
the value.

Fixes OCA#1411
@maisim maisim force-pushed the 16.0-fix-recurring-next-date-reset branch from 6947997 to fdc01a5 Compare June 11, 2026 11:54
@maisim

maisim commented Jun 12, 2026

Copy link
Copy Markdown
Author

replaced by #1462

@maisim maisim closed this Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants