洞察探索open banking如何通过小程序容器技术助力金融企业实现数据安全和数字化转型
733
2022-10-11
odoo 字段权限管控原理
从视图结构来管控:
以stock.picking 的tree 视图为例,如果将name字段设置群组管控
服务器返回的字段结构将发生变更,根据用户登录所拥有的群组:
{ "list": { "model": "stock.picking", "name": "stock.picking.tree", "toolbar": { "relate": [], "print": [ { "model": "stock.picking", "groups_id": [], "attachment": false, "report_type": "qweb-pdf", "type": "ir.actions.report", "binding_model_id": [ 220, "Transfer" ], "create_uid": [ 1, "OdooBot" ], "paperformat_id": false, "jasper_report": false, "create_date": "2020-03-05 14:07:45", "binding_type": "report", "attachment_use": false, "__last_update": "2020-06-21 13:06:37", "help": false, "name": "Picking Operations", "display_name": "Picking Operations", "report_name": "stock.report_picking", "jasper_output": "pdf", "string": "Picking Operations", "id": 169, "xml_id": "stock.action_report_picking", "report_file": "stock.report_picking_operations", "write_uid": [ 1, "OdooBot" ], "write_date": "2020-06-21 13:06:37", "model_id": [ 220, "Transfer" ], "print_report_name": "'Picking Operations - %s - %s' % (object.partner_id.name or '', object.name)", "multi": false, "jasper_file_ids": [] }, { "model": "stock.picking", "groups_id": [], "attachment": false, "report_type": "qweb-pdf", "type": "ir.actions.report", "binding_model_id": [ 220, "Transfer" ], "create_uid": [ 1, "OdooBot" ], "paperformat_id": false, "jasper_report": false, "create_date": "2020-03-05 14:07:45", "binding_type": "report", "attachment_use": false, "__last_update": "2020-06-21 13:06:37", "help": false, "name": "Delivery Slip", "display_name": "Delivery Slip", "report_name": "stock.report_deliveryslip", "jasper_output": "pdf", "string": "Delivery Slip", "id": 170, "xml_id": "stock.action_report_delivery", "report_file": "stock.report_deliveryslip", "write_uid": [ 1, "OdooBot" ], "write_date": "2020-06-21 13:06:37", "model_id": [ 220, "Transfer" ], "print_report_name": "'Delivery Slip - %s - %s' % (object.partner_id.name or '', object.name)", "multi": false, "jasper_file_ids": [] }, { "model": "stock.picking", "groups_id": [], "attachment": false, "report_type": "qweb-pdf", "type": "ir.actions.report", "binding_model_id": [ 220, "Transfer" ], "create_uid": [ 1, "OdooBot" ], "paperformat_id": false, "jasper_report": false, "create_date": "2020-05-30 08:01:33", "binding_type": "report", "attachment_use": false, "__last_update": "2020-06-21 13:09:01", "help": false, "name": "Delivery Slip", "display_name": "Delivery Slip", "report_name": "bi_professional_reports_templates.report_deliveryslip", "jasper_output": "pdf", "string": "Delivery Slip", "id": 662, "xml_id": "bi_professional_reports_templates.action_report_delivery_custom", "report_file": "bi_professional_reports_templates.report_deliveryslip", "write_uid": [ 1, "OdooBot" ], "write_date": "2020-06-21 13:09:01", "model_id": [ 220, "Transfer" ], "print_report_name": false, "multi": false, "jasper_file_ids": [] } ], "action": [ { "groups_id": [], "limit": 0, "xml_id": "stock_picking_batch.stock_picking_to_batch_action_stock_picking", "views": [ [ false, "form" ] ], "auto_search": true, "type": "ir.actions.act_window", "filter": false, "context": "{}", "binding_model_id": [ 220, "Transfer" ], "create_uid": [ 1, "OdooBot" ], "view_mode": "form", "view_type": "form", "domain": "[]", "create_date": "2020-04-29 10:53:30", "binding_type": "action", "display_name": "Add to Batch", "view_id": false, "help": false, "name": "Add to Batch", "res_id": 0, "usage": false, "string": "Add to Batch", "view_ids": [], "id": 565, "res_model": "stock.picking.to.batch", "src_model": "stock.picking", "write_uid": [ 1, "OdooBot" ], "write_date": "2020-06-21 13:07:37", "search_view_id": false, "__last_update": "2020-06-21 13:07:37", "search_view": "{'model': 'stock.picking.to.batch', 'name': 'default', 'arch': '
从返回的结果中可以看到:当前登录用户没有stock.group_stock_manager权限,故字段中的name将不会返回但是数据的返回结果是不会变更的,即接口search_read的结果不会发生改变,仍然有name字段,只是没有被js处理罢了.
{ "0": { "priority": false, "name": "My Co/IN/00001", "origin": false, "partner_id": false, "scheduled_date": "2020-05-13 03:14:38", "id": 36, "batch_id": false, "picking_type_id": [ 7, "My Company, Chicago: Receipts" ], "date": "2020-05-13 03:14:43", "backorder_id": false, "location_dest_id": [ 27, "My Co/Stock" ], "state": "done", "group_id": false }}
懂得,原来世界如此简单!
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~