Untitled
unknown
python
a year ago
1.4 kB
3
Indexable
from rh.gfp.models import * from contrib.middleware import get_current_user, set_current_user FERIAS = ['05000'] INSS = ['91000'] def get_ferias_inss(mes,ano): fes = FolhaEvento.objects.filter(folha__periodo__mes=mes, folha__periodo__ano=ano, evento__numero__in=FERIAS ) fes_bug = [] for fe in fes: if fe.contracheque.lancamentos.filter(evento__numero__in=INSS).exists(): fes_bug.append(fe) return fes_bug def update_fe(fe): print'DEIXANDO O FOLHA EVENTO COMO ERA ANTES DO RECALCULO! {}'.format(fe.servidor) set_current_user('athenas') fe.automated = False fe.save() fe = FolhaEvento.objects.get(pk=fe.pk) fe.correct_value = fe.correct_value fe.correct_valor = fe.valor fe.correct_base_value = fe.valor_base fe.correct_base_previdencia = fe.base_previdencia fe.correct_qnt = fe.qnt fe.correct_pct = fe.pct fe.save() fe = FolhaEvento.objects.get(pk=fe.pk) fe.contracheque.evaluate_differences() fe.save() print 'AVALIANDO DIFERENÇA DO FOLHA FE!' def update_fes(mes,ano): fes = get_ferias_inss(mes,ano) for fe in fes: update_fe(fe) def start(): update_fes(2,2024) start()
Editor is loading...
Leave a Comment