添加功能
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import api, fields, models, _
|
||||
import datetime
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class HrJob(models.Model):
|
||||
@@ -45,29 +44,6 @@ class HrJob(models.Model):
|
||||
other_notes = fields.Text(string="任职要求")
|
||||
function = fields.Text(string="岗位职责")
|
||||
|
||||
is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company',
|
||||
search='_search_part_of_company')
|
||||
|
||||
@api.depends_context('uid', 'company')
|
||||
@api.depends('company_id')
|
||||
def _compute_is_company(self):
|
||||
active_company_ids = self.env.companies
|
||||
for employee in self:
|
||||
employee.is_company = employee.company_id in active_company_ids
|
||||
|
||||
def _search_part_of_company(self, operator, value):
|
||||
if operator not in ('=', '!=') or not isinstance(value, bool):
|
||||
raise UserError(('Operation not supported'))
|
||||
company_ids = self.env.companies.ids # 获取公司ID列表
|
||||
# 处理反向操作符
|
||||
if not value:
|
||||
operator = '!=' if operator == '=' else '='
|
||||
# 使用company_id in company_ids的结构
|
||||
if operator == '=':
|
||||
return [('company_id', 'in', company_ids)]
|
||||
else: # operator == '!='
|
||||
return [('company_id', 'not in', company_ids)]
|
||||
|
||||
def action_create_new_job(self):
|
||||
action = self.env.ref("hr_recruitment.hr_applicant_view_form")
|
||||
return {
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
<field name="start_date" optional="hide"/>
|
||||
<field name="end_date" optional="hide"/>
|
||||
<field name="is_enable" optional="hide"/>
|
||||
<field name="is_company" optional="hide"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from odoo import api, fields, models, _
|
||||
import re
|
||||
from pypinyin import pinyin, Style
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
|
||||
class HrPayrollStructure(models.Model):
|
||||
@@ -26,27 +25,6 @@ class HrPayrollStructure(models.Model):
|
||||
position_subsidy = fields.Monetary(string="岗位补贴", currency_field="currency_id")
|
||||
integrated_subsidy = fields.Monetary(string="综合补贴", currency_field="currency_id")
|
||||
advance_performance_bonuses = fields.Monetary(string="预发绩效奖金", currency_field="currency_id")
|
||||
is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company',search='_search_part_of_company')
|
||||
|
||||
@api.depends_context('uid', 'company')
|
||||
@api.depends('company_id')
|
||||
def _compute_is_company(self):
|
||||
active_company_ids = self.env.companies
|
||||
for employee in self:
|
||||
employee.is_company = employee.company_id in active_company_ids
|
||||
|
||||
def _search_part_of_company(self, operator, value):
|
||||
if operator not in ('=', '!=') or not isinstance(value, bool):
|
||||
raise UserError(('Operation not supported'))
|
||||
company_ids = self.env.companies.ids # 获取公司ID列表
|
||||
# 处理反向操作符
|
||||
if not value:
|
||||
operator = '!=' if operator == '=' else '='
|
||||
# 使用company_id in company_ids的结构
|
||||
if operator == '=':
|
||||
return [('company_id', 'in', company_ids)]
|
||||
else: # operator == '!='
|
||||
return [('company_id', 'not in', company_ids)]
|
||||
|
||||
@api.model
|
||||
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
<field name="create_time"/>
|
||||
<field name="end_time"/>
|
||||
<field name="is_enable"/>
|
||||
<field name="is_company" optional="hide"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -97,7 +96,6 @@
|
||||
<field name="name">职级</field>
|
||||
<field name="res_model">hr.payroll.structure</field>
|
||||
<field name="view_mode">tree,form,search</field>
|
||||
<field name="domain">[('is_company','=', True)]</field>
|
||||
<!-- <field name="context">{'group_by_no_leaf':1,'group_by':[]}</field>-->
|
||||
</record>
|
||||
<record id="all_paroll_write_salary" model="ir.actions.server">
|
||||
|
||||
Reference in New Issue
Block a user