Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- from openerp import api, fields, models, _
- import logging
- from BeautifulSoup import BeautifulSoup
- import subprocess
- import urllib, urllib2
- from urllib import urlencode
- import openerp.addons.decimal_precision as dp
- import re
- from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
- from httplib2 import Http
- import logging
- import sys
- #Generacion del QR
- import qrcode
- import tempfile
- import base64
- #Convertir numeros en texto
- import rm_amount_to_text_es
- import time
- from time import mktime
- from datetime import date
- from datetime import datetime, timedelta
- from openerp import SUPERUSER_ID
- from openerp.exceptions import UserError
- _logger = logging.getLogger(__name__)
- class account_invoice(models.Model):
- _inherit = 'account.invoice'
- # Al momento de Validar la factura, se realiza la generacion del Numero de Factura y el codigo de control.
- @api.multi
- def invoice_validate(self):
- if self.type == "out_invoice": # solo calcular codigo de control cuando sean facturas de cliente
- for invoice in self:
- #refuse to validate a vendor bill/refund if there already exists one with the same reference for the same partner,
- #because it's probably a double encoding of the same bill/refund
- if invoice.type in ('in_invoice', 'in_refund') and invoice.reference:
- if self.search([('type', '=', invoice.type), ('reference', '=', invoice.reference), ('company_id', '=', invoice.company_id.id), ('commercial_partner_id', '=', invoice.commercial_partner_id.id), ('id', '!=', invoice.id)]):
- raise UserError(_("Duplicated vendor reference detected. You probably encoded twice the same vendor bill/refund."))
- tax_flag = 0
- for invoice in self:
- import time
- from datetime import datetime, timedelta,date
- from time import mktime
- # fecha limite de emision
- qr = self.env['pos.order'].search([('invoice_id', '=', invoice.id)])
- if not qr.session_id.config_id.qr_code_id:
- raise UserError(_('Asigne una dosificacion al punto de venta' + qr.session_id.config_id.name))
- pos_config = qr.session_id.config_id
- qr = qr.session_id.config_id.qr_code_id
- if not qr.activo:
- raise UserError(_('Active una dosificacion para habilitar facturacion'))
- if (qr.fecha_limite_emision):
- fecha_actual = datetime.strptime((datetime.now() - timedelta(hours = 4)).strftime('%d%m%Y'), "%d%m%Y").date()
- fecha_actual2 = datetime.strptime(qr.fecha_limite_emision, '%Y-%m-%d').strftime('%d%m%Y')
- fecha_actual2 = datetime.strptime(fecha_actual2, "%d%m%Y").date()
- if fecha_actual > fecha_actual2:
- raise UserError(_('La fecha limite de EMISION a caducado, notifique a su contador'))
- # Obtener la dosificacion asignada para el POS y grabarla en la factura
- if invoice.origin:
- pos_order = self.env['pos.order'].search([('invoice_id','=',invoice.id)], limit=1)
- numero_comanda = ((pos_order.pos_reference).replace('-', ' ')).split()
- numero_comanda = int(numero_comanda[len(numero_comanda)-1])
- if numero_comanda:
- self.env.cr.execute("UPDATE account_invoice SET numero_autorizacion="+str(qr.numero_autorizacion)+", qr_code_id=" + str(qr.id) + ", razon_social='"+ str((invoice.partner_id.razon_social or 'SN').encode("utf-8") or 'S/N')+ "', nit='"+str(invoice.partner_id.nit or '0') + "', numero_comanda='"+str(numero_comanda)+"' WHERE id="+str(invoice.id))
- # Valida si la factura no es rectificada, tiene impuestos, si ha sido pagada o Validada.
- for inv_line in invoice.invoice_line_ids:
- if inv_line.invoice_line_tax_ids:
- tax_flag = 1
- else:
- tax_flag = 0
- # raise UserError(_('Error.\n Registre impuestos al producto '+str(inv_line.product_id.name)))
- invoice.write({'order_status': 'no_utilizada'})
- # raise osv.except_osv(_('Warning'),_('Entered Quantity is greater than quantity on source.'))
- # sys.exit("Configure los impuestos por defecto, en categorias o directamente en los productos.")
- if (tax_flag == 1) & (invoice.type != 'out_refund'):
- invoice_search = self.env['account.invoice'].search(
- [('qr_code_id.numero_autorizacion','=',qr.numero_autorizacion),
- ('qr_code_id','=',qr.id),
- ('id','!=',invoice.id),
- ('invoice_number','!=','')
- ])
- # Genera un nuevo numero de factura
- numero_duplicado = self.env['account.invoice'].search([('qr_code_id','=',qr.id),('invoice_number','=',invoice.invoice_number or -1)])
- if not numero_duplicado:
- invoice.write({'invoice_number': len(invoice_search) + 1})
- else:
- raise UserError(_("El numero de factura intenta duplicarse, por favor comuniquece con su Administrador de Sistemas"))
- # Generando Codigo de Control
- fecha_actual = invoice.create_date
- struct_time_convert = time.strptime(fecha_actual, '%Y-%m-%d %H:%M:%S')
- date_time_convert = datetime.fromtimestamp(mktime(struct_time_convert))
- date_time_convert = date_time_convert - timedelta(hours = 4)
- fecha = date_time_convert.strftime('%Y%m%d')
- # date = datetime.datetime.strptime(invoice.date_invoice, DEFAULT_SERVER_DATE_FORMAT).strftime('%Y%m%d')
- h = Http()
- # Verificar si el NIT es texto o invalido y asignar 0
- # if (isinstance(invoice.nit, basestring)):
- if (invoice.nit == ''):
- invoice.write({'nit': '0'})
- url_data = dict(AUTH_NUMBER=int(qr.numero_autorizacion),INVOICE_NUMBER=int(invoice.invoice_number),NIT_CODE_CUSTOMER=str(invoice.nit),DATE=int(fecha),AMOUNT=invoice.amount_total,KEYGEN=str(qr.llave_dosificacion))
- url= urlencode(url_data)
- # resp = urllib2.urlopen('http://odoo.romilax.com/cc/codigo_control.php?'+url)
- resp = urllib2.urlopen('http://'+pos_config.rm_url_bd+'/cc/codigo_control.php?'+url)
- soup = BeautifulSoup(resp)
- if len(str(soup)) <= 20:
- invoice.write({'control_code': str(soup) or '', 'state': 'open'})
- else:
- raise UserError(_('El codigo de control no fue generado correctamente, Contacte con su Administrador de Sistemas'))
- else:
- # raise UserError(_('Error.\nPor favor registre impuestos a los productos'))
- invoice.write({'invoice_number': 0})
- @api.multi
- def action_move_create(self):
- """ Creates invoice related analytics and financial move lines """
- # account_move = self.env['account.move']
- for inv in self:
- # if not inv.journal_id.sequence_id:
- # raise UserError(_('Please define sequence on the journal related to this invoice.'))
- if not inv.invoice_line_ids:
- raise UserError(_('Please create some invoice lines.'))
- if inv.move_id:
- continue
- ctx = dict(self._context, lang=inv.partner_id.lang)
- if not inv.date_invoice:
- inv.with_context(ctx).write({'date_invoice': fields.Date.context_today(self)})
- date_invoice = inv.date_invoice
- company_currency = inv.company_id.currency_id
- # create move lines (one per invoice line + eventual taxes and analytic lines)
- iml = inv.invoice_line_move_line_get()
- iml += inv.tax_line_move_line_get()
- # diff_currency = inv.currency_id != company_currency
- # create one move line for the total and possibly adjust the other lines amount
- total, total_currency, iml = inv.with_context(ctx).compute_invoice_totals(company_currency, iml)
- # name = inv.name or '/'
- # if inv.payment_term_id:
- # totlines = inv.with_context(ctx).payment_term_id.with_context(currency_id=company_currency.id).compute(total, date_invoice)[0]
- # res_amount_currency = total_currency
- # ctx['date'] = date_invoice
- # for i, t in enumerate(totlines):
- # if inv.currency_id != company_currency:
- # amount_currency = company_currency.with_context(ctx).compute(t[1], inv.currency_id)
- # else:
- # amount_currency = False
- # # last line: add the diff
- # res_amount_currency -= amount_currency or 0
- # if i + 1 == len(totlines):
- # amount_currency += res_amount_currency
- # iml.append({
- # 'type': 'dest',
- # 'name': name,
- # 'price': t[1],
- # 'account_id': inv.account_id.id,
- # 'date_maturity': t[0],
- # 'amount_currency': diff_currency and amount_currency,
- # 'currency_id': diff_currency and inv.currency_id.id,
- # 'invoice_id': inv.id
- # })
- # else:
- # iml.append({
- # 'type': 'dest',
- # 'name': name,
- # 'price': total,
- # 'account_id': inv.account_id.id,
- # 'date_maturity': inv.date_due,
- # 'amount_currency': diff_currency and total_currency,
- # 'currency_id': diff_currency and inv.currency_id.id,
- # 'invoice_id': inv.id
- # })
- # part = self.env['res.partner']._find_accounting_partner(inv.partner_id)
- # line = [(0, 0, self.line_get_convert(l, part.id)) for l in iml]
- # line = inv.group_lines(iml, line)
- # journal = inv.journal_id.with_context(ctx)
- # line = inv.finalize_invoice_move_lines(line)
- date = inv.date or date_invoice
- # move_vals = {
- # 'ref': inv.reference,
- # 'line_ids': line,
- # 'journal_id': journal.id,
- # 'date': date,
- # 'narration': inv.comment,
- # }
- # ctx['company_id'] = inv.company_id.id
- # ctx['dont_create_taxes'] = True
- # ctx['invoice'] = inv
- # ctx_nolang = ctx.copy()
- # ctx_nolang.pop('lang', None)
- # move = account_move.with_context(ctx_nolang).create(move_vals)
- # Pass invoice in context in method post: used if you want to get the same
- # account move reference when creating the same invoice after a cancelled one:
- # move.post()
- # make the invoice point to that move
- vals = {
- # 'move_id': move.id,
- 'date': date,
- # 'move_name': move.name,
- }
- inv.with_context(ctx).write(vals)
- return True
- # Generar el QR
- def _cambiar_mes(self,mes):
- mes_traducido = ''
- if mes == '01': mes_traducido = 'Enero'
- if mes == '02': mes_traducido = 'Febrero'
- if mes == '03': mes_traducido = 'Marzo'
- if mes == '04': mes_traducido = 'Abril'
- if mes == '05': mes_traducido = 'Mayo'
- if mes == '06': mes_traducido = 'Junio'
- if mes == '07': mes_traducido = 'Julio'
- if mes == '08': mes_traducido = 'Agosto'
- if mes == '09': mes_traducido = 'Septiembre'
- if mes == '10': mes_traducido = 'Octubre'
- if mes == '11': mes_traducido = 'Noviembre'
- if mes == '12': mes_traducido = 'Diciembre'
- return mes_traducido
- # Funcion para Obtener la fecha con mes textual
- def convertir_mes_fecha(self, fecha):
- fecha_actual = fecha
- struct_time_convert = time.strptime(fecha_actual, '%Y-%m-%d')
- date_time_convert = datetime.fromtimestamp(mktime(struct_time_convert))
- fecha_actual = date_time_convert.strftime('%d') + " de " + self._cambiar_mes(date_time_convert.strftime('%m')) + " del " + date_time_convert.strftime('%Y')
- return fecha_actual
- @api.multi
- def _get_qr_code(self):
- if self:
- qr_code_ids = self.env['account.invoice'].search([('qr_code_id', 'in', self.ids)])
- return qr_code_ids.ids
- # Obtener las lineas de la factura
- def _get_invoice_line(self, cr, uid, ids, context=None):
- result = {}
- for line in self.pool.get('account.invoice.line').browse(cr, uid, ids, context=context):
- result[line.invoice_id.id] = True
- return result.keys()
- # Funcion para Factura QR
- def convertir_numero_a_literal(self, amount):
- amt_en = rm_amount_to_text_es.amount_to_text(amount, 'BOB')
- return amt_en
- # Detalle de productos con Tipo de Venta y comentario desde pos.order
- # obtener detalle pedido
- def get_habilidar_numero_pedido(self):
- pos_config = self.pool.get('pos.config')
- pos_config_search = pos_config.search(self.env.cr, self.env.uid, [('create_uid','=',SUPERUSER_ID)])
- pos_config_browse = pos_config.browse(self.env.cr, self.env.uid, pos_config_search)[0]
- return pos_config_browse.habilitar_numero_pedido
- def get_detalle_pedido(self,cr, order_id):
- variable = int(order_id.id)
- detalle_pedido=[]
- sql = """ SELECT
- pos_order_line.qty,
- product_product.name_template,
- pos_order_line.tipo_venta,
- pos_order_line.note,
- pos_order.invoice_id
- FROM
- pos_order
- INNER JOIN pos_order_line ON pos_order_line.order_id = pos_order.id
- INNER JOIN product_product ON pos_order_line.product_id = product_product.id
- WHERE pos_order_line.qty > 0
- AND pos_order.invoice_id ='%s' ORDER by pos_order_line.id """%(variable)
- cr.execute(sql)
- res = cr.dictfetchall()
- for r in res:
- detalle_pedido.append(r)
- return detalle_pedido
- # Tipo de comanda
- def get_tipo_comanda(self,cr, order_id):
- variable = int(order_id.id)
- tipo_comanda=[]
- sql = """ SELECT
- pos_config.tipo_comanda
- FROM
- pos_order
- INNER JOIN pos_session ON pos_order.session_id = pos_session.id
- INNER JOIN pos_config ON pos_session.config_id = pos_config.id
- WHERE
- pos_order.invoice_id ='%s' """%(variable)
- cr.execute(sql)
- res = cr.dictfetchall()
- for r in res:
- tipo_comanda.append(r)
- if tipo_comanda:
- return tipo_comanda[0]['tipo_comanda']
- else:
- return 'sin_comanda'
- # Solo comanda en recibo
- def get_solo_comanda_en_recibo(self,cr, order_id):
- variable = int(order_id.id)
- solo_comanda_en_recibo=[]
- sql = """ SELECT
- pos_config.solo_comanda_en_recibo
- FROM
- pos_order
- INNER JOIN pos_session ON pos_order.session_id = pos_session.id
- INNER JOIN pos_config ON pos_session.config_id = pos_config.id
- WHERE
- pos_order.invoice_id ='%s' """%(variable)
- cr.execute(sql)
- res = cr.dictfetchall()
- for r in res:
- solo_comanda_en_recibo.append(r)
- if solo_comanda_en_recibo:
- return solo_comanda_en_recibo[0]['solo_comanda_en_recibo']
- else:
- return False
- # Factura con pedido
- def get_factura_con_pedido(self,cr, order_id):
- variable = int(order_id.id)
- factura_con_pedido=[]
- sql = """ SELECT
- pos_config.factura_con_pedido
- FROM
- pos_order
- INNER JOIN pos_session ON pos_order.session_id = pos_session.id
- INNER JOIN pos_config ON pos_session.config_id = pos_config.id
- WHERE
- pos_order.invoice_id ='%s' """%(variable)
- cr.execute(sql)
- res = cr.dictfetchall()
- for r in res:
- factura_con_pedido.append(r)
- if factura_con_pedido:
- return factura_con_pedido[0]['factura_con_pedido']
- else:
- return False
- # Numero de pedido o factura impreso en la comanda de factura
- def get_numero_comanda(self,cr, order_id):
- variable = int(order_id.id)
- tipo_comanda=[]
- sql = """ SELECT
- pos_config.numero_comanda_factura
- FROM
- pos_order
- INNER JOIN pos_session ON pos_order.session_id = pos_session.id
- INNER JOIN pos_config ON pos_session.config_id = pos_config.id
- WHERE
- pos_order.invoice_id ='%s' """%(variable)
- cr.execute(sql)
- res = cr.dictfetchall()
- for r in res:
- tipo_comanda.append(r)
- if tipo_comanda:
- return tipo_comanda[0]['numero_comanda_factura']
- else:
- return 'sin_comanda'
- def get_omitir_categoria_producto(self,cr,order_id):
- variable = int(order_id.id)
- tipo_comanda=[]
- sql = """ SELECT
- pos_config.omitir_categoria_factura
- FROM
- pos_order
- INNER JOIN pos_session ON pos_order.session_id = pos_session.id
- INNER JOIN pos_config ON pos_session.config_id = pos_config.id
- WHERE
- pos_order.invoice_id ='%s' """%(variable)
- cr.execute(sql)
- res = [x[0] for x in cr.fetchall()]
- if res: return False
- else: return True
- # Categorias de la Factura
- def get_categorias(self, order_id):
- variable = int(order_id.id)
- categorias=[]
- sql = """ SELECT
- pos_category.id
- ,pos_category.name
- ,SUM(pos_order_line.qty) as qty
- ,product_product.name_template
- ,pos_order_line.tipo_venta
- ,pos_order_line.note
- FROM
- pos_order
- INNER JOIN pos_order_line ON pos_order_line.order_id = pos_order.id
- INNER JOIN product_product ON pos_order_line.product_id = product_product.id
- INNER JOIN product_template ON product_product.product_tmpl_id = product_template.id
- INNER JOIN pos_category ON product_template.pos_categ_id = pos_category.id
- WHERE
- pos_order.invoice_id = %s
- GROUP BY 1,2,4,5,6
- ORDER BY 1;"""%(variable)
- self.env.cr.execute(sql)
- res = self.env.cr.dictfetchall()
- codigo = 0
- cont = x = 0
- nomrbe = ''
- datos = []
- for r in res:
- if int(r['qty']) > 0:
- if r['id'] == codigo:
- vals = {
- 'qty' : r['qty'],
- 'name_template' : r['name_template'],
- 'tipo_venta' : r['tipo_venta'],
- 'note' : r['note']
- }
- datos.append(vals)
- else:
- if x != 0:
- categorias.append((codigo,nombre,datos))
- x = 1
- datos = []
- vals = {
- 'qty' : r['qty'],
- 'name_template' : r['name_template'],
- 'tipo_venta' : r['tipo_venta'],
- 'note' : r['note']
- }
- datos.append(vals)
- codigo = r['id']
- nombre = r['name']
- cont += 1
- if len(res) == cont:
- categorias.append((r['id'],r['name'],datos))
- return categorias
- # Funcion para Factura QR, cambio del efectivo
- def obtener_pago_pos(self, cr, order_id):
- data={}
- sql = """ select aj.name,absl.amount as amt from account_bank_statement as abs
- LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
- LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
- WHERE absl.pos_statement_id =%d ORDER by absl.amount DESC"""%(order_id)
- cr.execute(sql)
- data = cr.dictfetchall()
- return data
- def numero_impresion(self,cr,invoice):
- cr.execute("SELECT rm_numero_impresion FROM account_invoice WHERE id = "+str(invoice.id))
- numero = cr.fetchone()[0]
- cr.execute("UPDATE account_invoice SET rm_numero_impresion=%s WHERE id=%s",([numero+1,invoice.id]))
- cr.execute("SELECT rm_numero_impresion FROM account_invoice WHERE id = "+str(invoice.id))
- numero = cr.fetchone()[0]
- return numero
- @api.multi
- def invoice_print(self):
- """ Print the invoice and mark it as sent, so that we can see more
- easily the next step of the workflow
- """
- self.ensure_one()
- self.sent = True
- invoice = self.env['account.invoice'].browse(0)
- invoice += self
- config = self.env['pos.config'].search([('iface_invoicing','=',True),('state','=','active')],limit=1)
- if config.factura_con_copia:
- invoice += self
- return self.env['report'].get_action(invoice, 'account.report_invoice')
- # Obtener el pedido de venta
- def obtener_pedido_id(self, cr, origen):
- pedido=[]
- sql = """ SELECT
- pos_order.id
- FROM
- pos_order
- WHERE
- pos_order.name ='%s' """%(origen)
- cr.execute(sql)
- res = cr.dictfetchall()
- for r in res:
- pedido.append(r)
- if pedido:
- return pedido[0]['id']
- else:
- return 0
- def get_mesero(self,cr, order_id):
- detalle_pedido=[]
- sql = """ SELECT
- rp1.name
- FROM
- pos_order
- LEFT JOIN res_users ru1 ON ru1.id=pos_order.mesero
- LEFT JOIN res_partner rp1 ON rp1.id=ru1.partner_id
- WHERE pos_order.invoice_id = """ + str(order_id.id)
- cr.execute(sql)
- res = [i for i in cr.fetchall()]
- if res[0] in ['None',None,False,'']:
- return False
- return res[0][0]
- # Obtener Imagen QR para la Factura
- def get_qrcode(self, nit_empresa, invoice_number, numero_autorizacion, fecha_factura, amount_total, impuestos, control_code, nit_cliente):
- fecha_actual = fecha_factura
- struct_time_convert = time.strptime(fecha_actual, '%Y-%m-%d %H:%M:%S')
- date_time_convert = datetime.fromtimestamp(mktime(struct_time_convert))
- date_time_convert = date_time_convert - timedelta(hours = 4)
- fecha_convertida = date_time_convert.strftime('%d/%m/%Y')
- # cadena_qr = str(nit_empresa or '') + '|' + str(invoice_number or '') + '|' + str(numero_autorizacion or '') + '|' + str(fecha_convertida or '') + '|' + str(format(amount_total, '.2f') or '') + '|' + str(format(amount_total*.13, '.2f') or '') + '|' + str(control_code or '') + '|' + str(nit_cliente or '') + '|0|0|0|0'
- monto_factura = amount_total
- fecha_convertida = ((datetime.strptime(fecha_factura, '%Y-%m-%d %H:%M:%S')) - timedelta(hours = 4)).strftime('%d/%m/%Y')
- cadena_qr = ""
- cadena_qr = cadena_qr +str(nit_empresa or '0') + '|' # NIT emisor
- cadena_qr = cadena_qr + str(invoice_number or '0') + '|' # Numero factura
- cadena_qr = cadena_qr + str(numero_autorizacion or '0') + '|' # Numero autorizacion
- cadena_qr = cadena_qr + str(fecha_convertida or '0') + '|' # fecha de emision (DD/MM/AAAA)
- cadena_qr = cadena_qr + str(format(monto_factura, '.2f') or '0') + '|' # Total
- cadena_qr = cadena_qr + str(format(monto_factura, '.2f') or '0') + '|' # Importe credito fiscal
- cadena_qr = cadena_qr + str(control_code or '0') + '|' # Codigo de control
- cadena_qr = cadena_qr + str(nit_cliente or '0') + '|' # NIT/CI/CEX comprador
- cadena_qr = cadena_qr + str(0) + '|' # Importe ICE /IEHD /TASAS
- cadena_qr = cadena_qr + str(0) + '|' # Importe por ventas gravadas o Gravadas a tasa cero
- cadena_qr = cadena_qr + str(0) + '|' # Importe no sujeto a credito fiscal
- cadena_qr = cadena_qr + str(0) # Descuentos, bonificaciones y rebajas obtenidas
- qr_img = qrcode.make(cadena_qr)
- filename = str(tempfile.gettempdir()) + '/qrtest.png'
- # filename2 = '/static/src/img/qrtemp.png'
- qr_img.save(filename)
- # qr_img.save(filename2)
- return base64.encodestring(file(filename, 'rb').read())
- # return (file(filename, 'rb').read())
- # Computar Fecha Boliviana -4GM
- @api.depends('create_date')
- def _fecha_boliviana(self):
- for record in self:
- fecha_actual = record.create_date
- struct_time_convert = time.strptime(fecha_actual, '%Y-%m-%d %H:%M:%S')
- date_time_convert = datetime.fromtimestamp(mktime(struct_time_convert))
- date_time_convert = date_time_convert - timedelta(hours = 4)
- # fecha_actual = date_time_convert.strftime('%d/%m/%Y')
- fecha_actual = date_time_convert.strftime('%Y-%m-%d')
- record.fecha_boliviana = fecha_actual
- #se ha modificado esta función (ronald terceros)
- @api.depends('create_date')
- def _hora_boliviana(self):
- for record in self:
- hora_actual = (datetime.strptime(record.create_date,'%Y-%m-%d %H:%M:%S') - timedelta(hours = 4)).time().strftime('%H:%M:%S')
- record.hora_boliviana = hora_actual
- # Campos adicionales para la Factura
- qr_code_id = fields.Many2one('qr.code', 'Dosificacion', domain="[('activo', '=', True)]")
- nit = fields.Char('NIT', required=True, default='0')
- razon_social = fields.Char('Razon Social', required=True, help="Nombre o Razón Social para la Factura.", default='SN')
- invoice_number = fields.Integer('Numero Factura', required=True, readonly=True, default=0)
- control_code = fields.Char('Codigo Control', size=50, readonly=True)
- order_status = fields.Selection([('anulada', 'ANULADA'), ('extraviada', 'EXTRAVIADA'), ('valida','VALIDA'),('no_utilizada','NO UTILIZADA'),('emitida_por_contingencia','EMITIDA POR CONTINGENCIA')], 'Estado de Factura', default='valida')
- # numero_autorizacion = fields.Char(string='Numero Autorizacion', related="qr_code_id.numero_autorizacion", store=True, readonly=True)
- numero_autorizacion = fields.Char(string='Numero Autorizacion', store=True)
- motivo_anulacion = fields.Text('Motivo de Anulacion')
- fecha_boliviana = fields.Date(compute='_fecha_boliviana', store=True)
- hora_boliviana = fields.Text(compute='_hora_boliviana', store=True) #se ha modificado este campo(ronald terceros)
- numero_comanda = fields.Char('Comanda', size=20, readonly=True, help=u"Numeracion de Comanda.")
- rm_numero_impresion = fields.Integer(string='Numero de impresion', default=0)
- _defaults = {
- 'date_invoice': (datetime.now() - timedelta(hours = 4)).strftime('%Y-%m-%d'),
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement