-
-
Notifications
You must be signed in to change notification settings - Fork 318
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] [MIG] helpdesk_mgmt_fieldservice: Migration to 16.0 #608
base: 16.0
Are you sure you want to change the base?
[16.0] [MIG] helpdesk_mgmt_fieldservice: Migration to 16.0 #608
Conversation
When trying to open a res_partner form with a user who doesn't have permission for read fieldservice data, this view causes an error cause it try to set attributes to a button that doesn't exist. Specifying groups_id fix this, extending the view only if the current user has permissions to see that button.
Currently translated at 100.0% (32 of 32 strings) Translation: helpdesk-12.0/helpdesk-12.0-helpdesk_mgmt_fieldservice Translate-URL: https://translation.odoo-community.org/projects/helpdesk-12-0/helpdesk-12-0-helpdesk_mgmt_fieldservice/fr/
Currently translated at 100.0% (36 of 36 strings) Translation: helpdesk-14.0/helpdesk-14.0-helpdesk_mgmt_fieldservice Translate-URL: https://translation.odoo-community.org/projects/helpdesk-14-0/helpdesk-14-0-helpdesk_mgmt_fieldservice/it/
Currently translated at 100.0% (36 of 36 strings) Translation: helpdesk-14.0/helpdesk-14.0-helpdesk_mgmt_fieldservice Translate-URL: https://translation.odoo-community.org/projects/helpdesk-14-0/helpdesk-14-0-helpdesk_mgmt_fieldservice/es/
Currently translated at 100.0% (36 of 36 strings) Translation: helpdesk-14.0/helpdesk-14.0-helpdesk_mgmt_fieldservice Translate-URL: https://translation.odoo-community.org/projects/helpdesk-14-0/helpdesk-14-0-helpdesk_mgmt_fieldservice/pt_BR/
d0687ba
to
c8a33eb
Compare
<button name="action_view_helpdesk_tickets" position="attributes"> | ||
<attribute | ||
name="context" | ||
>{'default_partner_id': id, 'default_fsm_location_id': service_location_id}</attribute> | ||
groups="fieldservice.group_fsm_user_own" | ||
>{'default_partner_id': id}</attribute> | ||
</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: these changes are not really clear to me, could you give me some context and explain these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With migration 16.0 page, this point was mentioned:
I am not able to use groups_id in views instead need to add groups attribute in the field itself. Hence this change was introduced
Any view with groups_id on it now has to move such groups to the elements of the view. But now you can put groups attribute in a view field instead of isolating it on a view without fear of an access error. Check it in odoo/odoo#98551.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, looks great! But why the default location has been removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for delayed response. I shouldn't have removed service_location_id while incorporating "groups" for the button. Hope the latest code looks fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks!
c8a33eb
to
99e9757
Compare
<record id="res_partner_form_ticket_context" model="ir.ui.view"> | ||
<field name="name">res.partner.form.ticket.context</field> | ||
<field name="model">res.partner</field> | ||
<field name="inherit_id" ref="base.view_partner_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="service_location_id" invisible="1" /> | ||
<button name="action_view_helpdesk_tickets" position="attributes"> | ||
<attribute name="groups">fieldservice.group_fsm_user_own</attribute> | ||
<attribute | ||
name="context" | ||
>{'default_partner_id': id, 'default_fsm_location_id': service_location_id}</attribute> | ||
</button> | ||
</field> | ||
</record> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: it seems that in 14.0, this customization was made available only for users with the group fieldservice.group_fsm_user_own
, while now you are making the whole button available only for the users with that group.
Could you please check and fix the issue to make the functionality the same as it was before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed groups_id and for accessing service_location_id field which can be accessed only with groups "fieldservice.group_fsm_user_own" is added in the parent view with invisible attribute so that functionality would remain the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please double check? I feel like that to preserve the full functionality you should:
- Use two buttons, the one already existing and create a new one
- The first should be visible if you have the group, the other one not
- The one visible if you have the group should also have the customization made in this inheritance
Let me know if everything is clear :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems solved.
99e9757
to
6b0d16d
Compare
186f5dc
to
39e4ab9
Compare
39e4ab9
to
8eb0982
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment to fix a bug that was already present in previous versions
But in general, LGTM (Code review)
<field name="inherit_id" ref="base.view_partner_form" /> | ||
<field name="arch" type="xml"> | ||
<button name="action_view_helpdesk_tickets" position="attributes"> | ||
<button name="action_view_helpdesk_tickets" position="before"> | ||
<field name="service_location_id" invisible="1" /> | ||
</button> | ||
<button name="action_view_helpdesk_tickets" position="attributes"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chore: an issue that we should fix is that the <button name="action_view_helpdesk_tickets">
is not present in base.view_partner_form
but is added by helpdesk_mgmt.view_partner_form
so we should inherit from that view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this has to be inherited from helpdesk_mgmt.view_partner_form which is the right way to inherit as mentioned by you.
However, I see issue still persists with updating button with group attribute to "fieldservice.group_fsm_user_own" and having helpdesk_mgmt and fieldservice modules installed along with helpdesk_mgmt_fieldservice with user provided only with helpdesk_mgmt but not with fieldservice, helpdesk button is not visible in the contacts view as shown below:
Please let me know your views on it.
<record id="res_partner_form_ticket_context" model="ir.ui.view"> | ||
<field name="name">res.partner.form.ticket.context</field> | ||
<field name="model">res.partner</field> | ||
<field name="inherit_id" ref="base.view_partner_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="service_location_id" invisible="1" /> | ||
<button name="action_view_helpdesk_tickets" position="attributes"> | ||
<attribute name="groups">fieldservice.group_fsm_user_own</attribute> | ||
<attribute | ||
name="context" | ||
>{'default_partner_id': id, 'default_fsm_location_id': service_location_id}</attribute> | ||
</button> | ||
</field> | ||
</record> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems solved.
1c883c1
to
deb1d7b
Compare
8a63a0f
to
deb512d
Compare
action_view_helpdesk_ticket function is overridden by replacing context when both groups "helpdesk_mgmt.group_helpdesk_user_own" and "fieldservice.group_fsm_user_own" are available Functionality for button in 14 and 16 versions: Odoo 14:Helpdesk - Manager, Fieldservice - Manager - Has context with default_location_id, default_partner_id Odoo 16:Helpdesk - Manager, Fieldservice - Manager - context contains default_location_id, default_partner_id |
deb512d
to
19100f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review: LGTM
MIgrating helpdesk_mgmt_fieldservice to 16.0 version