Parcourir la source

[FIX] Limpieza de codigo

Rodney Elpidio Enciso Arias il y a 7 ans
Parent
commit
1747091827

+ 0 - 2
__init__.py

@@ -1,6 +1,4 @@
 # -*- 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


+ 1 - 21
__openerp__.py

@@ -1,28 +1,9 @@
 # -*- 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',
+    'category': 'extra',
     'version': '0.1',
     'description': """
     """,
@@ -36,7 +17,6 @@
     'data': [
         'data/report_paperformat.xml',
         'reports/ticket.xml',
-        # 'reports/work_order_company.xml',
         'data/sequence.xml',
         'views/eiru_study_feature.xml',
     ],

+ 0 - 2
models/__init__.py

@@ -1,5 +1,3 @@
 # -*- 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


+ 1 - 213
models/eiru_study_feature.py

@@ -1,6 +1,4 @@
 # -*- 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
@@ -8,7 +6,6 @@ import logging
 
 _log = logging.getLogger(__name__)
 
-
 class StudyFeature(models.Model):
     _name = 'study.feature'
     _description = 'Study Feature'
@@ -36,28 +33,12 @@ class StudyFeature(models.Model):
     )
     product_id = fields.Many2one(
         comodel_name='product.product',
-        string='Partner'
+        string='Product'
     )
-    # 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'
     )
@@ -70,201 +51,8 @@ class StudyFeature(models.Model):
     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


+ 0 - 2
reports/__init__.py

@@ -1,5 +1,3 @@
 # -*- 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


+ 1 - 63
reports/parser.py

@@ -1,13 +1,10 @@
 # -*- 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'
 
@@ -29,67 +26,8 @@ class PartnerReport(osv.AbstractModel):
             '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
+            docargs, context=context)

BIN
reports/parser.pyc


+ 0 - 181
reports/work_order_company.xml

@@ -1,181 +0,0 @@
-<?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>