Commit 749b5688 by Juan

Impresion directa

1 parent 450bb317
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from odoo import models, fields, api, exceptions from odoo import models, fields, api, exceptions
from .qr import qrfiscal from .qr import qrfiscal
from odoo.exceptions import UserError, ValidationError, Warning, RedirectWarning
import base64
class asw_comprobante(models.Model): class asw_comprobante(models.Model):
_inherit = 'asw.comprobante' _inherit = 'asw.comprobante'
...@@ -102,4 +104,18 @@ class asw_comprobante(models.Model): ...@@ -102,4 +104,18 @@ class asw_comprobante(models.Model):
def recalcularTotal(self): def recalcularTotal(self):
self._onchange_comp_linea_facturas() self._onchange_comp_linea_facturas()
def impresion_directa(self):
result = self.imprimir()
report_action = self.env[result['type']]._get_report_from_name(result['report_name'])
pdf = report_action.render_aeroo([self.id], {'context': self.env.context})
try:
#pdf = self.env.ref('hgt_produccion.remito_qweb').render_qweb_pdf(self.ids)
val = {}
val["tipo"] = 'impresora'
val["bs64"] = base64.encodestring(pdf[0])
self.env["hw.puesto_trabajo"].UsarDispositivo(val)
#print(base64.encodestring(pdf[0]))
except:
raise Warning("No tiene instalado este modulo en su sistema contactese con HGT")
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<xpath expr="//button[@name='validar']" position="after"> <xpath expr="//button[@name='validar']" position="after">
<button name="abrir_wizard_ppf" class='btn btn-success' string="+ Producto por precio final" type="object" attrs="{'invisible':[('comp_estado','!=','b')]}"/> <button name="abrir_wizard_ppf" class='btn btn-success' string="+ Producto por precio final" type="object" attrs="{'invisible':[('comp_estado','!=','b')]}"/>
<button name="recalcularTotal" class='btn btn-warning' string="Recalcular Monto" type="object" attrs="{'invisible':[('comp_estado','!=','b')]}"/> <button name="recalcularTotal" class='btn btn-warning' string="Recalcular Monto" type="object" attrs="{'invisible':[('comp_estado','!=','b')]}"/>
<button name="impresion_directa" class='btn btn-info' string="Impresion directa" type="object" attrs="{'invisible':[('comp_estado','=','b')]}"/>
</xpath> </xpath>
</data> </data>
</field> </field>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!