本月应收
This commit is contained in:
@@ -100,7 +100,7 @@ def ks_read(self, records):
|
||||
sql = comodel._order_to_sql(None, wquery)
|
||||
order_by_clause = comodel.env.cr.mogrify(sql).decode()
|
||||
order_by = order_by_clause and (' ORDER BY %s ' % order_by_clause) or ''
|
||||
# order_by = '' # 临时修复:跳过排序
|
||||
order_by = '' # 临时修复:跳过排序
|
||||
from_c, where_c, where_params = wquery.get_sql()
|
||||
query = """ SELECT {rel}.{id1}, {rel}.{id2} FROM {rel}, {from_c}
|
||||
WHERE {where_c} AND {rel}.{id1} IN %s AND {rel}.{id2} = {tbl}.id
|
||||
|
||||
@@ -414,9 +414,10 @@ class SoongWorkflowCommentWizard(models.TransientModel):
|
||||
today = datetime.now(pytz.utc).astimezone(tz).strftime('%Y-%m-%d')
|
||||
user_name = self.env.user.name
|
||||
code = self.code or ''
|
||||
new_line = f"{today}\n{code}\n{user_name}"
|
||||
note_name = self.comment_note_id.name or ''
|
||||
new_line = f"{today} {code} {user_name} {note_name}"
|
||||
old_info = self.comment_note_id.use_info or ''
|
||||
updated_info = (old_info + '\n\n' + new_line) if old_info else new_line
|
||||
updated_info = (old_info + '\n' + new_line) if old_info else new_line
|
||||
self.comment_note_id.sudo().write({'use_info': updated_info})
|
||||
cx = self.env.context.copy() or {}
|
||||
record_id = self.env[self.res_model].search([('id', '=', self.res_id)])
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='department_id']" position="after">
|
||||
<!-- <field name="allowed_user_ids" invisible="1"/>-->
|
||||
<field name="allowed_user_ids" invisible="1"/>
|
||||
<field name="number"/>
|
||||
<field name="establishment_quotas"/>
|
||||
<field name="no_of_employee" string="在编人数"/>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
'data': [
|
||||
'views/pre_arrears_report.xml',
|
||||
'views/pre_advance_report.xml',
|
||||
'views/month_receivable_report.xml',
|
||||
'views/penalty_arrears_report.xml',
|
||||
'views/penalty_month_received_report.xml',
|
||||
'views/penalty_year_cum_report.xml',
|
||||
|
||||
@@ -16,6 +16,7 @@ from . import att_report
|
||||
from . import staff_position_report
|
||||
from . import pre_arrears_report
|
||||
from . import pre_advance_report
|
||||
from . import month_receivable_report
|
||||
from . import penalty_arrears_report
|
||||
from . import penalty_month_received_report
|
||||
from . import penalty_year_cum_report
|
||||
|
||||
@@ -74,7 +74,11 @@ class CurrentMonthReceivedReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -106,7 +106,11 @@ class CurrentReceivablePropertyFeeReport(models.Model):
|
||||
"金额(含税)": round(amt, 2),
|
||||
"税率": f"{tax_rate:.1f}%" if tax_rate else "0.0%",
|
||||
"金额(不含税)": round(amt_nt, 2),
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"产权证": rec.title_deed or "",
|
||||
"合同编号": {
|
||||
'model': 'property.lease.contract',
|
||||
|
||||
@@ -63,7 +63,11 @@ class DepositCumArrearsReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -63,7 +63,11 @@ class DepositMonthReceivableReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -70,7 +70,11 @@ class DepositMonthReceivedReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -71,7 +71,11 @@ class DepositMonthRefundReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -63,7 +63,11 @@ class DepositPreReceivedReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -70,7 +70,11 @@ class DepositTotalReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import datetime
|
||||
import calendar
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class MonthReceivableReport(models.Model):
|
||||
_inherit = 'property.accounts.receivable'
|
||||
|
||||
@api.model
|
||||
def get_month_receivable_report(self, params):
|
||||
"""本月应收:取 due_date <= 查询月底 且 submitted > 0 的记录"""
|
||||
domain = [('is_invalid', '=', False), ('submitted', '>', 0)]
|
||||
|
||||
# 单月日期选择器传 date_start
|
||||
if params.get('date_start'):
|
||||
query_date = datetime.datetime.fromisoformat(params['date_start']).date()
|
||||
last_day = calendar.monthrange(query_date.year, query_date.month)[1]
|
||||
month_end = query_date.replace(day=last_day)
|
||||
domain.append(('due_date', '<=', month_end))
|
||||
|
||||
if params.get('keyword'):
|
||||
keyword = params['keyword']
|
||||
domain += ['|', '|',
|
||||
('lessee_id.name', 'ilike', keyword),
|
||||
('property_name', 'ilike', keyword),
|
||||
('contract_id.contract_code', 'ilike', keyword)]
|
||||
|
||||
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.submitted 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 '',
|
||||
'物业名称': {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or '',
|
||||
'承租方名称': rec.lessee_id.name if rec.lessee_id else '',
|
||||
'金额': amount,
|
||||
'管理员': rec.admin_id.name if rec.admin_id else '',
|
||||
})
|
||||
|
||||
stats = [{'name': '合计', 'amount': round(total_amount, 2)}]
|
||||
return {'rows': rows, 'stats': stats}
|
||||
@@ -57,7 +57,11 @@ class MonthlyPrecollectionReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -81,7 +81,11 @@ class ParkingFeeCurrentMonthReceivable(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -87,7 +87,11 @@ class ParkingFeeCurrentMonthReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -92,7 +92,11 @@ class ParkingFeeYearlyReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -88,7 +88,11 @@ class PenaltyArrearsReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -93,7 +93,11 @@ class PenaltyMonthReceivedReport(models.Model):
|
||||
'id': rec.contract_id.id,
|
||||
'display_name': rec.contract_id.contract_code,
|
||||
} if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -86,7 +86,11 @@ class PenaltyYearCumReport(models.Model):
|
||||
'id': contract.id,
|
||||
'display_name': contract.contract_code,
|
||||
} if contract else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -70,7 +70,11 @@ class PreAdvanceReport(models.Model):
|
||||
'id': contract.id,
|
||||
'display_name': contract.contract_code,
|
||||
} if contract else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -65,7 +65,11 @@ class PreArrearsReport(models.Model):
|
||||
'id': contract.id,
|
||||
'display_name': contract.contract_code,
|
||||
} if contract else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方名称": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -119,7 +119,11 @@ class YuthonProperty(models.Model):
|
||||
'id': info_rec.lessee_id.id,
|
||||
'display_name': info_rec.lessee_id.name,
|
||||
} if info_rec.lessee_id else "",
|
||||
"物业名称": info_rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': info_rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': info_rec.property_name,
|
||||
} if info_rec.contract_id and info_rec.contract_id.lease_ids and info_rec.contract_id.lease_ids[0].address_id else info_rec.property_name or "",
|
||||
"产权证号": info_rec.title_deed or "",
|
||||
"发票类型": info_rec.lessee_id.invoicing_ids[0].invoicing_type_id.name if info_rec.lessee_id and info_rec.lessee_id.invoicing_ids else "",
|
||||
"税率": self._get_tax_rate_display(info_rec),
|
||||
|
||||
@@ -32,7 +32,11 @@ class PropertyAccountsReceivable(models.Model):
|
||||
{
|
||||
"收款日期": rec.payout_date.strftime("%Y-%m-%d") if rec.payout_date else "",
|
||||
"合同编号": rec.contract_id.contract_code or "" if rec.contract_id else "",
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.contract_id.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方": rec.lessee_id.name or "" if rec.lessee_id else "",
|
||||
"收款类型": rec.management_type_id.name or "" if rec.management_type_id else "",
|
||||
"金额": rec.original_amount or 0.0,
|
||||
|
||||
@@ -61,7 +61,11 @@ class YuthonContractReport(models.Model):
|
||||
actual_tenure = "未设置实际租期"
|
||||
|
||||
report_data.append({
|
||||
"物业名称": rec.property_name or "",
|
||||
"物业名称": {
|
||||
'model': 'yuthon.property',
|
||||
'id': rec.lease_ids[0].address_id.id,
|
||||
'display_name': rec.property_name,
|
||||
} if rec.lease_ids and rec.lease_ids[0].address_id else rec.property_name or "",
|
||||
"承租方": {
|
||||
'model': 'property.tenant.information',
|
||||
'id': rec.lessee_id.id,
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
sequence="4"
|
||||
name="本月应收"
|
||||
parent="yuthon_property_income_menu"
|
||||
action="action_report_placeholder"/>
|
||||
action="action_month_receivable_report"/>
|
||||
<menuitem id="yuthon_property_income_total_received_menu"
|
||||
sequence="5"
|
||||
name="实收总额"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="action_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_month_receivable_report",
|
||||
"dateMode": "single",
|
||||
"columns": [
|
||||
{"headerName": "序号", "field": "序号", "width": 45, "flex": 0, "pinned": "left"},
|
||||
{"headerName": "合同编号", "field": "合同编号", "flex": 1.2},
|
||||
{"headerName": "物业名称", "field": "物业名称", "flex": 2.5},
|
||||
{"headerName": "承租方名称", "field": "承租方名称", "flex": 1.6},
|
||||
{"headerName": "金额", "field": "金额", "flex": 1, "type": "number"},
|
||||
{"headerName": "管理员", "field": "管理员", "flex": 1}
|
||||
]
|
||||
}
|
||||
}
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user