Merge branch 'develop'
Fix - Guardar condición de pago en socios
This commit is contained in:
commit
e8342de740
|
@ -860,9 +860,12 @@ def _comprobante(values, options):
|
||||||
'T': 'traslado',
|
'T': 'traslado',
|
||||||
}
|
}
|
||||||
data['tipodecomprobante'] = tipos.get(data['tipodecomprobante'])
|
data['tipodecomprobante'] = tipos.get(data['tipodecomprobante'])
|
||||||
data['lugarexpedicion'] = 'C.P. de Expedición: {}'.format(data['lugarexpedicion'])
|
data['lugarexpedicion'] = \
|
||||||
|
'C.P. de Expedición: {}'.format(data['lugarexpedicion'])
|
||||||
data['metododepago'] = options['metododepago']
|
data['metododepago'] = options['metododepago']
|
||||||
data['formadepago'] = options['formadepago']
|
data['formadepago'] = options['formadepago']
|
||||||
|
data['condicionesdepago'] = \
|
||||||
|
'Condiciones de pago: {}'.format(data['condicionesdepago'])
|
||||||
data['moneda'] = options['moneda']
|
data['moneda'] = options['moneda']
|
||||||
|
|
||||||
data['tipocambio'] = 'Tipo de Cambio: $ {:0.2f}'.format(
|
data['tipocambio'] = 'Tipo de Cambio: $ {:0.2f}'.format(
|
||||||
|
|
|
@ -50,6 +50,9 @@ class StorageEngine(object):
|
||||||
def _get_formapago(self, values):
|
def _get_formapago(self, values):
|
||||||
return main.SATFormaPago.get_activos(values)
|
return main.SATFormaPago.get_activos(values)
|
||||||
|
|
||||||
|
def _get_condicionespago(self, values):
|
||||||
|
return main.CondicionesPago.get_()
|
||||||
|
|
||||||
def _get_categorias(self, values):
|
def _get_categorias(self, values):
|
||||||
return main.Categorias.get_all()
|
return main.Categorias.get_all()
|
||||||
|
|
||||||
|
|
|
@ -477,6 +477,22 @@ class CondicionesPago(BaseModel):
|
||||||
class Meta:
|
class Meta:
|
||||||
order_by = ('condicion',)
|
order_by = ('condicion',)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.condicion
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_(cls):
|
||||||
|
q = CondicionesPago.select(CondicionesPago.condicion).tuples()
|
||||||
|
data = [r[0] for r in q]
|
||||||
|
return data
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_or(cls, value):
|
||||||
|
if value is None:
|
||||||
|
return value
|
||||||
|
obj, _ = CondicionesPago.get_or_create(condicion=value)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
|
||||||
class SATUnidades(BaseModel):
|
class SATUnidades(BaseModel):
|
||||||
key = TextField(unique=True, index=True)
|
key = TextField(unique=True, index=True)
|
||||||
|
@ -703,6 +719,9 @@ class Socios(BaseModel):
|
||||||
fields['nombre'] = util.spaces(fields['nombre'])
|
fields['nombre'] = util.spaces(fields['nombre'])
|
||||||
fields['slug'] = util.to_slug(fields['nombre'])
|
fields['slug'] = util.to_slug(fields['nombre'])
|
||||||
fields['uso_cfdi'] = fields.pop('uso_cfdi_socio', None)
|
fields['uso_cfdi'] = fields.pop('uso_cfdi_socio', None)
|
||||||
|
fields['condicion_pago'] = \
|
||||||
|
CondicionesPago.get_or(fields.get('condicion_pago', None))
|
||||||
|
|
||||||
fb = ('dias_habiles', 'es_activo', 'es_cliente',
|
fb = ('dias_habiles', 'es_activo', 'es_cliente',
|
||||||
'es_proveedor', 'es_ong')
|
'es_proveedor', 'es_ong')
|
||||||
for name in fb:
|
for name in fb:
|
||||||
|
@ -715,6 +734,9 @@ class Socios(BaseModel):
|
||||||
id = int(values['id'])
|
id = int(values['id'])
|
||||||
row = Socios.select().where(Socios.id==id).dicts()[0]
|
row = Socios.select().where(Socios.id==id).dicts()[0]
|
||||||
row['uso_cfdi_socio'] = row.pop('uso_cfdi')
|
row['uso_cfdi_socio'] = row.pop('uso_cfdi')
|
||||||
|
if not row['condicion_pago'] is None:
|
||||||
|
row['condicion_pago'] = \
|
||||||
|
str(CondicionesPago.get(id=row['condicion_pago']))
|
||||||
return row
|
return row
|
||||||
|
|
||||||
rows = Socios.select(Socios.id, Socios.rfc, Socios.nombre).dicts()
|
rows = Socios.select(Socios.id, Socios.rfc, Socios.nombre).dicts()
|
||||||
|
@ -778,6 +800,7 @@ class Socios(BaseModel):
|
||||||
def actualizar(cls, values, id):
|
def actualizar(cls, values, id):
|
||||||
fields = cls._clean(cls, values)
|
fields = cls._clean(cls, values)
|
||||||
try:
|
try:
|
||||||
|
print (fields)
|
||||||
q = Socios.update(**fields).where(Socios.id==id)
|
q = Socios.update(**fields).where(Socios.id==id)
|
||||||
q.execute()
|
q.execute()
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
|
@ -1368,7 +1391,7 @@ class Facturas(BaseModel):
|
||||||
emisor = Emisor.select()[0]
|
emisor = Emisor.select()[0]
|
||||||
values['folio'] = cls._get_folio(cls, values['serie'])
|
values['folio'] = cls._get_folio(cls, values['serie'])
|
||||||
values['tipo_cambio'] = float(values['tipo_cambio'])
|
values['tipo_cambio'] = float(values['tipo_cambio'])
|
||||||
values['lugar_expedicion'] = emisor.codigo_postal
|
values['lugar_expedicion'] = emisor.cp_expedicion or emisor.codigo_postal
|
||||||
|
|
||||||
with database_proxy.atomic() as txn:
|
with database_proxy.atomic() as txn:
|
||||||
obj = Facturas.create(**values)
|
obj = Facturas.create(**values)
|
||||||
|
|
|
@ -3,6 +3,19 @@ var grid = null
|
||||||
var msg = ''
|
var msg = ''
|
||||||
|
|
||||||
|
|
||||||
|
function get_condicion_pago(){
|
||||||
|
webix.ajax().get('/values/condicionespago', {
|
||||||
|
error: function(text, data, xhr) {
|
||||||
|
},
|
||||||
|
success: function(text, data, xhr) {
|
||||||
|
var values = data.json();
|
||||||
|
$$('txt_condicion_pago').define('suggest', values)
|
||||||
|
$$('txt_condicion_pago').refresh()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_series(){
|
function get_series(){
|
||||||
webix.ajax().get('/values/series', function(text, data){
|
webix.ajax().get('/values/series', function(text, data){
|
||||||
var values = data.json()
|
var values = data.json()
|
||||||
|
@ -91,6 +104,7 @@ function cmd_new_invoice_click(id, e, node){
|
||||||
default_config()
|
default_config()
|
||||||
form.adjust()
|
form.adjust()
|
||||||
form.setValues({id: 0, id_partner: 0, lbl_client: 'Ninguno'})
|
form.setValues({id: 0, id_partner: 0, lbl_client: 'Ninguno'})
|
||||||
|
get_condicion_pago()
|
||||||
grid.clearAll()
|
grid.clearAll()
|
||||||
grid_totals.clearAll()
|
grid_totals.clearAll()
|
||||||
grid_totals.add({id: 1, concepto: 'SubTotal', importe: 0})
|
grid_totals.add({id: 1, concepto: 'SubTotal', importe: 0})
|
||||||
|
@ -830,3 +844,10 @@ function cmd_prefactura_click(){
|
||||||
}
|
}
|
||||||
show('PreFactura')
|
show('PreFactura')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function lst_metodo_pago_change(nv, ov){
|
||||||
|
if(nv == 'PPD'){
|
||||||
|
$$('lst_forma_pago').setValue('99')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ var controllers = {
|
||||||
$$('filter_month').attachEvent('onChange', filter_month_change)
|
$$('filter_month').attachEvent('onChange', filter_month_change)
|
||||||
$$('filter_dates').attachEvent('onChange', filter_dates_change)
|
$$('filter_dates').attachEvent('onChange', filter_dates_change)
|
||||||
$$('cmd_prefactura').attachEvent('onItemClick', cmd_prefactura_click)
|
$$('cmd_prefactura').attachEvent('onItemClick', cmd_prefactura_click)
|
||||||
|
$$('lst_metodo_pago').attachEvent('onChange', lst_metodo_pago_change)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,23 @@
|
||||||
|
|
||||||
|
|
||||||
|
function get_condicion_pago(){
|
||||||
|
webix.ajax().get('/values/condicionespago', {
|
||||||
|
error: function(text, data, xhr) {
|
||||||
|
},
|
||||||
|
success: function(text, data, xhr) {
|
||||||
|
var values = data.json();
|
||||||
|
$$('condicion_pago').define('suggest', values)
|
||||||
|
$$('condicion_pago').refresh()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function cmd_new_partner_click(id, e, node){
|
function cmd_new_partner_click(id, e, node){
|
||||||
$$('form_partner').setValues({
|
$$('form_partner').setValues({
|
||||||
id: 0, pais: 'México', tipo_persona: 1, es_activo: true})
|
id: 0, pais: 'México', tipo_persona: 1, es_activo: true})
|
||||||
$$('forma_pago').getList().load('/values/formapago')
|
$$('forma_pago').getList().load('/values/formapago')
|
||||||
|
get_condicion_pago()
|
||||||
$$('grid_partners').clearSelection()
|
$$('grid_partners').clearSelection()
|
||||||
$$('multi_partners').setValue('partners_new')
|
$$('multi_partners').setValue('partners_new')
|
||||||
$$('tab_partner').setValue('Datos Fiscales')
|
$$('tab_partner').setValue('Datos Fiscales')
|
||||||
|
@ -29,6 +43,7 @@ function cmd_edit_partner_click(id, e, node){
|
||||||
webix.message({type:'error', text: msg})
|
webix.message({type:'error', text: msg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
get_condicion_pago()
|
||||||
|
|
||||||
webix.ajax().get("/partners", {id: row['id']}, {
|
webix.ajax().get("/partners", {id: row['id']}, {
|
||||||
error: function(text, data, xhr) {
|
error: function(text, data, xhr) {
|
||||||
|
|
|
@ -227,15 +227,14 @@ var opt_metodo_pago = [
|
||||||
|
|
||||||
|
|
||||||
var body_opciones = {rows: [
|
var body_opciones = {rows: [
|
||||||
|
{view: 'richselect', id: 'lst_metodo_pago', label: 'Método de Pago',
|
||||||
|
labelPosition: 'top', options: opt_metodo_pago, value: 'PUE',
|
||||||
|
required: true},
|
||||||
{view: 'richselect', id: 'lst_forma_pago', name: 'forma_pago',
|
{view: 'richselect', id: 'lst_forma_pago', name: 'forma_pago',
|
||||||
label: 'Forma de Pago', labelPosition: 'top', required: true,
|
label: 'Forma de Pago', labelPosition: 'top', required: true,
|
||||||
options: []},
|
options: []},
|
||||||
{view: 'richselect', id: 'lst_metodo_pago', label: 'Método de Pago',
|
|
||||||
labelPosition: 'top', options: opt_metodo_pago, readonly: true,
|
|
||||||
value: 'PUE',
|
|
||||||
required: true},
|
|
||||||
{view: 'text', id: 'txt_condicion_pago', label: 'Condiciones de Pago',
|
{view: 'text', id: 'txt_condicion_pago', label: 'Condiciones de Pago',
|
||||||
labelPosition: 'top'},
|
labelPosition: 'top', suggest: []},
|
||||||
]}
|
]}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ var controls_fiscales = [
|
||||||
label: 'Forma de Pago: ', required: true, options: [],
|
label: 'Forma de Pago: ', required: true, options: [],
|
||||||
invalidMessage: 'La Forma de pago es requerida'},
|
invalidMessage: 'La Forma de pago es requerida'},
|
||||||
{view: 'text', id: 'condicion_pago', name: 'condicion_pago',
|
{view: 'text', id: 'condicion_pago', name: 'condicion_pago',
|
||||||
label: 'Condiciones de Pago: '},
|
label: 'Condiciones de Pago: ', suggest: []},
|
||||||
]},
|
]},
|
||||||
{cols: [
|
{cols: [
|
||||||
{view: 'counter', id: 'dias_pago', name: 'dias_pago',
|
{view: 'counter', id: 'dias_pago', name: 'dias_pago',
|
||||||
|
|
Loading…
Reference in New Issue