添加功能

This commit is contained in:
李鹏宇
2025-11-28 15:37:40 +08:00
parent 115d5702c9
commit 3975d8f933
5 changed files with 26 additions and 15 deletions
@@ -480,6 +480,7 @@ class PropertyBankStatements(models.Model):
:return:
"""
start_time = self.start_time + relativedelta(hours=8)
warning_msg = self._check_unreconciled_statements(start_time)
context = {
"default_actual_date": fields.Date.to_date(start_time),
"default_bank_id": self.id,
@@ -490,11 +491,10 @@ class PropertyBankStatements(models.Model):
"default_reconciliation_line_ids": all_vals, # 租金,应收日期排序、管理费、电、水、押金
'default_amount_reconciled': self.no_amount,
"default_receivable_total": total_rent_month,
"default_warning_msg":warning_msg,
"dialog_size": "extra-large",
"default_order": "due_date desc",
}
self._check_unreconciled_statements(start_time)
return {
"type": "ir.actions.act_window",
"name": "对账弹窗",
@@ -532,7 +532,10 @@ class PropertyBankStatements(models.Model):
if statements:
unreconciled[account] = len(statements)
if unreconciled:
raise UserError("存在未对账的历史流水,请优先处理:")
warning_msg = _("⚠️ 检测到未对账的历史流水,请优先处理")
else:
warning_msg = False
return warning_msg
def button_reconciliation(self):
for record in self:
@@ -595,8 +598,6 @@ class PropertyAccountsReceivable(models.Model):
# company_id1 = fields.Many2one(related='contract_id.admin_id.company_id', string="管理员公司", store=True)
company_id2 = fields.Many2one("res.company", string="公司", compute='_compute_company_id2', store=True)
contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
version = fields.Char(related='contract_id.version', string='版本')
contract_name = fields.Char(string='合同编号', compute="_compute_contract_name")
contract_sort = fields.Selection([('property', '物业'), ('guanggao', '广告位'),('parking', '停车场'), ('guanzi', '管子间'), ('room', '机房'), ('base_station','基站'), ('other', '其他')],
related='contract_id.contract_sort', string="资产类型", index=True)
admin_id = fields.Many2one(related='contract_id.admin_id', string="片区管理员", store=True)
@@ -90,7 +90,7 @@ class PropertyLeaseContract(models.Model):
_name = 'property.lease.contract'
_description = '租赁合同审批'
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin']
_rec_name = 'contract_code'
_rec_name = 'display_name'
property_name = fields.Char(string='物业信息')
version = fields.Char(string="合同版本", default="V1.0")
@@ -98,6 +98,8 @@ class PropertyLeaseContract(models.Model):
admin_id = fields.Many2one('res.users', string="管理员", compute="_compute_admin_id", store=True)
tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型', compute="_compute_admin_id", store=True)
contract_code = fields.Char(string="合同编号")
display_name = fields.Char(string="合同编号", compute="_compute_display_name")
contract_date = fields.Date(string="合同签订日期")
is_print = fields.Boolean(string="当月打印", compute ="_compute_is_print", store=True)
property_documents_ids = fields.Many2many(
@@ -308,6 +310,17 @@ class PropertyLeaseContract(models.Model):
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
@api.depends('contract_code', 'version')
def _compute_display_name(self):
for rec in self:
if rec.version and rec.contract_code:
rec.display_name = f"{rec.contract_code}({rec.version})"
elif rec.contract_code:
rec.display_name = f"{rec.contract_code}"
else:
rec.display_name = False
@api.depends('payment_ids.print_date', 'payment_ids.is_print')
def _compute_is_print(self):
today = date.today()
@@ -408,9 +408,7 @@
<field name="ratio" column_invisible="1"/>
<field name="billable_quantity" column_invisible="1"/>
<!-- <field name="company_id1"/>-->
<field name="contract_id" string="合同编号" column_invisible="1"/>
<field name="version" column_invisible="1"/>
<field name="contract_name" string="合同编号"/>
<field name="contract_id" string="合同编号"/>
</xpath>
<xpath expr="//field[@name='remark']" position="after">
<field name="charging_range"/>
@@ -13,7 +13,7 @@ class PropertyReconciliationWizard(models.Model):
receivable_total = fields.Float(string='应收金额', compute="_compute_receivable_total", store=True)
bank_branch = fields.Char('银行名称')
warning_msg = fields.Char(string='警告')
bank_id = fields.Many2one('property.bank.statements', string='银行流水')
lessee_ids = fields.Many2many('property.tenant.information', string='承租方')
receivables_type_ids = fields.Many2many('yuthon.management.type', string="应收类型")
@@ -621,8 +621,6 @@ class PropertyReconciliationLine(models.Model):
property_name = fields.Text(string='物业', compute="_compute_property_name")
property_ids = fields.Many2many('yuthon.property', string='物业', compute="_compute_property_ids", store=True)
contract_id = fields.Many2one('property.lease.contract', string='合同编号')
version = fields.Char(related='contract_id.version', string='版本')
contract_name = fields.Char(string='合同编号', compute="_compute_contract_name")
rent_month = fields.Float(string='当期金额')
due_date = fields.Date(string='应收日期')
rent = fields.Float(string='未收')
@@ -51,6 +51,9 @@
<field name="receivables_type_ids" widget="many2many_tags" options="{'no_create': True}"/>
<field name="contract_ids" widget="many2many_tags" options="{'no_create': True}"/>
<field name="remake" readonly="1"/>
</group>
<group>
<field name="warning_msg" style="color: red; font-weight: bold;" readonly="1" invisible="not warning_msg" string=" "/>
</group>
<notebook>
<page name="对账明细">
@@ -60,9 +63,7 @@
<field name="color" column_invisible="1" force_save="1"/>
<field name="reconciliation_id" column_invisible="1"/>
<field name="property_ids" column_invisible="1"/>
<field name="contract_id" force_save="1" column_invisible="1"/>
<field name="version" column_invisible="1"/>
<field name="contract_name" readonly="1"/>
<field name="contract_id" force_save="1"/>
<field name="property_name"/>
<field name="due_date" readonly="1" force_save="1"/>
<field name="collection_type" readonly="1" force_save="1"