Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 我正在处理休假条件,我想在odoo中根据性别显示休假类型_Python_Openerp_Odoo 10 - Fatal编程技术网

Python 我正在处理休假条件,我想在odoo中根据性别显示休假类型

Python 我正在处理休假条件,我想在odoo中根据性别显示休假类型,python,openerp,odoo-10,Python,Openerp,Odoo 10,条件是如果hr.employee中的员工是女性,则显示假期类型,该类型只能分配给女性员工,与男性员工相同 特定性别的休假将从 人力资源休假规则。休假规则 提供的代码如下: class HRLeaveRules(models.Model): _name = 'hr_leave_rules.leave_rules' half_day_allowed = fields.Selection([ ('yes',"Yes"), ('no',"No")], string="Half

条件是如果hr.employee中的员工是女性,则显示假期类型,该类型只能分配给女性员工,与男性员工相同

特定性别的休假将从 人力资源休假规则。休假规则 提供的代码如下:

class HRLeaveRules(models.Model):
_name = 'hr_leave_rules.leave_rules'

half_day_allowed = fields.Selection([
    ('yes',"Yes"),
    ('no',"No")],
    string="Half Day Allowed", required=True)
gender_specific = fields.Selection([
    ('all' ,"All"),
    ('male',"Male"),
    ('female',"Female")],
    string="Gender Specific", required=True)    
leaves_allowed_on_prorata_basis = fields.Selection([
    ('yes',"Yes"),
    ('no',"No")],
    string="Leaves allowed on pro rata basis", required=True)
leave_encashment = fields.Boolean(string="Leave Encashment", 
    required=True)
leave_encashment_for_maximum = fields.Integer(
    string = "Leave Encashment for maximum", required=True)     
can_emp_club_leave = fields.Selection([
    ('yes',"Yes"),
    ('no',"No")],
    string="Can Employees Club this leave with any other leave", 
    required=True)  
past_dated_leave_allowed = fields.Selection([
    ('yes',"Yes"),
    ('no',"No")],
    string="Past dated leave application allowed", required=True)   
override_paid_leave_to_unpaid = fields.Selection([
    ('yes',"Yes"),
    ('no',"No")],
    string="Can managers override paid leaves to unpaid", required=True)    
carry_frwrdng_leaves = fields.Boolean(string="Carry forwarding of leaves", 
    required=True)  
maximum_accumulation_in_year = fields.Integer(string = "Maximum Accumulation in year", 
    required=True)  
leave_encash_rest_leaves = fields.Selection([
    ('yes',"Yes"),
    ('no',"No")],
    string="Leave Encashment for Rest Leaves", required=True)
employee_id = fields.Many2one('hr.employee', string="Employee")
holiday_status_id = fields.Many2one("hr.holidays.status", 
    string="Leave Type", required=True) 
department_id = fields.Many2one('hr.department', 
    related='employee_id.department_id', string='Department') 
count_intervening_leaves = fields.Boolean(
    string="Count intervening holidays/weekly offs as leaves", 
    required=True)
count_intervening_leaves_back_date = fields.Boolean(
    string="Count intervening holidays/weekly offs as leaves if applying for back date", 
    required=True)
leaves_probation_period = fields.Boolean(string="Leaves allowed in probation period", 
    required=True)
max_con_leaves_month = fields.Boolean(string="Maximum consecutive leaves per month", 
    required=True)
leave_encashment_cycle = fields.Selection([
    ('annually',"Annually"),
    ('super_annuation',"Super Annuation / Relieving")],
    string="Leave Encashment Cycle", required=True)
description = fields.Text(string="Description")
我没有发现任何错误的代码是:-


谢谢…

我得到的答案只是一个缩进错误,是

        res['domain']={'holiday_status_id':return_domain_list}
return res
而不是


我没有从你的问题中发现问题?在课堂上,如果我为女性分配假期,比如,为女性选择产假,那么"性别"规范"检查应该像在"休假类型"中选择女性员工一样工作只应显示我可以选择的产假,不应显示其他假期,如育儿假。您没有在if的第一部分返回域。请看我在您答案上的更新对不起,我不知道您的更正,因为我的答案与您的答案相同,没有任何更改。。谢谢..我认为您需要添加一个带有employee_id.gender的相关字段,然后添加带有条件的不可见属性
“不可见”:[('new_field','!=','female')]}
        res['domain']={'holiday_status_id':return_domain_list}
return res
res['domain']={'holiday_status_id':return_domain_list}
return res