Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
8188 Visualizzazioni

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
Abbandona
Autore Risposta migliore

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
Abbandona

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!

Autore

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?

Post correlati Risposte Visualizzazioni Attività
2
set 23
7736
2
mar 23
46828
2
dic 23
57749
0
mar 22
2416
3
giu 20
10715