!5532 添加功能

Merge pull request !5532 from dev_zhou
This commit is contained in:
李鹏宇
2025-10-10 07:36:08 +00:00
committed by Gitee
5 changed files with 67 additions and 54 deletions
+12 -5
View File
@@ -70,16 +70,23 @@ class HrAttendance(models.Model):
# 补充假期橙色逻辑,班次逻辑
for emp in self.sudo().env['hr.employee'].search([]):
test1 = att_ids.search([('current_data', '=', fields.Date.today()), ('employee_id', '=', emp.id)])
if not test1:
resource_user_ids = emp.resource_calendar_id.resource_user_ids.ids
is_resource_user = True if emp.id in resource_user_ids else False
if not is_resource_user and not test1:
slot_start = datetime.combine(fields.Date.today(), datetime.min.time())
slot_end = datetime.combine(fields.Date.today() + timedelta(days=1), datetime.min.time())
# 查找员工对应的班次
planning_slots = self.env['planning.slot'].search([
('employee_id', '=', emp.id),
('start_datetime', '>=', slot_start),
('start_datetime', '<', slot_end),
], limit=1)
att_ids.create({
'employee_id': emp.id,
'shift_id': planning_slots.id,
'current_data': fields.Date.today(),
})
def state_fix(self):
for att in self.env["hr.attendance"].browse(self._context.get('active_ids', self._context.get('active_id'))):
att.write({'is_no_card': False,
@@ -251,6 +251,8 @@ class PropertyLeaseContract(models.Model):
process_count = fields.Integer(string="流程数量", compute='_compute_process_count')
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
@api.onchange('is_issues')
def _onchange_is_issues(self):
@@ -272,24 +274,6 @@ class PropertyLeaseContract(models.Model):
name_title = fields.Char(default=_get_default_name_title)
contract_sort = fields.Selection([('property', '物业'), ('ads', '广告位'), ('guan', '管子间')], string="合同类型")
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
@api.onchange('is_issues')
def _onchange_is_issues(self):
if self.is_issues:
issue_id = self.env['issue.library'].create({'name': self.name})
self.related_issues_id = issue_id.id
workflow_record_id = self.env["soong.workflow.record"].search(
[("res_model", "=", self._name), ("res_id", "=", self.id)])
self.env['issue.library.approval.line'].create({
'issue_library_id': issue_id.id,
'workflow_record_id': workflow_record_id.id,
'approval_type': workflow_record_id.workflow_id.id,
'code': self.code,
'approval_date': fields.Datetime.now(),
})
@api.depends('lease_ids.address_id.title_deed')
def _compute_title_information(self):
@@ -172,12 +172,12 @@
<field name="cycle_mode" class="me-2" style="max-width: 11rem !important;"/>付款方式
<field name="cycle_dict" class="me-2" style="max-width: 11rem !important;"/>
</div>
<field name="total_area"/>
<field name="total_area" invisible="contract_sort != 'ads'"/>
<field name="rent" string="月租金" invisible="cycle_dict != 'monthly'"/>
<field name="rent" string="季租金" invisible="cycle_dict != 'quarter'"/>
<field name="rent" string="半年租金" invisible="cycle_dict != 'half'"/>
<field name="rent" string="年租金" invisible="cycle_dict != 'year'"/>
<field name="unit_price" force_save="1"/>
<field name="unit_price" force_save="1" invisible="contract_sort != 'property'"/>
</group>
<group>
<label for="first_pay"/>
@@ -192,7 +192,7 @@
</group>
</group>
<group col="2" string="收费详细">
<group>
<group invisible="contract_sort != 'property'">
<label for="rent_free_period_month"/>
<div class="d-inline-flex w-100">
<field name="rent_free_period_month" required="1" class="me-2"/>
@@ -215,13 +215,6 @@
<field name="increment_value"
class="me-2" style="max-width: 5rem !important;"/>
</div>
<label for="deposit_type"/>
<div class="d-inline-flex w-100">
<field name="deposit_type" string="押金/履约保证金" class="me-2"
style="max-width: 11rem !important;"/>金额
<field name="deposit" class="me-2"
style="max-width: 11rem !important;"/>
</div>
</group>
<group>
<label for="breach"/>
@@ -234,7 +227,16 @@
<field name="tax_rate"/>
</group>
</group>
<group col="3">
<group>
<label for="deposit_type"/>
<div class="d-inline-flex w-100">
<field name="deposit_type" string="押金/履约保证金" class="me-2"
style="max-width: 11rem !important;"/>金额
<field name="deposit" class="me-2"
style="max-width: 11rem !important;"/>
</div>
</group>
<group col="3" invisible="contract_sort != 'property'">
<group>
<field name="performance_bonds"/>
</group>
@@ -369,7 +371,8 @@
<field name="contract_code" decoration-danger="is_equal"/>
<field name="lessee_id"/>
<field name="tenure_type"/>
<field name="total_area"/>
<field name="contract_sort" column_invisible="1"/>
<field name="total_area" column_invisible="contract_sort == 'ads'"/>
<field name="is_equal" column_invisible="1"/>
<field name="deposit" decoration-success="deposit_status == 'paid'"
decoration-danger="deposit_status == 'unpaid'" decoration-muted="deposit_status == 'returned'"
@@ -578,12 +581,12 @@
<field name="cycle_dict" class="me-2"
style="max-width: 11rem !important;"/>
</div>
<field name="total_area"/>
<field name="total_area" invisible="contract_sort == 'ads'"/>
<field name="rent" string="月租金" invisible="cycle_dict != 'monthly'"/>
<field name="rent" string="季租金" invisible="cycle_dict != 'quarter'"/>
<field name="rent" string="半年租金" invisible="cycle_dict != 'half'"/>
<field name="rent" string="年租金" invisible="cycle_dict != 'year'"/>
<field name="unit_price" force_save="1"/>
<field name="unit_price" force_save="1" invisible="contract_sort != 'property'"/>
</group>
<group>
<label for="first_pay"/>
@@ -598,7 +601,7 @@
</group>
</group>
<group col="2" string="收费详细">
<group>
<group invisible="contract_sort != 'property'">
<label for="rent_free_period_month"/>
<div class="d-inline-flex w-100">
<field name="rent_free_period_month" required="1" class="me-2"/>
@@ -622,13 +625,6 @@
<field name="increment_value"
class="me-2" style="max-width: 5rem !important;"/>
</div>
<label for="deposit_type"/>
<div class="d-inline-flex w-100">
<field name="deposit_type" string="押金/履约保证金" class="me-2"
style="max-width: 11rem !important;"/>金额
<field name="deposit" class="me-2"
style="max-width: 11rem !important;"/>
</div>
</group>
<group>
<label for="breach"/>
@@ -645,7 +641,16 @@
<field name="total_receivable" invisible="1"/>
</group>
</group>
<group col="3">
<group>
<label for="deposit_type"/>
<div class="d-inline-flex w-100">
<field name="deposit_type" string="押金/履约保证金" class="me-2"
style="max-width: 11rem !important;"/>金额
<field name="deposit" class="me-2"
style="max-width: 11rem !important;"/>
</div>
</group>
<group col="3" invisible="contract_sort != 'property'">
<group>
<field name="performance_bonds"/>
</group>
@@ -9,7 +9,8 @@
<group>
<group>
<field name="lease_contract_id" invisible="1"/>
<field name="property_ids" widget="many2many_tags" context="{'search_view_ref': 'yuthon_property.yuthon_property_search'}" options="{'no_create': True}" domain="[('id', 'not in', property_ids2)]"/>
<field name="contract_sort_name"/>
<field name="property_ids" widget="many2many_tags" context="{'search_view_ref': 'yuthon_property.yuthon_property_search'}" options="{'no_create': True}" domain="[('id', 'not in', property_ids2),('asset_type_id.name', '=', contract_sort_name)]"/>
<field name="property_ids2" widget="many2many_tags" invisible="1"/>
</group>
<group/>
@@ -15,8 +15,31 @@ class ChoosePropertyWizard(models.Model):
property_ids = fields.Many2many(
'yuthon.property',
string="物业信息",
domain="[('asset_type_id.name', '=', contract_sort_name)]"
)
contract_sort_name = fields.Char(
string="合同类型名称",
compute='_compute_contract_sort_name',
store=False
)
@api.depends('lease_contract_id.contract_sort')
def _compute_contract_sort_name(self):
type_mapping = {
'property': '物业',
'ads': '广告位',
'guan': '管子间'
}
for rec in self:
if rec.lease_contract_id and rec.lease_contract_id.contract_sort:
rec.contract_sort_name = type_mapping.get(
rec.lease_contract_id.contract_sort,
''
)
else:
rec.contract_sort_name = ''
def confirm(self):
rec = self.lease_contract_id
lease_name = []
@@ -25,12 +48,6 @@ class ChoosePropertyWizard(models.Model):
title_deed = []
title_address = []
for record in self.property_ids:
if self.property_ids[0].asset_type_id.name == '广告位':
contract_sort = 'ads'
elif self.property_ids[0].asset_type_id.name == '管子间':
contract_sort = 'guan'
else:
contract_sort = 'property'
lease_name.append(record.name if record.name is not None else "")
title_addr_name = record.title_address.name if (record.title_address and record.title_address.name) else ""
title_address.append(title_addr_name)
@@ -79,7 +96,6 @@ class ChoosePropertyWizard(models.Model):
self.lease_contract_id.write({
'tenure_type': self.lease_contract_id.lease_ids[0].address_id.tenure_type,
'contract_sort': contract_sort,
'property_name': ','.join(all_names),
'title_address': ','.join(title_address_combined),
'lessor_id': self.lease_contract_id.lease_ids[0].address_id.company_id.id