Allow adding attachments and notes on new records

Tryton is a bit inconsistent when it comes to the buttons in the toolbars for new records that have not been saved yet:

  • The user can click on actions and the record will be saved before the action is executed. That applies to printing a report too.
  • The user cannot click on attachments nor notes until the record is saved. The icon is gray and a forbidden icon is shown but nothing explains to the user why she cannot save the record.

I think we should always have the same behaviour for all those buttons and I suggest that we save automatically when the user clicks on attachments and notes.

Thoughts?

There is also some strange behaviour on the new send by email button which does nothing when the record is not save but the button is not dissabled. Not sure if this is a bug, but something that should be improveed also.

Why? They do not have the same requirements.

I do not see the point. There is no attachments nor notes to consult when the record is not created. But you could consult them without having to save the record once created.

Indeed the button is doing nothing if the record has not a positive id. So as long as the current record is not created, it will be better to have the button disabled.

I will prefer to have the same behaviour on reports and email templates (because both are the same). So we should disable also the report button until the record is not saved.

The same applies for Actions and Relates:

  • It is not possible to perform an action on a record until is saved (otherwise the record does not now it’s details)
  • If the record is not saved it should not have anything related.

The user does not want to see the attachments but add them, when the record is not saved.

The problem is that currently there’s no message telling the user to save before attachments can be added.

Technically they are not the same. The reports are based on ir.action and the email templates are very custom.

Indeed I think it is better that the email button does like the actions, it saves the record if modified automatically.

All button based on ir.action do the same because they are managed by the exact same function. They try to save the record before being execute because they rely on the server having the correct data.

But the first action of the attachment is to show the attachments.

No the button is disabled until the record is saved.
For me it is a better behavior than having a popup telling “you must save before clicking on this button”.
And it will be wrong to force to save the modification like the ir.action buttons because these actions (attachments and notes) do not rely on the server data (except just the ID).

It is disable but the user does not know why. That is the problem. At least adding a tooltip would be an improvement.

We both understand that but the user doesn’t. They just see an inconsistent behaviour.

But as said, probably a tooltip would be enough.

We have such thing in many places like fields that are readonly depending on other values, button not displayed depending on the state etc.
I do not see the point nor why a user would put the mouse over a disabled button.
At best the behavior could be documented.

Here is Save record when sending email (#9879) · Issues · Tryton / Tryton · GitLab