{"id":1875,"date":"2022-03-21T16:54:38","date_gmt":"2022-03-21T11:24:38","guid":{"rendered":"https:\/\/store.ksolves.com\/blog\/?p=1875"},"modified":"2022-03-25T16:35:06","modified_gmt":"2022-03-25T11:05:06","slug":"understand-the-difference-between-api-onchange-and-api-depends","status":"publish","type":"post","link":"https:\/\/store.ksolves.com\/blog\/odoo\/understand-the-difference-between-api-onchange-and-api-depends","title":{"rendered":"Understand the Difference between api-onchange and api-depends"},"content":{"rendered":"<p>Odoo supports several decorators two among them are \u2018<b>onchange\u2019<\/b> and \u2018<b>depends\u2019 <\/b>decorators. We are going to discuss the api-onchange and api-decorators. But before that, we will understand what decorators are and how to use them.<\/p>\n<p>In this write-up, you will learn about the \u2018Method Decorators\u2019 in Odoo.<\/p>\n<h3 class=\"mt-4\"><b>INTRODUCTION TO DECORATORS<\/b><\/h3>\n<h4 class=\"mt-4\"><b>What are decorators?<\/b><\/h4>\n<p>Decorators let you change how a method operates. Furthermore, it allows us to expand the behavior of another function. In other words, it accepts a function and adds specific functionality to it before returning the function.<\/p>\n<p>Meaning, a decorator in Python is a function that takes another function as its argument and returns another function. Decorators can be extremely useful as they allow the extension of an existing function, without any modification to the original function source code.<\/p>\n<p><b class=\"mt-4\">Let\u2019s understand with an example<\/b><\/p>\n<p>Let our original <b>division<\/b> function calculate division but don\u2019t check zero in the division so without changing the original division function we will check and prevent division if 0 exist in the argument.<\/p>\n<p>def <b>div_by_0<\/b>(func):\u00a0 &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;. # custom function which will check the 0 in argument<\/p>\n<p>def check(x, y):<\/p>\n<p>if 0 in (x, y):<\/p>\n<p>print(&#8216;Cant perform Operation&#8217;)<\/p>\n<p>return<\/p>\n<p>return func(x, y)<\/p>\n<p>return check<\/p>\n<p><b>@div_by_0 <\/b><\/p>\n<p>def <b>division<\/b>(x, y): \u00a0 &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;. \u00a0 # original division function<\/p>\n<p>result = x \/ y<\/p>\n<p>print(result)<\/p>\n<p><b>OR\u00a0<\/b><\/p>\n<p>division = div_by_0(division)\u00a0 &#8230;&#8230;.. # to make this line shorter decorator uses <b>@\u00a0<\/b><\/p>\n<p>division(10,5)\u00a0 &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;. \u00a0 \u00a0 #calling of the division method<\/p>\n<p>@api.depends and @api.onchange both are decorators, but the main difference between them is stated further in the blog.<\/p>\n<h4 class=\"mt-4\"><b>GETTING STARTED WITH ODOO DECORATORS<\/b><\/h4>\n<p>The decorators in Odoo Module includes the following functions:<\/p>\n<p><b class=\"mt-4\">API ONCHANGE DECORATOR<\/b><\/p>\n<p><b>@api.onchange <\/b>is triggered in the same view and same model when the fields specified inside the decorator value change. Also, onchange has instant function invokation when the field value is changed.<\/p>\n<p>Syntax for api.onchange decorator in odoo<\/p>\n<p><b>@api.onchange(&#8216;field_name_1&#8217;, &#8216;field_name_2&#8217;, &#8230;)<\/b><\/p>\n<p><b>def function(self):<\/b><\/p>\n<p><b>#do something<\/b><\/p>\n<p><b>return<\/b><\/p>\n<p>It is an Odoo decorator, which runs when <b>field_name<\/b> value changes that is defined in the decorator, and value for <b>field_name<\/b> can be changed from its form view.<\/p>\n<p><b>Let\u2019s take this example<\/b><\/p>\n<p>let partner_name is a many2one field from res.partner(contact), where res.partner has a gender field in its form view.<\/p>\n<p>partner_name = fields.Many2one(&#8220;res.partner&#8221;,\u00a0 string=&#8221;Name&#8221;)<\/p>\n<p>partner_gender = field.char(&#8220;Gender&#8221;)<\/p>\n<p><b>Code<\/b><\/p>\n<p>@api.onchange(&#8216;partner_name&#8217;)<\/p>\n<p>def partner_gender(self):<\/p>\n<p>for current_record in self:<\/p>\n<p>if current_record.partner_name:<\/p>\n<p>current_record.partner_gender = current_record.partner_name.gender<\/p>\n<h4 class=\"mt-4\"><b>API DEPENDS DECORATOR<\/b><\/h4>\n<p><b>@api.depends<\/b> a function defined with this decorator will be called if any change happens in the fields specified. These fields can be <b>computed<\/b> (instead of fetching data from the database). Computed fields are not stored by default, they are computed and returned when requested. Hence, depends uses the compute keyword to call the function for computing the value.<\/p>\n<p>Syntax for api.depends decorator in odoo<\/p>\n<p><b>@api.depends (&#8216;field_name_1&#8217;, &#8216;field_name_2&#8217;, &#8230;)<\/b><\/p>\n<p><b>def function(self):<\/b><\/p>\n<p><b>#do something<\/b><\/p>\n<p><b>return<\/b><\/p>\n<p><b>Let\u2019s discuss with an example<\/b><\/p>\n<p>marks_obtained = fields.Float(\u2018Marks Obaintained\u2019)<\/p>\n<p>total_marks = fields.Float(\u2018Total Marks\u2019)<\/p>\n<p>percentage_score = fields.Float(string=\u2018Percentage\u2019, store=True, compute=\u2019_calculate_percent\u2019)<\/p>\n<p><b>Code<\/b><\/p>\n<p>@api.depend(\u2018marks_obtained\u2019, \u2018total_marks\u2019)<\/p>\n<p>def _calculate_percent(self):<\/p>\n<p>for record in self:<\/p>\n<p>if\u00a0 record.marks_obtained and record.total_marks:<\/p>\n<p>record.percentage_score = (record.marks_obtained \/ record.total_marks)*100<\/p>\n<h4 class=\"mt-4\"><b>What conclusion can be drawn?<\/b><\/h4>\n<p>Api. depends decorator will trigger if any of the fields specified in the decorator is <b>changed and saved <\/b>from<b> form view. <\/b>Whereas api.onchange decorator will trigger if any of the fields specified in the decorator is <b>changed <\/b>in the<b> form <\/b>before you<b> save, it will trigger.<\/b><\/p>\n<p>If you need any assistance with a deeper understanding of Odoo decorators, consult with Ksolves experts.<\/p>\n<p>Odoo customization, integration, extension, and other services are available at our Ksolves store. Contact us for robust Odoo services at the given details:<\/p>\n<p>Website: <a href=\"https:\/\/store.ksolves.com\/\"><span style=\"font-weight: 400; color: #0000ff;\">https:\/\/store.ksolves.com\/<\/span><br \/>\n<\/a>Email: <a href=\"mailto:sales@ksolves.com\">sales@ksolves.com<\/a><br \/>\nPhone:+1(646)-203-1075, +91-7498170227<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1875\" class=\"pvc_stats all  \" data-element-id=\"1875\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" data-src=\"https:\/\/store.ksolves.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 16px; --smush-placeholder-aspect-ratio: 16\/16;\" \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Odoo supports several decorators two among them are \u2018onchange\u2019 and \u2018depends\u2019 decorators. We are going to discuss the api-onchange and [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1875\" class=\"pvc_stats all  \" data-element-id=\"1875\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" data-src=\"https:\/\/store.ksolves.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 16px; --smush-placeholder-aspect-ratio: 16\/16;\" \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":3,"featured_media":1877,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1875","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-odoo"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is the difference between api-onchange and api-depends?<\/title>\n<meta name=\"description\" content=\"There are two types of Odoo decorators, one is \u2018onchange\u2019 and another is \u2018depends\u2019. Know the key difference between both decorators.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is the difference between api-onchange and api-depends?\" \/>\n<meta property=\"og:description\" content=\"There are two types of Odoo decorators, one is \u2018onchange\u2019 and another is \u2018depends\u2019. Know the key difference between both decorators.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends\" \/>\n<meta property=\"og:site_name\" content=\"Ksolves Store Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-21T11:24:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-03-25T11:05:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/store.ksolves.com\/blog\/wp-content\/uploads\/2022\/03\/Method-Decorators-in-Odoo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"880\" \/>\n\t<meta property=\"og:image:height\" content=\"440\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Parul Gautam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Parul Gautam\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/store.ksolves.com\/blog\/odoo\/understand-the-difference-between-api-onchange-and-api-depends\",\"url\":\"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends\",\"name\":\"What is the difference between api-onchange and api-depends?\",\"isPartOf\":{\"@id\":\"https:\/\/store.ksolves.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends#primaryimage\"},\"image\":{\"@id\":\"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends#primaryimage\"},\"thumbnailUrl\":\"https:\/\/store.ksolves.com\/blog\/wp-content\/uploads\/2022\/03\/Method-Decorators-in-Odoo.jpg\",\"datePublished\":\"2022-03-21T11:24:38+00:00\",\"dateModified\":\"2022-03-25T11:05:06+00:00\",\"author\":{\"@id\":\"https:\/\/store.ksolves.com\/blog\/#\/schema\/person\/24bfd358b29cc978fd6e7f809e28b7d2\"},\"description\":\"There are two types of Odoo decorators, one is \u2018onchange\u2019 and another is \u2018depends\u2019. Know the key difference between both decorators.\",\"breadcrumb\":{\"@id\":\"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends#primaryimage\",\"url\":\"https:\/\/store.ksolves.com\/blog\/wp-content\/uploads\/2022\/03\/Method-Decorators-in-Odoo.jpg\",\"contentUrl\":\"https:\/\/store.ksolves.com\/blog\/wp-content\/uploads\/2022\/03\/Method-Decorators-in-Odoo.jpg\",\"width\":880,\"height\":440,\"caption\":\"Method Decorators in Odoo\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/store.ksolves.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understand the Difference between api-onchange and api-depends\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/store.ksolves.com\/blog\/#website\",\"url\":\"https:\/\/store.ksolves.com\/blog\/\",\"name\":\"Ksolves Store Blog\",\"description\":\"Where Great Ideas Change Your Business\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/store.ksolves.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/store.ksolves.com\/blog\/#\/schema\/person\/24bfd358b29cc978fd6e7f809e28b7d2\",\"name\":\"Parul Gautam\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/store.ksolves.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9eb990d177ece8faa608213c706ff36edd7f09fbb996e90aaa4d36dcb6f41cac?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9eb990d177ece8faa608213c706ff36edd7f09fbb996e90aaa4d36dcb6f41cac?s=96&d=mm&r=g\",\"caption\":\"Parul Gautam\"},\"description\":\"Parul Gautam is a Sr. Technical Writer who believes in bridging the gap between customers and Technologies. She can convert the aura of any Technology into Powerful Words. One time she can Jot Down her words and at the other, she will Tap on the Beats of Great Music. To Taste the Recipe of her Writing, hang on to the great Blogs.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is the difference between api-onchange and api-depends?","description":"There are two types of Odoo decorators, one is \u2018onchange\u2019 and another is \u2018depends\u2019. Know the key difference between both decorators.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends","og_locale":"en_US","og_type":"article","og_title":"What is the difference between api-onchange and api-depends?","og_description":"There are two types of Odoo decorators, one is \u2018onchange\u2019 and another is \u2018depends\u2019. Know the key difference between both decorators.","og_url":"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends","og_site_name":"Ksolves Store Blog","article_published_time":"2022-03-21T11:24:38+00:00","article_modified_time":"2022-03-25T11:05:06+00:00","og_image":[{"width":880,"height":440,"url":"https:\/\/store.ksolves.com\/blog\/wp-content\/uploads\/2022\/03\/Method-Decorators-in-Odoo.jpg","type":"image\/jpeg"}],"author":"Parul Gautam","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Parul Gautam","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/store.ksolves.com\/blog\/odoo\/understand-the-difference-between-api-onchange-and-api-depends","url":"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends","name":"What is the difference between api-onchange and api-depends?","isPartOf":{"@id":"https:\/\/store.ksolves.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends#primaryimage"},"image":{"@id":"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends#primaryimage"},"thumbnailUrl":"https:\/\/store.ksolves.com\/blog\/wp-content\/uploads\/2022\/03\/Method-Decorators-in-Odoo.jpg","datePublished":"2022-03-21T11:24:38+00:00","dateModified":"2022-03-25T11:05:06+00:00","author":{"@id":"https:\/\/store.ksolves.com\/blog\/#\/schema\/person\/24bfd358b29cc978fd6e7f809e28b7d2"},"description":"There are two types of Odoo decorators, one is \u2018onchange\u2019 and another is \u2018depends\u2019. Know the key difference between both decorators.","breadcrumb":{"@id":"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends#primaryimage","url":"https:\/\/store.ksolves.com\/blog\/wp-content\/uploads\/2022\/03\/Method-Decorators-in-Odoo.jpg","contentUrl":"https:\/\/store.ksolves.com\/blog\/wp-content\/uploads\/2022\/03\/Method-Decorators-in-Odoo.jpg","width":880,"height":440,"caption":"Method Decorators in Odoo"},{"@type":"BreadcrumbList","@id":"https:\/\/store.ksolves.com\/blog\/odoo-2\/understand-the-difference-between-api-onchange-and-api-depends#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/store.ksolves.com\/blog"},{"@type":"ListItem","position":2,"name":"Understand the Difference between api-onchange and api-depends"}]},{"@type":"WebSite","@id":"https:\/\/store.ksolves.com\/blog\/#website","url":"https:\/\/store.ksolves.com\/blog\/","name":"Ksolves Store Blog","description":"Where Great Ideas Change Your Business","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/store.ksolves.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/store.ksolves.com\/blog\/#\/schema\/person\/24bfd358b29cc978fd6e7f809e28b7d2","name":"Parul Gautam","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/store.ksolves.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9eb990d177ece8faa608213c706ff36edd7f09fbb996e90aaa4d36dcb6f41cac?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9eb990d177ece8faa608213c706ff36edd7f09fbb996e90aaa4d36dcb6f41cac?s=96&d=mm&r=g","caption":"Parul Gautam"},"description":"Parul Gautam is a Sr. Technical Writer who believes in bridging the gap between customers and Technologies. She can convert the aura of any Technology into Powerful Words. One time she can Jot Down her words and at the other, she will Tap on the Beats of Great Music. To Taste the Recipe of her Writing, hang on to the great Blogs."}]}},"_links":{"self":[{"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/posts\/1875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/comments?post=1875"}],"version-history":[{"count":3,"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/posts\/1875\/revisions"}],"predecessor-version":[{"id":2245,"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/posts\/1875\/revisions\/2245"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/media\/1877"}],"wp:attachment":[{"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/media?parent=1875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/categories?post=1875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/store.ksolves.com\/blog\/wp-json\/wp\/v2\/tags?post=1875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}