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][IMP] web_timeline: implementing readonly_field attribute: a boolean field to mark the event as not editable #2981

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

Conversation

IJOL
Copy link

@IJOL IJOL commented Nov 7, 2024

Marks events as non editable following a field in the model

@OCA-git-bot
Copy link
Contributor

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

@IJOL
Copy link
Author

IJOL commented Nov 7, 2024

@carlos-lopez-tecnativa and this one too, thanks in advance

Copy link
Contributor

@carlos-lopez-tecnativa carlos-lopez-tecnativa left a comment

Choose a reason for hiding this comment

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

I'm not sure I fully understand the intended use case. Could you provide an example?

I tested it, but I'm not certain it's working as expected. I added readonly_field="active" to ir.cron and refreshed the view. However, when I double-click on a record, an empty popup opens without loading the record’s information.

Would it be better to use edit="0" or edit="expression" instead of adding a new option? What do you think? Otherwise, please add the new option to the README.
image

image

@IJOL
Copy link
Author

IJOL commented Nov 7, 2024

You are right i see the same, open a blank form, looking into this RN, the use you propose of the new attribute is perfectly valid, and that is the intended use case be able to put readonly bars in the timeline, i will see if can solve, at least not present a blank form, can you think of a way to show a readonly view of the form? if not the only solution now is to not show the popup

@IJOL
Copy link
Author

IJOL commented Nov 7, 2024

Btw nice use of the timeline... i will add it to my rather long todo list

@carlos-lopez-tecnativa
Copy link
Contributor

carlos-lopez-tecnativa commented Nov 7, 2024

@IJOL I believe these changes are covered in this PR. You can add edit="0", or expand it to support expressions if needed.
#2791

@IJOL
Copy link
Author

IJOL commented Nov 7, 2024

The issue is that you can control only group change ( lane change ) without forbid editing, i need to control group but not the data itself, and thats is because i use synthetic non relational groups in my use case where is appropiate to edit the event linked but not to change the group, makes only the group readonly essentially

@IJOL
Copy link
Author

IJOL commented Nov 7, 2024

And my use case is related to listing rentals where the group is the name of the product, you can change the dates but not the product in the line, and for those use cases I need too the readonly_field attribute, because i need lines in confirmed sale orders to be readonly..

@IJOL
Copy link
Author

IJOL commented Nov 7, 2024

The blank form is correct, is an add operation, that can be controlled with the create attribute, so my change is not the culprit is simply working correctly :)

@pedrobaeza
Copy link
Member

Shouldn't that be done with a special attribute like in kanban for not allowing drag and drop between groups? And for the form part, define a special form view to view used when opening the record, with the readonly fields you need. On one2many widget, that can be done passing through context tree_view_ref or form_view_ref.

@IJOL
Copy link
Author

IJOL commented Nov 7, 2024

Shouldn't that be done with a special attribute like in kanban for not allowing drag and drop between groups? And for

this is exactly what i'm proposing a new attribute "edit_group" to control exactly this, i'm open to any name change that fits better

@IJOL
Copy link
Author

IJOL commented Nov 7, 2024

this last comment was wrong, the pr where i propose the edit_group is another, sorry bout that

@pedrobaeza
Copy link
Member

Check how it's called in kanban, and you can use the same for homogeneity.

@IJOL
Copy link
Author

IJOL commented Nov 7, 2024

We are talking here of #2980, I had selected the opposite naming 💯 for me, i will change it to fit, good catch..

…d to mark the event as not editable in vis-timeline
@IJOL IJOL force-pushed the 16.0-web_timeline-readonly_field branch from e589df7 to 92803f4 Compare November 11, 2024 09:22
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.

4 participants