Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4213 Widoki
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 :)



Awatar
Odrzuć
Najlepsza odpowiedź

hello 

try with below line in xml

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


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
4
sty 24
24034
Attrs attribute Rozwiązane
2
sty 24
2966
0
sie 23
2813
5
wrz 21
18239
3
sty 21
18607