@@ -20,7 +20,7 @@ class SoongWorkflowLog(models.Model):
|
||||
workflow_id = fields.Many2one(comodel_name="soong.workflow")
|
||||
node_id = fields.Many2one(comodel_name="soong.workflow.node")
|
||||
node_btn_id = fields.Many2one(comodel_name="soong.workflow.node.button", string="动作名称")
|
||||
node_btn_name = fields.Selection([('0', ' '), ('1', '退回'), ('2', '加签'), ('3', '串'), ('4', '并')], string='节点功能', default='0')
|
||||
node_btn_name = fields.Selection([('0', ' '), ('1', '退回'), ('2', '加签'), ('3', '串'), ('4', '并')], store=True, string='节点功能', default='0')
|
||||
done_by = fields.Many2one(comodel_name="res.users", string="审批人")
|
||||
lase_click_date = fields.Datetime(string="操作时间")
|
||||
approval_state = fields.Selection([('0', '待办'), ('1', '办理中'), ('2', '已办结'), ('3', '结束')], string='状态', default='0')
|
||||
|
||||
@@ -533,10 +533,10 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
# res = self._load_one2many_views(view_type, res)
|
||||
res = self._update_fields_view(view_type, res)
|
||||
# res = self._add_state_tree_view(view_type, res)
|
||||
if self.env.user.has_group("soong_workflow.group_soong_workflow_manager"):
|
||||
res = self._add_soong_workflow_log_manager(view_type, res, params)
|
||||
else:
|
||||
res = self._add_soong_workflow_log(view_type, res, params)
|
||||
# if self.env.user.has_group("soong_workflow.group_soong_workflow_manager"):
|
||||
res = self._add_soong_workflow_log_manager(view_type, res, params)
|
||||
# else:
|
||||
# res = self._add_soong_workflow_log(view_type, res, params)
|
||||
res = self._load_sign_view(view_type, res)
|
||||
# res = self._load_workflow_approver_view(view_type, res)
|
||||
return res
|
||||
@@ -1056,9 +1056,7 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
all_models = res["models"].copy()
|
||||
for node in doc.xpath("/form/sheet"):
|
||||
# _add_tier_validation_reviews process
|
||||
str_element = self.env["ir.qweb"]._render(
|
||||
"soong_workflow.soong_workflow_log_manager", params
|
||||
)
|
||||
str_element = self.env["ir.qweb"]._render("soong_workflow.soong_workflow_log_manager", params)
|
||||
new_node = etree.fromstring(str_element)
|
||||
new_arch, new_models = View.postprocess_and_fields(new_node, self._name)
|
||||
for model in new_models:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<odoo>
|
||||
<template id="soong_workflow_log_manager">
|
||||
<notebook>
|
||||
<page string="审批详情">
|
||||
<page string="审批详情,正常-显示退回" invisible="work_end">
|
||||
<field name="log_ids" style="width:100%%; margin-top: 10px;">
|
||||
<tree editable="bottom">
|
||||
<field name="sequence" string="" widget="handle" groups="soong_workflow.group_soong_workflow_manager"/>
|
||||
@@ -11,7 +11,21 @@
|
||||
<field name="lase_click_date" string=""/>
|
||||
<field name="comment" string=""/>
|
||||
<field name="approval_state" string=""/>
|
||||
<field name="node_btn_name" string=""/>
|
||||
<field name="node_btn_name" string="" groups="soong_workflow.group_soong_workflow_manager"/>
|
||||
<field name="document_ids" string="" widget="preview_many2many"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="审批详情结束显示,隐藏退回" invisible="not work_end">
|
||||
<field name="log_ids" style="width:100%%; margin-top: 10px;" domain="[('node_btn_name', '!=', '1')]">
|
||||
<tree editable="bottom">
|
||||
<field name="sequence" string="" widget="handle" groups="soong_workflow.group_soong_workflow_manager"/>
|
||||
<field name="name" string="" readonly="0"/>
|
||||
<field name="done_by" string=""/>
|
||||
<field name="lase_click_date" string=""/>
|
||||
<field name="comment" string=""/>
|
||||
<field name="approval_state" string=""/>
|
||||
<field name="node_btn_name" string="" groups="soong_workflow.group_soong_workflow_manager"/>
|
||||
<field name="document_ids" string="" widget="preview_many2many"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -50,53 +64,53 @@
|
||||
</page>
|
||||
</notebook>
|
||||
</template>
|
||||
<template id="soong_workflow_log">
|
||||
<notebook>
|
||||
<page string="审批详情">
|
||||
<field name="log_ids" style="width:100%%; margin-top: 10px;">
|
||||
<tree create="false" edit="false" delete="false" editable="bottom" decoration-danger="node_btn_name == '1'">
|
||||
<field name="sequence" string="" column_invisible="1"/>
|
||||
<field name="name" string=""/>
|
||||
<field name="done_by" string=""/>
|
||||
<field name="lase_click_date" string=""/>
|
||||
<field name="comment" string=""/>
|
||||
<field name="approval_state" string=""/>
|
||||
<field name="node_btn_name" string=""/>
|
||||
<field name="document_ids" string="" widget="preview_many2many"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="抄送/传阅记录">
|
||||
<field name="log_ids2" style="width:100%%; margin-top: 10px;">
|
||||
<tree create="false" edit="false" delete="false" editable="bottom">
|
||||
<field name="done_by" string=""/>
|
||||
<field name="name" string=""/>
|
||||
<field name="approval_state" string=""/>
|
||||
<field name="lase_click_date" string=""/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="关联流程">
|
||||
<field name="soong_record_ids" style="width:100%%; margin-top: 10px;">
|
||||
<tree editable="bottom" delete="False">
|
||||
<field name="workflow_record_id" domain="[('users_ids', 'in', uid)]" options="{'no_open': True}"/>
|
||||
<field name="approvals_group_id"/>
|
||||
<field name="create_uid"/>
|
||||
<field name="write_date2"/>
|
||||
<button name="open_record" type="object" string="详情" class="btn-primary"/>
|
||||
<button name="unlink" type="object" string="删除" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="关联项目">
|
||||
<field name="project_ids" style="width:100%%; margin-top: 10px;">
|
||||
<tree editable="bottom">
|
||||
<field name="project_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="date_start"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</template>
|
||||
<!-- <template id="soong_workflow_log">-->
|
||||
<!-- <notebook>-->
|
||||
<!-- <page string="审批详情">-->
|
||||
<!-- <field name="log_ids" style="width:100%%; margin-top: 10px;" domain="[('node_btn_name', '!=', '1')]">-->
|
||||
<!-- <tree create="false" edit="false" delete="false" editable="bottom" decoration-danger="node_btn_name == '1'">-->
|
||||
<!-- <field name="sequence" string="" column_invisible="1"/>-->
|
||||
<!-- <field name="name" string=""/>-->
|
||||
<!-- <field name="done_by" string=""/>-->
|
||||
<!-- <field name="lase_click_date" string=""/>-->
|
||||
<!-- <field name="comment" string=""/>-->
|
||||
<!-- <field name="approval_state" string=""/>-->
|
||||
<!-- <field name="node_btn_name" string=""/>-->
|
||||
<!-- <field name="document_ids" string="" widget="preview_many2many"/>-->
|
||||
<!-- </tree>-->
|
||||
<!-- </field>-->
|
||||
<!-- </page>-->
|
||||
<!-- <page string="抄送/传阅记录">-->
|
||||
<!-- <field name="log_ids2" style="width:100%%; margin-top: 10px;">-->
|
||||
<!-- <tree create="false" edit="false" delete="false" editable="bottom">-->
|
||||
<!-- <field name="done_by" string=""/>-->
|
||||
<!-- <field name="name" string=""/>-->
|
||||
<!-- <field name="approval_state" string=""/>-->
|
||||
<!-- <field name="lase_click_date" string=""/>-->
|
||||
<!-- </tree>-->
|
||||
<!-- </field>-->
|
||||
<!-- </page>-->
|
||||
<!-- <page string="关联流程">-->
|
||||
<!-- <field name="soong_record_ids" style="width:100%%; margin-top: 10px;">-->
|
||||
<!-- <tree editable="bottom" delete="False">-->
|
||||
<!-- <field name="workflow_record_id" domain="[('users_ids', 'in', uid)]" options="{'no_open': True}"/>-->
|
||||
<!-- <field name="approvals_group_id"/>-->
|
||||
<!-- <field name="create_uid"/>-->
|
||||
<!-- <field name="write_date2"/>-->
|
||||
<!-- <button name="open_record" type="object" string="详情" class="btn-primary"/>-->
|
||||
<!-- <button name="unlink" type="object" string="删除" class="btn-primary"/>-->
|
||||
<!-- </tree>-->
|
||||
<!-- </field>-->
|
||||
<!-- </page>-->
|
||||
<!-- <page string="关联项目">-->
|
||||
<!-- <field name="project_ids" style="width:100%%; margin-top: 10px;">-->
|
||||
<!-- <tree editable="bottom">-->
|
||||
<!-- <field name="project_id"/>-->
|
||||
<!-- <field name="user_id"/>-->
|
||||
<!-- <field name="date_start"/>-->
|
||||
<!-- </tree>-->
|
||||
<!-- </field>-->
|
||||
<!-- </page>-->
|
||||
<!-- </notebook>-->
|
||||
<!-- </template>-->
|
||||
</odoo>
|
||||
|
||||
@@ -626,7 +626,7 @@ class HolidaysRequestBatch(models.Model):
|
||||
def _compute_holiday_allowance(self):
|
||||
for record in self:
|
||||
reports_id = self.env['yuthon.vacation.reports'].search([('employee_id', '=', record.users_id.employee_id.id)], limit=1)
|
||||
if reports_id:
|
||||
if reports_id and not record.log_ids:
|
||||
leave_hours_str = reports_id.leave.split('小时')[0].strip()
|
||||
leave_hours = float(leave_hours_str)
|
||||
leave_days = leave_hours / 8
|
||||
|
||||
@@ -10,16 +10,16 @@ class PropertyReconciliationWizard(models.Model):
|
||||
receivable_total = fields.Float(string='应收金额')
|
||||
bank_id = fields.Many2one('property.bank.statements', string='银行流水')
|
||||
account = fields.Char(string='账号')
|
||||
amount_been_reconciled = fields.Float(string='已对金额', compute="_compute_amount", store=True)
|
||||
amount_reconciled = fields.Float(string='未对金额', compute="_compute_amount", store=True)
|
||||
amount_been_reconciled = fields.Float(string='已对金额', store=True)
|
||||
amount_reconciled = fields.Float(string='未对金额', store=True)
|
||||
actual_total = fields.Float(string='实收金额')
|
||||
actual_date = fields.Date(string='实收日期')
|
||||
initial_total = fields.Float(string='初始金额', default=0.0)
|
||||
reconciliation_line_ids = fields.One2many('property.reconciliation.line', 'reconciliation_id', string='对账明细')
|
||||
|
||||
@api.depends('reconciliation_line_ids')
|
||||
def _compute_amount(self):
|
||||
pass
|
||||
# @api.depends('reconciliation_line_ids')
|
||||
# def _compute_amount(self):
|
||||
# pass
|
||||
# for rec in self:
|
||||
# rec.amount_been_reconciled = 0.0
|
||||
# rec.amount_reconciled = 0.0
|
||||
@@ -30,13 +30,12 @@ class PropertyReconciliationWizard(models.Model):
|
||||
# else:
|
||||
# rec.amount_reconciled = 0.0
|
||||
|
||||
@api.onchange('reconciliation_line_ids')
|
||||
@api.onchange('actual_total', 'actual_date')
|
||||
def _onchange_reconciliation_line_ids(self):
|
||||
if not self.reconciliation_line_ids:
|
||||
return
|
||||
new_lines = []
|
||||
remaining_amount = self.actual_total
|
||||
line_count = len(self.reconciliation_line_ids)
|
||||
# 检查是否有单行的rent等于实际金额
|
||||
exact_match_line = next((line for line in self.reconciliation_line_ids if line.rent == remaining_amount), None)
|
||||
if exact_match_line:
|
||||
@@ -61,37 +60,27 @@ class PropertyReconciliationWizard(models.Model):
|
||||
if key not in groups:
|
||||
groups[key] = []
|
||||
groups[key].append(line)
|
||||
|
||||
all_lines = self.reconciliation_line_ids
|
||||
sorted_lines = sorted(
|
||||
all_lines,
|
||||
key=lambda line: line.due_date if line.due_date else fields.Date.max
|
||||
)
|
||||
|
||||
sorted_lines = sorted(all_lines, key=lambda line: line.due_date if line.due_date else fields.Date.max)
|
||||
for line in sorted_lines:
|
||||
rent = line.rent or 0
|
||||
line.amount = 0 # 重置金额
|
||||
if remaining_amount <= 0:
|
||||
continue
|
||||
|
||||
# 分配不超过租金和剩余金额的数值
|
||||
assign_amount = min(rent, remaining_amount)
|
||||
line.amount = assign_amount
|
||||
remaining_amount -= assign_amount
|
||||
|
||||
# 检查是否违约
|
||||
if (line.due_date and self.actual_date and
|
||||
line.collection_type != 'deposit'):
|
||||
if (line.due_date and self.actual_date and line.collection_type != 'deposit'):
|
||||
# 计算应收日期的下月1号
|
||||
next_month_first = (fields.Date.from_string(line.due_date) + relativedelta(months=1)).replace(day=1)
|
||||
|
||||
# 如果实收日期晚于下月1号,产生违约
|
||||
if fields.Date.from_string(self.actual_date) > next_month_first:
|
||||
# 计算违约天数
|
||||
late_days = (fields.Date.from_string(self.actual_date) - next_month_first).days + 1
|
||||
|
||||
# 计算违约金 = 违约天数 * 应收租金 * 违约金百分比
|
||||
penalty_amount = late_days * line.rent * float(line.contract_id.percentage_liquidated_damages.name)
|
||||
penalty_amount = late_days * round(line.rent * float(line.contract_id.percentage_liquidated_damages.name), 2)
|
||||
if penalty_amount > 0:
|
||||
# 创建新的违约金记录,顺序值为原记录+1
|
||||
penalty_line_vals = {
|
||||
|
||||
Reference in New Issue
Block a user