deisy vor 6 Jahren
Ursprung
Commit
55ad75f02c

+ 28 - 3
static/src/js/reports/report_crm_partners.js

@@ -141,7 +141,6 @@ function report_crm_partners(reporting) {
             self.$el.find('#current-contact').append('<option value="' + item.id + '">' + item.name + '</option>');
           });
         } else {
-          CrmTrackingSource
           self.$el.find('.contact').css('display', 'none');
         }
         return self.fetchCrmTrackingSource();
@@ -177,6 +176,17 @@ function report_crm_partners(reporting) {
         } else {
           self.$el.find('.city').css('display', 'none');
         }
+        return self.fetchCrmCaseCateg();
+      }).then(function(CrmCaseCateg) {
+        self.CrmCaseCateg = CrmCaseCateg;
+        if (CrmCaseCateg.length > 1) {
+          self.$el.find('#current-tag').append('<option value="9999999">Todas las etiquetas</option>');
+          _.each(CrmCaseCateg, function(item) {
+            self.$el.find('#current-tag').append('<option value="' + item.id + '">' + item.name + '</option>');
+          });
+        } else {
+          self.$el.find('.tag').css('display', 'none');
+        }
         return self.fetchResCurrency();
       }).then(function(ResCurrency) {
         self.ResCurrency = ResCurrency;
@@ -294,6 +304,16 @@ function report_crm_partners(reporting) {
       });
       return defer;
     },
+    fetchCrmCaseCateg: function() {
+      var self = this;
+      var defer = $.Deferred();
+      var fields = ['id', 'name', ];
+      var tag = new model.web.Model('crm.case.categ');
+      tag.query(fields).filter().all().then(function(results) {
+        defer.resolve(results);
+      });
+      return defer;
+    },
 
     fetchCrmLead: function() {
       var self = this;
@@ -304,6 +324,7 @@ function report_crm_partners(reporting) {
       var stage = self.$el.find('#current-crm-stage').val();
       var source = self.$el.find('#current-source').val();
       var campaign = self.$el.find('#current-campaign').val();
+      var tag = self.$el.find('#current-tag').val();
       var fields = ['id', 'name', 'partner_id', 'stage_id', 'source_id', 'create_date'];
       var domain = [
         ['type', '=', 'opportunity']
@@ -342,6 +363,10 @@ function report_crm_partners(reporting) {
       if (campaign && campaign != 9999999) {
         domain.push(['campaign_id', '=', parseInt(campaign)])
       }
+      if (tag && tag != 9999999) {
+        domain.push(['categ_ids', '=', parseInt(tag)])
+      }
+
 
       var contact = new model.web.Model('crm.lead');
       contact.query(fields).filter(domain).all().then(function(results) {
@@ -637,7 +662,7 @@ function report_crm_partners(reporting) {
             halign: 'left'
           },
           partner_name: {
-            columnWidth: 25,
+            columnWidth: 30,
             halign: 'left'
           },
           street: {
@@ -655,7 +680,7 @@ function report_crm_partners(reporting) {
             halign: 'left'
           },
           email: {
-            columnWidth: 40,
+            columnWidth: 50,
             halign: 'left'
           },
         };

+ 4 - 0
static/src/reports/report_crm_partners.xml

@@ -42,6 +42,10 @@
             <label>Campaña</label>
             <select id="current-campaign" class="form-control form-control-sm"></select>
           </div>
+          <div class="col-lg-3 tag filter-style">
+            <label>Etiquetas</label>
+            <select id="current-tag" class="form-control form-control-sm"></select>
+          </div>
           <div class="col-lg-3 city filter-style">
             <label>Ciudad</label>
             <select id="current-city" class="form-control form-control-sm"></select>