添加功能

This commit is contained in:
zhou
2025-06-20 19:46:39 +08:00
parent ba674db9fd
commit 48f5364b1d
5 changed files with 29 additions and 18 deletions
+23 -12
View File
@@ -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
@@ -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="押金/履约保证金")
@@ -190,7 +190,7 @@
<div class="d-inline-flex w-100">
<field name="first_pay" string="首次付款日:" class="me-2"
style="max-width: 8rem !important;"/>每月支付日期
<field name="date_payment_day" string=" " class="ms-2"
<field name="date_of_payment" string=" " class="ms-2"
style="max-width: 3rem !important;"/>日
</div>
<field name="expected_reminders"/>
@@ -571,7 +571,7 @@
<div class="d-inline-flex w-100">
<field name="first_pay" string="首次付款日:" class="me-2"
style="max-width: 8rem !important;"/>每月支付日期
<field name="date_payment_day" string=" " class="ms-2"
<field name="date_of_payment" string=" " class="ms-2"
style="max-width: 3rem !important;"/>日
</div>
<field name="expected_reminders" readonly="1"/>
@@ -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,
@@ -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 # 免租期
#判断是否年