mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
fix bg color
This commit is contained in:
@@ -10,14 +10,6 @@ from lxml import etree
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@validate('tree')
|
||||
def app_valid_field_in_tree(arch, **kwargs):
|
||||
# 增加 header
|
||||
return all(
|
||||
child.tag in ('field', 'button', 'control', 'groupby', 'header')
|
||||
for child in arch.xpath('/tree/*')
|
||||
)
|
||||
|
||||
def app_relaxng(view_type):
|
||||
""" Return a validator for the given view type, or None. """
|
||||
if view_type not in _relaxng_cache:
|
||||
@@ -35,21 +27,6 @@ def app_relaxng(view_type):
|
||||
_relaxng_cache[view_type] = None
|
||||
return _relaxng_cache[view_type]
|
||||
|
||||
def app_reset_valid_view(view_type):
|
||||
_relaxng_cache = view_validation._relaxng_cache
|
||||
for pred in _validators[view_type]:
|
||||
# 要pop掉函数 valid_field_in_tree
|
||||
if pred.__name__ == 'valid_field_in_tree':
|
||||
_validators[view_type].remove(pred)
|
||||
try:
|
||||
_relaxng_cache.pop(view_type, None)
|
||||
_relaxng_cache[view_type] = None
|
||||
except Exception:
|
||||
pass
|
||||
_relaxng_cache[view_type] = app_relaxng(view_type)
|
||||
|
||||
app_reset_valid_view('tree')
|
||||
view_validation.valid_field_in_tree = app_valid_field_in_tree
|
||||
view_validation.relaxng = app_relaxng
|
||||
|
||||
class View(models.Model):
|
||||
@@ -58,8 +35,6 @@ class View(models.Model):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(View, self).__init__(*args, **kwargs)
|
||||
view_validation.relaxng = app_relaxng
|
||||
# 重置 tree
|
||||
app_reset_valid_view('tree')
|
||||
|
||||
# todo: 有可能需要处理增加的 header等标签
|
||||
# 直接重写原生方法
|
||||
|
||||
Reference in New Issue
Block a user