添加功能
This commit is contained in:
@@ -8,4 +8,36 @@
|
||||
<field name="padding">3</field>
|
||||
<field name="company_id" eval="False"/>
|
||||
</record>
|
||||
|
||||
<!-- 退租检查项字典:工程组检查的默认 7 项(noupdate=1,用户后续可自行增删改) -->
|
||||
<data noupdate="1">
|
||||
<record id="checkout_inspection_item_aircon" model="property.checkout.inspection.item">
|
||||
<field name="name">空调机</field>
|
||||
<field name="sequence">10</field>
|
||||
</record>
|
||||
<record id="checkout_inspection_item_waterpipe" model="property.checkout.inspection.item">
|
||||
<field name="name">水管</field>
|
||||
<field name="sequence">20</field>
|
||||
</record>
|
||||
<record id="checkout_inspection_item_light" model="property.checkout.inspection.item">
|
||||
<field name="name">光管(照明)</field>
|
||||
<field name="sequence">30</field>
|
||||
</record>
|
||||
<record id="checkout_inspection_item_decoration" model="property.checkout.inspection.item">
|
||||
<field name="name">室内装修</field>
|
||||
<field name="sequence">40</field>
|
||||
</record>
|
||||
<record id="checkout_inspection_item_other_equipment" model="property.checkout.inspection.item">
|
||||
<field name="name">其它设备</field>
|
||||
<field name="sequence">50</field>
|
||||
</record>
|
||||
<record id="checkout_inspection_item_keys" model="property.checkout.inspection.item">
|
||||
<field name="name">收回钥匙</field>
|
||||
<field name="sequence">60</field>
|
||||
</record>
|
||||
<record id="checkout_inspection_item_electric_meter" model="property.checkout.inspection.item">
|
||||
<field name="name">电表</field>
|
||||
<field name="sequence">70</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -72,7 +72,7 @@ class PropertyTenantCheckout(models.Model):
|
||||
|
||||
# ===== 节点四:费用结算与复核 =====
|
||||
fee_ids = fields.One2many('property.tenant.checkout.fee', 'checkout_id', string='应收费用明细') # 应收费用明细
|
||||
total_fee = fields.Float(string='应收合计', compute='_compute_total_fee', store=True) # 应收费用合计(自动求和)
|
||||
total_fee = fields.Float(string='应收合计', compute='_compute_total_fee', store=True) # 应收明细(未对账且未作废)金额-减免-退款合计
|
||||
deposit_treatment = fields.Selection([
|
||||
('refund', '全额退押'), ('part_refund', '部分退租'), ('no_refund', '全额没收')
|
||||
], string='保证金处理方式') # 保证金处理方式(与租赁变更审批·合同终止逻辑一致)
|
||||
@@ -91,11 +91,42 @@ class PropertyTenantCheckout(models.Model):
|
||||
total_receivables = fields.Float(string='应收金额', compute='_compute_total_receivables', store=True) # 应收金额(部分退押时汇总)
|
||||
receivables_ids = fields.One2many('early.receivables.line', 'checkout_id', string='应收明细') # 截至退租日的应收账单(可作废/减免/退款)
|
||||
|
||||
@api.depends('fee_ids', 'fee_ids.amount')
|
||||
# ===== 工程组检查项:默认带出字典中的检查项 =====
|
||||
def _default_inspection_lines(self):
|
||||
"""按检查项字典(有效项、按序号)生成明细行命令,供 default_get / create 自动带出"""
|
||||
items = self.env['property.checkout.inspection.item'].search([('active', '=', True)])
|
||||
return [(0, 0, {
|
||||
'item_id': item.id,
|
||||
'sequence': item.sequence,
|
||||
'status': 'normal',
|
||||
}) for item in items]
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields_list):
|
||||
"""新建表单时即带出检查项默认行(未保存也可在表单上看到)"""
|
||||
res = super().default_get(fields_list)
|
||||
if 'inspection_ids' in fields_list and not res.get('inspection_ids'):
|
||||
res['inspection_ids'] = self._default_inspection_lines()
|
||||
return res
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
"""程序化创建(如合同列表点「退租」发起)时,自动补齐检查项默认行"""
|
||||
for vals in vals_list:
|
||||
if 'inspection_ids' not in vals:
|
||||
vals['inspection_ids'] = self._default_inspection_lines()
|
||||
return super().create(vals_list)
|
||||
|
||||
@api.depends('receivables_ids', 'receivables_ids.original_amount', 'receivables_ids.reduction_amount',
|
||||
'receivables_ids.refund_amount', 'receivables_ids.void', 'receivables_ids.is_reconciliation')
|
||||
def _compute_total_fee(self):
|
||||
"""应收合计 = 所有费用明细金额之和"""
|
||||
"""应收合计 = 应收明细中「未对账且未作废」的(金额 - 减免金额 - 退款金额)之和"""
|
||||
for rec in self:
|
||||
rec.total_fee = sum(line.amount for line in rec.fee_ids)
|
||||
rec.total_fee = sum(
|
||||
line.original_amount - line.reduction_amount - line.refund_amount
|
||||
for line in rec.receivables_ids
|
||||
if not line.void and not line.is_reconciliation
|
||||
)
|
||||
|
||||
@api.onchange('tenant_signature')
|
||||
def _onchange_tenant_signature(self):
|
||||
|
||||
@@ -4,6 +4,17 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class PropertyCheckoutInspectionItem(models.Model):
|
||||
"""退租检查项字典(物业检查项明细行的「检查项」many2one 来源)"""
|
||||
_name = 'property.checkout.inspection.item'
|
||||
_description = '退租检查项'
|
||||
_order = 'sequence, id'
|
||||
|
||||
name = fields.Char(string='检查项名称', required=True)
|
||||
sequence = fields.Integer(string='序号', default=10)
|
||||
active = fields.Boolean(string='有效', default=True)
|
||||
|
||||
|
||||
class PropertyTenantCheckoutInspection(models.Model):
|
||||
"""租户退租表-物业检查项(工程组检查阶段的可增删明细行)"""
|
||||
_name = 'property.tenant.checkout.inspection'
|
||||
@@ -12,7 +23,8 @@ class PropertyTenantCheckoutInspection(models.Model):
|
||||
|
||||
checkout_id = fields.Many2one('property.tenant.checkout', string='退租表', ondelete='cascade') # 关联退租表
|
||||
sequence = fields.Integer(string='序号', default=10) # 排序
|
||||
item = fields.Char(string='检查项') # 检查项名称
|
||||
item_id = fields.Many2one('property.checkout.inspection.item', string='检查项') # 检查项(字典)
|
||||
item_name = fields.Char(related='item_id.name', string='检查项名称') # 冗余名称(报表展示用)
|
||||
status = fields.Selection([('normal', '正常'), ('abnormal', '异常')], string='状态', default='normal') # 正常/异常
|
||||
note = fields.Text(string='批注') # 批注说明
|
||||
repair_fee = fields.Float(string='维修费') # 维修费金额
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
</tr>
|
||||
<t t-foreach="doc.inspection_ids" t-as="line">
|
||||
<tr>
|
||||
<td class="text-left"><span t-esc="line.item or ''"/></td>
|
||||
<td class="text-left"><span t-esc="line.item_name or ''"/></td>
|
||||
<td class="text-left"><span t-esc="line.status or ''"/></td>
|
||||
<td class="text-left"><span t-esc="line.note or ''"/></td>
|
||||
<td class="text-left"><span t-esc="line.repair_fee or 0"/></td>
|
||||
|
||||
@@ -150,3 +150,4 @@ access_property_tenant_checkout,property_tenant_checkout,model_property_tenant_c
|
||||
access_property_tenant_checkout_inspection,property_tenant_checkout_inspection,model_property_tenant_checkout_inspection,base.group_user,1,1,1,1
|
||||
access_property_tenant_checkout_fee,property_tenant_checkout_fee,model_property_tenant_checkout_fee,base.group_user,1,1,1,1
|
||||
access_property_accounts_receivable_summary,property_accounts_receivable_summary,model_property_accounts_receivable_summary,base.group_user,1,0,0,0
|
||||
access_property_checkout_inspection_item,property_checkout_inspection_item,model_property_checkout_inspection_item,base.group_user,1,1,1,1
|
||||
|
||||
|
@@ -77,16 +77,9 @@
|
||||
<field name="user_id" string="申请人" required="1"/>
|
||||
<field name="contract_id" options="{'no_create': True}" required="1"/>
|
||||
<!-- 退租原因(兼合同办理方式):驱动终止逻辑与表单显隐 -->
|
||||
<field name="early_reason" required="1" widget="radio"/>
|
||||
<field name="early_reason" required="1"/>
|
||||
<!-- 退租日期:退租截止日期与退租日期统一使用此字段,所有退租原因均显示 -->
|
||||
<field name="early_quitting_date" required="1"/>
|
||||
<!-- 押金及费用结算:紧跟退租日期,仅「协商一致」退租显示 -->
|
||||
<field name="total_fee" readonly="1" invisible="early_reason != 'agree'"/>
|
||||
<field name="deposit_treatment" invisible="early_reason != 'agree'"/>
|
||||
<field name="deposit" readonly="1" invisible="early_reason != 'agree'"/>
|
||||
<field name="refund_amount" invisible="early_reason != 'agree' or deposit_treatment != 'part_refund'"/>
|
||||
<field name="forfeit" readonly="1" invisible="early_reason != 'agree' or deposit_treatment != 'part_refund'"/>
|
||||
<field name="total_receivables" readonly="1" invisible="early_reason != 'agree' or deposit_treatment != 'part_refund'"/>
|
||||
<!-- 退租说明:进入终止/押金处理逻辑 -->
|
||||
<field name="early_explain" widget="text"/>
|
||||
<!-- 其它(补充说明) -->
|
||||
@@ -94,85 +87,45 @@
|
||||
</group>
|
||||
</group>
|
||||
|
||||
|
||||
<!-- 应收明细(仅「协商一致」且已填退租日期时显示) -->
|
||||
<div invisible="early_reason != 'agree' or not early_quitting_date">
|
||||
<notebook>
|
||||
<page string="应收明细">
|
||||
<field name="receivables_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="checkout_id" column_invisible="1"/>
|
||||
<field name="receivable_id" column_invisible="1"/>
|
||||
<field name="management_type_id"/>
|
||||
<field name="due_date"/>
|
||||
<field name="original_amount"/>
|
||||
<field name="reduction_amount"/>
|
||||
<field name="refund_amount"/>
|
||||
<field name="is_reconciliation"/>
|
||||
<field name="void"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</div>
|
||||
<!-- 押金及费用结算:申请人/片区管理员/财务管理员三节点显示,仅「协商一致」退租 -->
|
||||
<group invisible="early_reason != 'agree' or state not in ['申请人', '片区管理员', '财务管理员']" col="1">
|
||||
<group>
|
||||
<field name="total_fee" readonly="1"/>
|
||||
<field name="deposit_treatment"/>
|
||||
<field name="deposit" readonly="1"/>
|
||||
<field name="refund_amount" invisible="deposit_treatment != 'part_refund'"/>
|
||||
<field name="forfeit" readonly="1" invisible="deposit_treatment != 'part_refund'"/>
|
||||
<field name="total_receivables" readonly="1" invisible="deposit_treatment != 'part_refund'"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<!-- ===== 节点二:工程组(工程组检查 + 租户签字,同一节点)===== -->
|
||||
<group string="工程组检查与确认" invisible="state not in ['工程组']" col="1">
|
||||
<group string="工程组检查与确认" invisible="state not in ['工程组', '片区管理员']" col="1">
|
||||
<group>
|
||||
<field name="inspection_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="item"/>
|
||||
<field name="item_id"/>
|
||||
<field name="status"/>
|
||||
<field name="note"/>
|
||||
<field name="repair_fee"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="site_photo" widget="many2many_binary"/>
|
||||
<field name="handler"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="engineering_sign" widget="signature" options="{'full_name': 'tenant_unit'}"/>
|
||||
</group>
|
||||
<field name="site_photo" widget="many2many_binary"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<!-- ===== 节点二附加:租户签字确认(与「工程组」同一节点,故条件同为工程组)===== -->
|
||||
<group string="租户签字确认" invisible="state not in ['工程组']" col="2">
|
||||
<group string="租户签字确认" invisible="state not in ['工程组', '片区管理员']" col="2">
|
||||
<group>
|
||||
<field name="result_summary" widget="text"/>
|
||||
<field name="tenant_signature" widget="signature" options="{'full_name': 'tenant_unit'}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="signer_name"/>
|
||||
<field name="tenant_sign_date" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<!-- ===== 节点三:片区管理员(费用明细与结算签字)===== -->
|
||||
<!-- 押金/退押相关字段已前移至「押金及费用结算」区块(仅协商一致显示),此处保留费用明细与签字 -->
|
||||
<group string="费用结算与复核" invisible="state not in ['片区管理员']" col="1">
|
||||
<group>
|
||||
<field name="fee_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="item"/>
|
||||
<field name="amount"/>
|
||||
<field name="period"/>
|
||||
<field name="remark"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="settlement_sign" widget="signature" options="{'full_name': 'tenant_unit'}"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<!-- ===== 节点四:财务管理员 ===== -->
|
||||
<group string="财务处理" invisible="state not in ['财务管理员']" col="1">
|
||||
<group>
|
||||
@@ -203,6 +156,25 @@
|
||||
<group>
|
||||
<field name="document_ids" widget="preview_many2many"/>
|
||||
</group>
|
||||
|
||||
<!-- 应收明细(notebook 页签):仅「协商一致」且已填退租日期时显示;工程组不可见,申请人/片区管理员/财务管理员可见 -->
|
||||
<notebook invisible="early_reason != 'agree' or not early_quitting_date or state == '工程组'">
|
||||
<page string="应收明细">
|
||||
<field name="receivables_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="checkout_id" column_invisible="1"/>
|
||||
<field name="receivable_id" column_invisible="1"/>
|
||||
<field name="management_type_id"/>
|
||||
<field name="due_date"/>
|
||||
<field name="original_amount"/>
|
||||
<field name="reduction_amount"/>
|
||||
<field name="refund_amount"/>
|
||||
<field name="is_reconciliation"/>
|
||||
<field name="void"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -251,16 +251,16 @@
|
||||
action="action_receivable_type_deposit"
|
||||
sequence="6"/>
|
||||
|
||||
<!-- ========== 7. 广告灯箱费 ========== -->
|
||||
<record id="action_receivable_type_advertising_lightbox_fee" model="ir.actions.act_window">
|
||||
<!-- ========== 7. 灯箱 ========== -->
|
||||
<record id="action_receivable_type_lightbox" model="ir.actions.act_window">
|
||||
<!-- 动作名称 -->
|
||||
<field name="name">广告灯箱费</field>
|
||||
<field name="name">灯箱</field>
|
||||
<!-- 模型:应收账单 -->
|
||||
<field name="res_model">property.accounts.receivable</field>
|
||||
<!-- 视图模式:仅列表 -->
|
||||
<field name="view_mode">tree</field>
|
||||
<!-- 只显示应收类型=广告灯箱费的记录 -->
|
||||
<field name="domain">[('management_type_id.name', '=', '广告灯箱费')]</field>
|
||||
<!-- 只显示应收类型=灯箱的记录 -->
|
||||
<field name="domain">[('management_type_id.name', '=', '灯箱')]</field>
|
||||
<!-- 不设默认分组(无 group_by);按应收开始 due_date 倒序;searchpanel 默认选中「未收」 -->
|
||||
<field name="context">{'orderedBy': [{'name': 'due_date', 'asc': False}], 'searchpanel_default_deposit_state': 'unpaid'}</field>
|
||||
<!-- 使用本模块专用的搜索视图(含 searchpanel) -->
|
||||
@@ -268,26 +268,26 @@
|
||||
<!-- 复用本模块「隐藏应收类型列」的列表视图(类型专属菜单不需要再显示应收类型列) -->
|
||||
<field name="view_id" ref="yuthon_work_brand.view_receivable_type_tree_no_type"/>
|
||||
</record>
|
||||
<menuitem id="menu_receivable_type_advertising_lightbox_fee"
|
||||
name="广告灯箱费"
|
||||
<menuitem id="menu_receivable_type_lightbox"
|
||||
name="灯箱"
|
||||
parent="yuthon_accounts_receivable_menu"
|
||||
action="action_receivable_type_advertising_lightbox_fee"
|
||||
action="action_receivable_type_lightbox"
|
||||
sequence="7"/>
|
||||
|
||||
<!-- ========== 8. 其它(汇总其余 9 个应收类型) ========== -->
|
||||
<!-- ========== 8. 其他(广告灯箱费并入,汇总其余 9 个应收类型) ========== -->
|
||||
<!--
|
||||
「其它」= 有偿服务收入 / 停车费 / 灯箱 / 管子间 / 更名费 / 维修费 / 其他费用 / 评估费 / 保险费
|
||||
「其他」= 广告灯箱费 / 有偿服务收入 / 停车费 / 管子间 / 更名费 / 维修费 / 其他费用 / 评估费 / 保险费
|
||||
这 9 类原来各自独立菜单,现合并到本菜单;domain 用 management_type_id.name in [...] 一次取全
|
||||
-->
|
||||
<record id="action_receivable_type_others" model="ir.actions.act_window">
|
||||
<!-- 动作名称 -->
|
||||
<field name="name">其它</field>
|
||||
<field name="name">其他</field>
|
||||
<!-- 模型:应收账单 -->
|
||||
<field name="res_model">property.accounts.receivable</field>
|
||||
<!-- 视图模式:仅列表 -->
|
||||
<field name="view_mode">tree</field>
|
||||
<!-- 汇总其余 9 个应收类型的记录 -->
|
||||
<field name="domain">[('management_type_id.name', 'in', ['有偿服务收入', '停车费', '灯箱', '管子间', '更名费', '维修费', '其他费用', '评估费', '保险费'])]</field>
|
||||
<field name="domain">[('management_type_id.name', 'in', ['广告灯箱费', '有偿服务收入', '停车费', '管子间', '更名费', '维修费', '其他费用', '评估费', '保险费'])]</field>
|
||||
<!-- 按「应收类型」分组显示;按应收开始 due_date 倒序;searchpanel 默认选中「未收」 -->
|
||||
<field name="context">{'group_by': 'management_type_id', 'orderedBy': [{'name': 'due_date', 'asc': False}], 'searchpanel_default_deposit_state': 'unpaid'}</field>
|
||||
<!-- 使用本模块专用的搜索视图(含 searchpanel) -->
|
||||
@@ -296,7 +296,7 @@
|
||||
<field name="view_id" ref="yuthon_property.view_property_accounts_receivable_tree"/>
|
||||
</record>
|
||||
<menuitem id="menu_receivable_type_others"
|
||||
name="其它"
|
||||
name="其他"
|
||||
parent="yuthon_accounts_receivable_menu"
|
||||
action="action_receivable_type_others"
|
||||
sequence="8"/>
|
||||
@@ -310,7 +310,7 @@
|
||||
-->
|
||||
<delete model="ir.ui.menu" id="menu_receivable_type_service_income"/>
|
||||
<delete model="ir.ui.menu" id="menu_receivable_type_parking_fee"/>
|
||||
<delete model="ir.ui.menu" id="menu_receivable_type_lightbox"/>
|
||||
<!-- 注意:menu_receivable_type_lightbox / action_receivable_type_lightbox 现已重新启用为「灯箱」菜单,不要再 delete -->
|
||||
<delete model="ir.ui.menu" id="menu_receivable_type_pipe_room"/>
|
||||
<delete model="ir.ui.menu" id="menu_receivable_type_rename_fee"/>
|
||||
<delete model="ir.ui.menu" id="menu_receivable_type_repair_fee"/>
|
||||
@@ -319,13 +319,15 @@
|
||||
<delete model="ir.ui.menu" id="menu_receivable_type_insurance_fee"/>
|
||||
<delete model="ir.actions.act_window" id="action_receivable_type_service_income"/>
|
||||
<delete model="ir.actions.act_window" id="action_receivable_type_parking_fee"/>
|
||||
<delete model="ir.actions.act_window" id="action_receivable_type_lightbox"/>
|
||||
<delete model="ir.actions.act_window" id="action_receivable_type_pipe_room"/>
|
||||
<delete model="ir.actions.act_window" id="action_receivable_type_rename_fee"/>
|
||||
<delete model="ir.actions.act_window" id="action_receivable_type_repair_fee"/>
|
||||
<delete model="ir.actions.act_window" id="action_receivable_type_other_fee"/>
|
||||
<delete model="ir.actions.act_window" id="action_receivable_type_appraisal_fee"/>
|
||||
<delete model="ir.actions.act_window" id="action_receivable_type_insurance_fee"/>
|
||||
<!-- 旧「广告灯箱费」菜单/动作:已改为「灯箱」独立菜单 + 并入「其他」,清理旧记录 -->
|
||||
<delete model="ir.ui.menu" id="menu_receivable_type_advertising_lightbox_fee"/>
|
||||
<delete model="ir.actions.act_window" id="action_receivable_type_advertising_lightbox_fee"/>
|
||||
|
||||
<!--
|
||||
============================================================
|
||||
|
||||
Reference in New Issue
Block a user