@@ -15,7 +15,6 @@
|
||||
<field name="documents_ids" optional="hide"/>
|
||||
<group expand="0" string="审批分组">
|
||||
<filter string="审批类型分组" name='group_by_approvals_group_id' context="{'group_by':'approvals_group_id'}"/>
|
||||
<filter name="group_by_employee" string="我的流程" context="{'group_by': 'employee_ids.user_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
@@ -119,9 +118,8 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">soong.workflow.record</field>
|
||||
<field name="view_mode">tree,kanban,search</field>
|
||||
<field name="domain">[('reclaim_state', '=', False)]</field>
|
||||
<field name="domain">[('employee_ids.user_id', '=', uid), ('reclaim_state', '=', False)]</field>
|
||||
<field name="search_view_id" ref="soong_workflow_record_search"/>
|
||||
<field name="context">{'search_default_group_by_employee': True}</field>
|
||||
</record>
|
||||
<record id="soong_workflow_hr_employee_action" model="ir.actions.act_window">
|
||||
<field name="name">人事相关流程</field>
|
||||
|
||||
@@ -50,12 +50,7 @@ class GoApprovals(models.Model):
|
||||
@api.onchange('is_day', 'is_hour')
|
||||
def _onchange_role_selection(self):
|
||||
if self.is_day and self.is_hour:
|
||||
return {
|
||||
'warning': {
|
||||
'title': _('输入错误'),
|
||||
'message': _('只能选择主角色或者角色组中的一个,不能同时选择。')
|
||||
}
|
||||
}
|
||||
raise UserError("只能选择按天或按小时")
|
||||
|
||||
@api.onchange('start_day_selection', 'end_day_selection')
|
||||
def _onchange_selection_fields(self):
|
||||
|
||||
@@ -28,7 +28,7 @@ class PropertyAccountsReceivable(models.Model):
|
||||
remark = fields.Text(string='备注')
|
||||
red_date = fields.Date(string='红冲日期')
|
||||
charge_status = fields.Selection([('unpaid', '未收'), ('fully_paid', '已收')], string='收费状态')
|
||||
is_suspend = fields.Boolean(string='挂起')
|
||||
is_suspend = fields.Boolean(string='是否挂起')
|
||||
create_time = fields.Date(string='创建日期', default=lambda self: fields.Date.today())
|
||||
is_billing = fields.Boolean(string='开票')
|
||||
is_reconciliation = fields.Boolean(string='对账')
|
||||
@@ -41,4 +41,13 @@ class PropertyAccountsReceivable(models.Model):
|
||||
last_update_time = fields.Datetime(string='最后修改时间')
|
||||
|
||||
def unlink(self):
|
||||
return super().unlink()
|
||||
return super().unlink()
|
||||
|
||||
# 激活
|
||||
def suspend(self):
|
||||
return self.write({'is_suspend': False})
|
||||
|
||||
|
||||
# 挂起
|
||||
def unsuspend(self):
|
||||
return self.write({'is_suspend': True})
|
||||
@@ -24,7 +24,10 @@
|
||||
<field name="is_red" column_invisible="1"/>
|
||||
<field name="is_reconciliation" optional="hide"/>
|
||||
<field name="difference_amount"/>
|
||||
<field name="is_suspend" optional="hide"/>
|
||||
<button name="unlink" string="删除" type="object" class="oe_highlight"/>
|
||||
<button name="suspend" string="激活" type="object" class="oe_highlight" invisible="not is_suspend"/>
|
||||
<button name="unsuspend" string="挂起" type="object" class="oe_highlight" invisible="is_suspend"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -36,27 +39,12 @@
|
||||
<field name="property_id"/>
|
||||
<field name="lessee_id"/>
|
||||
<group expand="0" string="group_by">
|
||||
<filter name="group_is_reconciliation" string="对账" context="{'group_by':'is_reconciliation'}"/>
|
||||
<filter name="group_property_id" string="物业" context="{'group_by':'property_id'}"/>
|
||||
<filter name="group_lessee_id" string="承租方" context="{'group_by':'lessee_id'}"/>
|
||||
<filter name="group_is_reconciliation" string="对账" context="{'group_by':'is_reconciliation'}"/>
|
||||
</group>
|
||||
<header_search>
|
||||
<quick_filter string="应收状态">
|
||||
<filter string="红冲" name="is_red" domain="[('is_red', '=', True)]"/>
|
||||
<filter string="开票" name="is_billing " domain="[('is_billing', '=', True)]"/>
|
||||
<filter string="对账" name="is_reconciliation" domain="[('is_reconciliation', '=', True)]"/>
|
||||
<filter string="未对账" name="not_reconciliation" domain="[('is_reconciliation', '=', False)]"/>
|
||||
<filter string="未开票" name="not_billing" domain="[('is_billing', '=', False)]"/>
|
||||
</quick_filter>
|
||||
</header_search>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<record id="property_accounts_receivable_action" model="ir.actions.act_window">
|
||||
<field name="name">应收列表</field>
|
||||
<field name="res_model">property.accounts.receivable</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="context">{'search_default_group_is_reconciliation': 0}</field>
|
||||
</record>
|
||||
<record id="all_property_accounts_receivable_contract" model="ir.actions.server">
|
||||
<field name="name">批量导入合同</field>
|
||||
|
||||
@@ -52,7 +52,7 @@ class PropertyBankStatements(models.Model):
|
||||
dt = datetime.strptime(str(record.start_time), '%Y-%m-%d %H:%M:%S').date() # 对账日期
|
||||
due = datetime.strptime(str(receivable_id.due_date), '%Y-%m-%d').date() # 应收日期
|
||||
# 判断是否违约
|
||||
if receivable_id.due_date > record.start_time and not receivable_id.is_reconciliation:
|
||||
if receivable_id.due_date > record.start_time and not receivable_id.is_reconciliation or not receivable_id.is_suspend:
|
||||
original_amount = (due - dt).days * (receivable_id.original_amount - record.original_amount) * 0.001
|
||||
self.env['property.penalty.list'].create({
|
||||
'contract_id': contract_id.id,
|
||||
@@ -136,6 +136,8 @@ class PropertyBankStatements(models.Model):
|
||||
}
|
||||
total_rent_month += original_amount # 累加总金额
|
||||
vals_list.append((0, 0, vals))
|
||||
|
||||
|
||||
return vals_list
|
||||
|
||||
all_vals = []
|
||||
@@ -145,30 +147,6 @@ class PropertyBankStatements(models.Model):
|
||||
all_vals.extend(create_reconciliation_vals(water_ids, 'water_fee'))
|
||||
all_vals.extend(create_reconciliation_vals(electricity_ids, 'electricity_fee'))
|
||||
|
||||
# 处理违约金(关键新增逻辑)
|
||||
transaction_date = record.transaction_time # 银行流水交易时间
|
||||
if transaction_date:
|
||||
# 查找违约金记录中 start_date <= 交易时间 <= end_date 的记录
|
||||
penalty_records = penalty_ids.filtered(
|
||||
lambda p: p.start_date and p.end_date and
|
||||
p.start_date <= transaction_date and
|
||||
p.end_date >= transaction_date
|
||||
)
|
||||
for penalty in penalty_records:
|
||||
# 计算违约金金额(original_amount - deduction_amount)
|
||||
penalty_amount = (penalty.original_amount or 0) - (penalty.deduction_amount or 0)
|
||||
if penalty_amount > 0:
|
||||
vals = {
|
||||
'property_id': penalty.property_id.id if penalty.property_id else False,
|
||||
'contract_id': penalty.contract_id.id if penalty.contract_id else False,
|
||||
'rent_month': penalty_amount,
|
||||
'rent': penalty_amount,
|
||||
'collection_type': 'penalty', # 新增违约金类型
|
||||
'due_date': penalty.due_date if penalty.due_date else False,
|
||||
}
|
||||
total_rent_month -= penalty_amount
|
||||
all_vals.append((0, 0, vals))
|
||||
|
||||
return all_vals, total_rent_month
|
||||
return [], 0
|
||||
|
||||
|
||||
@@ -348,6 +348,12 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="property_accounts_receivable_action" model="ir.actions.act_window">
|
||||
<field name="name">应收列表</field>
|
||||
<field name="res_model">property.accounts.receivable</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="context">{'group_by': 'contract_id'}</field>
|
||||
</record>
|
||||
<record id="all_button_accounts_receivable" model="ir.actions.server">
|
||||
<field name="name">批量生成违约金</field>
|
||||
<field name="model_id" ref="yuthon_property.model_property_accounts_receivable"/>
|
||||
|
||||
@@ -9,8 +9,28 @@ class PropertyReconciliationWizard(models.Model):
|
||||
receivable_total = fields.Float(string='应收金额')
|
||||
account = fields.Char(string='账号')
|
||||
actual_total = fields.Float(string='实收金额')
|
||||
initial_total = fields.Float(string='初始金额', default=0.0)
|
||||
reconciliation_line_ids = fields.One2many('property.reconciliation.line', 'reconciliation_id', string='对账明细')
|
||||
|
||||
@api.onchange('actual_total')
|
||||
def _onchange_actual_total(self):
|
||||
if not self.reconciliation_line_ids:
|
||||
return
|
||||
# 首次设置时记录初始值
|
||||
if not self.initial_total:
|
||||
self.initial_total = self.actual_total
|
||||
# 遍历明细行,按规则分配金额
|
||||
for index, line in enumerate(self.reconciliation_line_ids):
|
||||
if index == 0:
|
||||
# 第一行等于初始值
|
||||
line.amount = self.initial_total
|
||||
elif index == 1:
|
||||
# 第二行等于当前值减去初始值
|
||||
line.amount = max(0, self.actual_total - self.initial_total)
|
||||
else:
|
||||
# 第三行及以后:当前值 - (初始值 * 行号),但不小于0
|
||||
line.amount = max(0, self.actual_total - (self.initial_total * index))
|
||||
|
||||
def confirm(self):
|
||||
pass
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<field name="account"/>
|
||||
<field name="receivable_total"/>
|
||||
<field name="actual_total"/>
|
||||
<field name="initial_total" invisible="1"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page name="对账明细">
|
||||
|
||||
@@ -704,7 +704,7 @@
|
||||
sequence="1"
|
||||
name="应收账单"
|
||||
parent="yuthon_financial_management_menu"
|
||||
action="yuthon_property.property_accounts_receivable_action"/>
|
||||
action="yuthon_property_approval.property_accounts_receivable_action"/>
|
||||
<menuitem id="yuthon_subject_form_menu"
|
||||
sequence="5"
|
||||
name="预算科目表"
|
||||
|
||||
Reference in New Issue
Block a user