Hello everyone, i'd like to pass attribute to xpath on .py file on odoo17 please help
@api.model def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False): res = super(SaleOrder, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu) if view_type == 'form': # Parse the view architecture doc = etree.XML(res['arch']) # Find the product_template_id field inside order_line and add the 'no_create' option for field in doc.xpath("//field[@name='order_line']//field[@name='product_template_id']"): field.set("options", "{'no_create': True, 'no_create_edit': True, 'no_open': True}") # Update the view architecture res['arch'] = etree.tostring(doc, encoding='unicode') return res