@@ -31,32 +31,18 @@ class PropertyBankStatements(models.Model):
|
||||
contract_account = fields.Char(string="合同累计应收")
|
||||
contract_penalty = fields.Char(string="合同累计违约金")
|
||||
original_amount = fields.Float(string='交易金额')
|
||||
yes_amount = fields.Float(string='已对')
|
||||
yes_amount = fields.Float(stringo='已对')
|
||||
no_amount = fields.Float(string='未对')
|
||||
reconciliation_time = fields.Datetime('对账时间')
|
||||
voucher_type = fields.Selection([('electronic_transfer', '电子转账凭证'), ('telegraphic_transfer', '电汇凭证')], string='凭证种类')
|
||||
remake = fields.Text('备注')
|
||||
registered = fields.Float('挂账')
|
||||
|
||||
create_receivable_ids = fields.Many2many(
|
||||
'property.accounts.receivable',
|
||||
'property_bank_stmt_create_receivable_rel',
|
||||
'bank_stmt_id',
|
||||
'receivable_id',
|
||||
string='创建应收单'
|
||||
)
|
||||
write_receivable_ids = fields.Many2many(
|
||||
'property.accounts.receivable',
|
||||
'property_bank_stmt_write_receivable_rel',
|
||||
'bank_stmt_id',
|
||||
'receivable_id',
|
||||
string='修改应收单'
|
||||
)
|
||||
is_reconciliation = fields.Boolean('是否对账') # 无效
|
||||
company_select = fields.Selection([('jhtz', '天河投资'), ('thwg', '天河物管'), ('thcj', '天河城建')])
|
||||
property_ids = fields.Many2many('yuthon.property', string='物业地址')
|
||||
bank_state = fields.Selection([('not_reconciled', '未对账'), ('reconciled', '已对账'), ('registered', '挂账'), ('other', '其他')], string='状态', default='not_reconciled')
|
||||
is_company = fields.Boolean(compute='_compute_is_company', search='_search_part_of_company')
|
||||
receivable_modify_ids = fields.One2many('receivable.modify.line', 'bank_id', string='修改应收单')
|
||||
|
||||
@api.depends_context('uid', 'company')
|
||||
@api.depends('your_own_account')
|
||||
@@ -95,22 +81,23 @@ class PropertyBankStatements(models.Model):
|
||||
return domain or [('id', '=', 0)]
|
||||
|
||||
def other(self):
|
||||
for rec in self:
|
||||
bank_ids = self.env["property.bank.statements"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for rec in bank_ids:
|
||||
rec.bank_state = 'other'
|
||||
receivable_ids = self.env['property.accounts.receivable'].search([('lessee_id.name', '=', self.name_account)])
|
||||
property_list = []
|
||||
for property in self.property_ids:
|
||||
property_list.append(property.name)
|
||||
property_names = ",".join(property_list)
|
||||
for receivable in receivable_ids:
|
||||
receivable_log = f'当前登录人{self.env.user.name}于{fields.Datetime.now()}将物业为 {property_names} 的银行对账单状态修改为其他'
|
||||
for record in self:
|
||||
original_log = record.receivable_log or ''
|
||||
receivable_ids = self.env['property.accounts.receivable'].search([('lessee_id.name', '=', rec.name_account)])
|
||||
property_list = []
|
||||
for property in rec.property_ids:
|
||||
property_list.append(property.name)
|
||||
property_names = ",".join(property_list)
|
||||
for receivable in receivable_ids:
|
||||
receivable_log = f'当前登录人{self.env.user.name}于{fields.Datetime.now()}将物业为 {property_names} 的银行对账单状态修改为其他'
|
||||
original_log = receivable.receivable_log or ''
|
||||
if original_log:
|
||||
new_log = f"{original_log}\n{receivable_log}"
|
||||
else:
|
||||
new_log = receivable_log
|
||||
receivable.write({'receivable_log': new_log})
|
||||
receivable.write({'receivable_log': new_log})
|
||||
|
||||
@api.onchange('name')
|
||||
def _onchange_bank_account(self):
|
||||
@@ -207,3 +194,15 @@ class PropertyBankStatements(models.Model):
|
||||
])
|
||||
if accounts:
|
||||
rec.reconciliation_time = accounts[0].reconciliation_time
|
||||
|
||||
class ReceivableModifyLine(models.Model):
|
||||
_name = 'receivable.modify.line'
|
||||
_description = '修改应收账单明细'
|
||||
|
||||
bank_id = fields.Many2one('property.bank.statements', string='关联银行对账单')
|
||||
receivable_id = fields.Many2one('property.accounts.receivable', string='应收账单')
|
||||
amount = fields.Float(string='修改金额')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ access_evaluation_plan_wizard,evaluation_plan_wizard,model_evaluation_plan_wizar
|
||||
access_receivable_log_wizard, receivable.log.wizard,model_receivable_log_wizard,base.group_user,1,1,1,1
|
||||
access_amount_way,amount_way,model_amount_way,base.group_user,1,1,1,1
|
||||
access_property_summary_report, property_summary_report,model_property_summary_report,base.group_user,1,1,1,1
|
||||
access_receivable_modify_line, receivable.modify.line,model_receivable_modify_line,base.group_user,1,1,1,1
|
||||
|
||||
access_meter_price_wizard, meter_price_wizard,model_meter_price_wizard,base.group_user,1,1,1,1
|
||||
access_water_price_wizard, water_price_wizard,model_water_price_wizard,base.group_user,1,1,1,1
|
||||
|
||||
|
@@ -5,6 +5,9 @@
|
||||
<field name="model">property.bank.statements</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="对账" editable="bottom" js_class="custom_statements_list_button">
|
||||
<header>
|
||||
<button name="other" type="object" class="oe_highlight" string="其他"/>
|
||||
</header>
|
||||
<field name="start_time"/>
|
||||
<field name="company_id" optional="hide"/>
|
||||
<field name="bank_name" optional="hide"/>
|
||||
@@ -30,6 +33,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_property_bank_statements_tree1" model="ir.ui.view">
|
||||
<field name="name">property.bank.statements.tree</field>
|
||||
<field name="model">property.bank.statements</field>
|
||||
@@ -37,10 +41,9 @@
|
||||
<tree string="银行流水" editable="bottom" js_class="custom_bank_statements_button">
|
||||
<field name="your_own_account" optional="hide"/>
|
||||
<field name="your_own_unit" optional="hide"/>
|
||||
<!--
|
||||
<field name="name_account"/> <header>-->
|
||||
<!-- <button name="handle_contract_penalty" type="object" class="oe_highlight" string="ce"/>-->
|
||||
<!-- </header>-->
|
||||
<header>
|
||||
<button name="other" type="object" class="oe_highlight" string="其他"/>
|
||||
</header>
|
||||
<field name="start_time"/>
|
||||
<field name="company_id" optional="hide"/>
|
||||
<field name="serial_number" optional="hide"/>
|
||||
@@ -65,7 +68,6 @@
|
||||
<field name="number" optional="hide"/>
|
||||
<field name="bank_state"/>
|
||||
<field name="voucher_type" optional="hide"/>
|
||||
<button name="other" type="object" string="其他" class="btn btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -153,21 +153,20 @@ class PropertyBankStatements(models.Model):
|
||||
statements_ids = self.env["property.bank.statements"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id'))
|
||||
)
|
||||
|
||||
for statement in statements_ids:
|
||||
bank_account = self.env['property.bank.line'].search([
|
||||
('bank', '=', statement.name) # 假设statement.name存储银行账号
|
||||
])
|
||||
if bank_account.tenant_id:
|
||||
# 获取需要删除的合同明细行
|
||||
lines_to_delete = self.env['property.tenant.line'].search([
|
||||
('tenant_id', '=', bank_account.tenant_id.id),
|
||||
('lease_contract_id', 'in', statement.contract_ids.ids)
|
||||
if statement.name:
|
||||
bank_account = self.env['property.bank.line'].search([
|
||||
('bank', '=', statement.name) # 假设statement.name存储银行账号
|
||||
])
|
||||
# 删除合同明细行
|
||||
if lines_to_delete:
|
||||
lines_to_delete.unlink()
|
||||
|
||||
if bank_account.tenant_id:
|
||||
# 获取需要删除的合同明细行
|
||||
lines_to_delete = self.env['property.tenant.line'].search([
|
||||
('tenant_id', '=', bank_account.tenant_id.id),
|
||||
('lease_contract_id', 'in', statement.contract_ids.ids)
|
||||
])
|
||||
# 删除合同明细行
|
||||
if lines_to_delete:
|
||||
lines_to_delete.unlink()
|
||||
statement.contract_ids = [(5,)]
|
||||
statement.property_ids = [(5,)]
|
||||
|
||||
@@ -630,7 +629,6 @@ class PropertyRentList(models.Model):
|
||||
if not management_type:
|
||||
management_type = self.env['yuthon.management.type'].create({'name': '租金'})
|
||||
due_date = rec.due_date
|
||||
due_date_end = False
|
||||
theoretical_end = False
|
||||
contract = rec.contract_id
|
||||
if contract and contract.cycle_mode and due_date:
|
||||
|
||||
@@ -55,21 +55,16 @@
|
||||
<field name="model">property.rent.list</field>
|
||||
<field name="inherit_id" ref="yuthon_property.view_property_rent_list_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree" position="inside">
|
||||
<header>
|
||||
<button name="batch_push_rent" type="object" string="推送" class="oe_highlight"/>
|
||||
</header>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='property_id']" position="before">
|
||||
<field name="contract_id" string="合同编号" options="{'no_create': True}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='is_reconciliation']" position="after">
|
||||
<button name="push_rent" type="object" string="推送" class="oe_highlight"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="all_property_rent_list_push" model="ir.actions.server">
|
||||
<field name="name">批量推送</field>
|
||||
<field name="model_id" ref="yuthon_property.model_property_rent_list"/>
|
||||
<field name="binding_model_id" ref="yuthon_property.model_property_rent_list"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.batch_push_rent()</field>
|
||||
</record>
|
||||
<record id="view_property_rent_list_action" model="ir.actions.act_window">
|
||||
<field name="name">租金列表</field>
|
||||
<field name="res_model">property.rent.list</field>
|
||||
@@ -84,15 +79,17 @@
|
||||
<field name="model">property.deposit.list</field>
|
||||
<field name="inherit_id" ref="yuthon_property.view_property_deposit_list_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree" position="inside">
|
||||
<header>
|
||||
<button name="batch_push_deposit" type="object" string="推送" class="oe_highlight"/>
|
||||
</header>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='property_id']" position="after">
|
||||
<field name="contract_id" string="合同"/>
|
||||
<field name="due_date"/>
|
||||
<field name="posit_type"/>
|
||||
<field name="original_amount"/>
|
||||
</xpath>
|
||||
<xpath expr="//tree/field[@name='is_push']" position="after">
|
||||
<button name="push_deposit" string="推送" type="object" class="oe_highlight"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!--押金累计欠收报表-->
|
||||
@@ -115,13 +112,6 @@
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="yuthon_property_approval.property_deposit_list_report_tree"/>
|
||||
</record>
|
||||
<record id="all_property_deposit_push" model="ir.actions.server">
|
||||
<field name="name">批量推送</field>
|
||||
<field name="model_id" ref="yuthon_property.model_property_deposit_list"/>
|
||||
<field name="binding_model_id" ref="yuthon_property.model_property_deposit_list"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.batch_push_deposit()</field>
|
||||
</record>
|
||||
<record id="property_deposit_search" model="ir.ui.view">
|
||||
<field name="name">property.deposit.list.search</field>
|
||||
<field name="model">property.deposit.list</field>
|
||||
@@ -170,20 +160,15 @@
|
||||
<field name="model">property.tariff.list</field>
|
||||
<field name="inherit_id" ref="yuthon_property.view_property_tariff_list_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree" position="inside">
|
||||
<header>
|
||||
<button name="batch_push_tariff" type="object" string="推送" class="oe_highlight"/>
|
||||
</header>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='property_id']" position="before">
|
||||
<field name="contract_id" string="合同编号" options="{'no_create': True}"/>
|
||||
</xpath>
|
||||
<xpath expr="//tree/field[@name='remarks']" position="after">
|
||||
<button name="push_tariff" string="推送" type="object" class="oe_highlight"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="all_property_tariff_list_push" model="ir.actions.server">
|
||||
<field name="name">批量推送</field>
|
||||
<field name="model_id" ref="yuthon_property.model_property_tariff_list"/>
|
||||
<field name="binding_model_id" ref="yuthon_property.model_property_tariff_list"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.batch_push_tariff()</field>
|
||||
</record>
|
||||
<record id='view_property_tariff_list_action' model="ir.actions.act_window">
|
||||
<field name="name">电费列表</field>
|
||||
@@ -216,20 +201,15 @@
|
||||
<field name="model">property.water.list</field>
|
||||
<field name="inherit_id" ref="yuthon_property.view_property_water_list_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree" position="inside">
|
||||
<header>
|
||||
<button name="batch_push_water" type="object" string="推送" class="oe_highlight"/>
|
||||
</header>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='property_id']" position="before">
|
||||
<field name="contract_id" string="合同编号" options="{'no_create': True}"/>
|
||||
</xpath>
|
||||
<xpath expr="//tree/field[@name='remarks']" position="after">
|
||||
<button name="push_water" string="推送" type="object" class="oe_highlight"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="all_property_water_list_push" model="ir.actions.server">
|
||||
<field name="name">批量推送</field>
|
||||
<field name="model_id" ref="yuthon_property.model_property_water_list"/>
|
||||
<field name="binding_model_id" ref="yuthon_property.model_property_water_list"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.batch_push_water()</field>
|
||||
</record>
|
||||
<record id='view_property_water_list_action' model="ir.actions.act_window">
|
||||
<field name="name">水费列表</field>
|
||||
@@ -245,12 +225,14 @@
|
||||
<field name="model">property.management.list</field>
|
||||
<field name="inherit_id" ref="yuthon_property.view_property_management_list_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree" position="inside">
|
||||
<header>
|
||||
<button name="batch_push_management" type="object" string="推送" class="oe_highlight"/>
|
||||
</header>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='lessee_id']" position="before">
|
||||
<field name="contract_id" string="合同"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='remarks']" position="after">
|
||||
<button name="push_management" string="推送" type="object" class="oe_highlight"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="property_management_list_search" model="ir.ui.view">
|
||||
@@ -270,13 +252,6 @@
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<record id="all_property_management_push" model="ir.actions.server">
|
||||
<field name="name">批量推送</field>
|
||||
<field name="model_id" ref="yuthon_property.model_property_management_list"/>
|
||||
<field name="binding_model_id" ref="yuthon_property.model_property_management_list"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.batch_push_management()</field>
|
||||
</record>
|
||||
<record id="property_management_list_action" model="ir.actions.act_window">
|
||||
<field name="name">管理费列表</field>
|
||||
<field name="res_model">property.management.list</field>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from odoo import models, fields, api, _, SUPERUSER_ID
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
|
||||
class BindingInformationWizard(models.Model):
|
||||
@@ -77,32 +78,52 @@ class BindingInformationWizard(models.Model):
|
||||
record.available_contract_ids = [(6, 0, contract_ids)] if contract_ids else [(5,)]
|
||||
|
||||
def confirm(self):
|
||||
bank_ids = self.env['property.bank.statements'].search([('name', '=', self.bank_id.name)])
|
||||
for bank_id in bank_ids:
|
||||
if self.property_ids:
|
||||
new_properties = self.property_ids - bank_id.property_ids
|
||||
if new_properties:
|
||||
bank_id.write({
|
||||
'property_ids': [(4, prop.id) for prop in new_properties]
|
||||
})
|
||||
if self.contract_ids:
|
||||
new_contracts = self.contract_ids - bank_id.contract_ids
|
||||
if new_contracts:
|
||||
bank_id.write({
|
||||
'contract_ids': [(4, cont.id) for cont in new_contracts]
|
||||
})
|
||||
if self.bank_id.name:
|
||||
bank_ids = self.env['property.bank.statements'].search([('name', '=', self.bank_id.name)])
|
||||
for bank_id in bank_ids:
|
||||
if self.property_ids:
|
||||
new_properties = self.property_ids - bank_id.property_ids
|
||||
if new_properties:
|
||||
bank_id.write({
|
||||
'property_ids': [(4, prop.id) for prop in new_properties]
|
||||
})
|
||||
if self.contract_ids:
|
||||
new_contracts = self.contract_ids - bank_id.contract_ids
|
||||
if new_contracts:
|
||||
bank_id.write({
|
||||
'contract_ids': [(4, cont.id) for cont in new_contracts]
|
||||
})
|
||||
|
||||
# 根据银行账号查找承租方信息
|
||||
bank_account = self.env['property.bank.line'].search([
|
||||
('bank', '=', self.bank_id.name)
|
||||
])
|
||||
if bank_account.tenant_id:
|
||||
# 获取已存在的合同明细行的合同ID
|
||||
existing_contract_ids = bank_account.tenant_id.property_contract_ids.mapped('lease_contract_id.id')
|
||||
# 过滤出需要新增的合同(排除已存在的)
|
||||
new_contracts = self.contract_ids.filtered(lambda c: c.id not in existing_contract_ids)
|
||||
for contract in new_contracts:
|
||||
self.env['property.tenant.line'].sudo().create({
|
||||
'tenant_id': bank_account.tenant_id.id,
|
||||
'lease_contract_id': contract.id,
|
||||
})
|
||||
# 根据银行账号查找承租方信息
|
||||
bank_account = self.env['property.bank.line'].search([
|
||||
('bank', '=', self.bank_id.name)
|
||||
])
|
||||
if bank_account:
|
||||
# 获取已存在的合同明细行的合同ID
|
||||
existing_contract_ids = bank_account.tenant_id.property_contract_ids.mapped('lease_contract_id.id')
|
||||
# 过滤出需要新增的合同(排除已存在的)
|
||||
new_contracts = self.contract_ids.filtered(lambda c: c.id not in existing_contract_ids)
|
||||
for contract in new_contracts:
|
||||
self.env['property.tenant.line'].sudo().create({
|
||||
'tenant_id': bank_account.tenant_id.id,
|
||||
'lease_contract_id': contract.id,
|
||||
})
|
||||
else:
|
||||
tenant = self.env['property.tenant.information'].create({
|
||||
'name': self.bank_id.name_account,
|
||||
})
|
||||
self.env['property.bank.line'].create({
|
||||
'bank': self.bank_id.name,
|
||||
'user': self.bank_id.name_account,
|
||||
'tenant_id': tenant.id,
|
||||
})
|
||||
existing_contract_ids = tenant.property_contract_ids.mapped('lease_contract_id.id')
|
||||
# 过滤出需要新增的合同(排除已存在的)
|
||||
new_contracts = self.contract_ids.filtered(lambda c: c.id not in existing_contract_ids)
|
||||
for contract in new_contracts:
|
||||
self.env['property.tenant.line'].sudo().create({
|
||||
'tenant_id': tenant.id,
|
||||
'lease_contract_id': contract.id,
|
||||
})
|
||||
else:
|
||||
raise UserError('请先输入该户名银行账号,才能绑定')
|
||||
Reference in New Issue
Block a user