diff --git a/yuthon_issue/wizard/soong_workflow_comment_wizard_inherit.py b/yuthon_issue/wizard/soong_workflow_comment_wizard_inherit.py index d58e15377..9013c8353 100644 --- a/yuthon_issue/wizard/soong_workflow_comment_wizard_inherit.py +++ b/yuthon_issue/wizard/soong_workflow_comment_wizard_inherit.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -from odoo import api, fields, models -from lxml import etree +from odoo import fields, models class SoongWorkflowCommentWizard(models.TransientModel): @@ -10,23 +9,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): 'issue.library', 'soong_comment_wizard_issue_filter_rel', 'wizard_id', 'issue_id', string='议题过滤') - @api.model - def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False): - res = super(SoongWorkflowCommentWizard, self).fields_view_get( - view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu) - if view_type == 'form': - # 从 context 中取 default_issue_filter_ids 的纯数字列表 - default_ids = self._context.get('default_issue_filter_ids') - ids = [] - if default_ids and isinstance(default_ids, list): - for cmd in default_ids: - if cmd and len(cmd) >= 3 and cmd[0] == 6: - ids = list(cmd[2]) - break - if ids: - domain_str = repr([('id', 'in', ids)]) - doc = etree.fromstring(res['arch']) - for node in doc.xpath("//field[@name='avoid_issue_ids']"): - node.set('domain', domain_str) - res['arch'] = etree.tostring(doc, encoding='unicode') - return res + avoid_issue_ids = fields.Many2many( + 'issue.library', 'soong_comment_wizard_avoid_issue_rel', + 'wizard_id', 'issue_id', string='回避议题', + domain="[('id', 'in', issue_filter_ids)]") diff --git a/yuthon_issue/wizard/soong_workflow_comment_wizard_inherit.xml b/yuthon_issue/wizard/soong_workflow_comment_wizard_inherit.xml index 159b7f25c..799036965 100644 --- a/yuthon_issue/wizard/soong_workflow_comment_wizard_inherit.xml +++ b/yuthon_issue/wizard/soong_workflow_comment_wizard_inherit.xml @@ -6,7 +6,7 @@ - +