|
@@ -1,102 +0,0 @@
|
|
|
-function configuration_reporting (reporting, instance, widget) {
|
|
|
- "use strict";
|
|
|
- var widgets = widget;
|
|
|
-
|
|
|
- widget.ReportingWidget = instance.Widget.extend({
|
|
|
- template: 'EiruReport',
|
|
|
- events: {},
|
|
|
-
|
|
|
- start: function () {
|
|
|
- var self = this;
|
|
|
- self.fetchInitial();
|
|
|
- self.BuildChart();
|
|
|
- },
|
|
|
-
|
|
|
- fetchInitial:function() {
|
|
|
- var self = this;
|
|
|
- self.fetchResUser().then(function (ResUser) {
|
|
|
- return ResUser;
|
|
|
- }).then(function (ResUser) {
|
|
|
- self.ResUser = ResUser;
|
|
|
- return self.fetchResCurrency();
|
|
|
- }).then(function (ResCurrency) {
|
|
|
- self.ResCurrency = ResCurrency;
|
|
|
- self.BuildChart();
|
|
|
- return self.InsertUser();
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- fetchResUser: function() {
|
|
|
- var self = this;
|
|
|
- var defer = $.Deferred();
|
|
|
- var fields = ['id','name'];
|
|
|
- var domain = [['id','=',self.session.uid]];
|
|
|
- var ResUser = new instance.web.Model('res.users');
|
|
|
- ResUser.query(fields).filter(domain).all().then(function (results) {
|
|
|
- defer.resolve(results);
|
|
|
- });
|
|
|
- return defer;
|
|
|
- },
|
|
|
-
|
|
|
- /*====================================================================
|
|
|
- RES CURRENCY
|
|
|
- ====================================================================*/
|
|
|
- fetchResCurrency : function(){
|
|
|
- var self = this;
|
|
|
- var defer = $.Deferred();
|
|
|
- var fields = ['id','name', 'symbol', 'rate_silent', 'base', 'decimal_separator', 'decimal_places', 'thousands_separator', 'symbol_position'];
|
|
|
- var domain = [
|
|
|
- ['base','=',true],
|
|
|
- ];
|
|
|
- var ResCurrency = new instance.web.Model('res.currency');
|
|
|
- ResCurrency.query(fields).filter(domain).all().then(function(results) {
|
|
|
- defer.resolve(results);
|
|
|
- });
|
|
|
- return defer;
|
|
|
- },
|
|
|
-
|
|
|
- BuildChart: function(){
|
|
|
- var self = this;
|
|
|
- var label = [
|
|
|
- 'Enero',
|
|
|
- 'Febrero',
|
|
|
- 'Marzo',
|
|
|
- 'Abril',
|
|
|
- 'Mayo',
|
|
|
- 'Junio',
|
|
|
- 'Julio',
|
|
|
- 'Agosto',
|
|
|
- 'Septiembre',
|
|
|
- 'Octubre',
|
|
|
- 'Noviembre',
|
|
|
- 'Diciembre',
|
|
|
- ];
|
|
|
- var body = [
|
|
|
- '20000',
|
|
|
- '30000',
|
|
|
- '80000',
|
|
|
- '50000',
|
|
|
- '60000',
|
|
|
- '70000',
|
|
|
- '90000',
|
|
|
- '40000',
|
|
|
- '100000',
|
|
|
- '70000',
|
|
|
- '30000',
|
|
|
- '50000',
|
|
|
- ];
|
|
|
- var CurrencyBase = self.ResCurrency;
|
|
|
- if(CurrencyBase){
|
|
|
- var chart = new reporting.ReportChartWidget(self);
|
|
|
- chart.BuildDemoChart(label,body,CurrencyBase[0]);
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- InsertUser: function(id) {
|
|
|
- var self = this;
|
|
|
- var user = self.ResUser[0].name;
|
|
|
- self.$el.find('.user-content').find('p').text("Hola " + user + " ...!");
|
|
|
- },
|
|
|
-
|
|
|
- });
|
|
|
-}
|