Odoo Help


How to automatically update sale order total?

Omal Bastin
on 10/22/13, 10:19 AM 4,005 views

Hi How can we automatically update the total each time we entering data in the sale order line. Now i have to click on the update button near total to update the value.


Omal Bastin

--Omal Bastin--

| 6 6 8
Kochi, Kerala, India
--Omal Bastin--

Swiming deep into openERP/ODOO

Omal Bastin
On 10/23/13, 3:48 AM

Got it! Added an onchange for the order line field.You will be able to get a list of tuples. Also added a fix in the web module.Data to the readonly field is saved if write function is called. But we want to change the readonly fields data by the onchange functions. Following is the patch

Index: view_form.js
--- openerp/addons/web/static/src/js/view_form.js   
+++ openerp/addons/web/static/src/js/view_form.js   
@@ -833,11 +833,9 @@
                     // Special case 'id' field, do not save this field
                     // on 'create' : save all non readonly fields
                     // on 'edit' : save non readonly modified fields
-                    if (!f.get("readonly")) {
-                        values[f.name] = f.get_value();
-                    } else {
-                        readonly_values[f.name] = f.get_value();
-                    }
+                   values[f.name] = f.get_value();
+                    if (f.get("readonly"))
+                       readonly_values[f.name] = f.get_value();
             if (form_invalid) {

Hi, Can you please explain more clearly?

on 10/27/13, 11:04 PM

I have added an on_change event on the one2many field. but the on_change method is triggerred only when i click 'Add an item' on the tree. That's to say , the amount of the last row cannot be counted. Have u solved this case? thank you!

on 10/27/13, 11:06 PM

I was able to get it. I have added a onchange function for the order_line field and the function defined in sale order.The onchange function is executed when we click on another reocrd.

Omal Bastin
on 10/28/13, 6:35 AM

Hi Omal, can you post the detail of your fix?

Toan Trieu
on 2/3/14, 3:16 AM

+1 Please post the details - thank you!

Michael Karrer
on 2/13/14, 3:55 AM

Could you publish a module on launchpad, or at least a detailed patch, please?

Mathieu Stumpf
on 4/16/14, 12:23 PM

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

0 follower(s)


Asked: 10/22/13, 10:19 AM
Seen: 4005 times
Last updated: 3/16/15, 8:10 AM