@@ -132,38 +132,7 @@ class YuthonVacationReports(models.Model):
|
||||
|
||||
def confirm_state(self):
|
||||
for rec in self:
|
||||
rec.vacation_state = 'confirmed'
|
||||
# 计算下个月的日期(基于当前记录的vacation_date)
|
||||
current_date = rec.vacation_date
|
||||
if current_date.month == 12:
|
||||
next_month_date = current_date.replace(year=current_date.year + 1, month=1, day=1)
|
||||
else:
|
||||
next_month_date = current_date.replace(month=current_date.month + 1, day=1)
|
||||
# 查找下个月是否已有该员工的记录
|
||||
next_month_record = self.search([
|
||||
('employee_id', '=', rec.employee_id.id),
|
||||
('vacation_date', '=', next_month_date)
|
||||
], limit=1)
|
||||
|
||||
inherit_vals = {
|
||||
'leave': rec.leave,
|
||||
'working_overtime': rec.working_overtime,
|
||||
'medical_fee': rec.medical_fee,
|
||||
}
|
||||
if next_month_record:
|
||||
# 如果下个月记录已存在,更新继承字段
|
||||
next_month_record.write(inherit_vals)
|
||||
|
||||
# 处理年假明细行继承
|
||||
if rec.leave:
|
||||
leave_hours = rec.leave * 8
|
||||
self._update_leave_lines(next_month_record, [rec], leave_hours)
|
||||
|
||||
# 处理补休明细行继承
|
||||
if rec.working_overtime:
|
||||
overtime_hours = rec.working_overtime * 8
|
||||
self._update_over_lines(next_month_record, [rec], overtime_hours)
|
||||
|
||||
rec.manage_reject()
|
||||
|
||||
@api.depends('vacation_date')
|
||||
def _compute_display_date(self):
|
||||
|
||||
@@ -396,7 +396,8 @@
|
||||
<button name="penalty_wizard" string="收款明细" type="object" class="btn btn-primary" invisible="is_penalty"/>
|
||||
<button name="button_accounts_wizard" string="操作" type="object" class="btn btn-primary"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='management_type_id']" position="after">
|
||||
<xpath expr="//field[@name='remark']" position="after">
|
||||
<field name="charging_range"/>
|
||||
<field name="is_penalty" column_invisible="1"/>
|
||||
<field name="property_name" width="350px"/>
|
||||
<field name="property_ids" options="{'no_create': True}" widget="many2many_tags" column_invisible="1"/>
|
||||
@@ -410,9 +411,6 @@
|
||||
<!-- <field name="company_id1"/>-->
|
||||
<field name="contract_id" string="合同编号"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='create_time']" position="after">
|
||||
<field name="charging_range"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='receivable_log']" position="after">
|
||||
<field name="penalty"/>
|
||||
<field name="penalty_date"/>
|
||||
|
||||
@@ -63,18 +63,24 @@ class YuthonProperty(models.Model):
|
||||
|
||||
@api.model
|
||||
def get_domain(self, start_date=False, end_date=False, company_id=False):
|
||||
|
||||
if not start_date or not end_date:
|
||||
return []
|
||||
if not company_id:
|
||||
return []
|
||||
|
||||
# 这里进行条件的修改
|
||||
property_records = self.env['yuthon.property'].search([('company_id', '=', company_id),('effective_date','>',start_date),('effective_date','<',end_date)])
|
||||
property_records = self.env['yuthon.property'].search([('company_id', '=', company_id)])
|
||||
|
||||
user_ids = set()
|
||||
for property_record in property_records:
|
||||
user_ids.add(property_record.admin_id.id)
|
||||
user_ids.add(property_record.users_id.id)
|
||||
user_ids.add(property_record.admin_id.employee_ids.id)
|
||||
|
||||
return list(user_ids)
|
||||
|
||||
@api.model
|
||||
def get_company_domain(self, user_id=False):
|
||||
if not user_id:
|
||||
return []
|
||||
|
||||
company_id = self.env['yuthon.property'].search([('admin_id', '=', user_id)], limit=1).company_id.id
|
||||
return company_id
|
||||
@@ -87,11 +87,14 @@ class ReceivableReport extends Component {
|
||||
}
|
||||
|
||||
getDomain() {
|
||||
// 过滤条件
|
||||
// return [['id', 'in', [107, 106, 215, 112, 110, 214, 218, 173, 219]]]
|
||||
console.log(this.state)
|
||||
return [['id','in',this.state.domainUsers]]
|
||||
console.log(this.state)
|
||||
const isCompanyEmpty = Object.keys(this.state.selectCompany).length === 0;
|
||||
if (isCompanyEmpty) {
|
||||
return [];
|
||||
} else {
|
||||
return [['id','in', this.state.domainUsers]];
|
||||
}
|
||||
}
|
||||
|
||||
async onUpdatePartner(v) {
|
||||
console.log(v)
|
||||
@@ -118,8 +121,7 @@ class ReceivableReport extends Component {
|
||||
}
|
||||
|
||||
async onUpdateCompany(v) {
|
||||
this.state.selectCompany = v[0]
|
||||
|
||||
this.state.selectCompany = v[0] || {}
|
||||
// 查询这个过程中的 user_id 组合成列表.返回.
|
||||
// 重置 partner 筛选结果
|
||||
// 修改过滤条件
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<Many2XAutocomplete
|
||||
value="state.selectPartner?.display_name"
|
||||
getDomain.bind="getDomain"
|
||||
resModel="'res.users'"
|
||||
resModel="'yuthon.precinct.message'"
|
||||
fieldString="'片区管理员'"
|
||||
activeActions="{}"
|
||||
update.bind="onUpdatePartner"
|
||||
|
||||
@@ -88,7 +88,7 @@ class YouthonReport extends Component {
|
||||
keyword: this.state.keyword || false,
|
||||
condition:this.state.condition || false,
|
||||
partner_id:this.state.selectPartner?.id,
|
||||
company_id:this.state.selectCompany?.id,
|
||||
company_id:this.state.selectCompany?.id ,
|
||||
};
|
||||
const result = await this.serviceOrm.call(
|
||||
this.config.model,
|
||||
|
||||
Reference in New Issue
Block a user