!9682 Merge branch 'dev' of <a href="https://gitee.com/jinan-pengyusen-data/gzth">https://gitee.com/jinan-pengyusen-data/gzth</a> into dev_wang
Merge pull request !9682 from 李鹏宇/dev_wang
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
'views/penalty_arrears_report.xml',
|
||||
'views/penalty_month_received_report.xml',
|
||||
'views/penalty_year_cum_report.xml',
|
||||
'views/deposit_reports.xml',
|
||||
'views/menu.xml',
|
||||
'views/ledger_report_views.xml',
|
||||
'views/receivable_report_views.xml',
|
||||
|
||||
@@ -37,4 +37,7 @@ from . import pre_arrears_report
|
||||
from . import pre_advance_report
|
||||
from . import penalty_arrears_report
|
||||
from . import penalty_month_received_report
|
||||
from . import penalty_year_cum_report
|
||||
from . import penalty_year_cum_report
|
||||
from . import deposit_month_receivable_report
|
||||
from . import deposit_pre_received_report
|
||||
from . import deposit_month_received_report
|
||||
@@ -0,0 +1,87 @@
|
||||
import datetime
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class DepositMonthReceivableReport(models.Model):
|
||||
_inherit = 'property.accounts.receivable'
|
||||
|
||||
@api.model
|
||||
def get_deposit_month_receivable_report(self, params):
|
||||
"""
|
||||
押金本月应收报表:
|
||||
- 管理费用类型为"押金"
|
||||
- due_date 在本月范围内
|
||||
- is_invalid = False
|
||||
- 每条记录单独一行,金额 = original_amount
|
||||
"""
|
||||
today = datetime.date.today()
|
||||
this_month_first = today.replace(day=1)
|
||||
if today.month == 12:
|
||||
next_month_first = today.replace(year=today.year + 1, month=1, day=1)
|
||||
else:
|
||||
next_month_first = today.replace(month=today.month + 1, day=1)
|
||||
this_month_last = next_month_first - datetime.timedelta(days=1)
|
||||
|
||||
deposit_type = self.env['yuthon.management.type'].search([('name', '=', '押金')], limit=1)
|
||||
|
||||
domain = [
|
||||
('due_date', '>=', this_month_first),
|
||||
('due_date', '<=', this_month_last),
|
||||
('is_invalid', '=', False),
|
||||
]
|
||||
if deposit_type:
|
||||
domain.append(('management_type_id', '=', deposit_type.id))
|
||||
|
||||
keyword = params.get("keyword")
|
||||
if keyword:
|
||||
domain += ['|', '|',
|
||||
('contract_id.contract_code', 'ilike', keyword),
|
||||
('property_name', 'ilike', keyword),
|
||||
('lessee_id.name', 'ilike', keyword),
|
||||
]
|
||||
|
||||
condition = params.get('condition')
|
||||
partner_id = params.get('partner_id')
|
||||
company_id = params.get('company_id')
|
||||
if condition:
|
||||
domain.append(('tenure_type', '=', condition))
|
||||
if partner_id:
|
||||
domain.append(('precinct_id', '=', partner_id))
|
||||
if company_id:
|
||||
domain.append(('company_id', '=', company_id))
|
||||
|
||||
receivables = self.search(domain, order="contract_id asc, due_date asc")
|
||||
|
||||
rows = []
|
||||
total_amount = 0.0
|
||||
for idx, rec in enumerate(receivables, start=1):
|
||||
amount = round(rec.original_amount or 0.0, 2)
|
||||
total_amount += amount
|
||||
rows.append({
|
||||
"序号": idx,
|
||||
"合同编号": {
|
||||
'model': 'property.lease.contract',
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
'display_name': rec.lessee_id.name,
|
||||
} if rec.lessee_id else "",
|
||||
"金额": amount,
|
||||
"所属公司": rec.company_id.name if rec.company_id else "",
|
||||
"管理员": {
|
||||
'model': 'res.users',
|
||||
'id': rec.admin_id.id,
|
||||
'display_name': rec.admin_id.name,
|
||||
} if rec.admin_id else "",
|
||||
})
|
||||
|
||||
stats = [
|
||||
{'name': '记录总数', 'amount': len(rows)},
|
||||
{'name': '合计金额', 'amount': round(total_amount, 2)},
|
||||
]
|
||||
return {"rows": rows, "stats": stats}
|
||||
@@ -0,0 +1,87 @@
|
||||
import datetime
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class DepositMonthReceivedReport(models.Model):
|
||||
_inherit = 'property.accounts.receivable'
|
||||
|
||||
@api.model
|
||||
def get_deposit_month_received_report(self, params):
|
||||
"""
|
||||
押金本月实收报表:
|
||||
- 管理费用类型为"押金"
|
||||
- payout_date 在本月范围内(本月有收款)
|
||||
- is_invalid = False
|
||||
- 每条记录单独一行,金额 = delivered1
|
||||
"""
|
||||
today = datetime.date.today()
|
||||
this_month_first = today.replace(day=1)
|
||||
if today.month == 12:
|
||||
next_month_first = today.replace(year=today.year + 1, month=1, day=1)
|
||||
else:
|
||||
next_month_first = today.replace(month=today.month + 1, day=1)
|
||||
this_month_last = next_month_first - datetime.timedelta(days=1)
|
||||
|
||||
deposit_type = self.env['yuthon.management.type'].search([('name', '=', '押金')], limit=1)
|
||||
|
||||
domain = [
|
||||
('payout_date', '>=', this_month_first),
|
||||
('payout_date', '<=', this_month_last),
|
||||
('is_invalid', '=', False),
|
||||
]
|
||||
if deposit_type:
|
||||
domain.append(('management_type_id', '=', deposit_type.id))
|
||||
|
||||
keyword = params.get("keyword")
|
||||
if keyword:
|
||||
domain += ['|', '|',
|
||||
('contract_id.contract_code', 'ilike', keyword),
|
||||
('property_name', 'ilike', keyword),
|
||||
('lessee_id.name', 'ilike', keyword),
|
||||
]
|
||||
|
||||
condition = params.get('condition')
|
||||
partner_id = params.get('partner_id')
|
||||
company_id = params.get('company_id')
|
||||
if condition:
|
||||
domain.append(('tenure_type', '=', condition))
|
||||
if partner_id:
|
||||
domain.append(('precinct_id', '=', partner_id))
|
||||
if company_id:
|
||||
domain.append(('company_id', '=', company_id))
|
||||
|
||||
receivables = self.search(domain, order="contract_id asc, due_date asc")
|
||||
|
||||
rows = []
|
||||
total_amount = 0.0
|
||||
for idx, rec in enumerate(receivables, start=1):
|
||||
amount = round(rec.delivered1 or 0.0, 2)
|
||||
total_amount += amount
|
||||
rows.append({
|
||||
"序号": idx,
|
||||
"合同编号": {
|
||||
'model': 'property.lease.contract',
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
'display_name': rec.lessee_id.name,
|
||||
} if rec.lessee_id else "",
|
||||
"金额": amount,
|
||||
"所属公司": rec.company_id.name if rec.company_id else "",
|
||||
"管理员": {
|
||||
'model': 'res.users',
|
||||
'id': rec.admin_id.id,
|
||||
'display_name': rec.admin_id.name,
|
||||
} if rec.admin_id else "",
|
||||
})
|
||||
|
||||
stats = [
|
||||
{'name': '记录总数', 'amount': len(rows)},
|
||||
{'name': '合计金额', 'amount': round(total_amount, 2)},
|
||||
]
|
||||
return {"rows": rows, "stats": stats}
|
||||
@@ -0,0 +1,83 @@
|
||||
import datetime
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class DepositPreReceivedReport(models.Model):
|
||||
_inherit = 'property.accounts.receivable'
|
||||
|
||||
@api.model
|
||||
def get_deposit_pre_received_report(self, params):
|
||||
"""
|
||||
押金前期实收报表:
|
||||
- 管理费用类型为"押金"
|
||||
- due_date < 本月第一天(前期账单)
|
||||
- delivered1 > 0(有实收记录)
|
||||
- is_invalid = False
|
||||
- 每条记录单独一行,金额 = delivered1
|
||||
"""
|
||||
today = datetime.date.today()
|
||||
this_month_first = today.replace(day=1)
|
||||
|
||||
deposit_type = self.env['yuthon.management.type'].search([('name', '=', '押金')], limit=1)
|
||||
|
||||
domain = [
|
||||
('due_date', '<', this_month_first),
|
||||
('delivered1', '>', 0),
|
||||
('is_invalid', '=', False),
|
||||
]
|
||||
if deposit_type:
|
||||
domain.append(('management_type_id', '=', deposit_type.id))
|
||||
|
||||
keyword = params.get("keyword")
|
||||
if keyword:
|
||||
domain += ['|', '|',
|
||||
('contract_id.contract_code', 'ilike', keyword),
|
||||
('property_name', 'ilike', keyword),
|
||||
('lessee_id.name', 'ilike', keyword),
|
||||
]
|
||||
|
||||
condition = params.get('condition')
|
||||
partner_id = params.get('partner_id')
|
||||
company_id = params.get('company_id')
|
||||
if condition:
|
||||
domain.append(('tenure_type', '=', condition))
|
||||
if partner_id:
|
||||
domain.append(('precinct_id', '=', partner_id))
|
||||
if company_id:
|
||||
domain.append(('company_id', '=', company_id))
|
||||
|
||||
receivables = self.search(domain, order="contract_id asc, due_date asc")
|
||||
|
||||
rows = []
|
||||
total_amount = 0.0
|
||||
for idx, rec in enumerate(receivables, start=1):
|
||||
amount = round(rec.delivered1 or 0.0, 2)
|
||||
total_amount += amount
|
||||
rows.append({
|
||||
"序号": idx,
|
||||
"合同编号": {
|
||||
'model': 'property.lease.contract',
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
'display_name': rec.lessee_id.name,
|
||||
} if rec.lessee_id else "",
|
||||
"金额": amount,
|
||||
"所属公司": rec.company_id.name if rec.company_id else "",
|
||||
"管理员": {
|
||||
'model': 'res.users',
|
||||
'id': rec.admin_id.id,
|
||||
'display_name': rec.admin_id.name,
|
||||
} if rec.admin_id else "",
|
||||
})
|
||||
|
||||
stats = [
|
||||
{'name': '记录总数', 'amount': len(rows)},
|
||||
{'name': '合计金额', 'amount': round(total_amount, 2)},
|
||||
]
|
||||
return {"rows": rows, "stats": stats}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="action_deposit_month_receivable_report" model="ir.actions.client">
|
||||
<field name="name">押金本月应收</field>
|
||||
<field name="tag">receivable_report_client</field>
|
||||
<field name="context">
|
||||
{
|
||||
"sideBar": true,
|
||||
"report_config": {
|
||||
"model": "property.accounts.receivable",
|
||||
"method": "get_deposit_month_receivable_report",
|
||||
"columns": [
|
||||
{"headerName": "序号", "field": "序号", "flex": 0.5},
|
||||
{"headerName": "合同编号", "field": "合同编号", "flex": 1.2},
|
||||
{"headerName": "物业名称", "field": "物业名称", "flex": 2.5},
|
||||
{"headerName": "承租方名称", "field": "承租方名称", "flex": 1.4},
|
||||
{"headerName": "金额", "field": "金额", "flex": 1, "type": "number"},
|
||||
{"headerName": "所属公司", "field": "所属公司", "flex": 1},
|
||||
{"headerName": "管理员", "field": "管理员", "flex": 1}
|
||||
]
|
||||
}
|
||||
}
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_deposit_pre_received_report" model="ir.actions.client">
|
||||
<field name="name">押金前期实收</field>
|
||||
<field name="tag">receivable_report_client</field>
|
||||
<field name="context">
|
||||
{
|
||||
"sideBar": true,
|
||||
"report_config": {
|
||||
"model": "property.accounts.receivable",
|
||||
"method": "get_deposit_pre_received_report",
|
||||
"columns": [
|
||||
{"headerName": "序号", "field": "序号", "flex": 0.5},
|
||||
{"headerName": "合同编号", "field": "合同编号", "flex": 1.2},
|
||||
{"headerName": "物业名称", "field": "物业名称", "flex": 2.5},
|
||||
{"headerName": "承租方名称", "field": "承租方名称", "flex": 1.4},
|
||||
{"headerName": "金额", "field": "金额", "flex": 1, "type": "number"},
|
||||
{"headerName": "所属公司", "field": "所属公司", "flex": 1},
|
||||
{"headerName": "管理员", "field": "管理员", "flex": 1}
|
||||
]
|
||||
}
|
||||
}
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_deposit_month_received_report" model="ir.actions.client">
|
||||
<field name="name">押金本月实收</field>
|
||||
<field name="tag">receivable_report_client</field>
|
||||
<field name="context">
|
||||
{
|
||||
"sideBar": true,
|
||||
"report_config": {
|
||||
"model": "property.accounts.receivable",
|
||||
"method": "get_deposit_month_received_report",
|
||||
"columns": [
|
||||
{"headerName": "序号", "field": "序号", "flex": 0.5},
|
||||
{"headerName": "合同编号", "field": "合同编号", "flex": 1.2},
|
||||
{"headerName": "物业名称", "field": "物业名称", "flex": 2.5},
|
||||
{"headerName": "承租方名称", "field": "承租方名称", "flex": 1.4},
|
||||
{"headerName": "金额", "field": "金额", "flex": 1, "type": "number"},
|
||||
{"headerName": "所属公司", "field": "所属公司", "flex": 1},
|
||||
{"headerName": "管理员", "field": "管理员", "flex": 1}
|
||||
]
|
||||
}
|
||||
}
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_deposit_month_receivable_report"
|
||||
name="押金本月应收"
|
||||
parent="yuthon_property_approval.property_approval_report_menu"
|
||||
action="action_deposit_month_receivable_report"
|
||||
sequence="560"/>
|
||||
<menuitem id="menu_deposit_pre_received_report"
|
||||
name="押金前期实收"
|
||||
parent="yuthon_property_approval.property_approval_report_menu"
|
||||
action="action_deposit_pre_received_report"
|
||||
sequence="570"/>
|
||||
<menuitem id="menu_deposit_month_received_report"
|
||||
name="押金本月实收"
|
||||
parent="yuthon_property_approval.property_approval_report_menu"
|
||||
action="action_deposit_month_received_report"
|
||||
sequence="580"/>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -131,7 +131,7 @@
|
||||
sequence="1"
|
||||
name="本月应收"
|
||||
parent="yuthon_property_deposit_menu"
|
||||
action="action_current_receivable_rent_report"/>
|
||||
action="action_deposit_month_receivable_report"/>
|
||||
<menuitem id="yuthon_property_deposit_pre_receivable_menu"
|
||||
sequence="2"
|
||||
name="前期应收"
|
||||
@@ -141,7 +141,7 @@
|
||||
sequence="3"
|
||||
name="本月实收"
|
||||
parent="yuthon_property_deposit_menu"
|
||||
action="action_cumulative_arrears_report"/>
|
||||
action="action_deposit_month_received_report"/>
|
||||
<menuitem id="yuthon_property_deposit_cum_arrears_menu"
|
||||
sequence="4"
|
||||
name="累计欠收"
|
||||
|
||||
Reference in New Issue
Block a user