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

[IMP] sale_global_stock_route: prevent to update route_id on confirme… #1730

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

Conversation

bealdav
Copy link
Member

@bealdav bealdav commented Sep 26, 2024

Copy link
Contributor

@cvinh cvinh left a comment

Choose a reason for hiding this comment

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

Even if it's still draft, I understand what you did and of course I'm approving

@bealdav bealdav marked this pull request as ready for review September 26, 2024 12:41
@rousseldenis
Copy link
Sponsor Contributor

Mmmh, I understand the problem you have but:

  • In Odoo core, the route_id field on sale order line is readonly in "done" and "cancel"

That's why I think the best is to mimic the same states.

@bealdav
Copy link
Member Author

bealdav commented Sep 26, 2024

@rousseldenis Thanks for your suggestion.
But readonly is only in the view then method in current module can change the field isn't it ?

@bealdav
Copy link
Member Author

bealdav commented Sep 26, 2024

And on the user side, it can let think we can update the flow whereas we should not. Then it's error prone or at least a source of misunderstood isn't it ?

@cvinh
Copy link
Contributor

cvinh commented Sep 26, 2024

Mmmh, I understand the problem you have but:

  • In Odoo core, the route_id field on sale order line is readonly in "done" and "cancel"

That's why I think the best is to mimic the same states.

Well IMHO sometimes, Odoo's way is not the best... but sometimes it is...
I prefer sale, done... if it's cancelled then why would it be forbidden to change it...
I vote for @bealdav way

@bealdav
Copy link
Member Author

bealdav commented Sep 27, 2024

@rousseldenis maybe I misunderstood your message but my commit also makes field readonly when state in done/cancel, then that's the odoo way ? I missed something ?

@cvinh
Copy link
Contributor

cvinh commented Sep 27, 2024

@rousseldenis maybe I misunderstood your message but my commit also makes field readonly when state in done/cancel, then that's the odoo way ? I missed something ?

@bealdav you did
attrs="{'readonly': [('state', 'in', ('sale', 'done'))
and I vote for you

@rousseldenis
Copy link
Sponsor Contributor

@rousseldenis maybe I misunderstood your message but my commit also makes field readonly when state in done/cancel, then that's the odoo way ? I missed something ?

In fact, that's the behaviour for the lines in sale state, you can still add lines with a route (e.g. : for MTO).

Here, the field is global, so, it can be good to protect salestate too.

But for the cancelstate, you should not be able to change something too. So, I would have added that state

@bealdav
Copy link
Member Author

bealdav commented Sep 27, 2024

Sorry I misread states, really sorry :-(

Everybody is OK for 'readonly': [('state', 'in', ('sale', 'done', 'cancel'))] ?

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.

6 participants