diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 914343a2c..b09a9798c 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -671,14 +671,6 @@ class SoongWorkflowMixin(models.AbstractModel): elif button.review_type == "group": if self.env.user not in button.reviewer_group_id.users: continue - elif button.review_type == 'user_role': - user_role_id = self.env['res.users'].search(['|', ('employee_id.user_role_id', '=', button.users_role_id.id), - ('employee_id.user_role_ids', 'in', button.users_role_id.id)]) - if button.users_role_group_ids: - user_role_id = self.env['res.users'].search(['|', ('employee_id.user_role_id', 'in', button.users_role_group_ids.user_role_ids.ids), - ('employee_id.user_role_ids', 'in',button.users_role_group_ids.user_role_ids.ids)]) - if self.env.user not in user_role_id: - continue # 如果是加签确认 elif button.review_type == "apostille": is_apostille = True @@ -707,9 +699,28 @@ class SoongWorkflowMixin(models.AbstractModel): # btn_exec_action_el.set("style", "background-color: red !important;color: white !important;") if button.has_icon: btn_exec_action_el.set("icon", button.icon) - # 接下来是隐藏的配置 invisible = "not id or state != '{0}' ".format(str(node.node_name)) + if button.review_type == 'user_role': + # 构建角色条件 + role_domain = [] + if button.users_role_id: + role_domain = [ + '|', + ('employee_id.user_role_id', '=', button.users_role_id.id), + ('employee_id.user_role_ids', 'in', button.users_role_id.id) + ] + if button.users_role_group_ids: + role_ids = button.users_role_group_ids.user_role_ids.ids + role_domain = [ + '|', + ('employee_id.user_role_id', 'in', role_ids), + ('employee_id.user_role_ids', 'in', role_ids) + ] + # 如果有角色条件,添加到可见性条件中 + if role_domain: + allowed_user_ids = self.env['res.users'].search(role_domain).ids + invisible += f" or uid not in {allowed_user_ids}" # 如果有隐藏条件的话,启用隐藏 if button.is_review_invisible and button.invisible_expression: domain = eval(button.invisible_expression) @@ -994,9 +1005,9 @@ class SoongWorkflowMixin(models.AbstractModel): field_inst.set("required", "state in %s" % required_arr) if invisible_arr: field_inst.set("invisible", "state in %s" % invisible_arr) - # current_field_name = field_inst.attrib.get("name") - # if current_field_name in ["code", "name_title"]: - # field_inst.set("readonly", "1") + current_field_name = field_inst.attrib.get("name") + if current_field_name in ["code", "name_title"]: + field_inst.set("readonly", "1") res["arch"] = etree.tostring(arch, encoding="unicode").replace("\t", "") return res diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index f3086ca4f..09ef6712c 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -103,7 +103,7 @@ class PropertyLeaseContract(models.Model): split_context = fields.Char(string="拆分内容", default="该合同已拆分") percentage_liquidated_damages = fields.Many2one('yuthon.penalty.setting', string="违约金比例") percentage_damages= fields.Float(string="违约金") - date_payment_day = fields.Selection([('five', '5'), ('fifteen', '15'), ('twentyfive', '25')], string="支付日期") + date_of_payment = fields.Selection([('five', '5'), ('fifteen', '15'), ('twentyfive', '25')], string="支付日期") first_pay = fields.Date(string="首次付款日") unit_price = fields.Float(string="单价", store=True, digits=(16, 2)) deposit_type = fields.Selection([('deposit', '押金'), ('performance', '履约保证金')], string="押金/履约保证金") diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index b580f5752..3de445966 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -190,7 +190,7 @@
每月支付日期 - 日
@@ -571,7 +571,7 @@
每月支付日期 - 日
diff --git a/yuthon_property_approval/wizard/property_contract_wizard.py b/yuthon_property_approval/wizard/property_contract_wizard.py index e126ce64a..f37c25f2b 100644 --- a/yuthon_property_approval/wizard/property_contract_wizard.py +++ b/yuthon_property_approval/wizard/property_contract_wizard.py @@ -67,7 +67,7 @@ class PropertyContractWizard(models.Model): if not percentage_liquidated_damages: percentage_liquidated_damages = self.env['yuthon.penalty.setting'].create({'name': row[36].value}) tax = row[40].value - date_payment_day = row[37].value + date_of_payment = row[37].value performance_bonds = row[40].value contract_date = { 'name': name, @@ -82,7 +82,7 @@ class PropertyContractWizard(models.Model): 'total_area':total_area, 'deposit':deposit, 'tax':tax, - 'date_payment_day':date_payment_day, + 'date_payment_day':date_of_payment, 'increments_every_few_years':increments_every_few_years, 'increment_percentage':increment_percentage, 'unit_price':unit_price, diff --git a/yuthon_property_approval/wizard/property_rental_wizard.py b/yuthon_property_approval/wizard/property_rental_wizard.py index 54aa02443..df6f4cf1a 100644 --- a/yuthon_property_approval/wizard/property_rental_wizard.py +++ b/yuthon_property_approval/wizard/property_rental_wizard.py @@ -163,7 +163,7 @@ class PropertyRentalWizard(models.Model): 'twentyfive': 25 } - days = date_data.get(record.date_payment_day, 0) + days = date_data.get(record.date_of_payment, 0) period_month =record.rent_free_period_month if record.rent_free_period_month else 0 # 免租期 #判断是否年