@@ -1230,7 +1230,10 @@ class PropertyManagementList(models.Model):
|
||||
theoretical_end = date(due_date_obj.year, due_date_obj.month, last_day)
|
||||
|
||||
if contract_actual_end:
|
||||
due_date_end = fields.Date.to_string(min(theoretical_end, contract_actual_end))
|
||||
if theoretical_end:
|
||||
due_date_end = fields.Date.to_string(min(theoretical_end, contract_actual_end))
|
||||
else:
|
||||
due_date_end = fields.Date.to_string(contract_actual_end)
|
||||
else:
|
||||
due_date_end = fields.Date.to_string(theoretical_end)
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ class PropertyLeaseContract(models.Model):
|
||||
)
|
||||
title_address = fields.Char(string="产权地址")
|
||||
receivable_ids = fields.One2many('property.accounts.receivable', 'contract_id', string="应收账单")
|
||||
receivable_report_ids = fields.Many2many('property.accounts.receivable', string="应收账单(报表)")
|
||||
payment_ids = fields.One2many('property.payment.notice', 'contract_id', string="合同打印")
|
||||
handling_opinions = fields.Text(string="经办意见")
|
||||
lessor_id = fields.Many2one('yuthon.property.company', string="出租方公司")
|
||||
|
||||
@@ -56,21 +56,19 @@ class PropertyLeaseRenewal(models.Model):
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
work_end = fields.Boolean(string="结束")
|
||||
|
||||
full_refund = fields.Boolean(string="全额退还", compute="_compute_full_refund")
|
||||
deposit = fields.Float(string="押金")
|
||||
is_full_refund = fields.Boolean(string="是否全额退押", default=True)
|
||||
refund_amount = fields.Float(string="退款金额")
|
||||
balance = fields.Float(string="余额")
|
||||
remake = fields.Text(string="备注")
|
||||
|
||||
receivables_ids = fields.One2many('early.receivables.line', 'renewal_id', string='应收明细')
|
||||
bills_record_id = fields.Many2one('property.bills.payable', string='应付账单流程')
|
||||
|
||||
@api.depends('receivables_ids.original_amount')
|
||||
def _compute_full_refund(self):
|
||||
for record in self:
|
||||
deposit_line = record.receivables_ids.filtered(
|
||||
lambda l: l.management_type_id.name == '押金'
|
||||
)[:1]
|
||||
if deposit_line:
|
||||
record.full_refund = deposit_line.original_amount
|
||||
else:
|
||||
record.full_refund = False
|
||||
@api.onchange('refund_amount')
|
||||
def _onchange_refund_amount(self):
|
||||
for rec in self:
|
||||
rec.balance = rec.deposit - rec.refund_amount
|
||||
|
||||
def end_approval(self):
|
||||
for rec in self:
|
||||
@@ -181,49 +179,72 @@ class PropertyLeaseRenewal(models.Model):
|
||||
'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)
|
||||
bills_line_list = []
|
||||
soong_workflow_line_list = []
|
||||
if refund_lines:
|
||||
bills_line_list = []
|
||||
soong_workflow_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
|
||||
|
||||
if rec.is_full_refund:
|
||||
deposit_management_type = self.env['yuthon.management.type'].search(
|
||||
[('name', '=', '押金')],
|
||||
limit=1
|
||||
)
|
||||
deposit_amount = rec.deposit if rec.is_full_refund else rec.refund_amount
|
||||
if deposit_amount > 0:
|
||||
bills_line_list.append((0, 0, {
|
||||
'due_date': fields.Date.today(),
|
||||
'management_type_id': deposit_management_type.id,
|
||||
'original_amount': deposit_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
|
||||
})
|
||||
|
||||
if not rec.is_full_refund:
|
||||
start_time = datetime.combine(rec.early_quitting_date, datetime.min.time().replace(hour=8, minute=00))
|
||||
self.env['property.bank.statements'].create({
|
||||
'start_time': start_time,
|
||||
'original_amount': rec.balance,
|
||||
'name_account': rec.new_lessee_id.name,
|
||||
'remake': f'合同为{rec.contract_id.contract_code}提前退押金',
|
||||
})
|
||||
workflow_record_id = self.env['soong.workflow.record'].search([
|
||||
('code', '=', self.code),
|
||||
])
|
||||
soong_workflow_line_list.append((0, 0, {
|
||||
'model': 'property.bills.payable',
|
||||
'res_id': bills_payable.id,
|
||||
'workflow_record_id': workflow_record_id.id
|
||||
}))
|
||||
self.bills_record_id = bills_payable.id
|
||||
bills_payable.soong_record_ids = soong_workflow_line_list
|
||||
|
||||
soong_record = self.env["soong.workflow.record"].search([("code", "=", bills_payable.code)])
|
||||
if soong_record:
|
||||
self.workflow_record_id = soong_record.id
|
||||
workflow_record_id = self.env['soong.workflow.record'].search([
|
||||
('code', '=', self.code),
|
||||
])
|
||||
soong_workflow_line_list.append((0, 0, {
|
||||
'model': 'property.bills.payable',
|
||||
'res_id': bills_payable.id,
|
||||
'workflow_record_id': workflow_record_id.id
|
||||
}))
|
||||
self.bills_record_id = bills_payable.id
|
||||
bills_payable.soong_record_ids = soong_workflow_line_list
|
||||
|
||||
# 原有作废/减免逻辑保留
|
||||
for receivable_id in rec.receivables_ids:
|
||||
if receivable_id.void:
|
||||
receivable_id.receivable_id.write({
|
||||
'is_void': True,
|
||||
'void_date': fields.Date.today()
|
||||
})
|
||||
if receivable_id.reduction_amount:
|
||||
receivable_id.receivable_id.reduction_amount = receivable_id.reduction_amount
|
||||
receivable_id.receivable_id.discount_date = fields.Date.today()
|
||||
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.Date.today()
|
||||
})
|
||||
if receivable_id.reduction_amount:
|
||||
receivable_id.receivable_id.reduction_amount = receivable_id.reduction_amount
|
||||
receivable_id.receivable_id.discount_date = fields.Date.today()
|
||||
|
||||
@api.onchange('early_quitting_date', 'contract_id')
|
||||
def _onchange_early_quitting_date(self):
|
||||
@@ -235,8 +256,19 @@ class PropertyLeaseRenewal(models.Model):
|
||||
('due_date', '<=', self.early_quitting_date),
|
||||
('contract_id', '=', self.contract_id.id),
|
||||
])
|
||||
receivable_list = []
|
||||
deposit_receivables = self.env['property.accounts.receivable']
|
||||
normal_receivables = self.env['property.accounts.receivable']
|
||||
for rec in receivable_ids:
|
||||
if rec.management_type_id and rec.management_type_id.name == '押金':
|
||||
deposit_receivables |= rec
|
||||
else:
|
||||
normal_receivables |= rec
|
||||
|
||||
if deposit_receivables:
|
||||
self.deposit = sum(rec.original_amount for rec in deposit_receivables)
|
||||
|
||||
receivable_list = []
|
||||
for rec in normal_receivables:
|
||||
receivable_list.append([0, 0, {
|
||||
'receivable_id': rec.id,
|
||||
}])
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
<template id="report_contract_accounts_receivable">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<t t-call="yuthon_property_approval.external_layout">
|
||||
<div class="page">
|
||||
<style>
|
||||
@@ -112,19 +113,19 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="receivable_lines" t-as="line">
|
||||
<t t-foreach="o.receivable_report_ids" t-as="line">
|
||||
<tr>
|
||||
<td class="text-start"><t t-esc="line"/></td>
|
||||
<!-- <td><t t-esc="line.last_month_table"/></td>-->
|
||||
<!-- <td><t t-esc="line.this_month_table"/></td>-->
|
||||
<!-- <td><t t-esc="line.ratio"/></td>-->
|
||||
<!-- <td><t t-esc="line.billable_quantity"/></td>-->
|
||||
<!-- <td><t t-esc="line.due_date"/></td>-->
|
||||
<!-- <td><t t-esc="line.due_date_end"/></td>-->
|
||||
<!-- <td><t t-esc="line.original_amount"/></td>-->
|
||||
<!-- <td><t t-esc="line.pre_collection"/></td>-->
|
||||
<!-- <td><t t-esc="line.actual_coping"/></td>-->
|
||||
<!-- <td><t t-esc="line.remark"/></td>-->
|
||||
<td><t t-esc="line.last_month_table"/></td>
|
||||
<td><t t-esc="line.this_month_table"/></td>
|
||||
<td><t t-esc="line.ratio"/></td>
|
||||
<td><t t-esc="line.billable_quantity"/></td>
|
||||
<td><t t-esc="line.due_date"/></td>
|
||||
<td><t t-esc="line.due_date_end"/></td>
|
||||
<td><t t-esc="line.original_amount"/></td>
|
||||
<td><t t-esc="line.pre_collection"/></td>
|
||||
<td><t t-esc="line.actual_coping"/></td>
|
||||
<td><t t-esc="line.remark"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
@@ -149,6 +150,7 @@
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -85,8 +85,12 @@
|
||||
<group>
|
||||
<field name="reason" invisible="renewal_type != 'lease'"/>
|
||||
<field name="effective_date" invisible="renewal_type != 'lease'"/>
|
||||
<field name="full_refund" invisible="early_reason != 'normal'"/>
|
||||
<field name="early_reason" invisible="renewal_type != 'early_checkout'"/>
|
||||
<field name="deposit" invisible="renewal_type != 'early_checkout'"/>
|
||||
<field name="is_full_refund" invisible="renewal_type != 'early_checkout'"/>
|
||||
<field name="refund_amount" invisible="is_full_refund"/>
|
||||
<field name="balance" invisible="is_full_refund"/>
|
||||
<field name="remake" invisible="is_full_refund"/>
|
||||
<field name="early_explain" invisible="renewal_type != 'early_checkout'"/>
|
||||
<field name="document_ids" widget="preview_many2many"/>
|
||||
</group>
|
||||
|
||||
@@ -19,6 +19,7 @@ class YuthonBusinessApproval(models.Model):
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
issues_result = fields.Html(string="会议结果")
|
||||
related_issues_id = fields.Many2one('issue.library', string="关联议题")
|
||||
information_categories_ids = fields.Many2many('yuthon.information.categories', string='信息分类')
|
||||
reason = fields.Text(string="正文")
|
||||
document_ids = fields.Many2many('ir.attachment', string="附件")
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<field name="work_end" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="users_id"/>
|
||||
<field name="information_categories_ids" widget="many2many_tags"/>
|
||||
<field name="reason"/>
|
||||
<field name="document_ids" widget="preview_many2many"/>
|
||||
<field name="department_id" invisible="1"/>
|
||||
|
||||
Reference in New Issue
Block a user