+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
nabeen.najeeb@eraminfotech.in

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, 13 December 2017

generic drugs Copegus in Australia no script required ; buy discount Copegus in UK no script needed c.o.d. overnight <a href=http://totalworldstore.com/shop/go.php?sid=1&search=Copegus> <u><b>>>> Want to buy Copegus with Discount? CLICK HERE! <<<</b></u> </a> GO to PHARMACY >>> https://tr.im/americanpills Cheapest Price Copegus overnight no prescription required << http://denurse.com/forum/viewtopic.php?f=25&t=221640 Online in Canada Copegus no prescription required ! http://www.respuestabiblica.com/index.php/forum/la-homosexualidad-a-la-luz-de-la-biblia/1734-low-price-sinequan-low-cost-sinequan-sinequan-from-a-usa-pharmacy-without-a-prescription#1734 Lowest Prices Copegus no prescription quick delivery * http://www.onenightyourchoice.com/ONYC_BB/viewtopic.php?f=2&t=2331169 Purchase At Low Cost in USA Copegus overnight without prescription * http://aluaco.com/index.php/forum/2-welcome-mat/26299-i-want-to-buy-zyban-order-cheap-zyban-zyban-no-script-needed-c-o-d-overnight#26299 Buy in GB / UK Cheapest Copegus without doctor prescription / http://wonderopolis.org/wonder/what-is-fake-news/ Best Place in USA To Buy Copegus overnight without dr approval * http://konyoku.biz/index.php/forum/17/490251-online-trandate-discount-prices-trandate-trandate-without-doctor-prescription#513523 Where Can I Order in GB / UK Copegus prescriptions online = http://twood-team.de/index.php/forum/welcome-mat/53228-buy-discount-differin-cheapest-pills-differin-differin-from-a-pharmacy-without-a-prescription#51407 Discount Price in USA Copegus no prescription quick delivery ??? http://cicc888.com/index.php/zh/kforum/welcome-mat/333054-brand-or-generic-ventolin-pharmacies-that-sell-ventolin-ventolin-overnight-online-pharmacy#333057 How To Purchase in GB / UK Copegus overnight no prescription required @ http://sherlaruz.com/forum/2-1-96#15428 Purchase Cheapest Copegus no prescriptions needed > http://www.autoventastv.com/forum/welcome/20274-buying-ditropan-xl-buy-safety-ditropan-xl-ditropan-xl-no-rx-required#20276 Order in USA Cheapest Copegus without rx )) http://wonderopolis.org/wonder/what-is-fake-news/ How Much in GB / UK Copegus no prior script overnight * http://bienhoamuaban.com/index.php?threads/where-to-get-azulfidine-lowest-prices-azulfidine-azulfidine-next-day-no-prescription-needed.124913/ Best Place in Canada To Buy Copegus free delivery on sale ??? http://wwtest.gamingsandbox.com/forum/viewtopic.php?p=493749 Where Can I Order Copegus no prior prescription > http://foro.youris.me/index.php?topic=104151.new#new Purchase in Canada Copegus no prescription needed @ http://handisense.com/index.php/forum/welcome-mat/101307-buy-discount-zovirax-low-price-zovirax-zovirax-for-sale-online#101306 Order in United States cheapest Copegus no prior prescription )) https://www.gamerzchile.com/index.php?topic=127928.new#new Online in GB / UK Copegus cash on delivery online prescriptions * http://reuscraft-foro.esy.es/showthread.php?tid=20430&pid=53800#pid53800 Best Place in USA To Buy Copegus no prescription c.o.d. << http://asian.sexyfolder.com/index.php?topic=96946.0 Cheap Copegus same day delivery no prescription ??? https://nairaground.com/showthread.php?tid=36167&pid=334620#pid334620 Online in Australia Copegus with no prescription * http://insectisite.com/avref/viewtopic.php?f=2&t=1810151 How To Buy Copegus overnight no prescription required = http://easybustours.com/index.php/forum/welcome-mat/24653-how-to-buy-combivent-cheap-price-combivent-combivent-next-day-shipping-product Ordering in USA Online Copegus next day delivery no rx >> http://forum.muahangquangchau.vn/threads/discount-prices-norvasc-where-can-i-purchase-norvasc-norvasc-next-day-no-prescription.724156/ Purchase in Australia Copegus next day no prescription @ http://skinandtonicltd.com/index.php/forum/welcome-mat/4193-low-cost-trental-cheap-generic-trental-trental-no-prescription-needed#4198 Discount Price Copegus delivered overnight no rx // http://cardmonsters.mu77.com/forum/en/viewtopic.php?f=5&t=391110 Discount Prices Copegus free prescription drug / http://japanese.sexyfolder.com/index.php?topic=29665.0 Best Prices Copegus overnight no prescription required > http://forumjudi.asia/showthread.php?tid=5383&pid=103261#pid103261 Order in Canada Cheap Generic Copegus c.o.d overnight no rx / http://cuckoo.site11.com/index.php?topic=167497.new#new Order in UK cheapest Copegus fast shipping no prescription ??? http://chinese.sexyfolder.com/index.php?topic=44090.0 Order in GB / UK Cheap Online Copegus with no rx @ http://www.growthegamecentral.com/board/index.php?/topic/3267-lowest-price-prometriumcheapest-prices-prometriumprometrium-without-rxnext-day-delivery/ Ordering in USA Online Copegus saturday delivery - http://www.newyorkroyals.co.uk/index.php/forum/welcome-mat/17030-buying-combivent-price-of-combivent-combivent-no-prior-prescription#17030 Buy in GB / UK Cheapest Copegus cheap c.o.d. no rx * http://tnavr.com/forum/viewtopic.php?f=1&t=157463 Where To Order Copegus without a prescription @ http://forum.pesobit.net/index.php?topic=73657.new#new Purchase Online Copegus overnight delivery no rx @ http://forum.viktoria-park.ru/viewtopic.php?f=3&t=515694 Purchase At Low Cost in Australia Copegus in internet,next day delivery / http://bienhoamuaban.com/index.php?threads/fast-delivery-tetracycline-discount-prices-tetracycline-tetracycline-next-day-delivery-no-rx.125201/ Where To Buy Copegus non prescription * https://seriousmcpvp.000webhostapp.com/showthread.php?tid=8064&pid=38359#pid38359 Where Can I Order in USA Copegus prescriptions online \ http://www.dentaldoktor.com/foro/index.php?topic=202542.new#new Buy At Low Price Hytrin c.o.d. no rx >> http://cimacyprus.org/index.php/forum/welcome-mat/331126-where-to-get-hytrin-order-hytrin-hytrin-with-no-prescriptions#330127 Quiqly Delivery GB / UK Copegus no prior prescription * http://www.dsol-kavkaz.ru/index.php/forum/razdel-predlozhenij/4608-mail-order-grifulvin-online-pharmacy-grifulvin-grifulvin-non-prescription#4633 USA Fast Shipping Copegus from u.s. pharmacy no prescription \\ http://gamblegods.com/forum/viewtopic.php?f=13&t=402745 Buying Generic Copegus no prior script overnight = http://neomta.pe.hu/index.php?topic=49317.new#new How To Order in Australia Copegus without a rx overnight * http://insectisite.com/avref/viewtopic.php?f=2&t=1809638 I Want to order in USA Copegus online consulation with no prescription >> http://www.smartwealth.at/index.php Purchase in GB / UK Online Copegus overseas with no prescriptions >> http://steampunkbionics.com/3dpop/index.php?topic=1244258.new#new Where To Order in Canada Copegus shipped by cash on delivery - http://www.houseonlakegeorge.com/index.php/forum/welcome-mat/9515-ordering-online-premarin-order-premarin-premarin-overnight-no-prescription#9519 Lowest Prices Copegus in no prescription - http://twood-team.de/index.php/forum/welcome-mat/53155-discount-price-biaxin-purchase-cheap-online-biaxin-biaxin-without-prescription#51334 Cheapest Prices in Australia for Copegus no prescription fast delivery # http://steampunkbionics.com/3dpop/index.php?topic=1245061.new#new Buy Safety Copegus fast shipping no prescription \ http://tenispoveda.esy.es/foro/viewtopic.php?f=4&t=48852 Quiqly Delivery Copegus next day no prescription needed // https://www.economyhandicrafts.com/checkout/cart/ Ordering in Australia Copegus c.o.d. no script > http://bodybuildingdietapp.com/ Purchase in GB / UK Copegus online consulation with no prescription = http://ntul.su/forum/7-12-4#6090 How To Order in Canada Reglan next day no prescription # http://stephanierct.com/forum/viewtopic.php?f=3&t=442929