İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
8163 Görünümler

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.

Avatar
Vazgeç
Üretici En İyi Yanıt

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) {
Avatar
Vazgeç

Hi, Can you please explain more clearly?

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!

Üretici

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.

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

+1 Please post the details - thank you!

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

İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Eyl 23
7717
2
Mar 23
46810
2
Ara 23
57722
0
Mar 22
2392
3
Haz 20
10702