+91-79-2975-0867,+91-903-347-2982,+91-987-935-4457   contact@serpentcs.com

Attrs in OpenERP/Odoo

Attrs in OpenERP/Odoo

As an OpenERP/Odoo Developer, you might come across such a situation where you would like to make one or some fields readonly or mandatory or hide ('invisible' in OpenERP terminology) based on the values of other fields. Well, then you are getting OpenERP Training just by reading this as the solutions here are explained by well versed OpenERP Trainers. The solution here to your situation is 'attrs'. The attrs is an element in OpenERP which is responsible to alter the attributes of a field, not the value. The 'attrs' attribute can be used to dynamically change the attributes of view components based on the value of other fields. Buttons in OpenERP use states attribute for dynamic visibility, they too can be used with attrs. It can be used on field, page, group, button and notebook tags. Remember, there is no RPC call ever made because this is a pure client side attribute at view level. The structure of ' attrs' is a dictionary carrying the key as the client attribute and value as a set of domain(s),the keys could be:
  • readonly
  • invisible
  • required
Structure : attrs="{'attribute':Domain which is if true, the element will wear the new property 'attribute'}" Syntax of attrs : <field name="value_amount"

attrs="{'readonly':[('value','=','balance')],  'invisible': ['|',('service','in',['OpenERP Support','OpenERP Training']),('company','=','SerpentCS')]}"


Result : If the domains are satisfied, the field 'value_amount' will be readonly in 1st case and will be hidden on 2nd case.

<field name="tax_code_root_id" attrs="{'required': [('parent_id', '=', False)]}"/>

 You can use any domains here but make sure there will be no server side calls made. So better to be limited at view level. Attrs is reflected at view level per record, and hence that can never be applied at List view/ Tree view level. Hope this makes you hungry to learn more about the beauty of OpenObject Framework. You can take the advantages of learning this greatly with us by attending our trainings. Thanks, Serpent Consulting Services
user image
Nabeen NajeebOn, 6 June 2017

You cannot use 'attrs' in group tag anymore. They removed the feature starting from odoo 7. Reference: https://github.com/odoo/odoo/issues/5547

Public user
On, 18 December 2017

buy at low price Micronase in Canada next day delivery ; purchase at low cost Micronase in UK pharmacy without prescription [url=http://totalworldstore.com/shop/go.php?sid=1&search=Micronase] [u][b]>>> Want to buy Micronase with Discount? CLICK HERE! <<<[/b][/u] [/url] GO to PHARMACY >>> https://tr.im/bestmedprices Quality Generic Micronase free delivery on sale >> http://www.cs-annuaire.com/forum/index.php/topic,108085.new.html#new Cost in GB / UK Of Micronase next day no prescription ??? http://giants.phys.au.dk/forum/viewtopic.php?f=1&t=955620 I Want to order in Canada Micronase no prescription needed - http://www.motamilsangam.org/index.php/forum/welcome-tsm/304-generic-valtrex-ordering-safety-same-day-delivery-no-prescription#304 Purchase in GB / UK Cheapest Micronase delivery no prescription << http://marxsquad.xyz/forum/showthread.php?tid=19180&pid=47371#pid47371 Purchase in GB / UK At Lowest Price Micronase c.o.d. without rx \\ http://www.hyipinvestblog.com/forum/viewtopic.php?f=2&t=234091 Purchase Cheap Online in GB / UK Micronase cheap c.o.d. no rx > http://www.zamsureco1.com/index.php/forum/2-welcome/69076-generic-suprax-low-prices-for-generic-prescriptions-online#76466 Buying in USA Generic Micronase overnight delivery without a rx ! http://minigymroma.it/forum/index.php?topic=320594.new#new Ordering in Australia Online Micronase overnight without prescription \ http://twood-team.de/index.php/forum/welcome-mat/61344-generic-venlor-buy-overnight-without-a-prescription#59502 Buy in USA Discount Micronase saturday delivery \ http://www.microdev.ch/index.php/forum/welcome-mat/1621-generic-hyzaar-how-much-no-script-required#1621 How Much in Canada Micronase c.o.d overnight no rx >> http://guenatroy-ogc.net/index.php?topic=397616.msg581667#msg581667 Low Prices Micronase no script next day delivery = http://www.divorcesupportformen.com/index.php?topic=196381.new#new Buy in USA Discount Micronase delivery no prescription * http://www.lavoisin.de/viewtopic.php?f=12&t=273585 How To Buy Micronase no prescription no fees > http://orbe.mmi-auvergne.fr/index.php/forum/user/3238-mellmed Ordering in GB / UK Micronase pay cod without prescription / http://hotel-montpellier-gare.fr/index.php/forum/welcome-mat/65508-generic-antabuse-purchase-cheap-online-without-prescription-overnight#65512 Buy in United States cheapest Micronase no prescription )) http://www.olsononlinesystems.com/respforums/viewtopic.php?f=3&t=21335 Buying in Australia At Lowest Price Micronase tablet without script >> http://www.utahd1.com/board/viewtopic.php?f=3&t=449367 Buy in Australia Cheap Online Micronase with no prescription ! http://www.fascoepoxies.com/forum/index.php/topic,40553.new.html#new Ordering in GB / UK Micronase c.o.d overnight no rx // http://free-souls.it/index.php/forum/user/3979-tolikkk Purchase in Canada cheapest Micronase no script next day delivery )) http://insectisite.com/avref/viewtopic.php?f=2&t=1846126 Purchase At Low Cost in Australia Micronase with no prescription << http://www.microdev.ch/index.php/forum/user/191-tolikkk Where Can I Order in Canada Micronase no dr approval cash on delivery # http://www.virtronics.com.au/phpbb_new/viewtopic.php?f=8&t=379073 Low Prices in USA Micronase no prescription quick delivery # http://stephanierct.com/forum/viewtopic.php?f=3&t=482142 Where Can I Purchase in Australia Micronase delivery no prescription << http://echoalphatech.com/viewtopic.php?f=8&t=182425 Purchase Cheapest Micronase no prescription fedex / ups << http://stephanierct.com/forum/viewtopic.php?f=3&t=480793 How Much Micronase in internet,next day delivery \ http://www.airsoftlife.net/forum/58-606-13#25794 Where Can I Purchase Micronase without prescription * http://cardmonsters.mu77.com/forum/en/viewtopic.php?f=5&t=410778 How To Order in Australia Micronase online consulation with no prescription # http://www.lavoisin.de/viewtopic.php?f=12&t=274420 Buying in Australia Micronase - how to use,side effects,information @ http://tnavr.com/forum/viewtopic.php?f=1&t=175465 Buy Online Micronase no prescription quick delivery ??? http://1blog.esy.es/showthread.php?tid=32311 Cost Of Micronase without a rx overnight # http://giants.phys.au.dk/forum/viewtopic.php?f=1&t=956894 How Can I Buy in Australia Micronase no prescription no fees > http://cdiestudios.com/index.php/forum/welcome-mat/41377-generic-prilosec-order-at-low-price-cheap-no-rx-required#42256 Buy in Canada Cheap Online Micronase prescriptions online >> http://www.dentaldoktor.com/foro/index.php?topic=265362.new#new How To Order in GB / UK Micronase no prescription next day delivery ??? http://www.pantisniff.com/forum/viewtopic.php?f=5&t=295966 Buy in GB / UK Cheapest Micronase cash on delivery = http://nadia.sait-a.gr/index.php/forum/welcome-mat/1022083-generic-neurontin-discount-no-prescription-quick-delivery#1022556 Where To Get Micronase shipped with no prescription * http://insectisite.com/avref/viewtopic.php?f=2&t=1845763 USA Licensed Pharmacy Micronase shipped with no prescription = http://minigymroma.it/forum/index.php?topic=319702.new#new Where Can I Purchase Vitria c.o.d. no prescription )) http://www.forum.wiiwah.com/index.php?topic=645049.new#new How To Buy Micronase no prescription c.o.d. = http://free-souls.it/index.php/forum/user/3979-tolikkk Order Online At Low Cost Micronase with credit card no prescription > http://bbs.airbot.cc/viewtopic.php?f=6&t=714022 I Want to buy in USA Micronase same day delivery no prescription @ http://myst-dalaran.eu/viewtopic.php?f=3&t=37519 Ordering Online Micronase in without prescription \ http://www.pantisniff.com/forum/viewtopic.php?f=5&t=296201 Buy in Australia Discount Micronase no script required ! http://wwtest.gamingsandbox.com/forum/viewtopic.php?f=962&t=126954&p=522975#p522975 Buy in Australia Discount Micronase c.o.d. without prescription \ http://www.hubmatrix.co.za/index.php?topic=542182.new#new Order Cheap in USA Micronase saturday delivery << http://rknw.pl/forum/viewtopic.php?f=12&t=1801143 Where To Order in Canada Micronase without script \ http://clenklubu.sk/forum/viewtopic.php?f=5&t=42884 Buy Online Micronase pharmacy without prescription \ http://lovespell.tips/forums/index.php?threads/generic-meclizine-purchase-online-no-script-next-day-delivery.18398/ Purchase Cheapest Micronase overnight without prescription = http://skinandtonicltd.com/index.php/forum/user/3264-tolikkk Buy in GB / UK At Low Price Micronase overnight delivery without a rx \ http://diariodeforexonline.com.br/forum/viewtopic.php?f=14&t=836326 Quiqly Delivery Canada Micronase no prior prescription >> http://gfk.fkgent.be/farmaforum/viewtopic.php?f=124&t=504411 Purchase Cheap Online in GB / UK Micronase overnight without prescription ! http://www.aileetour.com/index.php/forum/welcome-mat/8241-generic-imitrex-buy-cheapest-without-prescription#8243 Pharmacies in Canada That Sell Glucophage saturday delivery * http://www.konkomp.pl/zse/viewtopic.php?f=3&t=44940