Thinkphp周易⼋字起名⽹宝宝起名在线下单源码
宝宝起名/⼋字起名/周易取名/周易⼋字起名平台⽹站/在线付费起名源码,thinkphp框架开发周易⼋字起名⽹宝宝起名在线下单⽹站源码⾃适应可⼆开,PHP权威起名策划机构平台源码,Thinkphp3.2给宝宝起名在线算命⽹站站码之家源码,宝宝取名在线下单平台源码⽀持⼿机wap。
1.宝宝在线起名;
2.⼋字起名,周易取名;
3.带在线付费起名;
4.⽼师,⼀对⼀起名 。
链接数据库地址:Application\Common\Conf 修改⾥⾯config.php数据库连接
导⼊sm.sql数据库⽂件即可
伪静态⽤thinkphp
后台域名/admin.php账号admin密码123456 或 admin0000
⽂件:(访问密码:551685)
以下内容⽆关:
-------------------------------------------分割线---------------------------------------------
背景:同⼀个模块,两组开发⼈员对同⼀个模型的form视图进⾏了⼆开。在没有指定外部ID的情况下,odoo是如何选择展⽰展⽰哪个视图呢?
上⼲货
odoo在加载视图的时候,⾸先调⽤的models.py中的load_views函数;
@del
def load_views(self, views, options=None):
“”" Returns the fields_views of given views, along with the fields of
the current model, and optionally its filters for the given action.
:param views: list of [view_id, view_type]
:param options['toolbar']: True to include contextual actions when loading fields_views
:param options['load_filters']: True to return the model's filters
:param options['action_id']: id of the action to get the filters
:return: dictionary with fields_views, fields and optionally filters
"""
options = options or {}
result = {}
toolbar = ('toolbar')
result['fields_views'] = {
v_type: self.fields_view_get(v_id, v_type if v_type != 'list' else 'tree',
toolbar=toolbar if v_type != 'search' else False)
for [v_id, v_type] in views
}
result['fields'] = self.fields_get()
('load_filters'):
result['filters'] = v['ir.filters'].get_filters(self._name, ('action_id'))
return result
上⾯的核⼼在fields_view_get函数,如下,截取重要的内容
@del
def fields_view_get(self, view_id=None, view_type=‘form’, toolbar=False, submenu=False): self.check_access_rights(‘read’)
view = v[‘ir.ui.view’].sudo().browse(view_id)
# Get the view arch and all other attributes describing the composition of the view
result = self._fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
···
检查权限通过后,调⽤_fields_view_get函数,若⽤户调⽤的视图没有指定视图ID,那么将调⽤默认的视图@del
def _fields_view_get(self, view_id=None, view_type=‘form’, toolbar=False, submenu=False): View = v[‘ir.ui.view’].sudo()
result = {
‘model’: self._name,
‘field_parent’: False,
}
# try to find a view_id if none provided
if not view_id:
# <view_type>_view_ref in context can be used to overrride the default view
view_ref_key = view_type + '_view_ref'
view_ref = self._(view_ref_key)
if view_ref:
if '.' in view_ref:
module, view_ref = view_ref.split('.', 1)
query = "SELECT res_id FROM ir_model_data WHERE model='ir.ui.view' AND module=%s AND name=%s" self._cr.execute(query, (module, view_ref))
view_ref_res = self._cr.fetchone()
if view_ref_res:
view_id = view_ref_res[0]
else:
_logger.warning('%r requires a fully-qualified external id (got: %r for model %s). '
'Please use the complete `module.view_id` form instead.', view_ref_key, view_ref,
self._name)
if not view_id:
# otherwise try to find the lowest priority matching ir.ui.view
view_id = View.default_view(self._name, view_type)
if view_id:
# read the view with inherited views applied
root_view = View.browse(view_id).read_combined(['id', 'name', 'field_parent', 'type', 'model', 'arch'])
result['arch'] = root_view['arch']
result['name'] = root_view['name']
result['type'] = root_view['type']
result['view_id'] = root_view['id']
result['field_parent'] = root_view['field_parent']
result['base_model'] = root_view['model']
else:
# fallback on default views methods if no ir.ui.view could be found
try:
arch_etree = getattr(self, '_get_default_%s_view' % view_type)()
result['arch'] = string(arch_etree, encoding='unicode')
result['type'] = view_type
result['name'] = 'default'
except AttributeError:
unicode在线工具raise UserError(_("No default view of type '%s' could be found !", view_type))
return result
此处我们讨论的是odoo是如何取默认视图的,再进ir.ui.view模型的default_view函数查看@del
def default_view(self, model, view_type):
“”" Fetches the default view for the provided (model, view_type) pair:
primary view with the lowest priority.
:param str model:
:param int view_type:
:return: id of the default view of False if none found
:
rtype: int
"""
domain = [('model', '=', model), ('type', '=', view_type), ('mode', '=', 'primary')]
return self.search(domain, limit=1).id
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论