Cambio de editor en descripción

This commit is contained in:
Mauricio Baeza 2018-01-13 18:39:22 -06:00
parent 02d59dfc6d
commit fe37e92766
6 changed files with 26 additions and 11 deletions

View File

@ -198,8 +198,17 @@ class CFDI(object):
return
def _conceptos(self, datos):
from xml.sax.saxutils import escape, unescape
conceptos = ET.SubElement(self._cfdi, '{}:Conceptos'.format(self._pre))
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 = {}
if 'complemento' in row:
complemento = row.pop('complemento')
@ -228,13 +237,6 @@ class CFDI(object):
ET.SubElement(
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:
attributes = {'NumeroPedimento': pedimento}
node_name = '{}:InformacionAduanera'.format(self._pre)

View File

@ -335,7 +335,7 @@ def parse_con(values):
def spaces(value):
return ' '.join(value.split())
return '\n'.join([' '.join(l.split()) for l in value.split('\n')])
def to_slug(string):

View File

@ -2223,6 +2223,7 @@ class Productos(BaseModel):
rows = (Productos
.select(
Productos.id,
Productos.clave_sat,
Productos.clave,
Productos.descripcion,
SATUnidades.name.alias('unidad'),
@ -2234,11 +2235,12 @@ class Productos(BaseModel):
def _clean(self, values):
taxes = util.loads(values.pop('taxes'))
descripcion = util.spaces(values.pop('descripcion'))
fields = util.clean(values)
fields.pop('precio_con_impuestos', '')
fields['es_activo'] = fields.pop('es_activo_producto')
fields['descripcion'] = util.spaces(fields['descripcion'])
fields['descripcion'] = descripcion
fields['unidad'] = int(fields['unidad'])
fields['valor_unitario'] = fields['valor_unitario'].replace(
'$', '').replace(',', '')
@ -2866,7 +2868,7 @@ class Facturas(BaseModel):
locales_retenciones = 0
for product in products:
# ~ print (product)
# ~ print ('\n', product['descripcion'])
id_product = product.pop('id')
p = Productos.get(Productos.id==id_product)

View File

@ -373,3 +373,12 @@ function validate_pedimento(value){
var pattern = '[0-9]{2} [0-9]{2} [0-9]{4} [0-9]{7}'
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'}
},
};

View File

@ -276,7 +276,7 @@ var grid_details_cols = [
{id: "clave", header:{text: 'Clave', css: 'center'}, width: 100},
{id: "clave_sat", hidden: true},
{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: "unidad", header:{text: 'Unidad', css: 'center'}, width: 100},
{id: 'cantidad', header: {text: 'Cantidad', css: 'center'}, width: 100,
@ -301,6 +301,7 @@ var grid_details = {
editable: true,
columns: grid_details_cols,
data: [],
fixedRowHeight: false,
}

View File

@ -12,6 +12,7 @@ var toolbar_products = [
var grid_products_cols = [
{ id: "id", header: "ID", width: 75, hidden: true},
{ id: "clave_sat", header: ["Clave SAT"], width: 100,},
{ id: "clave", header: ["Clave", {content: "textFilter"}], width: 100,
sort: 'string', footer: {content: 'countRows', css: 'right'}},
{ id: "descripcion", header: ["Descripción", {content: "textFilter"}],