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

[14.0][FIX] stock_move_location: take values from the current transient model #2106

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

Conversation

Ricardoalso
Copy link

@Ricardoalso Ricardoalso commented Jul 12, 2024

Issue Description
The previous implementation of _get_move_values(self, picking, lines) relied on data from the transient model "wiz.stock.move.location.line". This approach led to potential inconsistencies between stock_move_location_line_ids.destination_location_id and self.destination_location_id.

Previous Implementation
location_from_id = lines[0].origin_location_id.id
location_to_id = lines[0].destination_location_id.id

The issue arose when the _onchange_destination_location_id(self) method was not properly triggered:

@api.onchange("destination_location_id")
def _onchange_destination_location_id(self):
    for line in self.stock_move_location_line_ids:
        line.destination_location_id = self.destination_location_id

If this onchange method wasn't called correctly, _get_move_values(self, picking, lines) would use potentially outdated values from lines.destination_location_id.id, leading to errors

Proposed Solution
To resolve this issue, we now use values directly from the current transient model "wiz.stock.move.location":

location_from_id = self.origin_location_id.id
location_to_id = self.destination_location_id.id

This change ensures consistency and eliminates the dependency on the proper execution of the onchange method

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.

2 participants