deisy преди 5 години
ревизия
9953749261
променени са 11 файла, в които са добавени 275 реда и са изтрити 0 реда
  1. 2 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 24 0
      __openerp__.py
  4. 2 0
      models/__init__.py
  5. BIN
      models/__init__.pyc
  6. 16 0
      models/sale_order.py
  7. BIN
      models/sale_order.pyc
  8. 55 0
      views/layouts.xml
  9. 144 0
      views/reports/report_saleorder.xml
  10. 19 0
      views/sale_order.xml
  11. 13 0
      views/sale_report.xml

+ 2 - 0
__init__.py

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

BIN
__init__.pyc


+ 24 - 0
__openerp__.py

@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+
+{
+    'name': 'Nuevos formatos de pdf',
+    'version': '8.0.0.1.0',
+    'category': '',
+    'summary': 'Nuevos formatos de pdf',
+    'author': 'Eiru',
+    'license': 'AGPL-3',
+    'depends': [
+        'base',
+        'sale',
+        'partner_social_fields',
+        ],
+    'data': [
+        'views/layouts.xml',
+        'views/sale_order.xml',
+        'views/sale_report.xml',
+        'views/reports/report_saleorder.xml',
+
+    ],
+
+    'installable': True,
+}

+ 2 - 0
models/__init__.py

@@ -0,0 +1,2 @@
+# -*- encoding: utf-8 -*-
+import sale_order

BIN
models/__init__.pyc


+ 16 - 0
models/sale_order.py

@@ -0,0 +1,16 @@
+# -*- encoding: utf-8 -*-
+
+from openerp import models, fields, api, tools, _
+from openerp.exceptions import Warning
+
+class sale_order(models.Model):
+    _inherit = 'sale.order'
+
+
+    def print_quotation2(self, cr, uid, ids, context=None):
+        '''
+        This function prints the sales order and mark it as sent, so that we can see more easily the next step of the workflow
+        '''
+        assert len(ids) == 1, 'This option should only be used for a single id at a time'
+        self.signal_workflow(cr, uid, ids, 'quotation_sent')
+        return self.pool['report'].get_action(cr, uid, ids, 'new_pdf_formats.report_saleorder', context=context)

BIN
models/sale_order.pyc


+ 55 - 0
views/layouts.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+
+<template id="new_external_layout">
+    <!-- Multicompany -->
+    <t t-if="o and 'company_id' in o">
+        <t t-set="company" t-value="o.company_id"></t>
+    </t>
+    <t t-if="not o or not 'company_id' in o">
+        <t t-set="company" t-value="res_company"></t>
+    </t>
+
+    <t t-call="new_pdf_formats.new_external_layout_header" />
+    <t t-raw="0" />
+    <t t-call="report.external_layout_footer" />
+</template>
+
+<template id="new_external_layout_header">
+    <div class="header">
+        <div class="row">
+
+          <div class="col-xs-8">
+            <div>
+              <strong><span t-field="company.partner_id" style="font-size:20px"/></strong>
+            </div>
+            <div t-field="company.rml_header1"/>
+            <div>
+              <span>R.U.C:</span>
+              <span t-field="company.partner_id.ruc"/>
+            </div>
+
+            <div t-field="company.street"/>
+            <div t-field="company.street2"/>
+            <div t-field="company.state_id"/>
+            <div t-field="company.country_id"/>
+
+          </div>
+
+              <div class="col-xs-4">
+                <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 100px; float:right"/>
+              </div>
+            </div>
+        <div class="row zero_min_height">
+            <div class="col-xs-12">
+                <div style="border-bottom: 1px solid black;"></div>
+            </div>
+        </div>
+
+    </div>
+</template>
+
+</data>
+</openerp>

+ 144 - 0
views/reports/report_saleorder.xml

@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+    <template id="report_saleorder_document">
+      <t t-call="new_pdf_formats.new_external_layout">
+        <div class="page">
+          <div class="oe_structure"/>
+          <h2>
+            <span t-if="o.state not in ['draft','sent']">Order N° </span>
+            <span t-if="o.state in ['draft','sent']">Presupuesto N° </span>
+            <span t-field="o.name"/>
+          </h2>
+          <div class="row">
+            <div class="col-xs-6">
+              <div t-if="o.partner_id">
+                <strong>Cliente:</strong>
+                <span t-field="o.partner_id"/>
+              </div>
+              <div t-if="o.ruc">
+                <strong>Cédula / R.U.C:</strong>
+                <span t-field="o.ruc"/>
+              </div>
+              <div t-if="o.street">
+                <strong>Dirección:</strong>
+                <span t-field="o.street"/>
+              </div>
+              <div t-if="o.state_id">
+                <strong>Departamento:</strong>
+                <span t-field="o.state_id"/>
+              </div>
+              <div t-if="o.country_id">
+                <strong>Pais:</strong>
+                <span t-field="o.country_id"/>
+              </div>
+              <div t-if="o.phone">
+                <strong>Teléfono:</strong>
+                <span t-field="o.phone"/>
+              </div>
+            </div>
+            <div class="col-xs-6">
+              <div t-if="o.client_order_ref">
+                <strong>Referencia:</strong>
+                <span t-field="o.client_order_ref"/>
+              </div>
+              <div t-if="o.date_order">
+                <strong t-if="o.state not in ['draft','sent']">Fecha del pedido:</strong>
+                <strong t-if="o.state in ['draft','sent']">Fecha del presupuesto:</strong>
+                <span t-field="o.date_order"/>
+              </div>
+              <div t-if="o.user_id.name">
+                <strong>Vendedor:</strong>
+                <span t-field="o.user_id.name"/>
+              </div>
+              <div t-if="o.payment_term">
+                <strong>Condiciones de pago:</strong>
+                <span t-field="o.payment_term"/>
+              </div>
+            </div>
+          </div>
+
+          <div style="width:20px; height:20px;"/>
+
+          <table class="table table-condensed table-bordered">
+            <thead>
+              <tr>
+                <th class="text-right">Cantidad</th>
+                <th>Descripción</th>
+                <th class="text-right">Precio unitario</th>
+                <th class="text-right" groups="sale.group_discount_per_so_line">Desc.(%)</th>
+                <th class="text-right">Impuestos</th>
+                <th class="text-right">Precio</th>
+              </tr>
+            </thead>
+            <tbody class="sale_tbody">
+              <tr t-foreach="o.order_line" t-as="l">
+                <td class="text-right">
+                  <span t-field="l.product_uom_qty"/>
+                  <span groups="product.group_uom" t-field="l.product_uom"/>
+                </td>
+                <td>
+                  <span t-field="l.name"/>
+                </td>
+                <td class="text-right">
+                  <span t-field="l.price_unit"/>
+                </td>
+                <td class="text-right" groups="sale.group_discount_per_so_line">
+                  <span t-field="l.discount"/>
+                </td>
+                <td>
+                  <span class="text-right" t-esc="', '.join(map(lambda x: x.name, l.tax_id))"/>
+                </td>
+                <td class="text-right">
+                  <span t-field="l.price_subtotal" t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
+                </td>
+              </tr>
+            </tbody>
+          </table>
+          <div class="row">
+            <div class="col-xs-4 pull-right">
+              <table class="table table-condensed">
+                <tr class="border-black">
+                  <td><strong>Total sin impuestos</strong></td>
+                  <td class="text-right">
+                    <span t-field="o.amount_untaxed" t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
+                  </td>
+                </tr>
+                <tr>
+                  <td>Impuestos</td>
+                  <td class="text-right">
+                    <span t-field="o.amount_tax" t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
+                  </td>
+                </tr>
+                <tr class="border-black">
+                  <td><strong>Total</strong></td>
+                  <td class="text-right">
+                    <span t-field="o.amount_total" t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
+                  </td>
+                </tr>
+              </table>
+            </div>
+          </div>
+          <div>
+            <strong>Peso Total:</strong>
+            <span t-field="o.total_weight"/> Kg
+          </div>
+          <p t-field="o.note" />
+          <p t-if="o.payment_term.note">
+            <strong>Condiciones de pago:</strong>
+            <span t-field="o.payment_term.note"/>
+          </p>
+          <div class="oe_structure"/>
+        </div>
+      </t>
+    </template>
+
+    <template id="report_saleorder">
+      <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', 'new_pdf_formats.report_saleorder_document')"/>
+        </t>
+      </t>
+    </template>
+  </data>
+</openerp>

+ 19 - 0
views/sale_order.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+    <record model="ir.ui.view" id="new_pdf_format_sale_form">
+       <field name="name">new_pdf_format_sale_form</field>
+       <field name="model">sale.order</field>
+       <field name="inherit_id" ref="sale.view_order_form"/>
+       <field name="arch" type="xml">
+         <button name="print_quotation" states="draft" position="replace">
+           <button name="print_quotation" string="Imprimir" type="object" states="draft" class="oe_highlight" groups="base.group_user" invisible="1"/>
+         </button>
+         <button name="print_quotation" states="sent,progress,manual" position="replace">
+           <button name="print_quotation2" string="Imprimir" type="object" states="sent,progress,manual" groups="base.group_user" invisible="1"/>
+         </button>
+
+       </field>
+    </record>
+  </data>
+</openerp>

+ 13 - 0
views/sale_report.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <report
+            id="sale.report_sale_order"
+            string="Presupuesto / Pedido"
+            model="sale.order"
+            report_type="qweb-pdf"
+            file="new_pdf_formats.report_saleorder"
+            name="new_pdf_formats.report_saleorder"
+        />
+    </data>
+</openerp>