@@ -36,9 +36,9 @@
|
||||
<field name="flow_start"/>
|
||||
<field name="flow_end" invisible="1"/>
|
||||
<field name="is_carbon_copy"/>
|
||||
<field name="is_apostille"/>
|
||||
<field name="employee_ids" widget="many2many_tags" invisible="not is_carbon_copy"
|
||||
options="{'no_create': True}"/>
|
||||
<field name="is_apostille"/>
|
||||
<field name="is_end"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -24,7 +24,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
|
||||
node_link_len = fields.Char(string="转交2")
|
||||
is_supervising = fields.Boolean(string="是否督办")
|
||||
comment_note_id = fields.Many2one('soong.note', string="常用意见", default='妥否,呈领导审批')
|
||||
comment_note = fields.Char(string="意见", default='同意')
|
||||
comment_note = fields.Char(string="意见", default='妥否,呈领导审批')
|
||||
comment = fields.Char(compute='_compute_comment', store=True)
|
||||
state_list = fields.Char(string="状态列表")
|
||||
record_id = fields.Integer()
|
||||
|
||||
@@ -62,6 +62,7 @@ class YuthonVacationReports(models.Model):
|
||||
is_no_card = fields.Integer(string="缺卡", compute='compute_attendance_fields', store=True, group_operator=None)
|
||||
is_work = fields.Integer(string='旷工', compute='compute_attendance_fields', store=True, group_operator=None)
|
||||
is_abnormal = fields.Integer(string="异常", compute='compute_attendance_fields', store=True, group_operator=None)
|
||||
att_mount = fields.Integer(string="出勤天数", compute='compute_att_mount', store=True, group_operator=None)
|
||||
|
||||
|
||||
vacation_state = fields.Selection(
|
||||
@@ -90,6 +91,57 @@ class YuthonVacationReports(models.Model):
|
||||
f"已存在假期额度记录,不能重复创建!"
|
||||
)
|
||||
|
||||
@api.depends('vacation_date', 'employee_id')
|
||||
def compute_att_mount(self):
|
||||
for record in self:
|
||||
target_date = record.vacation_date or fields.Date.today().replace(day=1)
|
||||
first_day = target_date.replace(day=1)
|
||||
if target_date.month == 12:
|
||||
next_month = 1
|
||||
next_year = target_date.year + 1
|
||||
else:
|
||||
next_month = target_date.month + 1
|
||||
next_year = target_date.year
|
||||
last_day = fields.Date.from_string(f"{next_year}-{next_month}-01") - timedelta(days=1)
|
||||
|
||||
first_day_str = fields.Date.to_string(first_day)
|
||||
last_day_str = fields.Date.to_string(last_day)
|
||||
attendance_records = self.env['hr.attendance'].search([
|
||||
('employee_id', '=', record.employee_id.id),
|
||||
('current_data', '>=', first_day_str),
|
||||
('current_data', '<=', last_day_str)
|
||||
])
|
||||
unique_dates = set(attendance_records.mapped('current_data'))
|
||||
record.att_mount = len(unique_dates)
|
||||
|
||||
def action_open(self):
|
||||
self.ensure_one()
|
||||
target_date = self.vacation_date or fields.Date.today().replace(day=1)
|
||||
first_day = target_date.replace(day=1)
|
||||
if target_date.month == 12:
|
||||
next_month = 1
|
||||
next_year = target_date.year + 1
|
||||
else:
|
||||
next_month = target_date.month + 1
|
||||
next_year = target_date.year
|
||||
last_day = fields.Date.from_string(
|
||||
f"{next_year}-{next_month}-01"
|
||||
) - timedelta(days=1)
|
||||
|
||||
first_day_str = fields.Date.to_string(first_day)
|
||||
last_day_str = fields.Date.to_string(last_day)
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("yuthon_hr_attendance.action_attendance_company_form")
|
||||
action.update({
|
||||
'domain': [
|
||||
('employee_id', '=', self.employee_id.id),
|
||||
('current_data', '>=', first_day_str),
|
||||
('current_data', '<=', last_day_str)
|
||||
]
|
||||
})
|
||||
return action
|
||||
|
||||
|
||||
|
||||
def confirm_state(self):
|
||||
for rec in self:
|
||||
rec.vacation_state = 'confirmed'
|
||||
|
||||
@@ -101,8 +101,10 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="假期额度日志">
|
||||
<sheet>
|
||||
<div>
|
||||
|
||||
<div name="button_box" class="oe_button_box">
|
||||
<button icon="fa-calendar" name="action_open" class="oe_stat_button" type="object">
|
||||
<field string="本月考勤记录" name="att_mount" widget="statinfo"/>
|
||||
</button>
|
||||
</div>
|
||||
<field name="employee_id"/>
|
||||
<field name="vacation_date"/>
|
||||
|
||||
@@ -393,6 +393,7 @@ class PropertyAccountsReceivable(models.Model):
|
||||
_rec_name = 'contract_id'
|
||||
|
||||
property_ids = fields.Many2many('yuthon.property', string='物业', compute='_compute_property_ids', store=True)
|
||||
property_name = fields.Text(string='物业', compute="_compute_property_name")
|
||||
management_area = fields.Float(related='contract_id.total_area', string='面积')
|
||||
title_deed = fields.Char(string="产权证号", compute='_compute_title_deed')
|
||||
lessee_id = fields.Many2one(related='contract_id.lessee_id', string='承租方')
|
||||
@@ -407,6 +408,11 @@ class PropertyAccountsReceivable(models.Model):
|
||||
rent_owed = fields.Float(string="欠租金额")
|
||||
per_day = fields.Float(string="每天违约金(元/天)")
|
||||
|
||||
@api.depends('contract_id')
|
||||
def _compute_property_name(self):
|
||||
for record in self:
|
||||
record.property_name = record.contract_id.property_name
|
||||
|
||||
@api.depends('property_ids')
|
||||
def _compute_title_deed(self):
|
||||
for record in self:
|
||||
|
||||
@@ -401,7 +401,10 @@ class PropertyLeaseContract(models.Model):
|
||||
})
|
||||
|
||||
def end_approval(self):
|
||||
self.write({'condition': 'be_executed'})
|
||||
self.write({'condition': 'be_executed',
|
||||
'actual_start_time': self.term_start_time,
|
||||
'actual_end_time': self.term_end_time,
|
||||
})
|
||||
|
||||
def open_record(self):
|
||||
return {
|
||||
@@ -1506,6 +1509,36 @@ class PropertyLeaseContract(models.Model):
|
||||
elif effective_month and today >= effective_month < term_end:
|
||||
contract.contact_state = 'terminate'
|
||||
|
||||
@api.onchange('actual_start', 'actual_end')
|
||||
def _onchange_contact_state(self):
|
||||
for contract in self:
|
||||
today = fields.Date.today()
|
||||
term_end = contract.term_start_time
|
||||
actual_start = contract.actual_start
|
||||
actual_end = contract.actual_end
|
||||
effective_month = None
|
||||
|
||||
if actual_end:
|
||||
last_day_of_month = calendar.monthrange(actual_end.year, actual_end.month)[1]
|
||||
if actual_end.day == last_day_of_month:
|
||||
effective_month = fields.Date.to_date(f"{actual_end.year}-{actual_end.month}-{last_day_of_month}")
|
||||
if effective_month.month == 12:
|
||||
effective_month = fields.Date.to_date(f"{effective_month.year + 1}-01-01")
|
||||
else:
|
||||
effective_month = fields.Date.to_date(f"{effective_month.year}-{effective_month.month + 1}-01")
|
||||
else:
|
||||
effective_month = fields.Date.to_date(f"{actual_end.year}-{actual_end.month}-01")
|
||||
|
||||
if not actual_start or today < actual_start:
|
||||
# 待执行:实际开始时间未到或未设置
|
||||
contract.contact_state = 'to'
|
||||
elif actual_start and (not actual_end or today < actual_end):
|
||||
# 执行中:已开始且未结束(或结束时间未设置)
|
||||
contract.contact_state = 'ing'
|
||||
elif today >= actual_end == term_end:
|
||||
contract.contact_state = 'complete'
|
||||
elif effective_month and today >= effective_month and effective_month < term_end:
|
||||
contract.contact_state = 'terminate'
|
||||
|
||||
# 续租
|
||||
def button_lease_extension(self):
|
||||
|
||||
@@ -16,7 +16,8 @@ class PropertyManagement(models.Model):
|
||||
default=lambda self: self.env['ir.sequence'].next_by_code('property_management_code'))
|
||||
reason_change = fields.Char(string="变更事由")
|
||||
user_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user)
|
||||
department_id = fields.Many2one('hr.department', related='user_id.employee_id.department_id',string="申请人部门")
|
||||
department_id = fields.Many2one('hr.department', related='user_id.employee_id.department_id',string="申请人部门", store=True)
|
||||
company_id = fields.Many2one('res.company', related='user_id..employee_id.company_id', string="公司", store=True)
|
||||
handling_opinions = fields.Text(string="经办意见")
|
||||
management_line2_ids = fields.One2many('property.management.line2', 'property_management_id', string="原物业信息")
|
||||
management_line_ids = fields.One2many('property.management.line', 'property_management_id', string="物业信息")
|
||||
|
||||
@@ -276,7 +276,8 @@
|
||||
<xpath expr="//field[@name='payout_date']" position="after">
|
||||
<field name="lessee_id" options="{'no_create': True}" readonly="1"/>
|
||||
<field name="title_deed" readonly="1"/>
|
||||
<field name="property_ids" options="{'no_create': True}" widget="many2many_tags"/>
|
||||
<field name="property_ids" options="{'no_create': True}" widget="many2many_tags" column_invisible="1"/>
|
||||
<field name="property_name"/>
|
||||
<field name="contract_id" string="合同编号" options="{'no_create': True}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='receivable_log']" position="after">
|
||||
|
||||
@@ -453,6 +453,7 @@ class PropertyReconciliationLine(models.Model):
|
||||
|
||||
reconciliation_id = fields.Many2one('property.reconciliation.wizard', string='关联对账单弹窗')
|
||||
sequence = fields.Integer(string='顺序')
|
||||
property_name = fields.Text(string='物业', compute="_compute_property_name")
|
||||
property_ids = fields.Many2many('yuthon.property', string='物业', compute="_compute_property_ids", store=True)
|
||||
contract_id = fields.Many2one('property.lease.contract', string='合同编号')
|
||||
rent_month = fields.Float(string='当期金额')
|
||||
@@ -464,6 +465,11 @@ class PropertyReconciliationLine(models.Model):
|
||||
('other', '其他')], string='收款类型', store=True)
|
||||
remake = fields.Char(string='备注')
|
||||
|
||||
@api.depends('contract_id')
|
||||
def _compute_property_name(self):
|
||||
for record in self:
|
||||
record.property_name = record.contract_id.property_name
|
||||
|
||||
@api.depends('contract_id', 'contract_id.lease_ids', 'contract_id.lease_ids.address_id')
|
||||
def _compute_property_ids(self):
|
||||
for record in self:
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<field name="sequence" column_invisible="1" />
|
||||
<field name="reconciliation_id" column_invisible="1"/>
|
||||
<field name="property_ids" readonly="1" column_invisible="1"/>
|
||||
<field name="property_name"/>
|
||||
<field name="contract_id" readonly="1" force_save="1"/>
|
||||
<field name="due_date" readonly="1" force_save="1"/>
|
||||
<field name="rent_month" sum = "Total" readonly="1" force_save="1"/>
|
||||
|
||||
Reference in New Issue
Block a user