Fabien (Open ERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-10-first-clicks-purchase-atp-invoice-nco into 
lp:openerp-web.

Requested reviews:
  OpenERP R&D Web Team (openerp-dev-web)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-10-first-clicks-purchase-atp-invoice-nco/+merge/133791
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-10-first-clicks-purchase-atp-invoice-nco/+merge/133791
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-10-first-clicks-purchase-atp-invoice-nco.
=== modified file 'addons/web/static/src/js/view_list.js'
--- addons/web/static/src/js/view_list.js	2012-11-09 08:35:13 +0000
+++ addons/web/static/src/js/view_list.js	2012-11-10 13:49:21 +0000
@@ -1016,6 +1016,7 @@
                     ids = value;
                 }
                 new instance.web.Model(column.relation)
+<<<<<<< TREE
                     .call('name_get', [ids]).done(function (names) {
                         // FIXME: nth horrible hack in this poor listview
                         record.set(column.id + '__display',
@@ -1024,6 +1025,12 @@
                     });
                 // temp empty value
                 record.set(column.id, false);
+=======
+                    .call('name_get', [ids]).then(function (names) {
+                        record.set(column.id + '_many2many', value);
+                        record.set(column.id, _(names).pluck(1).join(', '));
+                    })
+>>>>>>> MERGE-SOURCE
             }
         }
         return column.format(record.toForm().data, {

=== modified file 'addons/web/static/src/js/view_list_editable.js'
--- addons/web/static/src/js/view_list_editable.js	2012-11-08 15:35:44 +0000
+++ addons/web/static/src/js/view_list_editable.js	2012-11-10 13:49:21 +0000
@@ -726,6 +726,10 @@
             // TODO: specify sequence of edit calls
             var self = this;
             var form = self.form;
+            var m2m_field = this.get_many2many_field();
+            if(record && m2m_field.length !== 0){
+                record = this.set_many2many_record(m2m_field, record);
+            }
             var loaded = record
                 ? form.trigger('load_record', _.extend({}, record))
                 : form.load_defaults();
@@ -740,6 +744,19 @@
                 return form;
             });
         },
+        get_many2many_field:function(){
+            var parent = this.getParent();
+            return _.filter(parent.columns, function(field){
+                return field.type === "many2many";
+            });
+        },
+        set_many2many_record:function(m2m_field, record){
+            _.each(m2m_field, function(field){
+                record[field.name] = record[field.name + '_many2many'];
+                delete record[field.name + '_many2many'];
+            });
+            return record;
+        },
         save: function () {
             var self = this;
             return this.form

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to