Преглед изворни кода

Módulo retocar orden de trabajo para Bioelectric

SEBAS пре 1 година
комит
711f278ad4
11 измењених фајлова са 1157 додато и 0 уклоњено
  1. 2 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 18 0
      __openerp__.py
  4. 194 0
      models.py
  5. BIN
      models.pyc
  6. BIN
      static/description/icon.png
  7. 3 0
      static/src/css/style.css
  8. 906 0
      static/src/js/workorder.js
  9. 9 0
      static/src/xml/workorder.xml
  10. 10 0
      views/template.xml
  11. 15 0
      views/workorder.xml

+ 2 - 0
__init__.py

@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+import models


+ 18 - 0
__openerp__.py

@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+{
+    'name' : 'Print Work Orders Best',
+    'version' : '1.0',
+    'description' : """
+Este modulo permite realizar impresión de la orden de trabajo mejorado.
+    """,
+    'author' : 'Eiru',
+    'category' : 'Service',
+    'depends' : ['repair_workorder_mejorado'],
+    'data' : [
+        'views/template.xml',
+        'views/workorder.xml'
+    ],
+    'qweb' : ['static/src/xml/*.xml',],
+    'installable' : True,
+    'auto_install' : False,
+}

+ 194 - 0
models.py

@@ -0,0 +1,194 @@
+# -*- coding: utf-8 -*-
+
+from openerp import models, fields, api
+
+class RepairWorkorder(models.Model):
+	_inherit = 'repair.workorderimproved'
+
+	@api.model
+	def getRepairWorkorder(self,domain):
+		RepairWorkorder = self.env['repair.workorderimproved'].search(domain)
+		values = []
+		for workorder in RepairWorkorder:
+			try:
+				street = workorder.partner_id.street
+			except Exception as e:
+				street = ''
+			values.append({
+                # ID
+				'id': workorder.id,
+                # WORKORDER INFO
+                'name': workorder.name or "",
+                'user_name': workorder.user_id.name or "",
+				'responsable': workorder.responsable or "",
+				'movil': workorder.movil or "",
+				'name_obra': workorder.name_obra or "",
+				'nro_factura': workorder.nro_factura or "",
+				'name_local': workorder.name_local or "",
+				'contacto_obra': workorder.contacto_obra or "",
+                'causes': workorder.causes or "",
+                'order_date': workorder.order_date or "",
+                'planned_start_date': workorder.planned_start_date or "",
+                'planned_end_date': workorder.planned_end_date or "",
+                'recommendations': workorder.recommendations or "",
+				'emergente': workorder.emergente or "",
+                'actions': workorder.actions or "",
+				'date_service': workorder.date_service or "",
+                # PARTNER INFO
+				'partner_id': workorder.partner_id.id or "",
+				'partner_name': workorder.partner_id.name or "",
+				'partner_ruc': workorder.partner_id.ruc or "",
+				'partner_address': street or "",
+                'partner_phone': workorder.partner_id.phone or "",
+				'partner_mobile': workorder.partner_id.mobile or "",
+                # COMPANY INFO
+                'company_id': workorder.user_id.company_id.id or "",
+                'company_name': workorder.user_id.company_id.name or "",
+                'company_logo': workorder.user_id.company_id.logo or "",
+                'company_address': workorder.user_id.company_id.street2 or "",
+                'company_phone': workorder.user_id.company_id.phone or "",
+				'vat': workorder.user_id.company_id.vat or "",
+			})
+
+		return values
+
+class RepairWorkorderLine(models.Model):
+	_inherit = 'repair.workorderimproved.line'
+
+	@api.model
+	def getRepairWorkorderLine(self,domain):
+		RepairWorkorderLine = self.env['repair.workorderimproved.line'].search(domain)
+		values = []
+		for line in RepairWorkorderLine:
+			values.append({
+                # ID
+				'id': line.id,
+                # LINE INFO
+                'workorder_id': line.workorder_id.id,
+                'description': line.description or "",
+                'quantity': line.quantity or "",
+                'brand': line.brand or "",
+                'number': line.number or "",
+			})
+
+		return values
+
+class RepairPedidosorderLine(models.Model):
+	_inherit = 'repair.pedidosorderimproved.line'
+
+	@api.model
+	def getRepairPedidosorderLine(self,domain):
+		RepairPedidosorderLine = self.env['repair.pedidosorderimproved.line'].search(domain)
+		values = []
+		for line in RepairPedidosorderLine:
+			values.append({
+                # ID
+				'id': line.id,
+                # LINE INFO
+                'workorder_id': line.workorder_id.id,
+                'description': line.description or "",
+                'quantity': line.quantity or "",
+                'brand': line.brand or "",
+                'number': line.number or "",
+			})
+
+		return values
+
+class RepairResumenorderLine(models.Model):
+	_inherit = 'repair.resumenorderimproved.line'
+
+	@api.model
+	def getRepairResumenorderLine(self,domain):
+		RepairResumenorderLine = self.env['repair.resumenorderimproved.line'].search(domain)
+		values = []
+		for line in RepairResumenorderLine:
+			values.append({
+                # ID
+				'id': line.id,
+                # LINE INFO
+                'workorder_id': line.workorder_id.id,
+                'description': line.description or "",
+			})
+
+		return values
+
+class RepairCalidadorderLine(models.Model):
+	_inherit = 'repair.calidadorderimproved.line'
+
+	@api.model
+	def getRepairCalidadorderLine(self,domain):
+		RepairCalidadorderLine = self.env['repair.calidadorderimproved.line'].search(domain)
+		values = []
+		for line in RepairCalidadorderLine:
+			values.append({
+                # ID
+				'id': line.id,
+                # LINE INFO
+                'workorder_id': line.workorder_id.id,
+                'description': line.description or "",
+                'brand': line.brand or "",
+                'number': line.number or "",
+			})
+
+		return values
+
+class RepairSugerenciaorderLine(models.Model):
+	_inherit = 'repair.sugerenciaorderimproved.line'
+
+	@api.model
+	def getRepairSugerenciaorderLine(self,domain):
+		RepairSugerenciaorderLine = self.env['repair.sugerenciaorderimproved.line'].search(domain)
+		values = []
+		for line in RepairSugerenciaorderLine:
+			values.append({
+	               # ID
+				'id': line.id,
+	               # LINE INFO
+	            'workorder_id': line.workorder_id.id,
+	            'description': line.description or "",
+			})
+
+		return values
+
+class RepairProblemasorderLine(models.Model):
+	_inherit = 'repair.problemasorderimproved.line'
+
+	@api.model
+	def getRepairProblemasorderLine(self,domain):
+		RepairProblemasorderLine = self.env['repair.problemasorderimproved.line'].search(domain)
+		values = []
+		for line in RepairProblemasorderLine:
+			values.append({
+	               # ID
+				'id': line.id,
+	               # LINE INFO
+	            'workorder_id': line.workorder_id.id,
+	            'description': line.description or "",
+			})
+
+		return values
+
+class RepairWorkorderConsumed(models.Model):
+	_inherit = 'repair.workorderimproved.consumed'
+
+	@api.model
+	def getRepairWorkorderConsumed(self,domain):
+		RepairWorkorderConsumed = self.env['repair.workorderimproved.consumed'].search(domain)
+		values = []
+		for line in RepairWorkorderConsumed:
+			values.append({
+                # ID
+				'id': line.id,
+                # LINE INFO
+                'workorder_id': line.workorder_id.id,
+                'product_id':[
+                    line.product_id.id,
+                    line.product_id.name,
+                ],
+                'description': line.description or "",
+                'quantity': line.quantity or "",
+                'price_unit': line.price_unit or "",
+                'subtotal': line.subtotal or "",
+			})
+
+		return values


BIN
static/description/icon.png


+ 3 - 0
static/src/css/style.css

@@ -0,0 +1,3 @@
+.print_workorderbioelectric{
+    height: 35px;
+}

+ 906 - 0
static/src/js/workorder.js

@@ -0,0 +1,906 @@
+openerp.workorder_printbioelectric = function (instance, local) {
+    local.widgetInstance = null;
+    local.parentInstance = null;
+
+    local.WorkOrderbioelectricWidget = instance.Widget.extend({
+        template : "workorder_printbioelectric.WorkOrderbioelectric",
+        jsonDoc:[],
+
+        init:function(parent){
+            this._super(parent);
+        },
+
+        updateId : function(id){
+            var self = this;
+            self.id=id;
+        },
+
+        start: function () {
+            var self = this;
+            this.$el.click(function (e) {
+                self.fecthInitial();
+            });
+        },
+
+        valorNull:function(dato){
+            var valor ="";
+            if (dato){
+                if(dato == true && typeof dato == 'boolean'){
+                    valor=" ";
+                }else{
+                    valor=dato;
+                }
+            }
+            return valor;
+        },
+
+        fecthInitial: function(){
+            var id= openerp.webclient._current_state.id;
+            var self = this;
+            self.fecthRepairWorkorder(id).then(function(RepairWorkorder){
+                return RepairWorkorder;
+            }).then(function(RepairWorkorder){
+                self.RepairWorkorder = RepairWorkorder;
+                return self.fecthRepairWorkorderLine();
+            }).then(function(RepairWorkorderLine){
+                self.RepairWorkorderLine = RepairWorkorderLine;
+                return self.fecthRepairPedidosorderLine();
+            }).then(function(RepairPedidosorderLine){
+                self.RepairPedidosorderLine = RepairPedidosorderLine;
+                return self.fecthRepairResumenorderLine();
+            }).then(function(RepairResumenorderLine){
+                self.RepairResumenorderLine = RepairResumenorderLine;
+                return self.fecthRepairCalidadorderLine();
+            }).then(function(RepairCalidadorderLine){
+                self.RepairCalidadorderLine = RepairCalidadorderLine;
+                return self.fecthRepairSugerenciaorderLine();
+            }).then(function(RepairSugerenciaorderLine){
+                self.RepairSugerenciaorderLine = RepairSugerenciaorderLine;
+                return self.fecthRepairProblemasorderLine();
+            }).then(function(RepairProblemasorderLine){
+                self.RepairProblemasorderLine = RepairProblemasorderLine;
+                return self.fetchRepairWorkorderConsumed();
+            }).then(function(RepairWorkorderConsumed){
+                self.RepairWorkorderConsumed = RepairWorkorderConsumed;
+                return self.drawPDF();
+            });
+            return false;
+        },
+
+        fecthRepairWorkorder: function(id){
+            var domain=[['id','=', id]];
+            var RepairWorkorder = new instance.web.Model('repair.workorderimproved');
+            return RepairWorkorder.call('getRepairWorkorder',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+        fecthRepairWorkorderLine: function () {
+            var self = this;
+            var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
+                return map.id;
+            }));
+            var domain=[['workorder_id','in',workorder_ids]];
+            var RepairWorkorderLine = new instance.web.Model('repair.workorderimproved.line');
+            return RepairWorkorderLine.call('getRepairWorkorderLine',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+
+        fecthRepairPedidosorderLine: function () {
+            var self = this;
+            var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
+                return map.id;
+            }));
+            var domain=[['workorder_id','in',workorder_ids]];
+            var RepairPedidosorderLine = new instance.web.Model('repair.pedidosorderimproved.line');
+            return RepairPedidosorderLine.call('getRepairPedidosorderLine',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+        fecthRepairResumenorderLine: function () {
+            var self = this;
+            var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
+                return map.id;
+            }));
+            var domain=[['workorder_id','in',workorder_ids]];
+            var RepairResumenorderLine = new instance.web.Model('repair.resumenorderimproved.line');
+            return RepairResumenorderLine.call('getRepairResumenorderLine',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+        fecthRepairCalidadorderLine: function () {
+            var self = this;
+            var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
+                return map.id;
+            }));
+            var domain=[['workorder_id','in',workorder_ids]];
+            var RepairCalidadorderLine = new instance.web.Model('repair.calidadorderimproved.line');
+            return RepairCalidadorderLine.call('getRepairCalidadorderLine',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+        fecthRepairSugerenciaorderLine: function () {
+            var self = this;
+            var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
+                return map.id;
+            }));
+            var domain=[['workorder_id','in',workorder_ids]];
+            var RepairSugerenciaorderLine = new instance.web.Model('repair.sugerenciaorderimproved.line');
+            return RepairSugerenciaorderLine.call('getRepairSugerenciaorderLine',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+        fecthRepairProblemasorderLine: function () {
+            var self = this;
+            var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
+                return map.id;
+            }));
+            var domain=[['workorder_id','in',workorder_ids]];
+            var RepairProblemasorderLine = new instance.web.Model('repair.problemasorderimproved.line');
+            return RepairProblemasorderLine.call('getRepairProblemasorderLine',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+        fetchRepairWorkorderConsumed: function () {
+            var self = this;
+            var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
+                return map.id;
+            }));
+            var domain=[['workorder_id','in',workorder_ids]];
+            var RepairWorkorderConsumed = new instance.web.Model('repair.workorderimproved.consumed');
+            return RepairWorkorderConsumed.call('getRepairWorkorderConsumed',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+        drawPDF:function(){
+            var self = this;
+            var doc = self.RepairWorkorder.shift();
+
+            var docItem = [];
+            var docWorkItem = [];
+            var getColumns = [];
+            var getColumns1 = [];
+            var getColumnsMaterial = [];
+            var docWorkItem1 = [];
+            var docWorkItem2 = [];
+            var docWorkItem4 = [];
+            var docWorkItem5 = [];
+            var docWorkItem6 = [];
+            var docWorkItem7 = [];
+            var docWorkItem8 = [];
+            var getColumnsMaterial1 = [];
+            var getColumnsMaterial2 = [];
+            var getColumnsMaterial4 = [];
+            var getColumnsMaterial5 = [];
+            var getColumnsMaterial6 = [];
+            var getColumnsMaterial7 = [];
+            var getColumnsMaterial8 = [];
+
+            var pdfDoc = new jsPDF();
+            pdfDoc.addImage("data:image/png;base64," + doc.company_logo, 'PNG',12,5,45,15);
+
+
+            /*
+            =============================================================
+                OBTENER LINEAS DEL PEDIDO INICIAL
+            =============================================================
+            */
+            var RepairWorkorderLine = self.RepairWorkorderLine;
+            for (var i = 0; i < RepairWorkorderLine.length; i++) {
+                docItem.push({
+                    xnumber : i + 1,
+                    product : RepairWorkorderLine[i].description,
+                    brand : RepairWorkorderLine[i].brand,
+                    number : RepairWorkorderLine[i].number
+                })
+            }
+
+            getColumns.push({
+                title : 'A',
+                dataKey: 'xnumber',
+                align: 'center',
+            });
+
+            getColumns.push({
+                title : 'Pedido inicial del cliente    L: logrado EP: en proceso P: pendiente',
+                dataKey: 'product',
+                align: 'left',
+            });
+            getColumns.push({
+                title : 'Cant.',
+                dataKey: 'brand',
+                align: 'center',
+            });
+            getColumns.push({
+                title : 'Estado',
+                dataKey: 'number',
+                align: 'center',
+            });
+
+
+            var RepairProblemasorderLine = self.RepairProblemasorderLine;
+            if(RepairProblemasorderLine.length > 0){
+                for (var i = 0; i < RepairProblemasorderLine.length; i++) {
+                      docWorkItem.push({
+                          xnumber : i + 1,
+                          description : RepairProblemasorderLine[i].description
+                     });
+                  }
+
+                  getColumnsMaterial.push({
+                      title : 'B',
+                      dataKey: 'xnumber',
+                      align: 'center',
+                  });
+                  getColumnsMaterial.push({
+                      title : 'Problemas o sintomas encontrados',
+                      dataKey: 'description',
+                      align: 'left',
+                  });
+            }else{
+              docWorkItem.push({
+                  xnumber : '-',
+                  description : '-'
+              });
+              getColumnsMaterial.push({
+                  title : 'B',
+                  dataKey: 'xnumber',
+                  align: 'center',
+              });
+              getColumnsMaterial.push({
+                  title : 'Problemas o sintomas encontrados',
+                  dataKey: 'description',
+                  align: 'left',
+              });
+            }
+            var RepairPedidosorderLine = self.RepairPedidosorderLine;
+            if(RepairPedidosorderLine.length > 0){
+                for (var x = 0; x < RepairPedidosorderLine.length; x++) {
+                    docWorkItem1.push({
+                        xnumber : x+1,
+                        description : RepairPedidosorderLine[x].description,
+                        brand : RepairPedidosorderLine[x].brand,
+                        number : RepairPedidosorderLine[x].number
+                    });
+                }
+                getColumnsMaterial1.push({
+                    title : 'C',
+                    dataKey: 'xnumber',
+                    align: 'center',
+                });
+                getColumnsMaterial1.push({
+                    title : 'Pedido adicional para servicio extra   L: logrado EP: en proceso P: pendiente',
+                    dataKey: 'description',
+                    align: 'left',
+                });
+                getColumnsMaterial1.push({
+                    title : 'Cant.',
+                    dataKey: 'quantity',
+                    align: 'center',
+                });
+                getColumnsMaterial1.push({
+                    title : 'Estado',
+                    dataKey: 'number',
+                    align: 'center',
+                });
+           }else{
+               docWorkItem1.push({
+                   xnumber : '-',
+                   description : '-',
+                   quantity : '-',
+                   number : '-'
+               });
+               getColumnsMaterial1.push({
+                   title : 'C',
+                   dataKey: 'xnumber',
+                   align: 'center',
+               });
+               getColumnsMaterial1.push({
+                   title : 'Pedido adicional para servicio extra   L: logrado EP: en proceso P: pendiente',
+                   dataKey: 'description',
+                   align: 'left',
+               });
+               getColumnsMaterial1.push({
+                   title : 'Cant.',
+                   dataKey: 'quantity',
+                   align: 'center',
+               });
+               getColumnsMaterial1.push({
+                   title : 'Estado',
+                   dataKey: 'number',
+                   align: 'center',
+               });
+           }
+            var RepairWorkorderConsumed = self.RepairWorkorderConsumed;
+            if(RepairWorkorderConsumed.length > 0){
+                for (var r = 0; r < RepairWorkorderConsumed.length; r++) {
+                    docWorkItem5.push({
+                        xnumber : r+1,
+                        description : RepairWorkorderConsumed[r].description
+                    });
+                }
+                getColumnsMaterial5.push({
+                    title : 'D',
+                    dataKey: 'xnumber',
+                    align: 'center',
+                });
+                getColumnsMaterial5.push({
+                    title : 'Lista de materiales proveidos por Bioelectric',
+                    dataKey: 'description',
+                    align: 'left',
+                });
+          }else{
+                docWorkItem5.push({
+                    xnumber : '-',
+                    description : '-'
+                });
+                getColumnsMaterial5.push({
+                    title : 'D',
+                    dataKey: 'xnumber',
+                    align: 'center',
+                });
+                getColumnsMaterial5.push({
+                    title : 'Lista de materiales proveidos por Bioelectric',
+                    dataKey: 'description',
+                    align: 'left',
+                });
+          }
+
+            var RepairCalidadorderLine = self.RepairCalidadorderLine;
+            if(RepairCalidadorderLine.length > 0){
+                  for (var y = 0; y < RepairCalidadorderLine.length; y++) {
+                      docWorkItem2.push({
+                          xnumber : y+1,
+                          description : RepairCalidadorderLine[y].description,
+                          quantity : RepairCalidadorderLine[y].quantity,
+                          number : RepairCalidadorderLine[y].number
+                      });
+                  }
+                  getColumnsMaterial2.push({
+                      title : 'E',
+                      dataKey: 'xnumber',
+                      align: 'center',
+                  });
+                  getColumnsMaterial2.push({
+                      title : 'Ensayos y control de calidad realizados a los trabajos o equipos entregados al cliente',
+                      dataKey: 'description',
+                      align: 'left',
+                  });
+                  getColumnsMaterial2.push({
+                      title : 'Ficha',
+                      dataKey: 'quantity',
+                      align: 'center',
+                  });
+                  getColumnsMaterial2.push({
+                      title : 'Lacre',
+                      dataKey: 'number',
+                      align: 'center',
+                  });
+          }else{
+              docWorkItem2.push({
+                  xnumber : '-',
+                  description : '-',
+                  quantity :  '-',
+                  number :  '-'
+              });
+              getColumnsMaterial2.push({
+                  title : 'E',
+                  dataKey: 'xnumber',
+                  align: 'center',
+              });
+              getColumnsMaterial2.push({
+                  title : 'Ensayos y control de calidad realizados a los trabajos o equipos entregados al cliente',
+                  dataKey: 'description',
+                  align: 'left',
+              });
+              getColumnsMaterial2.push({
+                  title : 'Ficha',
+                  dataKey: 'quantity',
+                  align: 'center',
+              });
+              getColumnsMaterial2.push({
+                  title : 'Lacre',
+                  dataKey: 'number',
+                  align: 'center',
+              });
+            }
+
+            var RepairResumenorderLine = self.RepairResumenorderLine;
+            if(RepairResumenorderLine.length > 0){
+                for (var t = 0; t < RepairResumenorderLine.length; t++) {
+                    docWorkItem7.push({
+                        xnumber : t+1,
+                        description : RepairResumenorderLine[t].description
+                    });
+                }
+                getColumnsMaterial7.push({
+                    title : 'F',
+                    dataKey: 'xnumber',
+                    align: 'center',
+                });
+                getColumnsMaterial7.push({
+                    title : 'Estado final de equipos y sistemas entregados al cliente luego de terminar los trabajos',
+                    dataKey: 'description',
+                    align: 'left',
+                });
+          }else{
+                docWorkItem7.push({
+                    xnumber : '-',
+                    description : '-'
+                });
+                getColumnsMaterial7.push({
+                    title : 'F',
+                    dataKey: 'xnumber',
+                    align: 'center',
+                });
+                getColumnsMaterial7.push({
+                    title : 'Estado final de equipos y sistemas entregados al cliente luego de terminar los trabajos',
+                    dataKey: 'description',
+                    align: 'left',
+                });
+          }
+
+
+
+            var RepairSugerenciaorderLine = self.RepairSugerenciaorderLine;
+            if(RepairSugerenciaorderLine.length > 0){
+                  for (var z = 0; z < RepairSugerenciaorderLine.length; z++) {
+                      docWorkItem8.push({
+                          xnumber : z+1,
+                          description : RepairSugerenciaorderLine[z].description
+                      });
+                  }
+                  getColumnsMaterial8.push({
+                      title : 'G',
+                      dataKey: 'xnumber',
+                      align: 'center',
+                  });
+                  getColumnsMaterial8.push({
+                      title : 'Sugerencias y pendientes',
+                      dataKey: 'description',
+                      align: 'left',
+                  });
+          }else{
+            docWorkItem8.push({
+                xnumber : '-',
+                description : '-'
+            });
+            getColumnsMaterial8.push({
+                title : 'G',
+                dataKey: 'xnumber',
+                align: 'center',
+            });
+            getColumnsMaterial8.push({
+                title : 'Sugerencias y pendientes',
+                dataKey: 'description',
+                align: 'left',
+            });
+          }
+
+
+            pdfDoc.autoTable(getColumns, docItem, {
+                theme: 'grid',
+                styles: {
+                    overflow: 'linebreak',
+                    columnWidth: 'auto',
+                    fontSize: 7,
+
+                },
+                headerStyles: {
+                    fillColor: [255, 255, 255],
+                    borderColor: [150, 152, 154],
+                    color: 'black',
+                    fontStyle: 'bold',
+                    textColor: [0, 0, 0],
+                    fontSize: 9
+                },
+                columnStyles: {
+                    xnumber : {halign:'center',columnWidth: '4px'},
+                    product : {columnWidth: '8px',fontStyle: 'bold'},
+                    brand : {halign:'center', columnWidth: '8px'},
+                    number : {halign:'center',columnWidth: '8px'},
+                },
+                margin: { top: 60, horizontal: 12},
+
+
+                addPageContent: function (data) {
+
+                    /*
+                    ====================================================================
+                        CABECERA
+                    ====================================================================
+                    */
+
+                    // pdfDoc.setFontSize(8);
+                    // pdfDoc.setFontStyle('bold');
+                    // pdfDoc.setTextColor(40);
+                    // pdfDoc.text(14,26,doc.company_address);
+                    //
+                    // pdfDoc.setFontSize(8);
+                    // pdfDoc.setFontStyle('bold');
+                    // pdfDoc.setTextColor(40);
+                    // pdfDoc.text(14,30,'Cel.: ' + doc.company_phone);
+
+                    pdfDoc.setFontSize(14);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(105,10,'INFORME TÉCNICO DE TRABAJO');
+
+                    pdfDoc.setFontSize(12);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(125,23, doc.vat);
+
+                    pdfDoc.setFontSize(13);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(130,17,'Nº  ' +  doc.name);
+
+                    pdfDoc.setDrawColor('150', '152', '154');
+                    pdfDoc.rect(13, 25, pdfDoc.internal.pageSize.getWidth() - 26 , 26, 'S');
+
+                    /*
+                    ====================================================================
+                        PRIMERA SECCION
+                    ====================================================================
+                    */
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(14,32,'Fecha: ' + moment(doc.order_date).format('DD/MM/YYYY'));
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(47,32,'Cliente: ');
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(61,32, doc.partner_name);
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(149,32,'R.U.C. N°: ');
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(168,32, doc.partner_ruc);
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(14,37,'Presupuesto: ');
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(49,37,'Obra: ');
+
+                    pdfDoc.setFontSize(9);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(60,37,self.valorNull(doc.name_obra));
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(10);
+                    pdfDoc.text(151,37,'Inicio: ' );
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    var fecha = moment(doc.planned_start_date).subtract(4, 'hours').format('DD/MM/YYYY HH:mm');
+                    pdfDoc.text(166, 37, fecha);
+
+
+                    // pdfDoc.text(166,37, moment(doc.planned_start_date).format('DD/MM/YYYY hh:mm'));
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(14,42,'Factura N°: ');
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(33,42,self.valorNull(doc.nro_factura));
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(75,42,'Pedido por: ');
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(95,42, doc.contacto_obra);
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(10);
+                    pdfDoc.text(151,42,'Fin: ');
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    var end_fecha = moment(doc.planned_end_date).subtract(4, 'hours').format('DD/MM/YYYY HH:mm');
+                    pdfDoc.text(166, 42, end_fecha);
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(14,47,'Local: ');
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(29,47,self.valorNull(doc.name_local));
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(75,47,'Técnico: ');
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(90,47, doc.responsable);
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(10);
+                    pdfDoc.text(151,47,'Móvil: ');
+
+                    pdfDoc.setFontSize(10);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(168,47, doc.movil);
+
+                    pdfDoc.setFontSize(12);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(77,58,'DETALLES DE ASISTENCIA');
+
+                }
+            });
+            /*
+            =============================================================
+                Problemas o sintomas encontrados
+            =============================================================
+            */
+            var finalY = pdfDoc.autoTable.previous.finalY;
+            pdfDoc.autoTable(getColumnsMaterial, docWorkItem, {
+                theme: 'grid',
+                startY: finalY + 3,
+                styles: {
+                    overflow: 'linebreak',
+                    columnWidth: 'auto',
+                    fontSize: 8,
+
+                },
+                headerStyles: {
+                    fillColor: [255, 255, 255],
+                    borderColor: [150, 152, 154],
+                    fontSize: 9,
+                    textColor: [0, 0, 0]
+                },
+                columnStyles: {
+                    xnmumber : {columnWidth: '4px',halign: 'center'},
+                    description: {columnWidth: '8px', halign: 'left'},
+                    quantity : {columnWidth: '8px', halign: 'center'},
+                    number : {columnWidth: '8px', halign: 'center'},
+                },
+                margin: {horizontal: 12},
+
+            });
+
+
+            /*
+            =============================================================
+                Pedido adicional para servicio extra
+            =============================================================
+            */
+            var finalY = pdfDoc.autoTable.previous.finalY;
+            pdfDoc.autoTable(getColumnsMaterial1, docWorkItem1, {
+                theme: 'grid',
+                startY: finalY + 3,
+                styles: {
+                    overflow: 'linebreak',
+                    columnWidth: 'auto',
+                    fontSize: 8,
+
+                },
+                headerStyles: {
+                    fillColor: [255, 255, 255],
+                    borderColor: [150, 152, 154],
+                    fontSize: 9,
+                    textColor: [0, 0, 0]
+                },
+                columnStyles: {
+                    xnmumber : {columnWidth: '4px',halign: 'center'},
+                    description: {columnWidth: '24px', halign: 'left'},
+                },
+                margin: {horizontal: 12},
+
+            });
+
+
+
+            /*
+            =============================================================
+               Lista de materiales proveidos por Bioelectric
+            =============================================================
+            */
+            var finalY = pdfDoc.autoTable.previous.finalY;
+            pdfDoc.autoTable(getColumnsMaterial5, docWorkItem5, {
+                theme: 'grid',
+                startY: finalY + 3,
+                styles: {
+                    overflow: 'linebreak',
+                    columnWidth: 'auto',
+                    fontSize: 8,
+
+                },
+                headerStyles: {
+                    fillColor: [255, 255, 255],
+                    borderColor: [150, 152, 154],
+                    fontSize: 9,
+                    textColor: [0, 0, 0]
+                },
+                columnStyles: {
+                    xnmumber : {columnWidth: '4px',halign: 'center'},
+                    description: {columnWidth: '24px', halign: 'left'},
+                },
+                margin: {horizontal: 12},
+            });
+
+
+                        /*
+                        =============================================================
+                          Ensayos y control de calidad realizados a los trabajos o equipos entregados al cliente
+                        =============================================================
+                        */
+                        var finalY = pdfDoc.autoTable.previous.finalY;
+                        pdfDoc.autoTable(getColumnsMaterial2, docWorkItem2, {
+                            theme: 'grid',
+                            startY: finalY + 3,
+                            styles: {
+                                overflow: 'linebreak',
+                                columnWidth: 'auto',
+                                fontSize: 8,
+
+                            },
+                            headerStyles: {
+                                fillColor: [255, 255, 255],
+                                borderColor: [150, 152, 154],
+                                fontSize: 9,
+                                textColor: [0, 0, 0]
+                            },
+                            columnStyles: {
+                                xnmumber : {columnWidth: '4px',halign: 'center'},
+                                description: {columnWidth: '24px', halign: 'left'},
+                            },
+                            margin: {horizontal: 12},
+                        });
+
+
+            /*
+            =============================================================
+                Estado final de equipos y sistemas entregados al cliente luego de terminar los trabajos
+            =============================================================
+            */
+            var finalY = pdfDoc.autoTable.previous.finalY;
+            pdfDoc.autoTable(getColumnsMaterial7, docWorkItem7, {
+                theme: 'grid',
+                startY: finalY + 3,
+                styles: {
+                    overflow: 'linebreak',
+                    columnWidth: 'auto',
+                    fontSize: 8,
+
+                },
+                headerStyles: {
+                    fillColor: [255, 255, 255],
+                    borderColor: [150, 152, 154],
+                    fontSize: 9,
+                    textColor: [0, 0, 0]
+                },
+                columnStyles: {
+                    xnmumber : {columnWidth: '4px', halign: 'center'},
+                    description: {columnWidth: '8px', halign: 'left'},
+                    quantity : {columnWidth: '8px', halign: 'center'},
+                    number : {columnWidth: '8px', halign: 'center'},
+                },
+                margin: {horizontal: 12},
+            });
+
+            /*
+            =============================================================
+                SUGERENCIAS Y PENDIENTES
+            =============================================================
+            */
+            var finalY = pdfDoc.autoTable.previous.finalY;
+            pdfDoc.autoTable(getColumnsMaterial8, docWorkItem8, {
+                theme: 'grid',
+                startY: finalY + 3,
+                styles: {
+                    overflow: 'linebreak',
+                    columnWidth: 'auto',
+                    fontSize: 8,
+
+                },
+                headerStyles: {
+                    fillColor: [255, 255, 255],
+                    borderColor: [150, 152, 154],
+                    fontSize: 9,
+                    textColor: [0, 0, 0]
+                },
+                columnStyles: {
+                    xnmumber : {columnWidth: '4px',halign: 'center'},
+                    description: {columnWidth: '24px', halign: 'left'},
+                },
+                margin: {horizontal: 12},
+            });
+
+
+
+           pdfDoc.setFontSize(9);
+           pdfDoc.setFontStyle('bold');
+           pdfDoc.setTextColor(10);
+           pdfDoc.text(14,pdfDoc.autoTable.previous.finalY + 5,'Mantenimiento próximo: ');
+
+           pdfDoc.setFontSize(9);
+           pdfDoc.setFontStyle('normal');
+           pdfDoc.setTextColor(10);
+           pdfDoc.text(60,pdfDoc.autoTable.previous.finalY + 5,self.valorNull(moment(doc.date_service).format('DD/MM/YYYY')));
+
+            pdfDoc.setFontSize(9);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.setTextColor(10);
+            pdfDoc.text(14,pdfDoc.autoTable.previous.finalY + 11,'Firma de conformidad de cliente o encargado:  .............................................   Sello: ');
+
+            pdfDoc.setFontSize(9);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.setTextColor(10);
+            pdfDoc.text(14,pdfDoc.autoTable.previous.finalY + 17,'Aclaración: .................................        C.I.N°: ....................');
+
+
+            pdfDoc.setFontSize(9);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.setTextColor(10);
+            pdfDoc.text(14,pdfDoc.autoTable.previous.finalY + 23,'Firma de técnico responsable:  .....................................................................   Sello: ');
+
+
+            pdfDoc.save('Informe técnico de trabajo.pdf');
+        },
+    });
+    if (instance.web && instance.web.FormView) {
+        instance.web.FormView.include({
+            load_form: function (record) {
+                this._super.apply(this, arguments);
+                if (this.model !== 'repair.workorderimproved') return;
+                local.parentInstance = this;
+                if (local.widgetInstance) {
+                    local.widgetInstance.updateId(record.id);
+                }
+                local.widgetInstance = new local.WorkOrderbioelectricWidget(this);
+                var elemento = this.$el.find('.oe_form_sheet.oe_form_sheet_width');
+                elemento =  elemento.find('.oe_right.oe_button_box.workorderbioelectric_button_box');
+                local.widgetInstance.appendTo(elemento);
+                local.widgetInstance.updateId(record.id);
+            }
+        });
+    }
+};

+ 9 - 0
static/src/xml/workorder.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="workorder_printbioelectric.WorkOrderbioelectric">
+        <button class="print_workorderbioelectric oe_stat_button btn btn-default oe_inline">
+            <div class="stat_button_icon fa fa-download"></div>
+            <div> Imprimir </div>
+        </button>
+    </t>
+</template>

+ 10 - 0
views/template.xml

@@ -0,0 +1,10 @@
+<openerp>
+    <data>
+        <template id="workorder_printbioelectric.assets_backend" name="workorderbioelectric_print_assets" inherit_id="eiru_assets.assets">
+            <xpath expr="." position="inside">
+                <link rel="stylesheet" href="/workorder_printbioelectric/static/src/css/style.css"/> 
+                <script type="text/javascript" src="/workorder_printbioelectric/static/src/js/workorder.js"/>
+            </xpath>
+        </template>
+    </data>
+</openerp>

+ 15 - 0
views/workorder.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+        <record model="ir.ui.view" id="workorderbioelectric_print">
+            <field name="name">workorderbioelectric.print</field>
+            <field name="model">repair.workorderimproved</field>
+            <field name="inherit_id" ref="repair_workorder_mejorado.form_repair_workorder_mejorado"/>
+            <field name="arch" type="xml">
+                <xpath expr="//div[@class='oe_right oe_button_box']" position="inside">
+					<div class="workorderbioelectric_button_box oe_right oe_button_box" id="workorderbioelectric_button_container"></div>
+				</xpath>
+            </field>
+        </record>
+	</data>
+</openerp>