Odoo Help


cant set the attribute domain in an XML code with python ?????

on 9/9/14, 6:15 AM 1,702 views


i want to set the domain of the field location_dest_id1, in the following XML:

<field name="mvtinternes_articleqty_rel" context="{'tree_view_ref':'itk_entrepot.itk_entrepot_moveline'}" domain="[('type','=','in'),('state','=','done'),('mouvementdustock_qtyadeplacer','!=',0)]">
                        <tree editable="bottom" create="false" >
                            <field name="partner_id" string="Fournisseur"/>
                            <field name="location_dest_id1" required="1" string="Emplacement Destination" domain="[('usage','=','internal')]" on_change="itk_entrepot_fct_articleqty_onchangedestination(location_dest_id1)"/>
                            <field name="mouvementdustock_placedest1_rel" domain="[('places_emplacement_rel','=',location_dest_id1)]" required="1" on_change="itk_entrepot_fct_articleqty_onchangeplacedestination(mouvementdustock_placedest1_rel)"/>
                            <field name="state" invisible="1"/>
                            <field name="mouvementdustock_qtymaxadeplacer" invisible="1"/>
                            <field name="product_qty" invisible="1"/>

with the following python code

  for node in doc.xpath("//field[@name='mvtinternes_articleqty_rel']") :
                for node1 in node.xpath("//field[@name='location_dest_id1']"):
                    print "node1",node1
                    node1.set('domain', "[('id','in',%s)]"%domain)

but i i havent any result, can someone help me




| 5 3 6
Jakarta, Indonesia
On 9/9/14, 7:08 AM

Have you re-set the arch value in the result?

how ???

on 9/9/14, 7:51 AM

You can check other codes that inherit fields_view_get (which I believe is where your code resides) in the official code provided by OpenERP/Odoo. One example that I can point out is account_invoice.py file in account module. Pay attention around line 370 - 390. There are a few lines that re-set the arch of the return value. My revision is 10100.

on 9/11/14, 1:58 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/9/14, 6:15 AM
Seen: 1702 times
Last updated: 3/16/15, 8:10 AM