Преглед на файлове

Retocar impresión de presupuesto tag, agregar moneda

sebas преди 3 години
ревизия
c0e510c437
променени са 8 файла, в които са добавени 571 реда и са изтрити 0 реда
  1. 19 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 37 0
      __openerp__.py
  4. 30 0
      presupuesto_venta_tag.py
  5. 456 0
      presupuesto_venta_tag.xml
  6. 26 0
      res_currency.py
  7. BIN
      static/description/icon.png
  8. 3 0
      static/src/css/style.css

+ 19 - 0
__init__.py

@@ -0,0 +1,19 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    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/>.      #
+#                                                                               #
+#################################################################################
+
+from . import presupuesto_venta_tag, res_currency

BIN
__init__.pyc


+ 37 - 0
__openerp__.py

@@ -0,0 +1,37 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    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': 'Presupuesto de Venta Tag',
+    'version': '0.1',
+    'category': 'Sale',
+    'description': """
+Presupuesto de Venta tag
+
+
+Formato para imprimir el Presupuesto de Venta tag
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': 'http://www.eiru.com.py',
+    'depends': ['base','sale','eiru_extra_sale'],
+    'data': [
+	    'presupuesto_venta_tag.xml'
+    ],
+    'installable': True,
+}

+ 30 - 0
presupuesto_venta_tag.py

@@ -0,0 +1,30 @@
+from openerp import api, models
+import datetime
+from num2words import num2words
+
+class report_presupuesto_tag(models.AbstractModel):
+    _name = 'report.presupuesto_venta_tag.report_presupuesto_tag'
+
+    @api.multi
+    def render_html(self, data=None):
+        report_obj = self.env['report']
+        report = report_obj._get_report_from_name('presupuesto_venta_tag.report_presupuesto_tag')
+        docargs = {
+            'doc_ids': self._ids,
+            'doc_model': report.model,
+            'docs': self.env[report.model].browse(self._ids),
+            'convertir':self.convertir,
+            'calcular_precio':self.calcular_precio,
+        }
+        return report_obj.render('presupuesto_venta_tag.report_presupuesto_tag', docargs)
+
+    def convertir(self,nro,moneda):
+        letra = num2words(nro,lang="es")
+        letra = letra.capitalize()
+        if not moneda:
+            moneda=''
+        letra = letra +' '+moneda
+        return letra
+
+    def calcular_precio(self,precio):
+        return (precio*1.1)

+ 456 - 0
presupuesto_venta_tag.xml

@@ -0,0 +1,456 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+
+  <!-- <t t-if="o.client_order_ref">
+    <div class="watermark" style="position:absolute;opacity:0.25;font-size:3em;width:100%;text-align:center;z-index:1000;">
+        <p t-field="o.client_order_ref"/>
+    </div>
+ </t> -->
+
+<data>
+
+     <report id="presupuesto_venta_tag"
+        model="sale.order"
+        string="Presupuesto de Venta"
+        report_type="qweb-pdf"
+        name="presupuesto_venta_tag.report_presupuesto_tag"
+        file="presupuesto_venta_tag.report_presupuesto_tag"
+     />
+
+     <record id="paperformat_lowmargin" model="report.paperformat">
+         <field name="name">A4 tag</field>
+         <field name="default" eval="True" />
+         <field name="format">custom</field>
+         <field name="page_height">297</field>
+         <field name="page_width">210</field>
+         <field name="orientation">Portrait</field>
+         <field name="margin_top">0</field>
+         <field name="margin_bottom">0</field>
+         <field name="margin_left">0</field>
+         <field name="margin_right">0</field>
+         <field name="header_line" eval="False" />
+         <field name="header_spacing">3</field>
+         <field name="dpi">90</field>
+   </record>
+
+
+   <record id="presupuesto_venta_tag.presupuesto_venta_tag" model="ir.actions.report.xml">
+     <field name="paperformat_id" ref="presupuesto_venta_tag.paperformat_lowmargin" />
+   </record>
+
+    <template id="report_presupuesto_tag">
+        <t t-call="report.html_container">
+
+                <div class="page">
+                    <style type="text/css">
+                        body{
+                            font-size: 3mm;
+                            font-family: Arial;
+                        }
+                        div{
+                            padding: 0px;
+                        }
+                        .pagina{
+                            width:21.0cm !important;
+                            margin: 0 !important;
+                            margin-left: 0 !important;
+                            min-width: 100%;
+                        }
+                        .logo{
+                            height: 3.73cm;
+                            width: 100%;
+                            clear: both;
+                        }
+                        .descripcion1{
+                            width: 8.2cm;
+                            font-size: 13px;
+                            position: absolute;
+                            z-index:9999;
+                            padding-top: 0.2cm;
+                            float: left;
+                            min-height: 0cm;
+                        }
+
+                        .descripcion2{
+                            width: 13cm;
+                            font-size: 10px;
+                            float: left;
+                            min-height: 0cm;
+                        }
+
+                        .descripcion3{
+                            width: 15cm;
+                            font-size: 10px;
+                            float: left;
+                            min-height: 0cm;
+                        }
+                        .descripcion4{
+                            width: 15cm;
+                            font-size: 10px;
+                            float: left;
+                            min-height: 0cm;
+                        }
+
+                        .email{
+                            width: 13cm;
+                            font-size: 10px;
+                            float: left;
+                            min-height: 0cm;
+                        }
+
+                        .ciudad{
+                            width: 13cm;
+                            float: left;
+                            font-size: 10px;
+                            min-height: 0cm;
+                        }
+                        .tel{
+                            width: 13cm;
+                            float: left;
+                            font-size: 10px;
+                            min-height: 0cm;
+                        }
+                        .table-condensed>tbody>tr>td {
+
+                        }
+                        .table-condensed1>tbody>tr>td {
+
+                        }
+                        .divisoria{
+                            height: 0.9cm;
+                            clear: both;
+                        }
+                        .divisoria1{
+                            height: 0.8cm;
+                            width: 100%;
+                            clear: both;
+                        }
+                        .titulo{
+                            width: 10.52cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: right;
+                            color:white;
+                            width: 97%;
+                            min-height: 0.9cm;
+                        }
+                        .titulo1{
+                            width: 25.4cm;
+                            margin-top: 1.9cm;
+                            text-align: left;
+                            position: absolute;
+                            z-index:9999;
+                            font-size: 13px;
+                            padding-left: 23.1cm;
+                            min-height: 0.9cm;
+                        }
+                        .fecha_emision_data{
+                            font-size: 20px;
+                            width: 12.5cm;
+                            font-weight: bold;
+                            margin-top: 3.2cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: right;
+                            width: 93%;
+                            min-height: 0.8cm;
+                        }
+                        .razon_data{
+                            width: 12.5cm;
+                            font-size: 14px;
+                            padding-left: 3.89cm;
+                            font-weight: bold;
+                            margin-top: 4.75cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: left;
+                            min-height: 0.8cm;
+                        }
+                        .cab-articulos{
+                            height: 0.8cm;
+                            clear: both;
+                        }
+                        .articulos{
+                            height: 14.5cm;
+                            z-index:9999;
+                            margin-top: 6.8cm;
+                            position: absolute;
+                        }
+                        .art-col1{
+                            width:3.2cm;
+                            z-index:9999;
+                            position: absolute;
+                            text-align: center;
+                        }
+                        .art-col3{
+                            padding-left: 0.3cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: left;
+                            width:12.7cm;
+                        }
+                        .art-col4{
+                            width:2.9cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: right;
+                        }
+                        .art-col2{
+                            width:1.8cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: right;
+                        }
+                        .art-col5{
+                            width:3cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: right;
+                        }
+
+                        .art-col11{
+                            width:3.7cm;
+                            text-align: center;
+                            padding-top: 0.2cm;
+                        }
+
+                        .art-col31{
+                            padding-left: 0.3cm;
+                            text-align: left;
+                            padding-top: 0.2cm;
+                            width:16.1cm;
+                        }
+                        .art-col41{
+                            width:3.4cm;
+                            text-align: right;
+                            padding-top: 0.2cm;
+                        }
+                        .art-col21{
+                            width:2.18cm;
+                            text-align: right;
+                            padding-top: 0.2cm;
+                        }
+                        .art-col51{
+                            width:2.75cm;
+                            text-align: right;
+                            padding-top: 0.2cm;
+                        }
+                        .subtotal_mat{
+                            width: 4.3cm;
+                            float: left;
+                            text-align: right;
+                            padding-top: 0.09cm;
+                            padding-left: 1cm;
+                            padding-bottom: 0.12cm;
+                            min-height: 0.4cm;
+                        }
+                        .subtotal_mo{
+                            width: 3.6cm;
+                            float: left;
+                            text-align: right;
+                            padding-top: 0.09cm;
+                            padding-bottom: 0.12cm;
+                            min-height: 0.4cm;
+                        }
+                        .total{
+                            width: 12.5cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: right;
+                            font-weight: bold;
+                            font-size: 15px;
+                            width: 94.5%;
+                            margin-top: 26.05cm;
+                            min-height: 0.9cm;
+                        }
+                        .totalenletra{
+                            width: 19.5cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: left;
+                            font-weight: bold;
+                            padding-left: 9.5cm;
+                            font-size: 15px;
+                            margin-top: 26.10cm;
+                            min-height: 0.9cm;
+                        }
+                        .asunto{
+                            width: 28.5cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: right;
+                            font-weight: bold;
+                            padding-left: 18.5cm;
+                            font-size: 15px;
+                            margin-top: 26.9cm;
+                            min-height: 0.9cm;
+                        }
+                        .plazo{
+                            width: 12.5cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: left;
+                            font-weight: bold;
+                            padding-left: 9.5cm;
+                            font-size: 15px;
+                            margin-top: 27.0cm;
+                            min-height: 0.9cm;
+                        }
+                        .validez{
+                            width: 12.5cm;
+                            position: absolute;
+                            z-index:9999;
+                            text-align: left;
+                            padding-left: 9.5cm;
+                            font-weight: bold;
+                            font-size: 15px;
+                            margin-top: 28.05cm;
+                            min-height: 0.9cm;
+                        }
+                        .contado_x{
+                            width: 12.5cm;
+                            position: absolute;
+                            font-weight: bold;
+                            z-index:9999;
+                            text-align: left;
+                            padding-left: 9.5cm;
+                            font-size: 15px;
+                            margin-top: 28.95cm;
+                            min-height: 0.9cm;
+                        }
+                        .anticipo{
+                            width: 23.5cm;
+                            position: absolute;
+                            font-weight: bold;
+                            z-index:9999;
+                            text-align: left;
+                            padding-left: 4.5cm;
+                            font-size: 15px;
+                            margin-top: 29.95cm;
+                            min-height: 0.9cm;
+                        }
+						            .logo1{
+                            height: 1cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .foto_personal {
+                            position: absolute;
+                            top: 1.5cm;
+                            left:0.25cm;
+                        }
+                    </style>
+                    <t t-foreach="docs" t-as="o">
+                        <div class="pagina">
+
+                            <t t-if="o.company_id.image">
+                                 <div class="watermark" style="position:absolute;top: 0mm;font-size:3em;width:100%;border:0;text-align:left;z-index:1;">
+                                    <img t-att-src="'data:image/png;base64,%s' % o.company_id.image"/>
+                                </div>
+                            </t>
+                           <div class="logo"> </div>
+
+                          <div class="titulo" >
+                                <h3><strong><span t-field="o.name"/></strong></h3>
+                          </div>
+                          <div class="titulo1" >
+                                <span t-field="o.user_id.name"/>
+                          </div>
+                          <div class="fecha_emision_data">
+                                <span t-field="o.date_order" t-field-options='{"format": "dd/MM/yyyy"}'/>
+                          </div>
+                          <div class="razon_data">
+                            <span t-field="o.partner_id.name"/>
+                          </div>
+
+                            <div class="divisoria"> </div>
+
+                               <div class="articulos">
+                                  <table class="tab-articulos" >
+                                      <t t-set="valor_mat" t-value="0"/>
+
+                                      <tr t-foreach="o.order_line" t-as="l">
+                                         <th  class="art-col11">
+
+                                         </th>
+
+                                          <th class="art-col31">
+                                             <span t-field="l.name"/>
+                                          </th>
+                                          <th class="art-col41">
+                                                  <t t-if="o.currency_id.id == 166">
+                                                      <span t-esc="'{0:,.0f}'.format(l.price_unit).replace(',', '.')"/>
+                                                  </t>
+                                                  <t t-if="o.currency_id.id == 3">
+                                                      <span t-esc="'{0:,.2f}'.format(l.price_unit).replace(',', '.')"/>
+                                                  </t>
+                                          </th>
+                                          <th class="art-col21">
+                                              <span t-esc="'%.0f'%l.product_uom_qty"/>
+                                          </th>
+                                          <th class="art-col51">
+                                                  <span t-if="o.currency_id.id == 166">
+                                                      <span t-esc= "'{0:,.0f}'.format(int(l.product_uom_qty * l.price_unit)).replace(',', '.')">
+                                                          <span t-value="valor_mat+(l.product_uom_qty * l.price_unit)"/></span>
+                                                          <t t-set="valor_mat" t-value="valor_mat+(l.product_uom_qty * l.price_unit)"/>
+                                                      </span>
+                                                  <span t-if="o.currency_id.id == 3">
+                                                      <span t-esc= "'{0:,.2f}'.format(int(l.product_uom_qty * l.price_unit)).replace(',', '.')">
+                                                          <span t-value="valor_mat+(l.product_uom_qty * l.price_unit)"/></span>
+                                                          <t t-set="valor_mat" t-value="valor_mat+(l.product_uom_qty * l.price_unit)"/>
+                                                      </span>
+                                          </th>
+                                      </tr>
+                                  </table>
+                                </div>
+
+                                <div class="total" >
+                                    <t t-if="o.currency_id.id == 166">
+                                        <span t-esc="'{0:,.0f}'.format(int(valor_mat)).replace(',', '.')"></span> Gs.
+                                    </t>
+                                    <t t-if="o.currency_id.id == 3">
+                                        <span t-esc="'{0:,.0f}'.format(int(valor_mat)).replace(',', '.')"> </span> U$.
+                                    </t>
+                                </div>
+
+                                <div class="totalenletra" >
+                                     <t t-if="o.currency_id.id == 166">
+                                        <span t-esc="convertir(o.amount_total,o.currency_id.en_letra)"/> Guaraníes
+                                     </t>
+                                     <t t-if="o.currency_id.id == 3">
+                                        <span t-esc="convertir(o.amount_total,o.currency_id.en_letra)" options="{'currency_field': 'o.currency_id'}"/> Dólares
+                                     </t>
+                                </div>
+
+                                <div class="asunto" >
+                                  <t t-if="o.amount_tax > 0">
+                                      IVA Incluido
+                                  </t>
+                                  <t t-if="o.amount_tax == 0">
+                                      No incluye el valor del IVA
+                                  </t>
+                                </div>
+
+                                <div class="plazo" >
+                                        <span t-esc="o.plazoentrega"></span>
+                                </div>
+
+                                <div class="validez" >
+                                        <span t-esc="o.validez"></span>
+                                </div>
+                                <div class="contado_x">
+                                      <t t-if="o.contado == True">Contado</t>
+                                </div>
+                                <div class="contado_x">
+                                      <t t-if="o.credito == True">Crédito<span t-field="o.payment_term"/></t>
+                                </div>
+                                <div class="anticipo">Anticipo 50% - Saldo al entregar.</div>
+
+                    </div>
+                  </t>
+              </div>
+        </t>
+    </template>
+
+</data>
+</openerp>

+ 26 - 0
res_currency.py

@@ -0,0 +1,26 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#                                                                               #
+#    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/>.      #
+#                                                                               #
+#################################################################################
+
+from openerp import models, fields
+
+class res_currency(models.Model):
+    _inherit = 'res.currency'
+    _name = 'res.currency'
+
+    en_letra = fields.Char('En letras')

BIN
static/description/icon.png


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

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