Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleMetric.js
index 89b9ebc..ac138f6 100644 (file)
@@ -200,46 +200,33 @@ Pman.Tab.XtupleMetric = new Roo.XComponent({
                             xns: Roo.Toolbar,
                             listeners : {
                                 click : function ()
-                                {
-                                
-                                     var sel  = _this.invgrid.getSelectionModel().getSelected();
-                                    if (!sel) {
-                                        Roo.MessageBox.alert("Error", "Select a invoice");
-                                        return;
-                                    }
-                                    // check current status of shipment..
+                                {   
+                                    var cs = _this.grid.getSelectionModel().getSelectedCell();
                                     
-                                    var params =  {
-                                //        cobmisc_id : sel.data.cobmisc_id,
-                                        _void : 1
-                                    };
-                                    if (sel.data.cobmisc_id * 1) {
-                                        params.cobmisc_id = sel.data.cobmisc_id * 1 ;
-                                    }
-                                    if (sel.data.cobmisc_invchead_id_invchead_id * 1) {    
-                                        params.invchead_id  =  sel.data.cobmisc_invchead_id_invchead_id * 1;
+                                    if (!cs) {
+                                        Roo.MessageBox.alert("Error", "Select a cell");
+                                        return;
                                     }
+                                    _this.grid.stopEditing();
+                                 
+                                    var r = _this.grid.ds.getAt(cs[0]);
                                     
-                                    Roo.MessageBox.confirm("Are you sure", "Are you sure you want to VOID that invoice?",
-                                        function(r) {
-                                            if (r != 'yes') {
-                                                return;
-                                            }
-                                            new Pman.Request({
-                                                mask : 'Sending',
-                                                url : baseURL + '/Roo/cobmisc',
-                                                method : 'POST',
-                                                params :  params,
-                                                success : function() {
-                                                    _this.invgrid.ds.load({});
-                                                }
-                                            })
-                                            
+                                    Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete this metric?", function (v){
+                                        if (v != 'yes') {
+                                            return;
                                         }
-                                    );
-                                            
-                                            
-                                   
+                                        
+                                        new Pman.Request({
+                                            url : baseURL + '/Roo/Metric',
+                                            method : 'POST',
+                                            params : {
+                                                _delete : r.data.id
+                                            },
+                                            success : function(res) {
+                                                _this.grid.footer.onClick('refresh');
+                                            }
+                                        });
+                                    });
                                 }
                             },
                             cls : 'x-btn-text-icon',