报表
This commit is contained in:
@@ -24,6 +24,7 @@ class YuthonRenewalApproval(models.Model):
|
||||
work_end = fields.Boolean(string="结束")
|
||||
|
||||
employee_id = fields.Many2one('hr.employee', string="续签员工")
|
||||
contract_signing_entity = fields.Char(string="合同签约主体")
|
||||
card = fields.Char(related='employee_id.identification_id', string="身份证号")
|
||||
department1_id = fields.Many2one('hr.department', string="续签部门")
|
||||
user_sex = fields.Selection(related='employee_id.user_sex', string="性别")
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
</group>
|
||||
<group string="续签员工" col="2">
|
||||
<group>
|
||||
<field name="contract_signing_entity"/>
|
||||
<field name="employee_id" options="{'no_create': True}" domain="[('company_id', '=', company_id)]"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="card"/>
|
||||
|
||||
@@ -227,6 +227,7 @@ class ReceivableModifyLine(models.Model):
|
||||
is_penalty = fields.Boolean(string='是否为违约金')
|
||||
not_collected = fields.Float(string='未收')
|
||||
amount = fields.Float(string='已对金额')
|
||||
has_date = fields.Date(related='receivable_id.has_date', string='退款日期', store=False)
|
||||
|
||||
penalty_pay_line_ids = fields.Many2many(
|
||||
'penalty.pay.line',
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
<field name="due_date_end"/>
|
||||
<field name="management_type_id"/>
|
||||
<field name="is_penalty"/>
|
||||
<field name="has_date"/>
|
||||
<button name="open_receivable" string="应收账单" type="object" class="btn btn-blue"/>
|
||||
<button name="open_bank_statement" string="银行流水" type="object" class="btn btn-blue"/>
|
||||
<button name="open_penalty_pay_lines" string="收款明细" type="object" class="btn btn-blue"/>
|
||||
|
||||
@@ -4,16 +4,17 @@ from odoo import api, models
|
||||
|
||||
|
||||
class DepositMonthRefundReport(models.Model):
|
||||
_inherit = 'property.accounts.receivable'
|
||||
_inherit = 'receivable.modify.line'
|
||||
|
||||
@api.model
|
||||
def get_deposit_month_refund_report(self, params):
|
||||
"""
|
||||
押金本月已退报表:
|
||||
- 管理费用类型为"押金"
|
||||
- has_date(退款日期)在本月范围内
|
||||
- 数据源:receivable.modify.line
|
||||
- 应收类型为"押金"
|
||||
- has_date(退款日期)有值且在查询月范围内
|
||||
- is_invalid = False
|
||||
- 每条记录单独一行,金额 = delivered1
|
||||
- 金额 = receivable_id.original_amount(当期金额,即押金收了多少退多少)
|
||||
"""
|
||||
today = datetime.date.today()
|
||||
this_month_first = today.replace(day=1)
|
||||
@@ -23,17 +24,18 @@ class DepositMonthRefundReport(models.Model):
|
||||
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)
|
||||
|
||||
date_start = params.get("date_start")
|
||||
date_end = params.get("date_end")
|
||||
start_dt = datetime.datetime.fromisoformat(date_start).date() if date_start else this_month_first
|
||||
end_dt = datetime.datetime.fromisoformat(date_end).date() if date_end else this_month_last
|
||||
|
||||
deposit_type = self.env['yuthon.management.type'].search([('name', '=', '押金')], limit=1)
|
||||
|
||||
domain = [
|
||||
('has_date', '>=', start_dt),
|
||||
('has_date', '<=', end_dt),
|
||||
('is_invalid', '=', False),
|
||||
('receivable_id.has_date', '!=', False),
|
||||
('receivable_id.has_date', '>=', start_dt),
|
||||
('receivable_id.has_date', '<=', end_dt),
|
||||
('receivable_id.is_invalid', '=', False),
|
||||
]
|
||||
if deposit_type:
|
||||
domain.append(('management_type_id', '=', deposit_type.id))
|
||||
@@ -41,27 +43,29 @@ class DepositMonthRefundReport(models.Model):
|
||||
keyword = params.get("keyword")
|
||||
if keyword:
|
||||
domain += ['|', '|',
|
||||
('contract_id.contract_code', 'ilike', keyword),
|
||||
('receivable_id.contract_id.contract_code', 'ilike', keyword),
|
||||
('property_name', 'ilike', keyword),
|
||||
('lessee_id.name', 'ilike', keyword),
|
||||
('receivable_id.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))
|
||||
domain.append(('receivable_id.tenure_type', '=', condition))
|
||||
if partner_id:
|
||||
domain.append(('precinct_id', '=', partner_id))
|
||||
domain.append(('receivable_id.precinct_id', '=', partner_id))
|
||||
if company_id:
|
||||
domain.append(('company_id', '=', company_id))
|
||||
domain.append(('receivable_id.company_id', '=', company_id))
|
||||
|
||||
receivables = self.search(domain, order="has_date asc, contract_id asc")
|
||||
lines = self.search(domain, order="receivable_id asc")
|
||||
|
||||
rows = []
|
||||
total_amount = 0.0
|
||||
for idx, rec in enumerate(receivables, start=1):
|
||||
amount = round(rec.delivered1 or 0.0, 2)
|
||||
idx = 1
|
||||
for line in lines:
|
||||
rec = line.receivable_id
|
||||
amount = round(rec.original_amount or 0.0, 2)
|
||||
total_amount += amount
|
||||
rows.append({
|
||||
"序号": idx,
|
||||
@@ -89,6 +93,7 @@ class DepositMonthRefundReport(models.Model):
|
||||
'display_name': rec.admin_id.name,
|
||||
} if rec.admin_id else "",
|
||||
})
|
||||
idx += 1
|
||||
|
||||
stats = [
|
||||
{'name': '记录总数', 'amount': len(rows)},
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
{
|
||||
"sideBar": true,
|
||||
"report_config": {
|
||||
"model": "property.accounts.receivable",
|
||||
"model": "receivable.modify.line",
|
||||
"method": "get_deposit_month_refund_report",
|
||||
"columns": [
|
||||
{"headerName": "序号", "field": "序号", "width": 45, "flex": 0, "pinned": "left"},
|
||||
|
||||
Reference in New Issue
Block a user