Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] sale_stock_release_channel_partner_by_date: Avoid release channel reset #954

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

santostelmo
Copy link
Contributor

@santostelmo santostelmo commented Nov 27, 2024

Avoid release channel reset when creating a SO.

Steps to replicate:

  1. create a new sale order
  2. select a customer
  3. select a commitment date (Delivery Date) in the future that does not propose any release channel
  4. select a release channel (any)
  5. save

Results: on save, release channel is reset to empty
Expected behavior: on save, the release channel is kept

@OCA-git-bot
Copy link
Contributor

Hi @sebalix,
some modules you are maintaining are being modified, check this out!

Copy link
Contributor

@sebalix sebalix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test to reproduce the issue is welcome

@sebalix sebalix changed the title [16.0][FIX] sale_stock_available_to_promise_release: Avoid release channel reset [16.0][FIX] sale_stock_release_channel_partner_by_date: Avoid release channel reset Nov 27, 2024
@sebalix
Copy link
Contributor

sebalix commented Nov 27, 2024

I fixed the PR title, the commit should be fixed too (wrong module mentioned)

Comment on lines 45 to 46
if channel_date:
rec.release_channel_id = channel_date.release_channel_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if channel_date:
rec.release_channel_id = channel_date.release_channel_id
forced_release_channel_id = self.env.context.get("order_release_channel_id", {}).get(rec.id)
if not channel_date and forced_release_channel_id:
rec.release_channel_id = forced_release_channel_id
continue
rec.release_channel_id = channel_date.release_channel_id

Copy link
Contributor Author

@santostelmo santostelmo Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That implementation doesn't seem to be possible:

  1. I don't know why but context variable passed in create order_release_channel_id never reach _compute_release_channel_id
  2. We can't know the id of the record before creating it.

@santostelmo santostelmo force-pushed the 16.0-fix-sale_stock_available_to_promise_release-force-release-channel branch 2 times, most recently from 436f75f to 2e063d7 Compare November 28, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants