@@ -33,7 +33,7 @@ class PropertyAccountsReceivable(models.Model):
|
||||
print_date = fields.Date(string='打印日期')
|
||||
print_number = fields.Integer(string='打印次数')
|
||||
delivered1 = fields.Float(string='已交')
|
||||
has_date = fields.Date(string='退押金日期')
|
||||
has_date = fields.Date(string='退款日期')
|
||||
delivered = fields.Boolean()
|
||||
submitted = fields.Float(string='未收', compute='compute_submitted', store=True)
|
||||
is_invalid = fields.Boolean(string='作废')
|
||||
|
||||
@@ -13,6 +13,7 @@ class PropertyBillsList(models.Model):
|
||||
contract_id = fields.Many2one('property.lease.contract', string="合同编号")
|
||||
lessee_id = fields.Many2one(related="contract_id.lessee_id", string="承租方", store=True)
|
||||
property_name = fields.Char(related='contract_id.property_name', string="物业信息")
|
||||
remake = fields.Text(string="备注")
|
||||
|
||||
def action_pay(self):
|
||||
return {
|
||||
|
||||
@@ -204,7 +204,7 @@ class PropertyLeaseContract(models.Model):
|
||||
tax = fields.Float(string="税金")
|
||||
is_water = fields.Boolean(string="是否有水费")
|
||||
is_electricity = fields.Boolean(string="是否有电费")
|
||||
is_manage = fields.Boolean(string="是否有管理费", compute='compute_is_manage')
|
||||
is_manage = fields.Boolean(string="是否有管理费")
|
||||
miscellaneous = fields.Text(string="其他约定")
|
||||
number = fields.Integer(string="次数", default=0)
|
||||
total_area = fields.Float(string="总面积", digits=(16, 4))
|
||||
@@ -231,11 +231,9 @@ class PropertyLeaseContract(models.Model):
|
||||
|
||||
water_fee_ids = fields.One2many('property.water.fee.line', 'contract_id', string="物业水表明细行")
|
||||
electricity_fee_ids = fields.One2many('property.electric.fee.line', 'contract_id', string="物业电表明细行")
|
||||
mange_fee_ids = fields.One2many('property.manage.fee.line', 'contract_id', string="物业管理费明细行", store=True) # 不需要
|
||||
other_ids = fields.One2many('property.other.fee.line', 'other_id', string="其他费用明细行")
|
||||
lease_bank_ids = fields.One2many('property.bank.line', 'contract_id', string="承租方账户明细行")
|
||||
bank_statements_ids = fields.One2many('property.bank.statements', 'contract_id', string="银行流水明细行")
|
||||
management_list_ids = fields.One2many('property.management.list', 'contract_id', string="管理费用明细行")
|
||||
contact_state = fields.Selection([('to', '待执行' ), ('ing', '执行中'), ('terminate', '中止'), ('complete', '完成'), ('early_termination', '提前终止'), ('settle', '结清')], string='合同管理状态', default='to')
|
||||
# 附件
|
||||
license_ids = fields.Many2many('ir.attachment',
|
||||
@@ -617,8 +615,7 @@ class PropertyLeaseContract(models.Model):
|
||||
contract_ids = self.env["property.lease.contract"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for rec in contract_ids:
|
||||
rec.compute_expiration_coming()
|
||||
|
||||
rec.onchange_lease_ids()
|
||||
|
||||
def update_admin_id(self):
|
||||
contract_ids = self.env["property.lease.contract"].browse(
|
||||
@@ -635,12 +632,18 @@ class PropertyLeaseContract(models.Model):
|
||||
@api.onchange("lease_ids")
|
||||
def onchange_lease_ids(self):
|
||||
for rec in self:
|
||||
start = rec.term_start_time
|
||||
end = rec.term_end_time
|
||||
total_months = (end.year - start.year) * 12 + (end.month - start.month)
|
||||
management_month_number = max(total_months, 0)
|
||||
# 初始化值
|
||||
rec.is_water = False
|
||||
rec.is_electricity = False
|
||||
rec.water_fee_ids = [(5, 0, 0)]
|
||||
rec.electricity_fee_ids = [(5, 0, 0)]
|
||||
rec.management_breakdown_ids = [(5, 0, 0)]
|
||||
water_fee_values = []
|
||||
message_fee_values = []
|
||||
electricity_fee_values = []
|
||||
if rec.lease_ids:
|
||||
# 处理每个租赁记录
|
||||
@@ -672,21 +675,26 @@ class PropertyLeaseContract(models.Model):
|
||||
'property_meter_archives_id': meter.property_meter_archives_id.id,
|
||||
}])
|
||||
|
||||
if lease.address_id.is_message_fee and lease.address_id.message_standard_id:
|
||||
message_fee_values.append([0, 0, {
|
||||
'breakdown_id': rec.id,
|
||||
'management_unit_price': lease.address_id.message_standard_id.amount,
|
||||
'management_monthly_amount': lease.address_id.message_standard_id.amount * lease.address_id.rent_area,
|
||||
'start_data': rec.term_start_time,
|
||||
'management_month_number': management_month_number + 1,
|
||||
'management_period_rent': management_month_number * lease.address_id.message_standard_id.amount * lease.address_id.rent_area,
|
||||
'end_data': rec.term_end_time,
|
||||
}])
|
||||
|
||||
rec.is_manage = bool(message_fee_values)
|
||||
rec.is_water = bool(water_fee_values)
|
||||
rec.is_electricity = bool(electricity_fee_values)
|
||||
if water_fee_values:
|
||||
rec.water_fee_ids = water_fee_values
|
||||
if electricity_fee_values:
|
||||
rec.electricity_fee_ids = electricity_fee_values
|
||||
|
||||
@api.depends('lease_ids')
|
||||
def compute_is_manage(self):
|
||||
for rec in self:
|
||||
rec.is_manage = False
|
||||
for lease in rec.lease_ids:
|
||||
if lease.address_id.is_message_fee and lease.address_id.message_standard_id:
|
||||
rec.is_manage = True
|
||||
break
|
||||
if message_fee_values:
|
||||
rec.management_breakdown_ids = message_fee_values
|
||||
|
||||
def all_end_approval(self):
|
||||
contract_ids = self.env["property.lease.contract"].browse(
|
||||
@@ -1629,14 +1637,13 @@ class PropertyLeaseContract(models.Model):
|
||||
rec.is_water = False
|
||||
|
||||
rec.electricity_fee_ids = [(5, 0, 0)]
|
||||
rec.mange_fee_ids = [(5, 0, 0)]
|
||||
rec.admin_id = rec.lease_ids[0].admin_line_id.id if rec.lease_ids else ''
|
||||
rec.tenure_type = rec.lease_ids[0].address_id.tenure_type if rec.lease_ids else ''
|
||||
rec.lessor_id = rec.lease_ids[0].address_id.company_id.id if rec.lease_ids else ''
|
||||
rec.precinct_id = rec.lease_ids[0].address_id.precinct_id.id if rec.lease_ids else ''
|
||||
rec.total_area = sum([lease.property_area for lease in rec.lease_ids])
|
||||
rec.electricity_fee_ids = electricity_list
|
||||
rec.mange_fee_ids = fee_list
|
||||
|
||||
|
||||
def trigger_lease_ids(self):
|
||||
property_ids = self.env["property.lease.contract"].browse(self._context.get('active_ids', self._context.get('active_id')))
|
||||
@@ -2065,11 +2072,11 @@ class PropertyLeaseContract(models.Model):
|
||||
for line in electric_lines:
|
||||
line.copy({'contract_id': new_contract.id})
|
||||
# 复制物业管理费明细行
|
||||
manage_lines = self.env['property.manage.fee.line'].search([
|
||||
('contract_id', '=', original_contract.id)
|
||||
])
|
||||
manage_lines = self.env['property.management.breakdown.line'].search([
|
||||
('breakdown_id', '=', original_contract.id)
|
||||
])
|
||||
for line in manage_lines:
|
||||
line.copy({'contract_id': new_contract.id})
|
||||
line.copy({'breakdown_id': new_contract.id})
|
||||
# 复制其他费用明细行
|
||||
other_lines = self.env['property.other.fee.line'].search([
|
||||
('other_id', '=', original_contract.id)
|
||||
@@ -2133,11 +2140,11 @@ class PropertyLeaseContract(models.Model):
|
||||
for line in electric_lines:
|
||||
line.copy({'contract_id': new_contract.id})
|
||||
# 复制物业管理费明细行
|
||||
manage_lines = self.env['property.manage.fee.line'].search([
|
||||
('contract_id', '=', lease_contract_ids.id)
|
||||
manage_lines = self.env['property.management.breakdown.line'].search([
|
||||
('breakdown_id', '=', lease_contract_ids.id)
|
||||
])
|
||||
for line in manage_lines:
|
||||
line.copy({'contract_id': new_contract.id})
|
||||
line.copy({'breakdown_id': new_contract.id})
|
||||
# 复制其他费用明细行
|
||||
other_lines = self.env['property.other.fee.line'].search([
|
||||
('other_id', '=', lease_contract_ids.id)
|
||||
@@ -2411,14 +2418,6 @@ class PropertyElectricFeeLine(models.Model):
|
||||
for line in rec.property_meter_archives_id.line_ids:
|
||||
line.line_loss = rec.line_loss
|
||||
|
||||
class PropertyManageFeeLine(models.Model):
|
||||
_name = 'property.manage.fee.line'
|
||||
_description = '物业管理费明细行'
|
||||
|
||||
contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
|
||||
charges = fields.Char(string="收费项", default='管理费')
|
||||
fees_id = fields.Many2one('property.message.fee', string="收费标准")
|
||||
|
||||
|
||||
class PropertyOtherFeeLine(models.Model):
|
||||
_name = 'property.other.fee.line'
|
||||
|
||||
@@ -57,7 +57,7 @@ class PropertyLeaseRenewal(models.Model):
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
work_end = fields.Boolean(string="结束")
|
||||
|
||||
deposit = fields.Float(string="押金")
|
||||
deposit = fields.Float(string="原押金")
|
||||
is_full_refund = fields.Boolean(string="是否全额退押", default=True)
|
||||
refund_amount = fields.Float(string="退款金额")
|
||||
balance = fields.Float(string="余额")
|
||||
@@ -181,8 +181,8 @@ class PropertyLeaseRenewal(models.Model):
|
||||
('due_date', '<=', rec.early_quitting_date),
|
||||
('contract_id', '=', rec.contract_id.id),
|
||||
])
|
||||
if any(not receivable.is_reconciliation for receivable in receivable_ids):
|
||||
raise UserError("该合同下存在未对账的应收单,无法提前退押金")
|
||||
# if any(not receivable.is_reconciliation for receivable in receivable_ids):
|
||||
# raise UserError("该合同下存在未对账的应收单,无法提前退押金")
|
||||
|
||||
rec.contract_id.write({
|
||||
'actual_end_time': rec.early_quitting_date
|
||||
@@ -199,21 +199,22 @@ class PropertyLeaseRenewal(models.Model):
|
||||
'management_type_id': refund_line.management_type_id.id,
|
||||
'amount': refund_line.refund_amount,
|
||||
'contract_id': rec.contract_id.id,
|
||||
'remake': rec.remake
|
||||
})
|
||||
|
||||
if rec.is_full_refund:
|
||||
deposit_management_type = self.env['yuthon.management.type'].search(
|
||||
[('name', '=', '押金')],
|
||||
limit=1
|
||||
)
|
||||
deposit_amount = rec.deposit if rec.is_full_refund else rec.refund_amount
|
||||
if deposit_amount > 0:
|
||||
bills_line_list.append({
|
||||
'due_date': fields.Date.today(),
|
||||
'management_type_id': deposit_management_type.id,
|
||||
'amount': deposit_amount,
|
||||
'contract_id': rec.contract_id.id,
|
||||
})
|
||||
# 押金
|
||||
deposit_management_type = self.env['yuthon.management.type'].search(
|
||||
[('name', '=', '押金')],
|
||||
limit=1
|
||||
)
|
||||
deposit_amount = rec.deposit if rec.is_full_refund else rec.refund_amount
|
||||
if deposit_amount > 0:
|
||||
bills_line_list.append({
|
||||
'due_date': fields.Date.today(),
|
||||
'management_type_id': deposit_management_type.id,
|
||||
'amount': deposit_amount,
|
||||
'contract_id': rec.contract_id.id,
|
||||
'remake': rec.remake
|
||||
})
|
||||
|
||||
if not rec.is_full_refund:
|
||||
start_time = datetime.combine(rec.early_quitting_date, datetime.min.time().replace(hour=8, minute=00))
|
||||
@@ -221,7 +222,7 @@ class PropertyLeaseRenewal(models.Model):
|
||||
'start_time': start_time,
|
||||
'original_amount': rec.balance,
|
||||
'name_account': rec.lessee_id.name,
|
||||
'remake': f'合同为{rec.contract_id.contract_code}{rec.remake}',
|
||||
'remake': rec.remake,
|
||||
})
|
||||
|
||||
# 创建应付账单
|
||||
|
||||
@@ -27,7 +27,6 @@ access_property_lease_contract_line,property_lease_contract_line,model_property_
|
||||
access_property_rent_breakdown_line,property_rent_breakdown_line,model_property_rent_breakdown_line,base.group_user,1,1,1,1
|
||||
access_property_water_fee_line,property_water_fee_line,model_property_water_fee_line,base.group_user,1,1,1,1
|
||||
access_property_electric_fee_line,property_electric_fee_line,model_property_electric_fee_line,base.group_user,1,1,1,1
|
||||
access_property_manage_fee_line,property_manage_fee_line,model_property_manage_fee_line,base.group_user,1,1,1,1
|
||||
access_property_other_fee_line,property_other_fee_line,model_property_other_fee_line,base.group_user,1,1,1,1
|
||||
access_property_renamed,property_renamed,model_property_renamed,base.group_user,1,1,1,1
|
||||
access_property_lessee_change,property_lessee_change,model_property_lessee_change,base.group_user,1,1,1,1
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
<field name="contract_id"/>
|
||||
<field name="property_name"/>
|
||||
<field name="lessee_id"/>
|
||||
<field name="remake"/>
|
||||
<button name="action_pay" string="核销" type="object" class="btn-primary" invisible="actual_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -64,9 +64,9 @@
|
||||
<group>
|
||||
<label for="contract_code"/>
|
||||
<div class="d-inline-flex w-100">
|
||||
<field name="contract_code" class="me-2" style="max-width: 12rem;" string="合同编号"/>
|
||||
<field name="contract_type" class="me-2" style="max-width: 7rem;" force_save="1"/>
|
||||
<field name="version" class="me-2" style="max-width: 7rem;" force_save="1"/>
|
||||
<field name="contract_code" class="me-2" style="max-width: 15rem;" string="合同编号"/>
|
||||
<field name="contract_type" class="me-2" style="max-width: 5rem;" force_save="1"/>
|
||||
<field name="version" class="me-2" style="max-width: 5rem;" force_save="1"/>
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
@@ -81,6 +81,7 @@
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="work_end" invisible="1"/>
|
||||
<field name="is_manage" invisible="1"/>
|
||||
<field name="rent_company" string="出租方" readonly="1"
|
||||
invisible="contract_sort != 'property'"/>
|
||||
<field name="lessee_id"/>
|
||||
@@ -267,16 +268,6 @@
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="其他费用" invisible="(state in ['分管领导', '总经理']) and (not work_end)">
|
||||
<field name="other_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="other_id" column_invisible="1"/>
|
||||
<field name="charges"/>
|
||||
<field name="coping"/>
|
||||
<field name="coping_time"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="水表明细" invisible="not is_water">
|
||||
<field name="water_fee_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
@@ -306,6 +297,29 @@
|
||||
<field name="end_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="管理费明细" invisible="not is_manage">
|
||||
<field name="management_breakdown_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="breakdown_id" column_invisible="1"/>
|
||||
<field name="management_unit_price"/>
|
||||
<field name="management_monthly_amount"/>
|
||||
<field name="start_data"/>
|
||||
<field name="end_data"/>
|
||||
<field name="management_month_number"/>
|
||||
<field name="management_period_rent"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="其他费用" invisible="(state in ['分管领导', '总经理']) and (not work_end)">
|
||||
<field name="other_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="other_id" column_invisible="1"/>
|
||||
<field name="charges"/>
|
||||
<field name="coping"/>
|
||||
<field name="coping_time"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="银行流水" invisible="(state in ['分管领导', '总经理']) and (not work_end)">
|
||||
<field name="bank_statements_ids" string=" ">
|
||||
@@ -1084,13 +1098,13 @@
|
||||
<!-- <field name="code">action = model.all_end_approval()</field>-->
|
||||
<!-- <field name="groups_id" eval="[(4, ref('base.group_system'))]"/>-->
|
||||
<!-- </record>-->
|
||||
<!-- <record id="update_contract" model="ir.actions.server">-->
|
||||
<!-- <field name="name">一次性</field>-->
|
||||
<!-- <field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>-->
|
||||
<!-- <field name="binding_model_id" ref="yuthon_property_approval.model_property_lease_contract"/>-->
|
||||
<!-- <field name="state">code</field>-->
|
||||
<!-- <field name="code">action = model.update_contract()</field>-->
|
||||
<!-- </record>-->
|
||||
<record id="update_contract" model="ir.actions.server">
|
||||
<field name="name">一次性</field>
|
||||
<field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
|
||||
<field name="binding_model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.update_contract()</field>
|
||||
</record>
|
||||
<!-- <record id="all_data_action_use_admin" model="ir.actions.server">-->
|
||||
<!-- <field name="name">调换</field>-->
|
||||
<!-- <field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>-->
|
||||
|
||||
@@ -157,6 +157,17 @@ class PenaltyLineWizard(models.Model):
|
||||
'penalty': penalty_receivable_id.submitted,
|
||||
}))
|
||||
|
||||
# 关联应付账单
|
||||
bills_id = self.env['property.bills.list'].search([('contract_id', '=', receivable.contract_id.id)])
|
||||
for bill in bills_id:
|
||||
if bill.actual_date:
|
||||
new_pay_lines.append((0, 0, {
|
||||
'date': bill.actual_date,
|
||||
'amount': bill.amount_actual,
|
||||
'management_type_id': bill.management_type_id.id,
|
||||
'remake': bill.remake,
|
||||
}))
|
||||
|
||||
self.penalty_line_ids = new_penalty_lines
|
||||
self.pay_line_ids = new_pay_lines
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ class PropertyBillsWizard(models.TransientModel):
|
||||
('contract_id', '=', self.bills_list_id.contract_id.id),
|
||||
])
|
||||
if any(not receivable.is_reconciliation for receivable in receivable_ids):
|
||||
raise UserError("该合同下存在未对账的应收单,无法退押金")
|
||||
raise UserError("该合同下存在未对账的应收单,无法退金额")
|
||||
|
||||
if self.actual_date:
|
||||
self.bills_list_id.actual_date = self.actual_date
|
||||
receivable = self.env['property.accounts.receivable'].search([('contract_id', '=', self.bills_list_id.contract_id.id),
|
||||
('management_type_id.name', '=', '押金')
|
||||
('management_type_id', '=', self.bills_list_i.management_type_id.id)
|
||||
])
|
||||
if receivable:
|
||||
receivable.write({'has_date': self.actual_date})
|
||||
|
||||
Reference in New Issue
Block a user