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.

1

How to automatically update sale order total?

By
Omal Bastin
on 10/22/13, 10:19 AM 2,750 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.

2

Omal Bastin

--Omal Bastin--
1146
| 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?

kazaf
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!

kazaf
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

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

0 follower(s)

Stats

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