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

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

By
kaisusr
on 9/9/14, 6:15 AM 1,075 views

hi

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"/>
                        </tree>
                    </field>

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

1

Ivan

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

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

how ???

kaisusr
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.

Ivan
on 9/11/14, 1:58 AM

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: 9/9/14, 6:15 AM
Seen: 1075 times
Last updated: 3/16/15, 8:10 AM