添加功能
This commit is contained in:
@@ -58,6 +58,7 @@ class PropertyLeaseRenewal(models.Model):
|
||||
deposit = fields.Float(string="押金")
|
||||
|
||||
receivables_ids = fields.One2many('early.receivables.line', 'renewal_id', string='应收明细')
|
||||
workflow_record_id = fields.Many2one('soong.workflow.record', string='应付账单流程')
|
||||
|
||||
@api.depends('receivables_ids.original_amount')
|
||||
def _compute_full_refund(self):
|
||||
@@ -100,9 +101,39 @@ class PropertyLeaseRenewal(models.Model):
|
||||
lessee_id.write({'property_contract_ids': property_contract_list})
|
||||
else:
|
||||
rec.contract_id.write({
|
||||
'actual_end_time': rec.early_quitting_date})
|
||||
rec.contract_id.get_property_contract_time()
|
||||
rec.hide = True
|
||||
'actual_end_time': rec.early_quitting_date
|
||||
})
|
||||
rec.contract_id.get_property_contract_time()
|
||||
rec.hide = True
|
||||
if rec.receivables_ids:
|
||||
refund_lines = rec.receivables_ids.filtered(lambda l: l.refund_amount > 0)
|
||||
if refund_lines:
|
||||
bills_line_list = []
|
||||
for refund_line in refund_lines:
|
||||
bills_line_list.append((0, 0, {
|
||||
'due_date': fields.Date.today(),
|
||||
'management_type_id': refund_line.management_type_id.id,
|
||||
'original_amount': refund_line.refund_amount,
|
||||
}))
|
||||
bills_payable = self.env['property.bills.payable'].create({
|
||||
'lease_contract_id': rec.contract_id.id,
|
||||
'name': f'{rec.contract_id.contract_code}退金额申请',
|
||||
'create_uid': self.env.uid,
|
||||
'bills_line_ids': bills_line_list
|
||||
})
|
||||
soong_record = self.env["soong.workflow.record"].search([("code", "=", bills_payable.code)])
|
||||
if soong_record:
|
||||
self.workflow_record_id = soong_record.id
|
||||
|
||||
# 原有作废/减免逻辑保留
|
||||
for receivable_id in rec.receivables_ids:
|
||||
if receivable_id.void:
|
||||
receivable_id.receivable_id.write({
|
||||
'is_void': True,
|
||||
'void_date': fields.Datetime.now()
|
||||
})
|
||||
if receivable_id.reduction_amount:
|
||||
receivable_id.receivable_id.reduction_amount = receivable_id.reduction_amount
|
||||
|
||||
@api.onchange('early_quitting_date', 'contract_id')
|
||||
def _onchange_early_quitting_date(self):
|
||||
@@ -119,7 +150,7 @@ class PropertyLeaseRenewal(models.Model):
|
||||
receivable_list.append([0, 0, {
|
||||
'receivable_id': rec.id,
|
||||
}])
|
||||
self.receivables_ids = receivable_list
|
||||
self.receivables_ids = receivable_list
|
||||
|
||||
@api.onchange('contract_id', 'renewal_type')
|
||||
def _onchange_name(self):
|
||||
@@ -142,6 +173,10 @@ class EarlyReceivablesLine(models.Model):
|
||||
renewal_id = fields.Many2one('property.lease.renewal', string='关联续租审批')
|
||||
receivable_id = fields.Many2one('property.accounts.receivable', string='应收账单')
|
||||
management_type_id = fields.Many2one(related='receivable_id.management_type_id', string='类型')
|
||||
is_reconciliation = fields.Boolean(related='receivable_id.is_reconciliation', string='对账')
|
||||
due_date = fields.Date(related='receivable_id.due_date', string='应收日期')
|
||||
original_amount = fields.Float(related='receivable_id.original_amount', string='金额')
|
||||
void = fields.Boolean(string='作废', default=False)
|
||||
reduction_amount = fields.Float(string='减免金额')
|
||||
refund_amount = fields.Float(string='退款金额')
|
||||
void = fields.Boolean(string='作废', default=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user