Ver Fonte

commit inicial

Rodney Elpidio Enciso Arias há 7 anos atrás
commit
f5813bc4d4

+ 6 - 0
__init__.py

@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# License, author and contributors information in:
+# __openerp__.py file at the root folder of this module.
+
+from . import models
+from . import reports

BIN
__init__.pyc


+ 46 - 0
__openerp__.py

@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#    Trey, Kilobytes de Soluciones
+#    Copyright (C) 2014-Today Trey, Kilobytes de Soluciones <www.trey.es>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+###############################################################################
+
+{
+    'name': 'Eiru study feature',
+    'summary': 'Study Feature',
+    'category': 'Repair',
+    'version': '0.1',
+    'description': """
+    """,
+    'author': 'Trey (www.trey.es) - Eiru',
+    'website': 'https://www.eiru.com.py',
+    'depends': [
+        'product',
+        'account',
+        'sale',
+    ],
+    'data': [
+        'data/report_paperformat.xml',
+        'reports/ticket.xml',
+        # 'reports/work_order_company.xml',
+        'data/sequence.xml',
+        'views/eiru_study_feature.xml',
+    ],
+    'test': [
+    ],
+    'installable': True,
+}

+ 20 - 0
data/report_paperformat.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="paperformat_repair_workorder" model="report.paperformat">
+            <field name="name">Repair Workorder</field>
+            <field name="default" eval="True"/>
+            <field name="format">custom</field>
+            <field name="page_height">150</field>
+            <field name="page_width">80</field>
+            <field name="orientation">Portrait</field>
+            <field name="margin_top">1</field>
+            <field name="margin_bottom">1</field>
+            <field name="margin_left">1</field>
+            <field name="margin_right">1</field>
+            <field name="header_line" eval="False" />
+            <field name="header_spacing">0</field>
+            <field name="dpi">300</field>
+        </record>
+    </data>
+</openerp>

+ 20 - 0
data/sequence.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <!-- Sequences for repair.workorder -->
+        <record id="seq_type_study_feature" model="ir.sequence.type">
+            <field name="name">Study Feature</field>
+            <field name="code">study.feature</field>
+        </record>
+
+        <record id="seq_study_feature" model="ir.sequence">
+            <field name="name">Study Feature</field>
+            <field name="code">study.feature</field>
+            <field name="prefix">O01- </field>
+            <field name="padding">4</field>
+            <field name="company_id" eval="False"/>
+        </record>
+
+    </data>
+</openerp>

+ 5 - 0
models/__init__.py

@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+# License, author and contributors information in:
+# __openerp__.py file at the root folder of this module.
+
+from . import eiru_study_feature

BIN
models/__init__.pyc


+ 270 - 0
models/eiru_study_feature.py

@@ -0,0 +1,270 @@
+# -*- coding: utf-8 -*-
+# License, author and contributors information in:
+# __openerp__.py file at the root folder of this module.
+
+from openerp import api, models, fields
+from openerp.exceptions import ValidationError, except_orm, Warning, RedirectWarning
+import logging
+
+_log = logging.getLogger(__name__)
+
+
+class StudyFeature(models.Model):
+    _name = 'study.feature'
+    _description = 'Study Feature'
+    _inherit = ['mail.thread', 'ir.needaction_mixin']
+
+    def _get_user(self):
+        return self.env.uid
+
+    def _get_number(self):
+        return self.env['ir.sequence'].get('study.feature') or '*'
+
+    name = fields.Char(
+        string=u'Code',
+        readonly=True,
+        default=_get_number
+    )
+    user_id = fields.Many2one(
+        comodel_name='res.users',
+        string='Engineer',
+        default=_get_user
+    )
+    partner_id = fields.Many2one(
+        comodel_name='res.partner',
+        string='Partner'
+    )
+    product_id = fields.Many2one(
+        comodel_name='product.product',
+        string='Partner'
+    )
+    # line_ids = fields.One2many(
+    #     comodel_name='repair.workorder.line',
+    #     inverse_name='workorder_id',
+    #     string='Products delivered'
+    # )
+    # consumed_ids = fields.One2many(
+    #     comodel_name='repair.workorder.consumed',
+    #     inverse_name='workorder_id',
+    #     string='Product & Services consumed'
+    # )
+    order_date = fields.Datetime(
+        string='Order date',
+        default=fields.Datetime.now
+    )
+    # planned_start_date = fields.Datetime(
+    #     string='Planned start date'
+    # )
+    # planned_end_date = fields.Datetime(
+    #     string='Planned end date'
+    # )
+    diagnostic = fields.Text(
+        string='Diagnostic'
+    )
+    causes = fields.Text(
+        string='Causes'
+    )
+    actions = fields.Text(
+        string='Actions'
+    )
+    recommendations = fields.Text(
+        string="recommendations"
+    )
+#     state = fields.Selection([
+#         ('draft', 'Pending'),
+#         ('in_progress', 'In progress'),
+#         ('done', 'Done'),
+#         ('canceled', 'Canceled'),
+#         ('invoiced', 'Invoiced')],
+#         string='State',
+#         default='draft'
+#     )
+#     invoice_ids = fields.One2many('account.invoice', 'work_invoice_id')
+#     invoice_count = fields.Integer(
+#         string='Facturas',
+#         compute='_get_invoice_count', 
+#     )
+
+#     @api.multi
+#     def button_draft(self):
+#         if self.invoice_count > 0:
+#             raise Warning('Este trabajo tiene una factura asociada')
+#         if self.invoice_count == 0:
+#             for work in self:
+#                 work.write({'state': 'draft'})
+#             return True
+
+#     @api.one
+#     @api.depends('invoice_ids')
+#     def _get_invoice_count(self):
+#         self.invoice_count = len(self.invoice_ids)
+
+    @api.one
+    def onchange_partner_id(self, partner_id):
+        _log.info('-'*100)
+        _log.info(partner_id)
+
+#     @api.one
+#     def button_in_progress(self):
+#         self.state = 'in_progress' 
+
+#     @api.one
+#     def button_in_progress_back(self):
+#         self.state = 'draft'
+
+#     @api.one
+#     def button_done(self):
+#         product = self.line_ids
+#         works = self.consumed_ids
+#         if not product or not works:
+#             raise Warning('El trabajo debe tener productos y trabajos asociados')
+#         else:
+#             self.state = 'done'
+
+#     @api.one
+#     def button_done_back(self):
+#         self.state = 'in_progress'
+
+#     @api.one
+#     def button_cancel(self):
+#         self.state = 'canceled'
+
+#     @api.multi
+#     def Facturado(self):
+#         inv_obj = self.env['account.invoice']
+#         inv_line_obj = self.env['account.invoice.line']
+#         customer = self.partner_id
+#         if not customer.name:
+#             raise osv.except_osv(_('UserError!'), _('Please select a Customer.'))
+#         company_id = self.env['res.users'].browse(1).company_id
+#         self.ensure_one()
+#         ir_values = self.env['ir.values']
+#         inv_data = {
+#             'name': customer.name,
+#             'reference': customer.name,
+#             'account_id': customer.property_account_receivable.id,
+#             'partner_id': customer.id,
+#             'origin': self.name,
+#             'work_invoice_id': self.id 
+#         }
+#         inv_id = inv_obj.create(inv_data)
+#         for records in self.consumed_ids:
+#             if records.product_id.id:
+#                 income_account = records.product_id.categ_id.property_account_income_categ.id
+#             if not income_account:
+#                 raise osv.except_osv(_('UserError!'), _('There is no income account defined '
+#                                                         'for this product: "%s".') % (records.product_id.name,))
+#             inv_line_data = {
+#                 'name': records.product_id.name,
+#                 'account_id': income_account,
+#                 'price_unit': records.price_unit,
+#                 'quantity': records.quantity,
+#                 'product_id': records.product_id.id,
+#                 'invoice_id': inv_id.id,
+#                 'invoice_line_tax_id': [(6, 0, [x.id for x in records.product_id.taxes_id])],
+#             }
+#             inv_line_obj.create(inv_line_data)
+#         self.state = 'invoiced'
+#         imd = self.env['ir.model.data']
+#         action = imd.xmlid_to_object('account.action_invoice_tree1')
+#         list_view_id = imd.xmlid_to_res_id('account.invoice_tree')
+#         form_view_id = imd.xmlid_to_res_id('account.invoice_form')
+#         result = {
+#             'name': action.name,
+#             'help': action.help,
+#             'type': 'ir.actions.act_window',
+#             'views': [[list_view_id, 'tree'], [form_view_id, 'form'], [False, 'graph'], [False, 'kanban'],
+#                       [False, 'calendar'], [False, 'pivot']],
+#             'target': action.target,
+#             'context': action.context,
+#             'res_model': 'account.invoice',
+#         }
+#         if len(inv_id) > 1:
+#             result['domain'] = "[('id','in',%s)]" % inv_id.ids
+#         elif len(inv_id) == 1:
+#             result['views'] = [(form_view_id, 'form')]
+#             result['res_id'] = inv_id.ids[0]
+#         else:
+#             result = {'type': 'ir.actions.act_window_close'}
+#         invoiced_records = self.env['repair.workorder']
+#         total = 0
+#         self.stage_id = 3
+#         for rows in invoiced_records:
+#             invoiced_date = rows.date
+#             invoiced_date = invoiced_date[0:10]
+#             if invoiced_date == str(date.today()):
+#                 total = total + rows.price_subtotal
+#         inv_id.signal_workflow('invoice_open')
+#         return result
+
+
+# class WorkOrderLine(models.Model):
+#     _name = 'repair.workorder.line'
+#     _description = 'Product to repair'
+#     _inherit = ['mail.thread', 'ir.needaction_mixin']
+
+#     workorder_id = fields.Many2one(
+#         comodel_name='repair.workorder',
+#         string='Work order')
+#     description = fields.Char(string='Description')
+#     quantity = fields.Float(string='Quantity', default=1.0)
+#     brand = fields.Char(string='Marca')
+#     number = fields.Char(string="Numero de serie")
+
+
+# class WorkOrderConsumed(models.Model):
+#     _name = 'repair.workorder.consumed'
+#     _description = 'Services for repair'
+#     _inherit = ['mail.thread', 'ir.needaction_mixin']
+
+#     workorder_id = fields.Many2one(
+#         comodel_name='repair.workorder',
+#         string='Work order'
+#     )
+#     product_id = fields.Many2one(
+#         comodel_name='product.product',
+#         string='Product'
+#     )
+#     type = fields.Selection([
+#         ('service', 'Service'),
+#         ('product', 'Product')],
+#         string='Type',
+#         required=True,
+#         default='service'
+#     )
+#     description = fields.Char(
+#         string='Description',
+#         required=True
+#     )
+#     quantity = fields.Float(
+#         string='Quantity',
+#         default=1
+#     )
+#     price_unit = fields.Float(
+#         string='Price unit'
+#     )
+#     subtotal = fields.Float(
+#         string='Subtotal',
+#         compute='compute_subtotal'
+#     )
+
+#     @api.one
+#     @api.depends('quantity', 'price_unit')
+#     def compute_subtotal(self):
+#         self.subtotal = self.quantity * self.price_unit
+
+#     @api.onchange('product_id')
+#     def onchange_product_id(self):
+#         if self.product_id:
+#             self.description = self.product_id.name
+#             self.type = 'service' if self.product_id.type == 'service' \
+#                 else 'product'
+
+#             # @ TODO impuestos??
+#             # Obtener el precio del producto a partir de la tarifa del cliente
+#             self.price_unit = self.product_id.list_price
+
+# class AccountInvoice(models.Model):
+#     _inherit = 'account.invoice'
+
+#     work_invoice_id = fields.Many2one('repair.workorder')

BIN
models/eiru_study_feature.pyc


BIN
models/work_order.pyc


+ 5 - 0
reports/__init__.py

@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+# License, author and contributors information in:
+# __openerp__.py file at the root folder of this module.
+
+from . import parser

BIN
reports/__init__.pyc


+ 95 - 0
reports/parser.py

@@ -0,0 +1,95 @@
+# -*- coding: utf-8 -*-
+# License, author and contributors information in:
+# __openerp__.py file at the root folder of this module.
+
+from functools import partial
+from openerp.osv import osv
+from openerp import exceptions, _
+from reportlab.graphics.barcode import createBarcodeDrawing
+
+
+class PartnerReport(osv.AbstractModel):
+    _name = 'report.eiru_study_features.partner_report'
+
+    def get_total(self, cr, uid, workorder, context=None):
+        total = 0
+        for line_consumed in workorder.consumed_ids:
+            total += line_consumed.quantity * line_consumed.price_unit
+        return total
+
+    def render_html(self, cr, uid, ids, data=None, context=None):
+        report_obj = self.pool['report']
+        repair_workorder_obj = self.pool['study.feature']
+        report = report_obj._get_report_from_name(
+            cr, uid, 'eiru_study_features.partner_report')
+        selected_orders = repair_workorder_obj.browse(
+            cr, uid, ids, context=context)
+
+        docargs = {
+            'doc_ids': ids,
+            'doc_model': report.model,
+            'docs': selected_orders,
+            'get_total': partial(
+                self.get_total, cr, uid, context=context),
+            'printBarcode': partial(
+                self.printBarcode, cr, uid, context=context),
+        }
+
+        return report_obj.render(
+            cr, uid, ids, 'eiru_study_features.partner_report',
+            docargs, context=context)
+
+    # def printBarcode(self, cr, uid, value, width, height, context=None):
+    #     try:
+    #         width, height = int(width), int(height)
+    #         barcode = createBarcodeDrawing(
+    #             'EAN13', value=value, format='png', width=width, height=height)
+    #         barcode = barcode.asString('png')
+    #         barcode = barcode.encode('base64', 'strict')
+    #     except (ValueError, AttributeError):
+    #         raise exceptions.Warning(_('Cannot convert into barcode.'))
+
+    #     return barcode
+
+
+# class CompanyReport(osv.AbstractModel):
+#     _name = 'report.repair_workorder.company_report'
+
+#     def get_total(self, cr, uid, workorder, context=None):
+#         total = 0
+#         for line_consumed in workorder.consumed_ids:
+#             total += line_consumed.quantity * line_consumed.price_unit
+#         return total
+
+#     def render_html(self, cr, uid, ids, data=None, context=None):
+#         report_obj = self.pool['report']
+#         repair_workorder_obj = self.pool['repair.workorder']
+#         report = report_obj._get_report_from_name(
+#             cr, uid, 'repair_workorder.company_report')
+#         selected_orders = repair_workorder_obj.browse(
+#             cr, uid, ids, context=context)
+
+#         docargs = {
+#             'doc_ids': ids,
+#             'doc_model': report.model,
+#             'docs': selected_orders,
+#             'get_total': partial(
+#                 self.get_total, cr, uid, context=context),
+#             'printBarcode': partial(
+#                 self.printBarcode, cr, uid, context=context),
+#         }
+#         return report_obj.render(
+#             cr, uid, ids, 'repair_workorder.company_report',
+#             docargs, context=context)
+
+#     def printBarcode(self, cr, uid, value, width, height, context=None):
+#         try:
+#             width, height = int(width), int(height)
+#             barcode = createBarcodeDrawing(
+#                 'EAN13', value=value, format='png', width=width, height=height)
+#             barcode = barcode.asString('png')
+#             barcode = barcode.encode('base64', 'strict')
+#         except (ValueError, AttributeError):
+#             raise exceptions.Warning(_('Cannot convert into barcode.'))
+
+#         return barcode

BIN
reports/parser.pyc


+ 191 - 0
reports/ticket.xml

@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <!-- Declarar el informe -->
+        <report
+            id="action_work_order_partner_report"
+            string="Work order (partner copy)"
+            model="study.feature"
+            report_type="qweb-pdf"
+            name="eiru_study_features.partner_report"
+            file="workorder_partner"
+         />
+
+        <record id="action_work_order_partner_report" model="ir.actions.report.xml">
+            <field name="paperformat_id" ref="eiru_study_features.paperformat_repair_workorder"/>
+        </record>
+
+        <!-- Informe -->
+        <template id="partner_report">
+            <t t-call="report.html_container">
+                <t t-foreach="doc_ids" t-as="doc_id">
+                    <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'eiru_study_features.partner_report_document')"/>
+                </t>
+            </t>
+        </template>
+
+        <template id="workorder_partner">
+            <div class="page">
+                <style>
+                    body {
+                        color: #000;
+                        font-family: Arial, Helvetica, sans-serif;
+                        font-size: 14px;
+                        letter-spacing: 0.0px;
+                        line-height: 20px;
+                        margin:0;
+                        padding:0;
+                        word-spacing:1px;
+                    }
+                    .text-lg {
+                        font-size: 18px;
+                        font-weight: bold;
+                    }
+                    .text-md {
+                        display: inline-block;
+                        font-size: 18px;
+                        font-weight: bold;
+                    }
+                    .bordered {
+                        border: 1px solid #000;
+                        padding: 10px;
+                    }
+                    /* http://www.squareonemd.co.uk/how-to-crop-an-image-with-a-css-class/ */
+                    .image-container {
+                        width: 366px;
+                        text-align: center;
+                    }
+                    .image-cropper {
+                        position: relative;
+                        height: 45px;
+                        overflow: hidden;
+                    }
+                    .centered {
+                        position: absolute;
+                        left: -50%;
+                        top: -50%;
+                        max-width: 100%;
+                    }
+                    .bottom {
+                        position: absolute;
+                        bottom: 0px;
+                        max-width: 100%;
+                    }
+                    .top {
+                        position: absolute;
+                        top: 0px;
+                        max-width: 100%;
+                    }
+                    .separator {
+                        border-top: 1px solid #000;
+                        margin-top: 20px;
+                        margin-bottom: 20px;
+                    }
+                </style>
+                <section class="header">
+                    <div class="row">
+                        <div class="col-xs-12">
+                            <p class="text-center" style="margin-top: 10px; margin-bottom: 10px;"><span class="text-lg">COMPROBANTE SAT <span t-if="o.name" t-field="o.name"/></span></p>
+                           <!--  <div class="image-container">
+                                <div class="image-cropper">
+                                    <img class="top" t-att-src="'data:image/png;base64,%s' % printBarcode(o.id, 732, 472)"/>
+                                </div>
+                            </div> -->
+                        </div>
+                    </div>
+                </section>
+                <div class="row"><div class="col-xs-12"><div class="separator"/></div></div>
+                <div class="row">
+                    <div class="col-xs-12">
+                        MATERIAL A RECOGER<br/>
+                        <!-- <t t-if="o.line_ids">
+                            <table class="order_lines" style="width: 100%;">
+                                <thead>
+                                    <tr>
+                                        <th style="width: 75%;">Concepto</th>
+                                        <th style="width: 25%;" class="text-right">Uds.</th>
+                                    </tr>
+                                </thead>
+                                <tbody>
+                                    <t t-foreach="o.line_ids" t-as="line">
+                                        <tr>
+                                            <td><span t-if="line.description" t-field="line.description"></span></td>
+                                            <td class="text-right"><span t-if="line.quantity" t-field="line.quantity"></span></td>
+                                        </tr>
+                                    </t>
+                                </tbody>
+                            </table>
+                        </t>
+                        <br/>
+                        Cliente: <span t-if="o.partner_id.name" t-field="o.partner_id.name"/><br/>
+                        Teléfono: <span t-if="o.partner_id.phone" t-field="o.partner_id.phone"/><t t-if="o.partner_id.mobile"> - <span t-field="o.partner_id.mobile"/></t><br/>
+                        Fecha Entrada: <span t-if="o.order_date" t-field="o.order_date"/><br/>
+                        Fecha Recogida: <span t-if="o.planned_end_date" t-field="o.planned_end_date"/> -->
+                    </div>
+                </div>
+                <!-- <t t-if="o.consumed_ids">
+                    <div class="row"><div class="col-xs-12"><div class="separator"/></div></div>
+                    <table class="consumed_lines" style="width: 100%;">
+                        <thead>
+                            <tr>
+                                <th style="width: 45%;">Concepto</th>
+                                <th style="width: 15%;" class="text-right">Uds.</th>
+                                <th style="width: 20%;" class="text-right">Precio</th>
+                                <th style="width: 20%;" class="text-right">Subtotal</th>
+                            </tr>
+                        </thead>
+                        <tbody>
+                            <t t-foreach="o.consumed_ids" t-as="consumed">
+                                <tr>
+                                    <td><span t-if="consumed.description" t-field="consumed.description"/></td>
+                                    <td class="text-right"><span t-if="consumed.quantity" t-field="consumed.quantity"/></td>
+                                    <td class="text-right"><span t-if="consumed.price_unit" t-field="consumed.price_unit"/></td>
+                                    <td class="text-right"><span t-if="consumed.subtotal and consumed.price_unit" t-raw="consumed.quantity * consumed.price_unit"/></td>
+                                </tr>
+                            </t>
+                        </tbody>
+                    </table>
+                    <t t-set="total" t-value="get_total(o)"/>
+                    <p class="text-right" style="margin-top: 10px; margin-bottom: 0px;">Total <span class="text-md" t-esc="total"></span> EUR</p>
+
+                </t> -->
+                <section class="warning">
+                    <div class="row"><div class="col-xs-12"><div class="separator"/></div></div>
+                    <div class="row">
+                        <div class="col-xs-12">
+                            <p style="text-align: justify; margin-bottom: 0px;">
+                                <small class="warning-text">Presupuesto estimado, si durante la reparación el importe se modificara sustancialmente se consultará al cliente para su aprobación.</small>
+                            </p>
+                        </div>
+                    </div>
+                </section>
+                <t t-if="o.partner_id.company_id">
+                    <div class="row"><div class="col-xs-12"><div class="separator"/></div></div>
+                    <div class="row">
+                        <div class="col-xs-12">
+                            <p class="company-info text-center">
+                                <t t-if="o.partner_id.company_id.name"><span t-field="o.partner_id.company_id.name"/></t>
+                                <t t-if="o.partner_id.company_id.street">- <span t-field="o.partner_id.company_id.street"/>,</t>
+                                <t t-if="o.partner_id.company_id.zip"> <span t-field="o.partner_id.company_id.zip"/></t>
+                                <t t-if="o.partner_id.company_id.city">- <span t-field="o.partner_id.company_id.city"/></t>
+                                <t t-if="o.partner_id.company_id.state_id">(<span t-field="o.partner_id.company_id.state_id.name"/>)</t>
+                                <t t-if="o.partner_id.company_id.phone">- <span t-field="o.partner_id.company_id.phone"/></t>
+                                <t t-if="o.partner_id.company_id.email">- <span t-field="o.partner_id.company_id.email"/></t>
+                                <t t-if="o.partner_id.company_id.website">- <span t-field="o.partner_id.company_id.website"/></t>
+                            </p>
+                        </div>
+                    </div>
+                </t>
+            </div>
+        </template>
+
+        <!-- Contenido del informe -->
+        <template id="partner_report_document">
+            <t t-call="report.html_container">
+                <t t-call="eiru_study_features.workorder_partner"/>
+            </t>
+        </template>
+
+    </data>
+</openerp>

+ 181 - 0
reports/work_order_company.xml

@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <!-- Declarar el informe -->
+        <report
+            id="action_work_order_company_report"
+            string="Work order (company copy)"
+            model="repair.workorder"
+            report_type="qweb-pdf"
+            name="repair_workorder.company_report"
+            file="workorder_company"
+         />
+
+        <record id="action_work_order_company_report" model="ir.actions.report.xml">
+            <field name="paperformat_id" ref="repair_workorder.paperformat_repair_workorder"/>
+        </record>
+
+        <!-- Informe -->
+        <template id="company_report">
+            <t t-call="report.html_container">
+                <t t-foreach="doc_ids" t-as="doc_id">
+                    <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'repair_workorder.company_report_document')"/>
+                </t>
+            </t>
+        </template>
+
+        <template id="workorder_company">
+            <div class="page">
+                <style>
+                    body {
+                        color: #000;
+                        font-family: Arial, Helvetica, sans-serif;
+                        font-size: 14px;
+                        letter-spacing: 0.0px;
+                        line-height: 20px;
+                        margin:0;
+                        padding:0;
+                        word-spacing:1px;
+                    }
+                    .text-lg {
+                        font-size: 18px;
+                        font-weight: bold;
+                    }
+                    .text-md {
+                        display: inline-block;
+                        font-size: 18px;
+                        font-weight: bold;
+                    }
+                    .bordered {
+                        border: 1px solid #000;
+                        padding: 10px;
+                    }
+                    /* http://www.squareonemd.co.uk/how-to-crop-an-image-with-a-css-class/ */
+                    .image-container {
+                        width: 366px;
+                        text-align: center;
+                    }
+                    .image-cropper {
+                        position: relative;
+                        height: 45px;
+                        overflow: hidden;
+                    }
+                    .centered {
+                        position: absolute;
+                        left: -50%;
+                        top: -50%;
+                        max-width: 100%;
+                    }
+                    .bottom {
+                        position: absolute;
+                        bottom: 0px;
+                        max-width: 100%;
+                    }
+                    .top {
+                        position: absolute;
+                        top: 0px;
+                        max-width: 100%;
+                    }
+                    .separator {
+                        border-top: 1px solid #000;
+                        margin-top: 20px;
+                        margin-bottom: 20px;
+                    }
+                </style>
+                <section class="header">
+                    <div class="row">
+                        <div class="col-xs-12">
+                        <p class="text-center" style="margin-top: 10px; margin-bottom: 10px;"><span class="text-lg">PARTE TRABAJO <span t-if="o.name" t-field="o.name"/></span></p>
+                        <div class="image-container">
+                            <div class="image-cropper">
+                                <img class="top" t-att-src="'data:image/png;base64,%s' % printBarcode(o.id, 732, 472)"/>
+                            </div>
+                        </div>
+                        </div>
+                    </div>
+                </section>
+                <div class="row"><div class="col-xs-12"><div class="separator"/></div></div>
+                <div class="row">
+                    <div class="col-xs-12">
+                        MATERIAL A RECOGER<br/>
+                        <t t-if="o.line_ids">
+                            <table class="order_lines" style="width: 100%;">
+                                <thead>
+                                    <tr>
+                                        <th style="width: 75%;">Concepto</th>
+                                        <th style="width: 25%;" class="text-right">Uds.</th>
+                                    </tr>
+                                </thead>
+                                <tbody>
+                                    <t t-foreach="o.line_ids" t-as="line">
+                                        <tr>
+                                            <td><span t-if="line.description" t-field="line.description"></span></td>
+                                            <td class="text-right"><span t-if="line.quantity" t-field="line.quantity"></span></td>
+                                        </tr>
+                                    </t>
+                                </tbody>
+                            </table>
+                        </t>
+                        <br/>
+                        <span class="text-md">Fecha Recogida: <span t-if="o.planned_end_date" t-field="o.planned_end_date"/></span><br/>
+                        Cliente: <span t-if="o.partner_id.name" t-field="o.partner_id.name"/><br/>
+                        Teléfono: <span t-if="o.partner_id.phone" t-field="o.partner_id.phone"/><t t-if="o.partner_id.mobile"> - <span t-field="o.partner_id.mobile"/></t><br/>
+                        Fecha Entrada: <span t-if="o.order_date" t-field="o.order_date"/>
+                    </div>
+                </div>
+                <t t-if="o.consumed_ids">
+                    <div class="row"><div class="col-xs-12"><div class="separator"/></div></div>
+                    <table class="consumed_lines" style="width: 100%;">
+                        <thead>
+                            <tr>
+                                <th style="width: 45%;">Concepto</th>
+                                <th style="width: 15%;" class="text-right">Uds.</th>
+                                <th style="width: 20%;" class="text-right">Precio</th>
+                                <th style="width: 20%;" class="text-right">Subtotal</th>
+                            </tr>
+                        </thead>
+                        <tbody>
+                            <t t-foreach="o.consumed_ids" t-as="consumed">
+                                <tr>
+                                    <td><span t-if="consumed.description" t-field="consumed.description"/></td>
+                                    <td class="text-right"><span t-if="consumed.quantity" t-field="consumed.quantity"/></td>
+                                    <td class="text-right"><span t-if="consumed.price_unit" t-field="consumed.price_unit"/></td>
+                                    <td class="text-right"><span t-if="consumed.subtotal and consumed.price_unit" t-raw="consumed.quantity * consumed.price_unit"/></td>
+                                </tr>
+                            </t>
+                        </tbody>
+                    </table>
+                    <t t-set="total" t-value="get_total(o)"/>
+                    <p class="text-right" style="margin-top: 10px; margin-bottom: 0px;">Total <span class="text-md" t-esc="total"></span></p>
+                </t>
+                <t t-if="o.causes">
+                    <div class="row"><div class="col-xs-12"><div class="separator"/></div></div>
+                    <div class="row">
+                        <div class="col-xs-12">
+                            <div t-field="o.causes"/>
+                        </div>
+                    </div>
+                </t>
+                <div class="row"><div class="col-xs-12"><div class="separator"/></div></div>
+                <div class="row">
+                    <div class="col-xs-6">
+                        <p class="text-center bordered sign"><br/><br/><br/><br/>Firma cliente</p>
+                    </div>
+                    <div class="col-xs-6">
+                        <p class="agreement">Doy mi consentimiento para la realización de las operaciones y montaje del material aquí descritos.</p>
+                    </div>
+                </div>
+            </div>
+        </template>
+
+        <!-- Contenido del informe -->
+        <template id="company_report_document">
+            <t t-call="report.html_container">
+                <t t-call="repair_workorder.workorder_company"/>
+            </t>
+        </template>
+
+
+    </data>
+</openerp>

+ 81 - 0
views/eiru_study_feature.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+
+        <!-- tree view -->
+        
+        <record id="study_feature_tree" model="ir.ui.view">
+            <field name="name">study.feature.tree</field>
+            <field name="model">study.feature</field>
+            <field name="arch" type="xml">
+                <tree string="study Feature">
+                    <field name="name" string="Numero"/>
+                    <field name="order_date" string="Fecha"/>
+                    <field name="partner_id" string="Paciente"/>
+                    <field name="product_id" string="Estudio"/>
+                    <field name="user_id" string="Responsable"/>
+                </tree>
+            </field>
+        </record>
+
+        <!-- form view -->
+
+        <record id="study_feature_form" model="ir.ui.view">
+            <field name="name">study.feature.form</field>
+            <field name="model">study.feature</field>
+            <field name="arch" type="xml">
+                <form string="study Feature">
+                    <sheet>
+                        <div class="oe_title">
+                            <h1>
+                                <label string="Numero de Estudio "/>
+                                <field name="name" class="oe_inline" readonly="1"/>
+                            </h1> 
+                        </div>
+                        <group>
+                            <group>
+                                <field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="[('customer','=',True)]" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}' string="Cliente" required="1"/>
+                                <field name="product_id" required="1" string="Estudio Realizado"/>
+                            </group>
+                            <group>
+                                <field string="Fecha de estudio" name="order_date" required="1"/>
+                                <field name="user_id" required="1"/>
+                            </group>
+                        </group>
+                       
+                        <notebook>
+                            <page string="Información">
+                                <group>
+                                    <group string="Diagnóstico">
+                                        <field name="diagnostic" nolabel="1"/>
+                                    </group>
+                                    <group string="Causas">
+                                        <field name="causes" nolabel="1"/>
+                                    </group>
+                                </group>
+                                <group>
+                                    <group string="Acciones">
+                                        <field name="actions" nolabel="1"/>    
+                                    </group>
+                                    <group string="Recomendaciones">
+                                        <field name="recommendations" nolabel="1"/>
+                                    </group>                                    
+                                </group>
+                            </page>
+                        </notebook>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+
+        <record id="action_study_feature" model="ir.actions.act_window">
+            <field name="name">Estudios</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">study.feature</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+        </record>
+
+        <menuitem id="study_feature" parent="base.menu_sales" action="action_study_feature" name="Estudios" sequence="20"/>
+    </data>
+</openerp>