Procházet zdrojové kódy

Modifcar nota de venta gavilan

SEBAS před 9 měsíci
rodič
revize
3e358f4fb4

+ 1 - 1
__init__.py

@@ -19,4 +19,4 @@
 ###################################################################################
 # Product Brand is an Openobject module wich enable Brand management for products #
 ###################################################################################
-from . import factura_venta_gavilan, sale_order, res_currency
+from . import factura_venta_gavilan, account_invoice, res_currency

+ 2 - 2
__openerp__.py

@@ -32,9 +32,9 @@ Formato para imprimir la Presupuesto de Venta de Gavilan
     """,
     'author': 'Eiru/Sebastian Penayo',
     'website': 'http://www.eiru.com',
-    'depends': ['base','sale'],
+    'depends': ['base','account'],
     'data': [
-        'report_saleorder_document1.xml',
+        'report_accountinvoice_document1.xml',
         'account_invoice_view.xml',
         'res_currency_view.xml'
     ],

+ 41 - 0
account_invoice.py

@@ -0,0 +1,41 @@
+# -*- 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, api
+
+class account_invoice(models.Model):
+    _inherit = 'account.invoice'
+    _name = 'account.invoice'
+
+    contado = fields.Boolean('Contado')
+    credito = fields.Boolean('Crédito')
+
+    _defaults = {
+        'contado': True
+    }
+
+    @api.one
+    @api.onchange('credito')
+    def cambiar_estado_credito(self):
+        self.contado = not self.credito
+
+    @api.one
+    @api.onchange('contado')
+    def cambiar_estado_contado(self):
+        self.credito = not self.contado

+ 4 - 4
account_invoice_view.xml

@@ -2,10 +2,10 @@
 
 <openerp>
     <data>
-        <record id="sale_order_cred_cont" model="ir.ui.view">
-            <field name="name">sale.order.cred.cont</field>
-            <field name="model">sale.order</field>
-            <field name="inherit_id" ref="sale.view_order_form" />
+        <record id="account_invoice_cred_cont" model="ir.ui.view">
+            <field name="name">account.invoice.cred.cont</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_form" />
             <field name="arch" type="xml">
                 <field name="fiscal_position" position="after">
                         <field name="contado"/>

+ 3 - 3
factura_venta_gavilan.py

@@ -3,12 +3,12 @@ import datetime
 from num2words import num2words
 
 class report_factura_gavilan(models.AbstractModel):
-    _name = 'report.factura_venta_gavilan.report_presupuesto_gavilan'
+    _name = 'report.factura_venta_gavilan.report_factura_gavilan'
 
     @api.multi
     def render_html(self, data=None):
         report_obj = self.env['report']
-        report = report_obj._get_report_from_name('factura_venta_gavilan.report_presupuesto_gavilan')
+        report = report_obj._get_report_from_name('factura_venta_gavilan.report_factura_gavilan')
         docargs = {
             'doc_ids': self._ids,
             'doc_model': report.model,
@@ -16,7 +16,7 @@ class report_factura_gavilan(models.AbstractModel):
             'convertir':self.convertir,
             'calcular_precio':self.calcular_precio,
         }
-        return report_obj.render('factura_venta_gavilan.report_presupuesto_gavilan', docargs)
+        return report_obj.render('factura_venta_gavilan.report_factura_gavilan', docargs)
 
     def convertir(self,nro,moneda):
         letra = num2words(nro,lang="es")

+ 15 - 19
report_saleorder_document1.xml → report_accountinvoice_document1.xml

@@ -2,12 +2,12 @@
 <openerp>
 <data>
 
-    <report id="report_saleorder_document1"
-        model="sale.order"
-        string="Presupuesto de Venta"
+    <report id="report_accountinvoice_document1"
+        model="account.invoice"
+        string="Nota de Venta"
         report_type="qweb-html"
-        name="factura_venta_gavilan.report_presupuesto_gavilan"
-        file="factura_venta_gavilan.report_presupuesto_gavilan"
+        name="factura_venta_gavilan.report_factura_gavilan"
+        file="factura_venta_gavilan.report_factura_gavilan"
     />
 
 
@@ -28,7 +28,7 @@
 
 
 
-   <template id="report_presupuesto_gavilan">
+   <template id="report_factura_gavilan">
         <t t-call="report.external_layout">
             <div class="page">
                 <style type="text/css">
@@ -280,11 +280,11 @@
                                 </tr>
 
                             </div>
-                            <div class="col-xs-8">
+                            <!-- <div class="col-xs-8">
                                 <center>
                                     <img t-if="o.company_id.logo" t-att-src="'data:image/png;base64,%s' % o.company_id.logo" style="max-height: 240px;max-width: 80px;"/>
                                 </center>
-                            </div>
+                            </div> -->
                         </div>
 
 
@@ -292,14 +292,14 @@
 
                         <h2>
                             <center>
-                            <span>Presupuesto N° </span>
+                            <span>NOTA DE VENTA N° </span>
                             <span t-field="o.name"/>
                             </center>
                         </h2>
 
                         <table class="table table-condensed table-bordered">
                             <tr>
-                                <td class="fecha_emision_data"><b>Fecha: </b><span t-field="o.date_order" t-field-options='{"format": "dd MMMM yyyy"}'/></td>
+                                <td class="fecha_emision_data"><b>Fecha: </b><span t-field="o.date_invoice" t-field-options='{"format": "dd MMMM yyyy"}'/></td>
                                 <td class="vendor"><b>Vendedor: </b><span t-field="o.user_id.name"/></td>
                             </tr>
                             <tr>
@@ -331,7 +331,7 @@
                            <tbody class="sale_tbody">
                                 <tr t-foreach="o.order_line" t-as="l">
                                     <td class="art-col1">
-                                        <span t-esc="'%.0f'%l.product_uom_qty"/>
+                                        <span t-esc="'%.0f'%l.quantity"/>
                                     </td>
                                     <td class="art-col2">
                                        <span t-field="l.name"/>
@@ -340,7 +340,7 @@
                                         <span t-esc="'{0:,.0f}'.format(l.price_unit)"/>
                                     </td>
                                     <td class="art-col4">
-                                        <span t-esc="'{0:,.0f}'.format(l.price_unit*l.product_uom_qty)"/>
+                                        <span t-esc="'{0:,.0f}'.format(l.price_unit*l.quantity)"/>
                                     </td>
                                 </tr>
                             </tbody>
@@ -362,7 +362,7 @@
 
                         <div class="divisoria"> </div>
 
-                        <p t-field="o.note"/>
+                        <!-- <p t-field="o.note"/>
                         <p t-if="o.payment_term.note">
                             <strong>Condición de Pago:</strong>
                             <span t-field="o.payment_term.note"/>
@@ -374,13 +374,9 @@
                         <p>
                             <strong>Garantia:</strong>
                             <span t-field="o.payment_term.note"/>
-                        </p>
+                        </p> -->
+
 
-                        <div>
-                            <center>
-                            <strong>Validez del presente presupuesto 15 días</strong>
-                           </center>
-                        </div>
                         <div class="divisoria"> </div>
                         <div>
                             <center>

+ 1 - 1
res_currency.py

@@ -23,4 +23,4 @@ class res_currency(models.Model):
     _inherit = 'res.currency'
     _name = 'res.currency'
 
-    en_letras1 = fields.Char('En letras')
+    en_letras = fields.Char('En letras')

+ 3 - 3
res_currency_view.xml

@@ -2,13 +2,13 @@
 
 <openerp>
     <data>
-        <record id="res_currency_en_letras1" model="ir.ui.view">
-            <field name="name">res.currency.en.letras1</field>
+        <record id="res_currency_en_letras" model="ir.ui.view">
+            <field name="name">res.currency.en.letras</field>
             <field name="model">res.currency</field>
             <field name="inherit_id" ref="base.view_currency_form" />
             <field name="arch" type="xml">
                 <field name="symbol" position="after">
-                    <field name="en_letras1"/>
+                    <field name="en_letras"/>
                 </field>
             </field>
         </record>