添加功能
This commit is contained in:
@@ -680,7 +680,7 @@ class HrAttendance(models.Model):
|
||||
"views": [[form_id, "form"]],
|
||||
"context": {
|
||||
'default_is_day': True,
|
||||
'default_statr_date': self.current_data,
|
||||
'default_start_date': self.current_data,
|
||||
'default_end_date': self.current_data,
|
||||
'default_users_id': self.employee_id.user_id.id,
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class AttendanceControlsWizard(models.TransientModel):
|
||||
'default_users_id': self.attendance_id.employee_id.user_id.id,
|
||||
'default_is_day': True,
|
||||
'reason_application': '事由',
|
||||
'default_statr_date': self.attendance_id.current_data,
|
||||
'default_start_date': self.attendance_id.current_data,
|
||||
'default_end_date': self.attendance_id.current_data,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class BindingInformationWizard(models.Model):
|
||||
'binding_information_wizard_available_contract_rel',
|
||||
'wizard_id',
|
||||
'contract_id',
|
||||
string='可用合同ID',
|
||||
string='已绑定合同',
|
||||
)
|
||||
|
||||
@api.onchange('contract_ids')
|
||||
@@ -25,13 +25,10 @@ class BindingInformationWizard(models.Model):
|
||||
return
|
||||
new_property_ids = []
|
||||
for contract_id in self.contract_ids:
|
||||
# 获取合同关联的物业明细行
|
||||
for line in contract_id.lease_ids:
|
||||
if line.address_id:
|
||||
new_property_ids.append(line.address_id.id)
|
||||
# 过滤掉已选择的物业,避免重复
|
||||
new_property_ids = list(set(new_property_ids) - set(self.property_ids.ids))
|
||||
# 追加新物业(使用操作码4)
|
||||
if new_property_ids:
|
||||
self.property_ids = [(4, property_id) for property_id in new_property_ids]
|
||||
|
||||
@@ -43,64 +40,88 @@ class BindingInformationWizard(models.Model):
|
||||
|
||||
def confirm(self):
|
||||
if self.bank_id.name:
|
||||
if self.contract_ids:
|
||||
new_contracts = self.contract_ids - self.bank_id.contract_ids
|
||||
if new_contracts:
|
||||
self.bank_id.write({
|
||||
'contract_ids': [(4, cont.id) for cont in new_contracts]
|
||||
})
|
||||
current_bank_contracts = self.bank_id.contract_ids
|
||||
new_contracts = self.contract_ids - current_bank_contracts
|
||||
if new_contracts:
|
||||
self.bank_id.write({
|
||||
'contract_ids': [(4, cont.id) for cont in new_contracts] # 添加新增合同
|
||||
})
|
||||
removed_contracts = current_bank_contracts - self.available_contract_ids
|
||||
removed_contract_ids = removed_contracts.ids
|
||||
if removed_contracts:
|
||||
self.bank_id.write({
|
||||
'contract_ids': [(3, cont.id) for cont in removed_contracts] # 删除移除的合同
|
||||
})
|
||||
|
||||
# 根据银行账号查找承租方信息
|
||||
bank_account = self.env['property.bank.line'].search([
|
||||
('bank', '=', self.bank_id.name),
|
||||
('tenant_id.name', '!=', False),
|
||||
bank_ids = self.env['property.bank.statements'].search([
|
||||
('name', '=', self.bank_id.name),
|
||||
('your_own_unit', '=', self.bank_id.your_own_unit)
|
||||
])
|
||||
# 银行当前最新的合同(新增 + 未被移除的)
|
||||
latest_contract_ids = self.bank_id.contract_ids.ids
|
||||
for bank_id in bank_ids:
|
||||
bank_id.write({
|
||||
'contract_ids': [(6, 0, latest_contract_ids)]
|
||||
})
|
||||
|
||||
# 根据银行账号查找承租方信息
|
||||
bank_account = self.env['property.bank.line'].search([
|
||||
('bank', '=', self.bank_id.name),
|
||||
('tenant_id.name', '!=', False),
|
||||
])
|
||||
# 删除空记录
|
||||
invalid_bank_lines = self.env['property.bank.line'].search([
|
||||
('name', '=', False),
|
||||
('user', '=', False),
|
||||
('bank', '=', False),
|
||||
])
|
||||
if invalid_bank_lines:
|
||||
invalid_bank_lines.unlink()
|
||||
|
||||
bank_ids = self.env['property.bank.statements'].search([('name', '=', self.bank_id.name),
|
||||
('your_own_unit', '=',
|
||||
self.bank_id.your_own_unit)])
|
||||
for bank_id in bank_ids:
|
||||
bank_id.write({
|
||||
'contract_ids': [(6, 0, self.bank_id.contract_ids.ids)],
|
||||
})
|
||||
|
||||
if bank_account:
|
||||
# 获取已存在的合同明细行的合同ID
|
||||
existing_contract_ids = bank_account.tenant_id.property_contract_ids.mapped('lease_contract_id.id')
|
||||
all_contracts = self.contract_ids | self.bank_id.contract_ids
|
||||
# 过滤出需要新增的合同(排除已存在的)
|
||||
new_contracts = all_contracts.filtered(lambda c: c.id not in existing_contract_ids)
|
||||
for contract in new_contracts:
|
||||
self.env['property.tenant.line'].sudo().create({
|
||||
'tenant_id': bank_account.tenant_id.id,
|
||||
'lease_contract_id': contract.id,
|
||||
})
|
||||
# 删除已经移除的合同
|
||||
lines_to_delete = self.env['property.tenant.line'].search([
|
||||
('tenant_id', '=', bank_account.tenant_id.id),
|
||||
('lease_contract_id', 'in', removed_contract_ids)
|
||||
])
|
||||
# 删除空记录
|
||||
invalid_bank_lines = self.env['property.bank.line'].search([
|
||||
('name', '=', False),
|
||||
('user', '=', False),
|
||||
('bank', '=', False),
|
||||
])
|
||||
if invalid_bank_lines:
|
||||
invalid_bank_lines.unlink()
|
||||
|
||||
bank_ids = self.env['property.bank.statements'].search([('name', '=', self.bank_id.name),
|
||||
('your_own_unit', '=',
|
||||
self.bank_id.your_own_unit)])
|
||||
for bank_id in bank_ids:
|
||||
bank_id.write({
|
||||
'contract_ids': [(6, 0, self.bank_id.contract_ids.ids)],
|
||||
})
|
||||
|
||||
if bank_account:
|
||||
# 获取已存在的合同明细行的合同ID
|
||||
existing_contract_ids = bank_account.tenant_id.property_contract_ids.mapped('lease_contract_id.id')
|
||||
all_contracts = self.contract_ids | self.bank_id.contract_ids
|
||||
# 过滤出需要新增的合同(排除已存在的)
|
||||
new_contracts = all_contracts.filtered(lambda c: c.id not in existing_contract_ids)
|
||||
for contract in new_contracts:
|
||||
self.env['property.tenant.line'].sudo().create({
|
||||
'tenant_id': bank_account.tenant_id.id,
|
||||
'lease_contract_id': contract.id,
|
||||
})
|
||||
else:
|
||||
tenant = self.env['property.tenant.information'].create({
|
||||
'name': self.bank_id.name_account,
|
||||
})
|
||||
self.env['property.bank.line'].create({
|
||||
'bank': self.bank_id.name,
|
||||
'name': self.bank_id.bank_branch,
|
||||
'user': self.bank_id.name_account,
|
||||
if lines_to_delete:
|
||||
lines_to_delete.unlink()
|
||||
else:
|
||||
tenant = self.env['property.tenant.information'].create({
|
||||
'name': self.bank_id.name_account,
|
||||
})
|
||||
self.env['property.bank.line'].create({
|
||||
'bank': self.bank_id.name,
|
||||
'name': self.bank_id.bank_branch,
|
||||
'user': self.bank_id.name_account,
|
||||
'tenant_id': tenant.id,
|
||||
})
|
||||
existing_contract_ids = tenant.property_contract_ids.mapped('lease_contract_id.id')
|
||||
# 过滤出需要新增的合同(排除已存在的)
|
||||
new_contracts = self.contract_ids.filtered(lambda c: c.id not in existing_contract_ids)
|
||||
for contract in new_contracts:
|
||||
self.env['property.tenant.line'].sudo().create({
|
||||
'tenant_id': tenant.id,
|
||||
'lease_contract_id': contract.id,
|
||||
})
|
||||
existing_contract_ids = tenant.property_contract_ids.mapped('lease_contract_id.id')
|
||||
# 过滤出需要新增的合同(排除已存在的)
|
||||
new_contracts = self.contract_ids.filtered(lambda c: c.id not in existing_contract_ids)
|
||||
for contract in new_contracts:
|
||||
self.env['property.tenant.line'].sudo().create({
|
||||
'tenant_id': tenant.id,
|
||||
'lease_contract_id': contract.id,
|
||||
})
|
||||
|
||||
else:
|
||||
raise UserError('请先输入该户名银行账号,才能绑定')
|
||||
@@ -9,7 +9,7 @@
|
||||
<group>
|
||||
<field name="bank_id" invisible="1"/>
|
||||
<field name="lessee_ids" widget="many2many_tags" readonly="1"/>
|
||||
<field name="available_contract_ids" widget="many2many_tags" invisible="1"/>
|
||||
<field name="available_contract_ids" widget="many2many_tags"/>
|
||||
<field name="your_own_unit" invisible="1"/>
|
||||
<field name="property_ids" widget="many2many_tags" options="{'no_create': True}"/>
|
||||
<field name="contract_ids" widget="many2many_tags" domain="[('lessor_id.referred', '=', your_own_unit), ('is_split', '=', False), ('id', 'not in', available_contract_ids)]" options="{'no_create': True}"/>
|
||||
|
||||
@@ -43,7 +43,7 @@ class PropertyRentalWizard(models.Model):
|
||||
('contract_id', '=', record.id),
|
||||
('management_type_id.name', '=', '租金'),
|
||||
])
|
||||
if not receivable and record.term_start_time >= date(2025, 1, 1):
|
||||
if not receivable and record.term_start_time >= date(2025, 1, 1) and record.term_end_time:
|
||||
acc_type = 'new'
|
||||
else:
|
||||
acc_type = None
|
||||
|
||||
@@ -29,7 +29,6 @@ class YuthonTaskApproval(models.Model):
|
||||
duration = fields.Float(string="时长", store=True, compute='_compute_duration')
|
||||
concentration = fields.Float( string="浓度")
|
||||
warning_value = fields.Float(string="警戒值")
|
||||
is_outweigh_warning = fields.Boolean(string="是否大于警戒值")
|
||||
def _get_default_name_title(self):
|
||||
return self._description if self._description else self._name
|
||||
|
||||
|
||||
@@ -61,17 +61,13 @@
|
||||
<field name="duration" string=" " class="ms-2"
|
||||
style="max-width: 3rem !important;"/>小时
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
<field name="concentration"/>
|
||||
</group>
|
||||
<group>
|
||||
<label for="is_outweigh_warning"/>
|
||||
<label for="concentration"/>
|
||||
<div class="d-inline-flex w-100">
|
||||
<field name="is_outweigh_warning" string="是否大于:" class="me-2"
|
||||
style="max-width: 10rem !important;"/>警戒值
|
||||
<field name="concentration" class="me-2" style="max-width: 3rem !important;"/>< 警戒值
|
||||
<field name="warning_value" string=" " class="ms-2"
|
||||
style="max-width: 3rem !important;"/>值
|
||||
style="max-width: 3rem !important;"/>
|
||||
</div>
|
||||
</group>
|
||||
</sheet>
|
||||
|
||||
Reference in New Issue
Block a user