!4780 添加功能

Merge pull request !4780 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-08-27 06:52:33 +00:00
committed by Gitee
2 changed files with 5 additions and 27 deletions
@@ -52,7 +52,7 @@ class PropertyLeaseContract(models.Model):
property_name = fields.Char(string='物业信息')
code = fields.Char(string="流水号", default=lambda self: self.env['ir.sequence'].next_by_code('property_lease_contract_code'))
admin_id = fields.Many2one('res.users', string="管理员", compute='_compute_admin_id', store=True)
admin_id = fields.Many2one('res.users', string="管理员", compute="_compute_lease_ids", store=True)
tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型')
contract_code = fields.Char(string="合同编号")
contract_date = fields.Date(string="合同签订日期")
@@ -68,8 +68,8 @@ class PropertyLeaseContract(models.Model):
lessor_id = fields.Many2one('yuthon.property.company', string="出租方公司")
rent_company = fields.Char(related='lessor_id.name', string="收租公司名称")
rent_account = fields.Char(related='lessor_id.rent_account', string="收租公司账号")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one('hr.department', string="部门", store=True, compute='_compute_department_id')
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user)
department_id = fields.Many2one('hr.department', string="部门", store=True, compute='_compute_lease_ids')
company_id = fields.Many2one(related='users_id.employee_id.company_id', string="公司")
# 承租方的个人信息
lessee_id = fields.Many2one('property.tenant.information', string='承租方')
@@ -220,11 +220,6 @@ class PropertyLeaseContract(models.Model):
reconciliation_count = fields.Integer(string="对账数量", compute='_compute_reconciliation_count')
process_count = fields.Integer(string="流程数量", compute='_compute_process_count')
@api.depends('users_id')
def _compute_department_id(self):
for record in self:
record.department_id = record.users_id.employee_ids.department_id.id
def _compute_contract_count(self):
for record in self:
record.contract_count = self.env['property.accounts.receivable'].search_count([('contract_id', '=', record.id)])
@@ -335,7 +330,8 @@ class PropertyLeaseContract(models.Model):
if electricity_fee_values:
rec.electricity_fee_ids = electricity_fee_values
rec.admin_id = rec.lease_ids[0].admin_line_id.id
rec.users_id = rec.lease_ids[0].admin_line_id.id
# rec.users_id = rec.lease_ids[0].admin_line_id.id
rec.department_id = rec.lease_ids[0].admin_line_id.employee_ids.department_id.id
@api.depends(
@@ -1221,11 +1217,6 @@ class PropertyLeaseContract(models.Model):
'property_name': ','.join(lease_name) if lease_name else ''
})
def action_update_contract(self):
contract_ids = self.env["property.lease.contract"].browse(self._context.get('active_ids', self._context.get('active_id')))
for record in contract_ids:
record._compute_department_id()
@api.constrains("contract_code")
def _check_contract_code(self):
"""检查合同编号的唯一性(不区分中英文括号)"""
@@ -1452,12 +1443,6 @@ class PropertyLeaseContract(models.Model):
self.address_for_delivery = self.property_name
self.use_address = self.property_name
@api.depends("lease_ids")
def _compute_admin_id(self):
for record in self:
if record.lease_ids:
record.admin_id = record.lease_ids[0].admin_line_id.id
@api.onchange("admin_id")
def _onchange_admin_id(self):
if self.admin_id:
@@ -925,13 +925,6 @@
<field name="state">code</field>
<field name="code">action = model.disposable_button()</field>
</record>
<record id="all_data_action_update_state" model="ir.actions.server">
<field name="name">更新状态</field>
<field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
<field name="binding_model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
<field name="state">code</field>
<field name="code">action = model.action_update_contract()</field>
</record>
<!-- <record id="all_data_action_update_rent" model="ir.actions.server">-->
<!-- <field name="name">更新租金明细</field>-->
<!-- <field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>-->