Strange behaviour when opening a m2o window

Hi,
I’ve started to investigate again the problem I had in this post: Production on_changes triggered while searching records, and I found something that I don’t understand, that could be related but I’m not really sure.
I tried on both 7.0 and 8.0 public demo and it happens on both:
Open a production in draft state, click on the product m2o icon:
image
Then without modifying anything click on “save”, and you will notice that the on_change_product has been called:


Also, when clicking in the m2o window, fields become readonly if the field itself is readonly; if the production is in draft state, where the product can be modified, I can modify the product fields from the window, but in a more advanced state where the product is readonly, I can’t.
Is this the intended/expected behaviour?

Then click on “Discard Changes”

It is the intended behavior.

Users can click on save by mistake, but without any actual modification, why should the on_changes be called? they will either do nothing or modify something that shouldn’t be.

Because it is like if a new value has been selected for the Many2One.

Now it may be possible to disable the “Save” button if nothing has changed in the form.

I do not understand this sentence.

Sorry, I meant that for example, in the case of productions, with the product field, explode_bom() is called amongst other things, if the user already did something in the production, it may be lost, and if he did nothing, then the production will remain the same.

Also, I remember some users reporting that sometimes when they are going to exit a record the program shows them the unsaved changes popup when they did nothing so they just click in “No” but with some confusion as they don’t know if they actually did something. This behaviour is probably the cause.

I agree that will be a good improvement but probably we should neither show a “Discard changes” button.

I’m wondering if it won’t be better to:

  1. Show a “Close” button when the user open the pop.
  2. Replace the button with “Discard Changes” / “Save” when the user modified something on the form.