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.

0

widget="selection" with domain fields issue [Closed]

By
priyankahdp
on 4/21/13, 4:38 PM 3,573 views

The Question has been closed

by
priyankahdp
on 04/30/2013 10:24:07

here is my view xml part

<field name="bpl_estate_id" placeholder="Estate" widget="selection" />

here is my model python part

'bpl_company_id':fields.many2one('res.company', 'Company', help='Company'),
'bpl_estate_id':fields.many2one('bpl.estate.n.registration', 'Estate', 
domain="[('company_id','=',bpl_company_id)]"),

my issue is when i used estate field,with widget option, then no domain filtered ? (show all records)

please advice me to implement this

i added domain filter also in view.xml.and removed from py class then below error occured

2013-04-22 08:16:02,963 885 ERROR demo openerp.tools.safe_eval: Cannot eval "[('company_id', '=', bpl_company_id)]"
Traceback (most recent call last):
  File "/home/bellvantage/Documents/openerp-7.0/openerp-7/openerp/tools/safe_eval.py", line 241, in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
NameError: name 'bpl_company_id' is not defined
2013-04-22 08:16:02,982 885 ERROR demo openerp.addons.base.ir.ir_ui_view: Can't render view bpl.bpl_officer_registration_form for model: bpl.officer
Traceback (most recent call last):
  File "/home/bellvantage/Documents/openerp-7.0/openerp-7/openerp/tools/safe_eval.py", line 241, in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
NameError: name 'bpl_company_id' is not defined
2013-04-22 08:16:03,024 885 ERROR demo openerp.tools.convert: Parse error in /home/bellvantage/Documents/openerp-7.0/openerp-7/openerp/addons/bpl/bpl_view.xml:26: 
<record id="bpl_officer_registration_form" model="ir.ui.view">
            <field name="name">bpl.officer.form</field>
            <field name="model">bpl.officer</field>
            <field name="arch" type="xml">
                <form string="bpl_officer_registration" version="7.0">
                    <sheet>
                        <field name="work_for" style="width: 50%%"/>
                        <field name="bpl_company_id" invisible="0" placeholder="" readonly="1" style="width: 50%%"/>
                        <field name="bpl_estate_id" placeholder="Estate" widget="selection" domain="[('company_id', '=', bpl_company_id)]" attrs="{'invisible':[('work_for','=','head_office')]}" style="width: 50%%"/>
                        <field name="bpl_division_id" invisible="1" placeholder="Division" style="width: 50%%"/>
1

Francesco OpenCode

--Francesco OpenCode--
3608
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 4/22/13, 6:14 AM

If you use

<field name="bpl_company_id" invisible="1" />
<field name="bpl_estate_id" placeholder="Estate" widget="selection" domain="[('company_id','=',bpl_company_id)]"/>

it works?

Hi, Francesco..post updated. please check and advice

priyankahdp
on 4/22/13, 6:19 AM

About This Community

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

Question tools

0 follower(s)

Stats

Asked: 4/21/13, 4:38 PM
Seen: 3573 times
Last updated: 3/16/15, 8:10 AM