Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Re: Group based editable tree vs form pop up edition?
by "Raphaël Valyi" <rvalyi@akretion.com> - 29/03/2024 08:39:01BTW this is the POC PR for sales in v14 if you are interested:
All in all the way to switch the tree view to editable or not is a bit different between v14 and v16 but the idea to do it in the _view_get method is the same.
Thank you again for encouraging me to try it this way.
On Thu, Mar 28, 2024 at 11:17 PM Raphaël Valyi <notifications@odoo-community.org> wrote:
Hello,Thank you Holger, overriding _get_view and using user_has_group absolutely still works in v16!I tried something like this for instance:if self.user_has_groups('base.group_system'):
for sub_form_node in arch.xpath("//field[@name='invoice_line_ids']/tree"):
sub_form_node.attrib["editable"] = ""I initially assumed the result of the method might be cached but fortunately that is not where the cache happens(I could test with different users). So the change is pretty easy to deal with.On Wed, Mar 27, 2024 at 3:17 PM Holger Brunn <notifications@odoo-community.org> wrote:*Do you have an alternative solution to suggest for v16?* override get_view for your model, and do group specific things there. Or probably better, override _get_view_cache [1], and also override _get_view_cache_key to add self.env.user.has_group('the_group.youre_looking_for') or similar to the cache key. I mourned the loss of group-specific view inheritance quite a bit, because you can do very nifty things with it. So I'm still of a mind to eventually write an addon that brings it back for models with some mixin applied. [1] https://github.com/OCA/OCB/blob/16.0/odoo/addons/base/models/ ir_ui_view.py#L2635 -- Your partner for the hard Odoo problems https://hunki-enterprises.com_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe
--Raphaël ValyiFounder and consultant_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe
Raphaël Valyi
Founder and consultant
Reference
-
Group based editable tree vs form pop up edition?
by "Raphaël Valyi" <rvalyi@akretion.com> - 27/03/2024 17:16:18 - 2-
Re: Group based editable tree vs form pop up edition?
by "Raphaël Valyi" <rvalyi@akretion.com> - 29/03/2024 08:39:01 - 0 -
Re: Group based editable tree vs form pop up edition?
by "Raphaël Valyi" <rvalyi@akretion.com> - 29/03/2024 03:13:17 - 0
-