Merge pull request !1265 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-01-10 08:55:49 +00:00
committed by Gitee
3 changed files with 69 additions and 15 deletions
+2 -2
View File
@@ -214,7 +214,7 @@ class HrAttendance(models.Model):
# 保安部 - 白班
def ba_card_white_up(self):
ba_up_users = self.env['planning.slot'].search(
[('role_id.name', '=', '保安部'), ('template_id.planning_name', '=', '白班')])
[('role_id.name', '=', '保安部'), ('template_id.planning_name', '=', '早班')])
for user in ba_up_users:
if user.start_datetime.date() == fields.date.today():
self.env['card.remind.form'].create({
@@ -226,7 +226,7 @@ class HrAttendance(models.Model):
def ba_card_white_down(self):
ba_up_users = self.env['planning.slot'].search(
[('role_id.name', '=', '保安部'), ('template_id.planning_name', '=', '白班')])
[('role_id.name', '=', '保安部'), ('template_id.planning_name', '=', '早班')])
for user in ba_up_users:
if user.start_datetime.date() == fields.date.today():
self.env['card.remind.form'].create({
@@ -3,7 +3,7 @@
import pandas as pd
import calendar
from dateutil.relativedelta import relativedelta
from datetime import datetime, timedelta
from datetime import datetime, timedelta, date
from odoo.tools.float_utils import float_round
from numpy.ma.core import default_filler
@@ -74,6 +74,11 @@ class PropertyLeaseContract(models.Model):
term_start_time = fields.Date(string="开始时间", default=fields.Datetime.now)
term_start_month_day = fields.Char(string="开始时间", compute="_compute_term_start_month_day")
term_end_time = fields.Date(string="结束时间")
actual_start_time = fields.Date(string="实际开始时间")
actual_end_time = fields.Date(string="实际结束时间", default=fields.Datetime.now)
end_comparison = fields.Selection([('red', '红'),('yellow', '黄'),('blue', '蓝')], string="结束时间对比", compute='_compute_end_comparison', store=True)
is_equal = fields.Boolean(string="是否相等", compute='_compute_end_comparison', store=True)
term_end_month_day = fields.Char(string="结束时间", compute="_compute_term_end_month_day")
cycle_dict =fields.Selection([('monthly','月度'), ('quarter','季度'), ('half','半年'),('year','年度')],string='付款方式', default='monthly', help="应收")
cycle_mode = fields.Selection([('fixed_monthly','合同月'), ('floating_monthly','自然月'), ('fixed_quarter', '合同季'), ('floating_quarter', '自然季'),
@@ -103,6 +108,7 @@ class PropertyLeaseContract(models.Model):
first_pay = fields.Date(string="首次付款日")
unit_price = fields.Float(string="单价")
deposit_type = fields.Selection([('deposit', '押金'), ('performance', '履约保证金')], string="押金/履约保证金")
deposit_status = fields.Selection([('unpaid', '未支付'), ('paid', '已支付'), ('returned','已退'),('no_paid', '没收')], string='押金状态')
deposit = fields.Float(string="押金/履约保证金", store=True)
performance_bonds_write = fields.Char(string="履约保证金大写")
first_year_rent = fields.Float(string="首年租金")
@@ -120,8 +126,9 @@ class PropertyLeaseContract(models.Model):
total_area = fields.Float(string="总面积", digits=(16, 4))
not_received = fields.Float(string="未收")
actual_receivable = fields.Float(string="实际应收")
now_receivable = fields.Float(string="当前应收")
now_receivable = fields.Float(string="当期应收")
total_receivable = fields.Float(string="总已收")
comparison = fields.Selection([('outweigh','大于'),('equal','等于'),('less','小于')], string="对比", compute='_compute_comparison', store=True)
progress_percentage = fields.Float(string="合同进度", compute="_compute_progress_percentage")
condition = fields.Selection([('new', '新建'),('approval','审批'),('cancel','作废')], string="状态", default='new')
message_type = fields.Selection([('be_executed','待执行'), ('executed','已执行'), ('expired','已终止'), ('advance','提前终止')], string="合同状态")
@@ -149,6 +156,35 @@ class PropertyLeaseContract(models.Model):
responsibility_book_id = fields.Many2one('ir.attachment', string="安全生产责任书")
handover_time = fields.Date(string="交接日期")
@api.depends('not_received', 'now_receivable')
def _compute_comparison(self):
for record in self:
if record.not_received and record.now_receivable:
if record.not_received > record.now_receivable:
record.comparison = 'outweigh'
elif record.not_received < record.now_receivable:
record.comparison = 'less'
else:
record.comparison = 'equal'
@api.depends('term_end_time', 'actual_end_time', 'term_start_time')
def _compute_end_comparison(self):
for record in self:
if record.term_end_time and record.actual_end_time and record.term_start_time:
delta = record.term_end_time - record.actual_end_time
if 60<= abs(delta.days) < 90:
record.end_comparison = 'blue'
elif 30<= abs(delta.days) < 60:
record.end_comparison = 'yellow'
elif 30 > abs(delta.days):
record.end_comparison = 'red'
else:
record.end_comparison = None
if record.actual_end_time == record.term_start_time:
record.is_equal = True
else:
record.end_comparison = None
@api.depends('term_start_time')
def _compute_term_start_month_day(self):
for record in self:
@@ -822,7 +858,8 @@ class PropertyLeaseContract(models.Model):
company_id = record.lease_ids[0].address_id.company_id.id if record.lease_ids else ''
admin_id = record.lease_ids[0].admin_id.id if record.lease_ids else ''
record.write({'company_id': company_id,
'admin_id': admin_id})
'admin_id': admin_id,
'actual_end_time': datetime.now()})
def action_yuthon_property_contract_wizard(self):
return {
@@ -1006,7 +1043,8 @@ class PropertyLeaseContract(models.Model):
if admin_id and user_id:
record.write({
'admin_id': user_id.id,
'users_id': admin_id.id,})
'users_id': admin_id.id,
})
def choose_property_button(self):
return {
@@ -294,23 +294,32 @@
</form>
</field>
</record>
<record id="view_property_lease_contract_tree1" model="ir.ui.view">
<field name="name">property.lease.contract.tree</field>
<field name="model">property.lease.contract</field>
<field name="arch" type="xml">
<tree string="租赁合同审批">
<field name="name"/>
<field name="code"/>
<field name="code" decoration-danger = "is_equal"/>
<field name="lessee_id"/>
<field name="total_area"/>
<field name="deposit"/>
<field name="is_equal"/>
<field name="deposit" decoration-success = "deposit_status == 'paid'"
decoration-danger = "deposit_status == 'unpaid'" decoration-muted = "deposit_status == 'returned'"
decoration-warning = "deposit_status == 'no_paid'"/>
<field name="rent"/>
<field name="not_received"/>
<field name="not_received" decoration-muted="comparison == 'equal'"
decoration-danger = "comparison == 'outweigh'"
decoration-success = "comparison == 'less'"/>
<field name="comparison"/>
<field name="percentage_damages"/>
<field name="total_receivable"/>
<field name="term_start_month_day"/>
<field name="term_end_month_day"/>
<field name="end_comparison" invisible="1"/>
<field name="term_end_month_day" decoration-info="end_comparison == 'blue'"
decoration-danger = "end_comparison == 'red'"
decoration-warning = "end_comparison == 'yellow'"/>
<field name="deposit_status"/>
<field name="company_id" string="所属公司"/>
<field name="admin_id" string="负责人"/>
</tree>
@@ -371,7 +380,11 @@
<field name="department_id" invisible="1"/>
<field name="name"/>
<field name="use_address"/>
<field name="deposit_status"/>
<field name="address_for_delivery"/>
<field name="is_equal"/>
<field name="end_comparison" invisible="1"/>
<field name="comparison" invisible="1"/>
<field name="message_type" readonly="1" invisible="1"/>
</group>
</group>
@@ -438,6 +451,8 @@
</div>
<field name="term_start_time"/>
<field name="term_end_time" readonly="1" force_save="1"/>
<field name="actual_start_time"/>
<field name="actual_end_time"/>
<label for="cycle_mode"/>
<div class="d-inline-flex w-100">
<field name="cycle_mode" class="me-2"
@@ -490,7 +505,6 @@
<field name="increment_value"
class="me-2" style="max-width: 5rem !important;"/>
</div>
<field name="tax_rate"/>
<label for="deposit_type"/>
<div class="d-inline-flex w-100">
<field name="deposit_type" string="押金/履约保证金" class="me-2"
@@ -507,9 +521,11 @@
<field name="percentage_liquidated_damages" class="me-2"
style="max-width: 11rem !important;"/>
</div>
<field name="actual_receivable"/>
<field name="now_receivable"/>
<field name="total_receivable"/>
<field name="tax_rate"/>
<field name="not_received" invisible="1"/>
<field name="actual_receivable" invisible="1"/>
<field name="now_receivable" invisible="1"/>
<field name="total_receivable" invisible="1"/>
</group>
</group>
<group col="3">