123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- # -*- 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
|