Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

TypeError: argument of type 'bool' is not iterable in openerp

By
Group ODOO
on 10/9/13, 4:28 AM 4,336 views

Here is the thing: I wanted to inherit the tree view(id is "view_employee_tree") of the moudle --hr: in the hr_contract module. Here is my code:

 <record id="hr_contract_hr_employee_tree" model="ir.ui.view">
                <field name="name">hr.contract.hr.employee.tree</field>
                <field name="model">hr.employee</field>
                <field name="inherit_id" ref="hr.view_employee_tree"/>
                <field name="arch" type="xml">
                    <field name="work_phone" position="after">
                        <field name="contract_ids"/>
                    </field>
                </field>
            </record>

After I update modules(hr,hr_contract),I get the error as follows:)

OpenERP Server Error Client Traceback (most recent call last): File "d:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\web\http.py", line 204, in dispatch File "d:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\web\controllers\main.py", line 1128, in call_kw File "d:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\web\controllers\main.py", line 1120, in _call_kw File "d:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\web\session.py", line 42, in proxy File "d:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\web\session.py", line 30, in proxy_method File "d:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\web\session.py", line 103, in send

Server Traceback (most recent call last): File "d:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\web\session.py", line 89, in send File "D:\Program Files\OpenERP 7.0-20130726-231403\Server\server.\openerp\netsvc.py", line 292, in dispatch_rpc File "D:\Program Files\OpenERP 7.0-20130726-231403\Server\server.\openerp\service\web_services.py", line 626, in dispatch File "D:\Program Files\OpenERP 7.0-20130726-231403\Server\server.\openerp\osv\osv.py", line 188, in execute_kw File "D:\Program Files\OpenERP 7.0-20130726-231403\Server\server.\openerp\osv\osv.py", line 131, in wrapper File "D:\Program Files\OpenERP 7.0-20130726-231403\Server\server.\openerp\osv\osv.py", line 197, in execute File "D:\Program Files\OpenERP 7.0-20130726-231403\Server\server.\openerp\osv\osv.py", line 185, in execute_cr File "D:\Program Files\OpenERP 7.0-20130726-231403\Server\server.\openerp\osv\orm.py", line 2290, in fields_view_get File "D:\Program Files\OpenERP 7.0-20130726-231403\Server\server.\openerp\osv\orm.py", line 2270, in clean TypeError: argument of type 'bool' is not iterable

I have been tracking the bug for a whole day. i went to the file:\openerp\osv\orm.py,and get the codes near the line 2270:

            ir_values_obj = self.pool.get('ir.values')
            resprint = ir_values_obj.get(cr, user, 'action',
                    'client_print_multi', [(self._name, False)], False,
                    context)
            resaction = ir_values_obj.get(cr, user, 'action',
                    'client_action_multi', [(self._name, False)], False,
                    context)

            resrelate = ir_values_obj.get(cr, user, 'action',
                    'client_action_relate', [(self._name, False)], False,
                    context)

            #I added this for output
            for action in resaction:
                print 'orm debug : '
                print 'action[1]:',action[1]
                print 'action[2]',action[2]

            resaction = [clean(action) for action in resaction
                         if view_type == 'tree' or not action[2].get('multi')]
            resprint = [clean(print_) for print_ in resprint
                        if view_type == 'tree' or not print_[2].get('multi')]
            #When multi="True" set it will display only in More of the list view 
            resrelate = [clean(action) for action in resrelate
                         if (action[2].get('multi') and view_type == 'tree') or (not action[2].get('multi') and view_type == 'form')]

            for x in itertools.chain(resprint, resaction, resrelate):
                x['string'] = x['name']

And I added print code to output the var:resaction, and this is the output:

#output: orm_debug: Subordinate Hierarchy False

Excellent! It seems that the error:TypeError: argument of type 'bool' is not iterable makes sense. Subordinate Hierarchy is the name of an act_window in the file hr_view.xml:

<record id="action2" model="ir.actions.act_window">
        <field name="name">Subordinate Hierarchy</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">hr.employee</field>
        <field name="domain">[('id','in',active_ids)]</field>
        <field name="view_type">tree</field>
        <field name="view_id" ref="view_partner_tree2"/>
        <field name="view_id" ref="view_employee_tree"/>
</record>

But what is the real problem?? what did I do wrong ?

Any help is highly appreciated!! Thanks in advance!!

1

Anil R. Kesariya

--Anil R. Kesariya--
4321
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
-
Technical & Functional Expert
Anil R. Kesariya
On 10/9/13, 4:45 AM

Hello Letitgo,

What you exactly want ?

you want to add one2many field on of Contract object(hr.contract) to th Employee object (hr.employee) ?

for that you need to add this this code in your custom module.

Code in your py file....

class hr_employee(osv.osv)

    _inherit = 'hr.employee'
    _columns = { 
    'contract_ids' : fields.one2many('hr.contract', 'emp_id' string="Contracts")
   }

hr_employee()

class hr_contract(osv.osv)

    _inherit = 'hr.contract'

    _columns = { 
      'emp_id':fields.many2one('hr.employee', string="Employee"),
      }

hr_contract()

Now you can add your contracts in to employee objects. by using xpath.

This is the relationship fields scenario to add on object.

Check it will work.

Or else you need different thing tell me your exact requirement what you needed

Regards,

Anil Kesariya.

0

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


Ahmed M.Elmubarak
On 10/9/13, 4:50 AM

Hi,

you didn't want to go to the ORM, it is a python error, I thing you're trying to make a loop with not [iterable] variable , you can try this on your python

for i in True:
print 'hello'

you 'll get the same error msg ...

so you can check your .py file for something like this ...

Thanks..

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/9/13, 4:28 AM
Seen: 4336 times
Last updated: 3/16/15, 8:10 AM