forked from elmau/empresa-libre
Fix - Al cambiar cuenta de banco
This commit is contained in:
parent
31c6261183
commit
d1b94cab57
|
@ -1686,6 +1686,10 @@ class CuentasBanco(BaseModel):
|
|||
|
||||
@classmethod
|
||||
def get_(cls, values):
|
||||
opt = values.pop('opt', '')
|
||||
if opt:
|
||||
return getattr(cls, '_get_{}'.format(opt))(cls, values)
|
||||
|
||||
if values['tipo'] == '1':
|
||||
rows = (CuentasBanco
|
||||
.select()
|
||||
|
@ -1705,7 +1709,12 @@ class CuentasBanco(BaseModel):
|
|||
}
|
||||
return data
|
||||
|
||||
return
|
||||
return {'ok': False}
|
||||
|
||||
def _get_currency(self, values):
|
||||
id = int(values['id'])
|
||||
account = CuentasBanco.get(CuentasBanco.id==id)
|
||||
return {'ok': True, 'currency': account.moneda.name}
|
||||
|
||||
@classmethod
|
||||
def emisor(cls):
|
||||
|
|
|
@ -145,8 +145,27 @@ function get_saldo_cuenta(){
|
|||
}
|
||||
|
||||
|
||||
function get_account_currency(){
|
||||
var id = $$('lst_cuentas_banco').getValue()
|
||||
webix.ajax().get('/cuentasbanco', {'id': id, 'opt': 'currency'}, {
|
||||
error:function(text, data, XmlHttpRequest){
|
||||
msg = 'Ocurrio un error, consulta a soporte técnico'
|
||||
msg_error(msg)
|
||||
},
|
||||
success:function(text, data, XmlHttpRequest){
|
||||
var values = data.json()
|
||||
if(values.ok){
|
||||
$$('txt_cuenta_moneda').setValue(values.currency)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function lst_cuentas_banco_change(nv, ov){
|
||||
get_saldo_cuenta()
|
||||
get_estado_cuenta()
|
||||
get_account_currency()
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue