forked from elmau/empresa-libre
Cambio de editor en descripción
This commit is contained in:
commit
564d784a63
|
@ -198,8 +198,17 @@ class CFDI(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
def _conceptos(self, datos):
|
def _conceptos(self, datos):
|
||||||
|
from xml.sax.saxutils import escape, unescape
|
||||||
|
|
||||||
conceptos = ET.SubElement(self._cfdi, '{}:Conceptos'.format(self._pre))
|
conceptos = ET.SubElement(self._cfdi, '{}:Conceptos'.format(self._pre))
|
||||||
for row in datos:
|
for row in datos:
|
||||||
|
|
||||||
|
# ~ print (row['Descripcion'])
|
||||||
|
# ~ xml = escape(xml.encode('ascii', 'xmlcharrefreplace').decode('utf-8'), False)
|
||||||
|
# ~ row['Descripcion'] = escape(row['Descripcion'].replace('\n', ' '), False)
|
||||||
|
# ~ row['Descripcion'] = row['Descripcion'].replace('\n', '
')
|
||||||
|
# ~ print (row['Descripcion'])
|
||||||
|
|
||||||
complemento = {}
|
complemento = {}
|
||||||
if 'complemento' in row:
|
if 'complemento' in row:
|
||||||
complemento = row.pop('complemento')
|
complemento = row.pop('complemento')
|
||||||
|
@ -228,13 +237,6 @@ class CFDI(object):
|
||||||
ET.SubElement(
|
ET.SubElement(
|
||||||
retenciones, '{}:Retencion'.format(self._pre), retencion)
|
retenciones, '{}:Retencion'.format(self._pre), retencion)
|
||||||
|
|
||||||
# ~ if 'InformacionAduanera' in row:
|
|
||||||
# ~ for field in fields:
|
|
||||||
# ~ if field in row['InformacionAduanera']:
|
|
||||||
# ~ attributes[field] = row['InformacionAduanera'][field]
|
|
||||||
# ~ if attributes:
|
|
||||||
# ~ node_name = '{}:InformacionAduanera'.format(self._pre)
|
|
||||||
# ~ ET.SubElement(concepto, node_name, attributes)
|
|
||||||
if pedimento:
|
if pedimento:
|
||||||
attributes = {'NumeroPedimento': pedimento}
|
attributes = {'NumeroPedimento': pedimento}
|
||||||
node_name = '{}:InformacionAduanera'.format(self._pre)
|
node_name = '{}:InformacionAduanera'.format(self._pre)
|
||||||
|
|
|
@ -335,7 +335,7 @@ def parse_con(values):
|
||||||
|
|
||||||
|
|
||||||
def spaces(value):
|
def spaces(value):
|
||||||
return ' '.join(value.split())
|
return '\n'.join([' '.join(l.split()) for l in value.split('\n')])
|
||||||
|
|
||||||
|
|
||||||
def to_slug(string):
|
def to_slug(string):
|
||||||
|
|
|
@ -2223,6 +2223,7 @@ class Productos(BaseModel):
|
||||||
rows = (Productos
|
rows = (Productos
|
||||||
.select(
|
.select(
|
||||||
Productos.id,
|
Productos.id,
|
||||||
|
Productos.clave_sat,
|
||||||
Productos.clave,
|
Productos.clave,
|
||||||
Productos.descripcion,
|
Productos.descripcion,
|
||||||
SATUnidades.name.alias('unidad'),
|
SATUnidades.name.alias('unidad'),
|
||||||
|
@ -2234,11 +2235,12 @@ class Productos(BaseModel):
|
||||||
|
|
||||||
def _clean(self, values):
|
def _clean(self, values):
|
||||||
taxes = util.loads(values.pop('taxes'))
|
taxes = util.loads(values.pop('taxes'))
|
||||||
|
descripcion = util.spaces(values.pop('descripcion'))
|
||||||
fields = util.clean(values)
|
fields = util.clean(values)
|
||||||
|
|
||||||
fields.pop('precio_con_impuestos', '')
|
fields.pop('precio_con_impuestos', '')
|
||||||
fields['es_activo'] = fields.pop('es_activo_producto')
|
fields['es_activo'] = fields.pop('es_activo_producto')
|
||||||
fields['descripcion'] = util.spaces(fields['descripcion'])
|
fields['descripcion'] = descripcion
|
||||||
fields['unidad'] = int(fields['unidad'])
|
fields['unidad'] = int(fields['unidad'])
|
||||||
fields['valor_unitario'] = fields['valor_unitario'].replace(
|
fields['valor_unitario'] = fields['valor_unitario'].replace(
|
||||||
'$', '').replace(',', '')
|
'$', '').replace(',', '')
|
||||||
|
@ -2866,7 +2868,7 @@ class Facturas(BaseModel):
|
||||||
locales_retenciones = 0
|
locales_retenciones = 0
|
||||||
|
|
||||||
for product in products:
|
for product in products:
|
||||||
# ~ print (product)
|
# ~ print ('\n', product['descripcion'])
|
||||||
id_product = product.pop('id')
|
id_product = product.pop('id')
|
||||||
p = Productos.get(Productos.id==id_product)
|
p = Productos.get(Productos.id==id_product)
|
||||||
|
|
||||||
|
|
|
@ -373,3 +373,12 @@ function validate_pedimento(value){
|
||||||
var pattern = '[0-9]{2} [0-9]{2} [0-9]{4} [0-9]{7}'
|
var pattern = '[0-9]{2} [0-9]{2} [0-9]{4} [0-9]{7}'
|
||||||
return validate_regexp(value, pattern)
|
return validate_regexp(value, pattern)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//config may as well include only text, color and date hash
|
||||||
|
webix.editors.$popup = {
|
||||||
|
text:{
|
||||||
|
view: 'popup', width:500, height:200,
|
||||||
|
body: {view: 'textarea'}
|
||||||
|
},
|
||||||
|
};
|
|
@ -276,7 +276,7 @@ var grid_details_cols = [
|
||||||
{id: "clave", header:{text: 'Clave', css: 'center'}, width: 100},
|
{id: "clave", header:{text: 'Clave', css: 'center'}, width: 100},
|
||||||
{id: "clave_sat", hidden: true},
|
{id: "clave_sat", hidden: true},
|
||||||
{id: "descripcion", header:{text: 'Descripción', css: 'center'},
|
{id: "descripcion", header:{text: 'Descripción', css: 'center'},
|
||||||
fillspace: true, editor: 'text'},
|
fillspace: true, editor: 'popup'},
|
||||||
{id: "pedimento", header: 'Pedimento', editor: 'text', hidden: true},
|
{id: "pedimento", header: 'Pedimento', editor: 'text', hidden: true},
|
||||||
{id: "unidad", header:{text: 'Unidad', css: 'center'}, width: 100},
|
{id: "unidad", header:{text: 'Unidad', css: 'center'}, width: 100},
|
||||||
{id: 'cantidad', header: {text: 'Cantidad', css: 'center'}, width: 100,
|
{id: 'cantidad', header: {text: 'Cantidad', css: 'center'}, width: 100,
|
||||||
|
@ -301,6 +301,7 @@ var grid_details = {
|
||||||
editable: true,
|
editable: true,
|
||||||
columns: grid_details_cols,
|
columns: grid_details_cols,
|
||||||
data: [],
|
data: [],
|
||||||
|
fixedRowHeight: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -531,12 +532,13 @@ var grid_preinvoices_cols = [
|
||||||
{id: "id", header:"ID", hidden:true},
|
{id: "id", header:"ID", hidden:true},
|
||||||
{id: "folio", header: ["Folio", {content: "numberFilter"}], adjust: "data",
|
{id: "folio", header: ["Folio", {content: "numberFilter"}], adjust: "data",
|
||||||
sort:"int", css: "cell_right"},
|
sort:"int", css: "cell_right"},
|
||||||
{id: "fecha", header: ["Fecha y Hora"],
|
{id: "fecha", header: ["Fecha y Hora"], adjust: "data", sort: "string",
|
||||||
adjust: "data", sort: "date"},
|
footer: 'Total'},
|
||||||
{id: "tipo_comprobante", header: ["Tipo", {content: "selectFilter"}],
|
{id: "tipo_comprobante", header: ["Tipo", {content: "selectFilter"}],
|
||||||
adjust: 'header', sort: 'string'},
|
adjust: 'header', sort: 'string'},
|
||||||
{id: 'total_mn', header: ['Total M.N.'], width: 150,
|
{id: 'total_mn', header: ['Total M.N.'], width: 150, sort: 'int',
|
||||||
sort: 'int', format: webix.i18n.priceFormat, css: 'right'},
|
format: webix.i18n.priceFormat, css: 'right',
|
||||||
|
footer: {content: 'summColumn', css: 'right'}},
|
||||||
{id: "cliente", header: ["Razón Social", {content: "selectFilter"}],
|
{id: "cliente", header: ["Razón Social", {content: "selectFilter"}],
|
||||||
fillspace:true, sort:"string"},
|
fillspace:true, sort:"string"},
|
||||||
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
|
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
|
||||||
|
|
|
@ -12,6 +12,7 @@ var toolbar_products = [
|
||||||
|
|
||||||
var grid_products_cols = [
|
var grid_products_cols = [
|
||||||
{ id: "id", header: "ID", width: 75, hidden: true},
|
{ id: "id", header: "ID", width: 75, hidden: true},
|
||||||
|
{ id: "clave_sat", header: ["Clave SAT"], width: 100,},
|
||||||
{ id: "clave", header: ["Clave", {content: "textFilter"}], width: 100,
|
{ id: "clave", header: ["Clave", {content: "textFilter"}], width: 100,
|
||||||
sort: 'string', footer: {content: 'countRows', css: 'right'}},
|
sort: 'string', footer: {content: 'countRows', css: 'right'}},
|
||||||
{ id: "descripcion", header: ["Descripción", {content: "textFilter"}],
|
{ id: "descripcion", header: ["Descripción", {content: "textFilter"}],
|
||||||
|
|
Loading…
Reference in New Issue