Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Error : "TypeError: data[0] is undefined " [EDITED with code]?

Naroči se

Get notified when there's activity on this post

This question has been flagged
javascriptpythonxml
7 Odgovori
27226 Prikazi
Avatar
priyankahdp

Please tell me the reason why this errors comes frequently in openerp ver 7 ? issue comes when i'm going to create a employee in human resource model

TypeError: data[0] is undefined

http://localhost:8069/web/webclient/js?db=201310211510:3560

here is my hr_view.xml

    <!--Employee form view -->
    <record id="view_employee_form" model="ir.ui.view">
        <field name="name">hr.employee.form</field>
        <field name="model">hr.employee</field>
        <field name="arch" type="xml">
            <form string="Employee" version="7.0">
                <sheet>
                    <field name="image_medium" widget='image' class="oe_left oe_avatar" />
                    <div class="oe_title">
                        <label for="full_name"   class="oe_edit_only"  />
                        <h1>
                            <field name="full_name" />
                        </h1>

                        <label for="category_ids" class="oe_edit_only" groups="base.group_hr_user" />
                        <field name="category_ids" widget="many2many_tags" placeholder="e.g. Part Time" groups="base.group_hr_user" />


                    </div>
                    <div class="oe_right oe_button_box" name="button_box">
                        <!-- Put here related buttons -->
                    </div>
                    <notebook>
                        <page string="Work Information">
                            <group>


                                <group string="Profile">
                                    <field name="epf_no" />
                                    <field name="name" string="Full Name" />
                                    <field name="surname" />
                                    <field name="given_name"  />
                                    <field name="user_id" string="System User Name" />
                                    <field name="active" invisible="1"/>
                                </group>


                                <group string="Position">
                                    <field name="coach_id" />
                                    <field name="parent_id" />
                                    <field name="department_id"  />
                                    <field name="work_location" />
                                    <field name="category" />
                                    <field name="job_id" options='{"no_open": True}' domain="[('state','!=','old')]"
                                        context="{'form_view_ref': 'hr.view_hr_job_employee_form'}" />
                                </group>

                                <group string="Contact Information - Official">
                                    <field name="mobile_phone" />
                                    <field name="cdma_no" />
                                    <field name="work_phone" />
                                    <field name="work_email" widget="email" />
                                    <field name="address_id"  />
                                </group>                                    
                                <group >
                                    <field name="company_id" groups="base.group_multi_company" on_change="onchange_company(company_id)" invisible="1" />
                                </group>

                            </group>
                            <field name="notes" placeholder="Other Information ..."
                                colspan="4" />
                        </page>
                        <page string="Personal Information" groups="base.group_hr_manager">
                            <group>
                                <group string="Identification">
                                    <field name="identification_id" groups="base.group_hr_manager" />
                                    <field name="passport_number" />
                                    <field name="driver_license_number" />
                                    <field name="passport_id" groups="base.group_hr_manager"
                                        invisible="1" />
                                    <field name="bank_account_id" groups="base.group_hr_manager" />
                                    <field name="country_id" options='{"no_open": True}' groups="base.group_hr_manager" />
                                    <field name="raise" />


                                    <field name="otherid" groups="base.group_hr_manager"
                                        invisible="1" />
                                </group>
                                <group string="Contact Information">

                                    <field name="home_address" groups="base.group_hr_manager" />
                                    <field name="secondary_address" groups="base.group_hr_manager" />
                                    <field name="home_phone" groups="base.group_hr_manager" />
                                    <field name="emergency_contact_name" groups="base.group_hr_manager" />
                                    <field name="emergency_contact_no" groups="base.group_hr_manager" />
                                </group>
                                <group string="Status">
                                    <field name="gender" groups="base.group_hr_manager" />
                                    <field name="marital" groups="base.group_hr_manager" />
                                    <field name="spouse_name"
                                        attrs="{'invisible':[('marital', '!=', 'married')]}" groups="base.group_hr_manager" />


                                </group>
                                <group string="Birth" groups="base.group_hr_manager">
                                    <field name="blood_group" />
                                    <field name="birthday" groups="base.group_hr_manager" />
                                </group>
                                <group name="Polling_Info" string="Polling Info" groups="base.group_hr_manager">
                                    <field name="province" groups="base.group_hr_manager" />
                                    <field name="district" groups="base.group_hr_manager" />
                                    <field name="electorate" groups="base.group_hr_manager" />
                                    <field name="travelling_mode" />
                                </group>


                                <group string="Allocation" groups="base.group_hr_manager">
                                    <field name="budget_center" />
                                    <field name="hr_cost_center" />
                                </group>
                            </group>
                        </page>
                        <page string="HR Contracts" groups="base.group_hr_manager">
                            <group>
                                <group cols="4" colspan="2">
                                    <br></br>
                                    <separator string='Status Change'   colspan="2" />
                                    <field name="current_status" groups="base.group_hr_manager" />
                                    <field name="inactive_status" attrs="{'invisible':[('current_status', '!=', 'inactive')]}" groups="base.group_hr_manager" />

                                    <br></br>
                                    <separator string='Employee Documents' colspan="2" />
                                    <field name='documents_ids' nolabel='1' string="Documents Ids" colspan="2">
                                        <tree string='List' editable='bottom'>
                                            <field name='documents_ids' invisible="1" />
                                            <field name='name' groups="base.group_hr_manager" />
                                            <field name='type' groups="base.group_hr_manager" />
                                            <field name='in_out' groups="base.group_hr_manager" />
                                            <field name='date' groups="base.group_hr_manager" />
                                            <field name='documents' groups="base.group_hr_manager" />
                                        </tree>
                                    </field>
                                    <br/><br/>
                                </group>
                                <group cols="4" colspan="2">
                                    <separator string='Transfer Info' colspan="2" />
                                    <field name='transfer_ids' nolabel='1' string="transfer_ids">
                                        <tree string='List' editable='bottom'>
                                            <field name='transfer_ids' invisible="1" />
                                            <field name='transfer_date' groups="base.group_hr_manager" />
                                            <field name='from_dept_id' groups="base.group_hr_manager" />
                                            <field name='to_dept_id' groups="base.group_hr_manager" />
                                            <field name='name' groups="base.group_hr_manager" />
                                        </tree>
                                    </field>                                    
                                </group>

                                <group cols="4" colspan="2">
                                    <separator string='Company Given Items' colspan="2" />
                                    <field name='company_given_items' nolabel='1' string="company_given_items">
                                        <tree string='List' editable='bottom'>
                                            <field name='company_given_items_id' invisible="1" />
                                            <field name='name' groups="base.group_hr_manager" />
                                            <field name='issue_date' groups="base.group_hr_manager" />
                                            <field name='item_type' groups="base.group_hr_manager" />
                                            <field name='ref_no' groups="base.group_hr_manager" />
                                            <field name='received_date' groups="base.group_hr_manager" />
                                            <field name='description' groups="base.group_hr_manager" />        
                                        </tree>
                                    </field>                                    
                                </group>

                            <group string="Leaves" invisible="1" />
                            <group string="Contract" invisible="1" />
                            <!--
                                <group>
                                    <field name="annual" groups="base.group_hr_manager" /> <field 
                                        name="casual" groups="base.group_hr_manager" /> <field name="sick" groups="base.group_hr_manager" 
                                        />
                                </group> -->


                            </group>
                        </page>
                        <page string="Achievements" groups="base.group_hr_manager">
                            <separator string='Educational Quilifications' />
                            <field name='qualification' nolabel='1' string="Education">
                                <tree string='List' editable='bottom'>
                                    <field name='qualification_id' invisible="1" />
                                    <field name='study_place' groups="base.group_hr_manager" />
                                    <field name='achievement' groups="base.group_hr_manager" />
                                    <field name='ach_name' groups="base.group_hr_manager" />
                                    <field name='partly_fully' groups="base.group_hr_manager" />
                                    <field name='university_institute' groups="base.group_hr_manager" />
                                    <field name='study_field' groups="base.group_hr_manager" />
                                    <field name='date' groups="base.group_hr_manager" />
                                </tree>
                            </field>
                            <br></br>
                            <separator string='Previous Work Experience' />
                            <field name='experience' nolabel='1' string="Education">
                                <tree string='List' editable='bottom'>
                                    <field name='experience_id' invisible="1" />
                                    <field name='old_job' groups="base.group_hr_manager" />
                                    <field name='old_company' groups="base.group_hr_manager" />
                                    <field name='location_name' groups="base.group_hr_manager" />

                                    <field name='str_date' groups="base.group_hr_manager" />
                                    <field name='end_date' groups="base.group_hr_manager" />
                                </tree>
                            </field>

                            <br></br>
                            <separator string='Employee Training' />
                            <field name='training' nolabel='1' string="Employee Training">
                                <tree string='List' editable='bottom'>
                                    <field name='training_ids' invisible="1" />
                                    <field name='training' groups="base.group_hr_manager" />
                                    <field name='place' groups="base.group_hr_manager" />
                                    <field name='area' groups="base.group_hr_manager" />
                                    <field name='str_date' groups="base.group_hr_manager" />
                                    <field name='end_date' groups="base.group_hr_manager" />
                                    <field name='info' groups="base.group_hr_manager" />
                                </tree>
                            </field>


                            <separator string='Skills' groups="base.group_hr_manager" />
                            <field name="skills" placeholder="Skills..."
                                groups="base.group_hr_manager" />
                            <separator string='Interests' groups="base.group_hr_manager" />
                            <field name="interests" placeholder="Interests..."
                                groups="base.group_hr_manager" />

                            <separator string='Prizes' groups="base.group_hr_manager" />
                            <field name="prizes" groups="base.group_hr_manager" />
                            <separator string='Scholarships' groups="base.group_hr_manager" />
                            <field name="scholarships" groups="base.group_hr_manager" />

                        </page>
                        <page string="Promotions" groups="base.group_hr_manager">
                            <separator string='Employee Promotions' />
                            <field name='promotions' nolabel='1' string="Employee Promotions">
                                <tree string='List' editable='bottom'>
                                    <field name='promotion_ids' invisible="1" />
                                    <field name='old_title' groups="base.group_hr_manager" />
                                    <field name='promoted_to' groups="base.group_hr_manager" />
                                    <field name='effect_date' groups="base.group_hr_manager" />
                                </tree>
                            </field>

                        </page>
                        <page string="Other Info" groups="base.group_hr_manager">
                            <separator string='Dependents Info' />
                            <field name='dependency_ids' nolabel='1' string="dependency ids">
                                <tree string='List' editable='bottom'>
                                    <field name='dependency_ids' invisible="1" />        
                                    <field name='type' groups="base.group_hr_manager" />
                                    <field name='name' groups="base.group_hr_manager" />
                                    <field name='occupation' groups="base.group_hr_manager" />
                                    <field name='date_of_birth' groups="base.group_hr_manager" />
                                    <field name='dependant' groups="base.group_hr_manager" />
                                    <field name='sex' groups="base.group_hr_manager" />
                                    <field name='entitle_for_medicle_scheme' groups="base.group_hr_manager" />
                                    <field name='company_given_benefits' groups="base.group_hr_manager" />
                                </tree>
                            </field>
                            <br/><br/>
                            <separator string='Health Info' />
                            <field name='health_info_ids' nolabel='1' string="health_info_ids">
                                <tree string='List' editable='bottom'>
                                    <field name='health_info_ids' invisible="1" />        
                                    <field name='name' groups="base.group_hr_manager" />
                                    <field name='from_date' groups="base.group_hr_manager" />
                                    <field name='to_date' groups="base.group_hr_manager" />
                                    <field name='hospitalized' groups="base.group_hr_manager" />
                                    <field name='comment' groups="base.group_hr_manager" />
                                    <field name='documents' groups="base.group_hr_manager" />
                                </tree>
                            </field>
                            <br/><br/>
                            <separator string='Legal Info' />
                            <field name='legal_info_ids' nolabel='1' string="legal_info_ids">
                                <tree string='List' editable='bottom'>
                                    <field name='legal_info_ids' invisible="1" />        
                                    <field name='name' groups="base.group_hr_manager" />
                                    <field name='type' groups="base.group_hr_manager" />
                                    <field name='year' groups="base.group_hr_manager" />
                                    <field name='outcome' groups="base.group_hr_manager" />
                                    <field name='venue' groups="base.group_hr_manager" />
                                    <field name='date' groups="base.group_hr_manager" />
                                    <field name='documents' groups="base.group_hr_manager" />
                                </tree>
                            </field>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

and here shows my python code in hr.py[i do some changes]

class hr_employee(osv.osv):
    _name = "hr.employee"
    _description = "Employee"
    _inherits = {'resource.resource': "resource_id"}

    def _get_image(self, cr, uid, ids, name, args, context=None):
        result = dict.fromkeys(ids, False)
        for obj in self.browse(cr, uid, ids, context=context):
            result[obj.id] = tools.image_get_resized_images(obj.image)
        return result

    def _set_image(self, cr, uid, id, name, value, args, context=None):
        return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)

    _columns = {
        'name_related': fields.related('resource_id', 'name', type='char', string='Full Name', readonly=True, store=True),

        'given_name': fields.char('Given Name', size=30),
        'surname': fields.char('Surname', size=20),
        'maiden_name': fields.char('Maiden Name', size=20),
        'blood_group': fields.many2one('hr.blood.group', 'Blood Group'),
        'age': fields.float('age'),
        'driver_license_number': fields.char('Driver License', size=20),
        'passport_number': fields.char('Passport', size=20),
        'passport_expiry_date': fields.date('Passport expiry date'),
        'religion' : fields.date('Religion'),
        'distance_from work_place' : fields.date('Distance from work Place'),
        'mode_of_travelling' : fields.date('Mode of travelling'),
        'travelling_mode':fields.char('Travelling Mode', size=5),
        'province': fields.many2one('res.province', 'Province'),
        'district': fields.many2one('res.district', 'District'),
        'electorate': fields.many2one('res.electorate', 'Electorate'),


        'country_id': fields.many2one('res.country', 'Nationality'),
        'birthday': fields.date("Date of Birth"),
        'ssnid': fields.char('SSN No', size=32, help='Social Security Number'),
        'sinid': fields.char('SIN No', size=32, help="Social Insurance Number"),

        'full_name': fields.char('Name with initials', size=60),
        'cdma_no': fields.char('Fixed/Direct No', size=32),
        'inactive_status': fields.selection([('suspend', 'Suspend'), ('interdict', 'Interdict'), ('terminate', 'Terminate')], 'Inactive Status'),
        'current_status': fields.selection([('active', 'Active'), ('inactive', 'Inactive')], 'Current Status'),
        'company_given_items': fields.one2many('company.given.items','company_given_items_id', 'Company Given Items'),
        'identification_id': fields.char('NIC No', size=32),
        'otherid': fields.char('Other Id', size=64),
        'gender': fields.selection([('male', 'Male'), ('female', 'Female')], 'Gender'),
        'marital': fields.selection([('single', 'Single'), ('married', 'Married'), ('widower', 'Widower'), ('divorced', 'Divorced')], 'Marital Status'),
        'department_id':fields.many2one('hr.section.n.registration', 'Attached To'),
        'address_id': fields.many2one('hr.address', 'Address'),

        #'bank_account_id':fields.many2one('res.partner.bank', 'Bank Account Details', domain="[('partner_id','=',address_home_id)]", help="Employee bank salary account"),
        'bank_account_id':fields.many2one('hr.branch.registration', 'Bank Account Details'),
        'mobile_phone': fields.char('Mobile', size=32, readonly=False),
        'work_phone': fields.char('Extension', size=32, readonly=False),
        'work_email': fields.char('Email', size=240),
        'work_location': fields.char('Office Location', size=32),
        'notes': fields.text('Notes'),
        'parent_id': fields.many2one('hr.employee', 'Reporting To'),
        'category_ids': fields.many2many('hr.employee.category', 'employee_category_rel', 'emp_id', 'category_id', 'Tags'),
        'child_ids': fields.one2many('hr.employee', 'parent_id', 'Subordinates'),
        'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade', required=True),
        'coach_id': fields.many2one('hr.employee', 'Immediate Supervisor'),  # Coach changed to Immediate Supervisor
        'job_id': fields.many2one('hr.job', 'Designation'),  # #
        'spouse_name': fields.char('Spouse Name', size=240),  # #
        'home_address': fields.char('Present Address', size=240),  # #
        'home_phone': fields.char('Home Phone', size=240),  # #
        'secondary_address': fields.char('Permanent Address', size=240),  # #
        'secondary_phone': fields.char('Permanent Phone', size=240),  # #
        'emergency_contact_name': fields.char('Emergency Cont Name', size=240),  # #
        'emergency_contact_no': fields.char('Emergency Cont No', size=240),  # #
        'raise': fields.selection([('sinhalese', 'Sinhalese'), ('tamil', 'Tamil'), ('muslim', 'Muslim'), ('berger', 'Berger')], 'Race'),  # #

        'annual': fields.integer('Annual Leaves', size=240),  # #
        'casual': fields.integer('Casual Leaves', size=240),  # #
        'sick': fields.integer('Sick Leaves', size=240),  # #
        'qualification':fields.one2many('hr.qulifications', 'qualification_id', 'Qualification ', ondelete="cascade"),
        'experience':fields.one2many('hr.experience', 'experience_id', 'Experience ', ondelete="cascade"),
        'promotions':fields.one2many('hr.promotions', 'promotion_ids', 'Promotions ', ondelete="cascade"),
        'training':fields.one2many('hr.training', 'training_ids', 'Training ', ondelete="cascade"),

        'prizes': fields.text('prizes'),
        'scholarships': fields.text('Scholarships'),        

        'skills': fields.text('Employee Skills'),
        'interests': fields.text('Employee Interests'),
        # image: all image fields are base64 encoded and PIL-supported
        'image': fields.binary("Photo",
            help="This field holds the image used as photo for the employee, limited to 1024x1024px."),
        'image_medium': fields.function(_get_image, fnct_inv=_set_image,
            string="Medium-sized photo", type="binary", multi="_get_image",
            store={
                'hr.employee': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
            },
            help="Medium-sized photo of the employee. It is automatically "\
                 "resized as a 128x128px image, with aspect ratio preserved. "\
                 "Use this field in form views or some kanban views."),
        'image_small': fields.function(_get_image, fnct_inv=_set_image,
            string="Smal-sized photo", type="binary", multi="_get_image",
            store={
                'hr.employee': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
            },
            help="Small-sized photo of the employee. It is automatically "\
                 "resized as a 64x64px image, with aspect ratio preserved. "\
                 "Use this field anywhere a small image is required."),
        'passport_id':fields.char('Passport No', size=64),
        'color': fields.integer('Color Index'),
        'city': fields.related('address_id', 'city', type='char', string='City'),
        'login': fields.related('user_id', 'login', type='char', string='Login', readonly=1),
        'last_login': fields.related('user_id', 'date', type='datetime', string='Latest Connection', readonly=1),


        'reporting_designation': fields.many2one('hr.job', 'reporting designation'),
        'budget_center': fields.many2one('hr.budget.center', 'Budget Center'),
        'hr_cost_center': fields.many2one('hr.cost.center', 'Cost Center'),
        'category': fields.many2one('hr.category', 'Employment Type'),
        'location': fields.many2one('hr.location', 'Location'),     

        'living_situation': fields.char('Living situation', ),
        'monthly_income': fields.float('Monthly income', ),
        'no_of_dependants': fields.integer('No of dependants'),
        'no_of_children': fields.integer('No of children'),

        'mother_name':fields.char('Mother Name', size=64),
        'm_date_of_birth': fields.date('Date of birth'),
        'm_age': fields.float('Age', ),
        'm_occupation':fields.char('Occupation', size=64),
        'm_employer_name_address':fields.char('Employer name & Address', size=64),
        'm_entitled_for_medical_scheme': fields.boolean('Medical-entitle'),
        'm_alive_or_dead': fields.selection([('alive', 'Alive'), ('dead', 'Dead')], 'Alive or Dead'),

        'father_name':fields.char('Father Name', size=64),
        'f_date_of_birth': fields.date('Date of birth'),
        'f_age': fields.float('Age', ),
        'f_occupation':fields.char('Occupation', size=64),
        'f_employer_name_address':fields.char('Employer name & Address', size=64),
        'f_entitled_for_medical_scheme': fields.boolean('Medical-entitle'),
        'f_alive_or_dead': fields.selection([('alive', 'Alive'), ('dead', 'Dead')], 'Alive or Dead'),

        'epf_no': fields.char('EPF No', size=20),
        'epf_nominee':fields.char('EPF Nominee', size=64),
        'relation_details':fields.char('Relation Details', size=64),        

        'dependency_ids':fields.one2many('hr.dependency', 'dependency_ids', 'Dependency ', ondelete="cascade"),
        'health_info_ids':fields.one2many('hr.health', 'health_info_ids', 'Health ', ondelete="cascade"),
        'legal_info_ids':fields.one2many('hr.legal', 'legal_info_ids', 'Legal ', ondelete="cascade"),
        'documents_ids':fields.one2many('hr.documents', 'documents_ids', 'Documents ', ondelete="cascade"),
        'transfer_ids':fields.one2many('hr.transfers', 'transfer_ids', 'Transfers ', ondelete="cascade"),
    }

    _order = 'name_related'

    def create(self, cr, uid, data, context=None):
        employee_id = super(hr_employee, self).create(cr, uid, data, context=context)
        try:
            (model, mail_group_id) = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'mail', 'group_all_employees')
            employee = self.browse(cr, uid, employee_id, context=context)
            self.pool.get('mail.group').message_post(cr, uid, [mail_group_id],
                body=_('Welcome to %s! Please help him/her take the first steps with HR System!') % (employee.name),
                subtype='mail.mt_comment', context=context)
        except:
            pass  # group deleted: do not push a message
        return employee_id

    def unlink(self, cr, uid, ids, context=None):
        resource_ids = []
        for employee in self.browse(cr, uid, ids, context=context):
            resource_ids.append(employee.resource_id.id)
        return self.pool.get('resource.resource').unlink(cr, uid, resource_ids, context=context)

    def onchange_address_id(self, cr, uid, ids, address, context=None):
        if address:
            address = self.pool.get('res.partner').browse(cr, uid, address, context=context)
            return {'value': {'work_phone': address.phone, 'mobile_phone': address.mobile}}
        return {'value': {}}

    def onchange_company(self, cr, uid, ids, company, context=None):
        address_id = False
        if company:
            company_id = self.pool.get('res.company').browse(cr, uid, company, context=context)
            address = self.pool.get('res.partner').address_get(cr, uid, [company_id.partner_id.id], ['default'])
            address_id = address and address['default'] or False
        return {'value': {'address_id' : address_id}}

    def onchange_department_id(self, cr, uid, ids, department_id, context=None):
        value = {'parent_id': False}
        if department_id:
            department = self.pool.get('hr.department').browse(cr, uid, department_id)
            value['parent_id'] = department.manager_id.id
        return {'value': value}

    def onchange_given_name(self, cr, uid, ids, given_name, context=None):
        if given_name:
            return {'value': {'user_id' : user_id}}
        else:
            return {'value': {'user_id' : user_id}}

    def onchange_user(self, cr, uid, ids, user_id, context=None):
        work_email = False
        if user_id:
            work_email = self.pool.get('res.users').browse(cr, uid, user_id, context=context).email
        return {'value': {'work_email' : work_email}}

    def _get_default_image(self, cr, uid, context=None):
        image_path = addons.get_module_resource('hr', 'static/src/img', 'default_image.png')
        return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))

    _defaults = {
        'image': _get_default_image,
        'color': 0,
        'country_id':130,
    }

    def _check_recursion(self, cr, uid, ids, context=None):
        level = 100
        while len(ids):
            cr.execute('SELECT DISTINCT parent_id FROM hr_employee WHERE id IN %s AND parent_id!=id', (tuple(ids),))
            ids = filter(None, map(lambda x:x[0], cr.fetchall()))
            if not level:
                return False
            level -= 1
        return True

    _constraints = [
        (_check_recursion, 'Error! You cannot create recursive hierarchy of Employee(s).', ['parent_id']),
    ]

hr_employee()
0
Avatar
Opusti
charlesraj

hi sometimes in v7.0 i feel the same error.

priyankahdp
Avtor

yes dear charlesraj still i'm not get where is the trigger point of that error

Avatar
User198605
Best Answer

I am also facing this issue.  Any of you found solution?  

It is really terrible to see that openerp team is not willing to help on these kind of small bugs.  :(  

Update1:

While searching in the web i found this and worked for me.  try this:  

edit view_form.js in  /addons/web/static/src/js  

Replace the following:  

        if (! no_recurse) {
            var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.build_context());
            this.alive(dataset.name_get([self.get("value")])).done(function(data) {
                self.display_value["" + self.get("value")] = data[0][1];
                self.render_value(true);
            });
        }

 

With following:  


        if (! no_recurse) {
            var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.build_context());
            this.alive(dataset.name_get([self.get("value")])).done(function(data) {
                if(typeof data[0] != "undefined" && data[0] != null && data[0].length > 0){
                    self.display_value["" + self.get("value")] = data[0][1];
                    self.render_value(true);
                }
                else {
                    return false;
                }
            });
        }

1
Avatar
Opusti
Avatar
Dare Ojo-Bello
Best Answer

I am having the same issue when I try to add an invoice line to Supplier Invoice. Please can someone help with this

1
Avatar
Opusti
Nicolaus Hartmann

same here... might this be a bug>>?? server log doesn't reveal any info leading to this error...

Avatar
Ankit H Gandhi(AHG)
Best Answer

Dear Priyankahdp,

Good question, I have also same problem but Now I solved out it.

I think When you select or press any field from tree view at that time this error will occur right.

Solution is this also create form view, not only create tree view.

You need to create both (form, tree) view.

Please use this below code.

<!--Employee form view -->

<record id="view_employee_form" model="ir.ui.view">

<field name="name">hr.employee.form</field>

<field name="model">hr.employee</field>

<field name="arch" type="xml">

<form string="Employee" version="7.0">

<sheet>

<field name="image_medium" widget='image' class="oe_left oe_avatar" />

<div class="oe_title">

<label for="full_name" class="oe_edit_only" />

<h1>

<field name="full_name" />

</h1>

<label for="category_ids" class="oe_edit_only" groups="base.group_hr_user" />

<field name="category_ids" widget="many2many_tags" placeholder="e.g. Part Time" groups="base.group_hr_user" />

</div>

<div class="oe_right oe_button_box" name="button_box">

<!-- Put here related buttons -->

</div>

<notebook>

<page string="Work Information">

<group>

<group string="Profile">

<field name="epf_no" />

<field name="name" string="Full Name" />

<field name="surname" />

<field name="given_name" />

<field name="user_id" string="System User Name" />

<field name="active" invisible="1"/>

</group>

<group string="Position">

<field name="coach_id" />

<field name="parent_id" />

<field name="department_id" />

<field name="work_location" />

<field name="category" />

<field name="job_id" options='{"no_open": True}' domain="[('state','!=','old')]"

context="{'form_view_ref': 'hr.view_hr_job_employee_form'}" />

</group>

<group string="Contact Information - Official">

<field name="mobile_phone" />

<field name="cdma_no" />

<field name="work_phone" />

<field name="work_email" widget="email" />

<field name="address_id" />

</group>

<group >

<field name="company_id" groups="base.group_multi_company" on_change="onchange_company(company_id)" invisible="1" />

</group>

</group>

<field name="notes" placeholder="Other Information ..."

colspan="4" />

</page>

<page string="Personal Information" groups="base.group_hr_manager">

<group>

<group string="Identification">

<field name="identification_id" groups="base.group_hr_manager" />

<field name="passport_number" />

<field name="driver_license_number" />

<field name="passport_id" groups="base.group_hr_manager"

invisible="1" />

<field name="bank_account_id" groups="base.group_hr_manager" />

<field name="country_id" options='{"no_open": True}' groups="base.group_hr_manager" />

<field name="raise" />

<field name="otherid" groups="base.group_hr_manager"

invisible="1" />

</group>

<group string="Contact Information">

<field name="home_address" groups="base.group_hr_manager" />

<field name="secondary_address" groups="base.group_hr_manager" />

<field name="home_phone" groups="base.group_hr_manager" />

<field name="emergency_contact_name" groups="base.group_hr_manager" />

<field name="emergency_contact_no" groups="base.group_hr_manager" />

</group>

<group string="Status">

<field name="gender" groups="base.group_hr_manager" />

<field name="marital" groups="base.group_hr_manager" />

<field name="spouse_name"

attrs="{'invisible':[('marital', '!=', 'married')]}" groups="base.group_hr_manager" />

</group>

<group string="Birth" groups="base.group_hr_manager">

<field name="blood_group" />

<field name="birthday" groups="base.group_hr_manager" />

</group>

<group name="Polling_Info" string="Polling Info" groups="base.group_hr_manager">

<field name="province" groups="base.group_hr_manager" />

<field name="district" groups="base.group_hr_manager" />

<field name="electorate" groups="base.group_hr_manager" />

<field name="travelling_mode" />

</group>

<group string="Allocation" groups="base.group_hr_manager">

<field name="budget_center" />

<field name="hr_cost_center" />

</group>

</group>

</page>

<page string="HR Contracts" groups="base.group_hr_manager">

<group>

<group cols="4" colspan="2">

<br></br>

<separator string='Status Change' colspan="2" />

<field name="current_status" groups="base.group_hr_manager" />

<field name="inactive_status" attrs="{'invisible':[('current_status', '!=', 'inactive')]}" groups="base.group_hr_manager" />

<br></br>

<separator string='Employee Documents' colspan="2" />

<field name='documents_ids' nolabel='1' string="Documents Ids" colspan="2">

<form>

<group>

<field name='documents_ids' invisible="1" />

<field name='name' groups="base.group_hr_manager" />

<field name='type' groups="base.group_hr_manager" />

<field name='in_out' groups="base.group_hr_manager" />

<field name='date' groups="base.group_hr_manager" />

<field name='documents' groups="base.group_hr_manager" />

</group>

</form>

<tree string='List' editable='bottom'>

<field name='documents_ids' invisible="1" />

<field name='name' groups="base.group_hr_manager" />

<field name='type' groups="base.group_hr_manager" />

<field name='in_out' groups="base.group_hr_manager" />

<field name='date' groups="base.group_hr_manager" />

<field name='documents' groups="base.group_hr_manager" />

</tree>

</field>

<br/><br/>

</group>

<group cols="4" colspan="2">

<separator string='Transfer Info' colspan="2" />

<field name='transfer_ids' nolabel='1' string="transfer_ids">

<form>

<group>

<field name='transfer_ids' invisible="1" />

<field name='transfer_date' groups="base.group_hr_manager" />

<field name='from_dept_id' groups="base.group_hr_manager" />

<field name='to_dept_id' groups="base.group_hr_manager" />

<field name='name' groups="base.group_hr_manager" />

</group>

</form>

<tree string='List' editable='bottom'>

<field name='transfer_ids' invisible="1" />

<field name='transfer_date' groups="base.group_hr_manager" />

<field name='from_dept_id' groups="base.group_hr_manager" />

<field name='to_dept_id' groups="base.group_hr_manager" />

<field name='name' groups="base.group_hr_manager" />

</tree>

</field>

</group>

<group cols="4" colspan="2">

<separator string='Company Given Items' colspan="2" />

<field name='company_given_items' nolabel='1' string="company_given_items">

<form>

<group>

<field name='company_given_items_id' invisible="1" />

<field name='name' groups="base.group_hr_manager" />

<field name='issue_date' groups="base.group_hr_manager" />

<field name='item_type' groups="base.group_hr_manager" />

<field name='ref_no' groups="base.group_hr_manager" />

<field name='received_date' groups="base.group_hr_manager" />

<field name='description' groups="base.group_hr_manager" />

</group>

</form>

<tree string='List' editable='bottom'>

<field name='company_given_items_id' invisible="1" />

<field name='name' groups="base.group_hr_manager" />

<field name='issue_date' groups="base.group_hr_manager" />

<field name='item_type' groups="base.group_hr_manager" />

<field name='ref_no' groups="base.group_hr_manager" />

<field name='received_date' groups="base.group_hr_manager" />

<field name='description' groups="base.group_hr_manager" />

</tree>

</field>

</group>

<group string="Leaves" invisible="1" />

<group string="Contract" invisible="1" />

<!--

<group>

<field name="annual" groups="base.group_hr_manager" /> <field

name="casual" groups="base.group_hr_manager" /> <field name="sick" groups="base.group_hr_manager"

/>

</group> -->

</group>

</page>

<page string="Achievements" groups="base.group_hr_manager">

<separator string='Educational Quilifications' />

<field name='qualification' nolabel='1' string="Education">

<form>

<group>

<field name='qualification_id' invisible="1" />

<field name='study_place' groups="base.group_hr_manager" />

<field name='achievement' groups="base.group_hr_manager" />

<field name='ach_name' groups="base.group_hr_manager" />

<field name='partly_fully' groups="base.group_hr_manager" />

<field name='university_institute' groups="base.group_hr_manager" />

<field name='study_field' groups="base.group_hr_manager" />

<field name='date' groups="base.group_hr_manager" />

</group>

</form>

<tree string='List' editable='bottom'>

<field name='qualification_id' invisible="1" />

<field name='study_place' groups="base.group_hr_manager" />

<field name='achievement' groups="base.group_hr_manager" />

<field name='ach_name' groups="base.group_hr_manager" />

<field name='partly_fully' groups="base.group_hr_manager" />

<field name='university_institute' groups="base.group_hr_manager" />

<field name='study_field' groups="base.group_hr_manager" />

<field name='date' groups="base.group_hr_manager" />

</tree>

</field>

<br></br>

<separator string='Previous Work Experience' />

<field name='experience' nolabel='1' string="Education">

<form>

<group>

<field name='experience_id' invisible="1" />

<field name='old_job' groups="base.group_hr_manager" />

<field name='old_company' groups="base.group_hr_manager" />

<field name='location_name' groups="base.group_hr_manager" />

<field name='str_date' groups="base.group_hr_manager" />

<field name='end_date' groups="base.group_hr_manager" />

</group>

</form>

<tree string='List' editable='bottom'>

<field name='experience_id' invisible="1" />

<field name='old_job' groups="base.group_hr_manager" />

<field name='old_company' groups="base.group_hr_manager" />

<field name='location_name' groups="base.group_hr_manager" />

<field name='str_date' groups="base.group_hr_manager" />

<field name='end_date' groups="base.group_hr_manager" />

</tree>

</field>

<br></br>

<separator string='Employee Training' />

<field name='training' nolabel='1' string="Employee Training">

<form>

<group>

<field name='training_ids' invisible="1" />

<field name='training' groups="base.group_hr_manager" />

<field name='place' groups="base.group_hr_manager" />

<field name='area' groups="base.group_hr_manager" />

<field name='str_date' groups="base.group_hr_manager" />

<field name='end_date' groups="base.group_hr_manager" />

<field name='info' groups="base.group_hr_manager" />

</group>

</form>

<tree string='List' editable='bottom'>

<field name='training_ids' invisible="1" />

<field name='training' groups="base.group_hr_manager" />

<field name='place' groups="base.group_hr_manager" />

<field name='area' groups="base.group_hr_manager" />

<field name='str_date' groups="base.group_hr_manager" />

<field name='end_date' groups="base.group_hr_manager" />

<field name='info' groups="base.group_hr_manager" />

</tree>

</field>

<separator string='Skills' groups="base.group_hr_manager" />

<field name="skills" placeholder="Skills..."

groups="base.group_hr_manager" />

<separator string='Interests' groups="base.group_hr_manager" />

<field name="interests" placeholder="Interests..."

groups="base.group_hr_manager" />

<separator string='Prizes' groups="base.group_hr_manager" />

<field name="prizes" groups="base.group_hr_manager" />

<separator string='Scholarships' groups="base.group_hr_manager" />

<field name="scholarships" groups="base.group_hr_manager" />

</page>

<page string="Promotions" groups="base.group_hr_manager">

<separator string='Employee Promotions' />

<field name='promotions' nolabel='1' string="Employee Promotions">

<form>

<group>

<field name='promotion_ids' invisible="1" />

<field name='old_title' groups="base.group_hr_manager" />

<field name='promoted_to' groups="base.group_hr_manager" />

<field name='effect_date' groups="base.group_hr_manager" />

</group>

</form>

<tree string='List' editable='bottom'>

<field name='promotion_ids' invisible="1" />

<field name='old_title' groups="base.group_hr_manager" />

<field name='promoted_to' groups="base.group_hr_manager" />

<field name='effect_date' groups="base.group_hr_manager" />

</tree>

</field>

</page>

<page string="Other Info" groups="base.group_hr_manager">

<separator string='Dependents Info' />

<field name='dependency_ids' nolabel='1' string="dependency ids">

<form>

<group>

<field name='dependency_ids' invisible="1" />

<field name='type' groups="base.group_hr_manager" />

<field name='name' groups="base.group_hr_manager" />

<field name='occupation' groups="base.group_hr_manager" />

<field name='date_of_birth' groups="base.group_hr_manager" />

<field name='dependant' groups="base.group_hr_manager" />

<field name='sex' groups="base.group_hr_manager" />

<field name='entitle_for_medicle_scheme' groups="base.group_hr_manager" />

<field name='company_given_benefits' groups="base.group_hr_manager" />

</group>

</form>

<tree string='List' editable='bottom'>

<field name='dependency_ids' invisible="1" />

<field name='type' groups="base.group_hr_manager" />

<field name='name' groups="base.group_hr_manager" />

<field name='occupation' groups="base.group_hr_manager" />

<field name='date_of_birth' groups="base.group_hr_manager" />

<field name='dependant' groups="base.group_hr_manager" />

<field name='sex' groups="base.group_hr_manager" />

<field name='entitle_for_medicle_scheme' groups="base.group_hr_manager" />

<field name='company_given_benefits' groups="base.group_hr_manager" />

</tree>

</field>

<br/><br/>

<separator string='Health Info' />

<field name='health_info_ids' nolabel='1' string="health_info_ids">

<form>

<group>

<field name='health_info_ids' invisible="1" />

<field name='name' groups="base.group_hr_manager" />

<field name='from_date' groups="base.group_hr_manager" />

<field name='to_date' groups="base.group_hr_manager" />

<field name='hospitalized' groups="base.group_hr_manager" />

<field name='comment' groups="base.group_hr_manager" />

<field name='documents' groups="base.group_hr_manager" />

</group>

</form>

<tree string='List' editable='bottom'>

<field name='health_info_ids' invisible="1" />

<field name='name' groups="base.group_hr_manager" />

<field name='from_date' groups="base.group_hr_manager" />

<field name='to_date' groups="base.group_hr_manager" />

<field name='hospitalized' groups="base.group_hr_manager" />

<field name='comment' groups="base.group_hr_manager" />

<field name='documents' groups="base.group_hr_manager" />

</tree>

</field>

<br/><br/>

<separator string='Legal Info' />

<field name='legal_info_ids' nolabel='1' string="legal_info_ids">

<form>

<group>

<field name='legal_info_ids' invisible="1" />

<field name='name' groups="base.group_hr_manager" />

<field name='type' groups="base.group_hr_manager" />

<field name='year' groups="base.group_hr_manager" />

<field name='outcome' groups="base.group_hr_manager" />

<field name='venue' groups="base.group_hr_manager" />

<field name='date' groups="base.group_hr_manager" />

<field name='documents' groups="base.group_hr_manager" />

</group>

</form>

<tree string='List' editable='bottom'>

<field name='legal_info_ids' invisible="1" />

<field name='name' groups="base.group_hr_manager" />

<field name='type' groups="base.group_hr_manager" />

<field name='year' groups="base.group_hr_manager" />

<field name='outcome' groups="base.group_hr_manager" />

<field name='venue' groups="base.group_hr_manager" />

<field name='date' groups="base.group_hr_manager" />

<field name='documents' groups="base.group_hr_manager" />

</tree>

</field>

</page>

</notebook>

</sheet>

</form>

</field>

</record>

Hope this code help for you.

Please let me know, if any problem.

Thanks & Regards

Ankit H Gandhi.

0
Avatar
Opusti
Avatar
Damien Taylor
Best Answer

Hi Guys,

Was there ever a resolution to this issue?  I am having exactly the same issue!

Thanks,
Damien

 

0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
synchronous JS
javascript python xml
Avatar
Avatar
2
jun. 18
6253
Display header only on the first page and footer on the last page Qweb Odoo 14
javascript python xml odoo
Avatar
Avatar
Avatar
2
avg. 24
7639
How to set default values to fields in Odoo 14
javascript python xml odoo
Avatar
Avatar
1
okt. 22
25349
How to create a customized Invoice Report . Odoo 14 Solved
javascript python xml odoo
Avatar
Avatar
Avatar
2
sep. 21
14309
Adding custom field in pos interface ? Odoo 14
javascript python xml odoo
Avatar
Avatar
1
avg. 21
9428
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now