Edición de notas en facturas
This commit is contained in:
parent
8f7c1c3a31
commit
bb7486be94
|
@ -138,6 +138,8 @@ class AppValues(object):
|
|||
req.context['result'] = self._db.edit_usuario(values)
|
||||
elif table == 'bdfl':
|
||||
req.context['result'] = self._db.importar_bdfl()
|
||||
elif table == 'invoicenotes':
|
||||
req.context['result'] = self._db.save_invoice_notes(values)
|
||||
else:
|
||||
req.context['result'] = self._db.validate_cert(values, session)
|
||||
else:
|
||||
|
|
|
@ -31,6 +31,12 @@ class StorageEngine(object):
|
|||
def _get_configtimbrar(self, values):
|
||||
return main.config_timbrar()
|
||||
|
||||
def _get_invoicenotes(self, values):
|
||||
return main.Facturas.get_notes(values['id'])
|
||||
|
||||
def save_invoice_notes(self, values):
|
||||
return main.Facturas.save_notes(values)
|
||||
|
||||
def _get_configticket(self, values):
|
||||
return main.config_ticket()
|
||||
|
||||
|
|
|
@ -2468,6 +2468,18 @@ class Facturas(BaseModel):
|
|||
cls._sync_xml(cls, obj)
|
||||
return obj.xml, name
|
||||
|
||||
@classmethod
|
||||
def get_notes(cls, id):
|
||||
obj = Facturas.get(Facturas.id==int(id))
|
||||
return {'notes': obj.notas}
|
||||
|
||||
@classmethod
|
||||
def save_notes(cls, values):
|
||||
obj = Facturas.get(Facturas.id==int(values['id']))
|
||||
obj.notas = values.get('notes', '')
|
||||
obj.save()
|
||||
return {'ok': True, 'msg': 'Notas guardadas correctamente'}
|
||||
|
||||
#~ Revisar
|
||||
def _get_data_cfdi_to_pdf(self, xml, cancel, version):
|
||||
pre_nomina = PRE['NOMINA'][version]
|
||||
|
|
|
@ -42,6 +42,7 @@ var invoices_controllers = {
|
|||
$$('lst_serie').attachEvent('onChange', lst_serie_change)
|
||||
|
||||
$$('cmd_cfdi_notes').attachEvent('onItemClick', cmd_cfdi_notes_click)
|
||||
$$('cmd_admin_invoice_notes').attachEvent('onItemClick', cmd_admin_invoice_notes_click)
|
||||
|
||||
webix.extend($$('grid_invoices'), webix.ProgressBar)
|
||||
}
|
||||
|
@ -1267,7 +1268,11 @@ function cmd_invoice_sat_click(){
|
|||
|
||||
webix.ajax().get('/values/statussat', {id: row.id}, function(text, data){
|
||||
var values = data.json()
|
||||
showvar(values)
|
||||
if(values == 'Vigente'){
|
||||
msg_ok(values)
|
||||
}else{
|
||||
msg_error(values)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -1729,12 +1734,36 @@ function cmd_cfdi_notes_click(){
|
|||
$$('invoice_notes').setValue(values.notas)
|
||||
$$('win_invoice_notes').show()
|
||||
to_end('invoice_notes')
|
||||
cfg_invoice['notes'] = false
|
||||
}
|
||||
|
||||
|
||||
function save_invoice_notes(notes){
|
||||
var row = $$('grid_invoices').getSelectedId()
|
||||
|
||||
webix.ajax().post('/values/invoicenotes', {id: row.id, notes: notes}, {
|
||||
error:function(text, data, XmlHttpRequest){
|
||||
},
|
||||
success:function(text, data, XmlHttpRequest){
|
||||
values = data.json();
|
||||
if(values.ok){
|
||||
msg_ok(values.msg)
|
||||
}else{
|
||||
msg_error(values.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function cmd_invoice_save_note_click(){
|
||||
var value = $$('invoice_notes').getValue()
|
||||
$$('form_invoice').setValues({notas: value}, true)
|
||||
if(cfg_invoice['notes']){
|
||||
save_invoice_notes(value)
|
||||
}else{
|
||||
$$('form_invoice').setValues({notas: value}, true)
|
||||
}
|
||||
$$('win_invoice_notes').close()
|
||||
|
||||
}
|
||||
|
@ -1777,10 +1806,18 @@ function grid_invoices_on_select_change(){
|
|||
var total = 0
|
||||
|
||||
for (i = 0; i < rows.length; i++) {
|
||||
total += rows[i].total_mn.to_float()
|
||||
if(typeof(rows[i].total_mn) == 'string'){
|
||||
total += rows[i].total_mn.to_float()
|
||||
}else{
|
||||
total += rows[i].total_mn
|
||||
}
|
||||
}
|
||||
g.getColumnConfig('cliente').footer[0].text = webix.i18n.priceFormat(total)
|
||||
g.refreshColumns()
|
||||
$$('cmd_admin_invoice_notes').disable()
|
||||
if(rows.length==1){
|
||||
$$('cmd_admin_invoice_notes').enable()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1797,3 +1834,23 @@ function grid_invoices_on_header_click(id){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function get_invoice_notes(row){
|
||||
webix.ajax().sync().get('/values/invoicenotes', {id: row.id}, function(text, data){
|
||||
var values = data.json()
|
||||
return values.notes
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function cmd_admin_invoice_notes_click(){
|
||||
var row = $$('grid_invoices').getSelectedId()
|
||||
win_invoice_notes.init()
|
||||
webix.ajax().sync().get('/values/invoicenotes', {id: row.id}, function(text, data){
|
||||
var values = data.json()
|
||||
$$('invoice_notes').setValue(values.notes)
|
||||
$$('win_invoice_notes').show()
|
||||
to_end('invoice_notes')
|
||||
})
|
||||
cfg_invoice['notes'] = true
|
||||
}
|
|
@ -174,7 +174,7 @@ var toolbar_invoices = [
|
|||
autowidth: true, icon: "pencil"},
|
||||
{},
|
||||
{view: 'button', id: 'cmd_admin_invoice_notes', label: 'Notas',
|
||||
type: 'iconButton', autowidth: true, icon: 'commenting-o'},
|
||||
disabled: true, type: 'iconButton', autowidth: true, icon: 'commenting-o'},
|
||||
{view: 'button', id: 'cmd_invoice_report_pdf', label: 'Reporte',
|
||||
type: 'iconButton', autowidth: true, icon: 'file-pdf-o'},
|
||||
{view: 'button', id: 'cmd_invoice_report_xls', label: 'Reporte',
|
||||
|
|
Loading…
Reference in New Issue