Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
4222 Vizualizări
Odoo v12
How to disable the edit button on the form?
Found only for tree view example (create = "false") in xml file (v12) But this code does not work for form.

@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
res =
super(VerificationPurchaseOrder, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
if view_type == 'form':
doc = etree.XML(res[
'arch'])
for node in doc.xpath("//form"):
++++++++++++++++++++++++++++++++++++++++++ --|
+RIGHT HERE ->> node.set(
'edit', "false")+ |---- Dose not work
++++++++++++++++++++++++++++++++++++++++++ --|
res[
'arch'] = etree.tostring(doc, encoding='unicode')
return res
What i do wrong?

Sorry, problem solved. Code works :)



Imagine profil
Abandonează
Cel mai bun răspuns

hello 

try with below line in xml

<form string="Sales Order" create="false" edit="false">


Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
4
ian. 24
24048
2
ian. 24
2969
0
aug. 23
2819
5
sept. 21
18258
3
ian. 21
18656