Update internal_property.py
This commit is contained in:
parent
1e2fcc1f93
commit
b902dfed47
|
|
@ -7,8 +7,8 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import json
|
# import json
|
||||||
from lxml import etree
|
# from lxml import etree
|
||||||
import re
|
import re
|
||||||
from odoo import models, fields, api, exceptions, _
|
from odoo import models, fields, api, exceptions, _
|
||||||
from odoo.modules.module import get_module_resource
|
from odoo.modules.module import get_module_resource
|
||||||
|
|
@ -31,18 +31,7 @@ class Property(models.Model):
|
||||||
('non_residential', 'Non-Residential'),
|
('non_residential', 'Non-Residential'),
|
||||||
], string="Property Suitability for Residence")
|
], string="Property Suitability for Residence")
|
||||||
|
|
||||||
@api.model
|
|
||||||
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
|
|
||||||
res = super(Property, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar,
|
|
||||||
submenu=submenu)
|
|
||||||
doc = etree.XML(res['arch'])
|
|
||||||
if (view_type == 'form'):
|
|
||||||
for node in doc.xpath("//field"):
|
|
||||||
modifiers = json.loads(node.get("modifiers"))
|
|
||||||
modifiers['readonly'] = [('state', 'in', ['approve'])]
|
|
||||||
node.set("modifiers", json.dumps(modifiers))
|
|
||||||
res['arch'] = etree.tostring(doc, encoding='unicode')
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
||||||
def _compute_maintenance_count(self):
|
def _compute_maintenance_count(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue