Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.0 fix/recisao datas mes #270

Open
wants to merge 3 commits into
base: 8.0-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 25 additions & 18 deletions l10n_br_hr_payroll/models/hr_payslip.py
Original file line number Diff line number Diff line change
Expand Up @@ -1266,25 +1266,26 @@ def _simulacao_ferias(self, ferias_vencida, um_terco_ferias):

if periodo.saldo:
data_inicio = self.data_afastamento
data_fim = data.parse_datetime(data_inicio) + relativedelta(days=periodo.avos * 2.5)
if periodo.avos >= 0:
data_fim = data.parse_datetime(data_inicio) + relativedelta(days=periodo.avos * 2.5)

domain = [
('tipo_de_folha', '=', 'ferias'),
('is_simulacao', '=', True),
('periodo_aquisitivo', '=', periodo_id)
]
payslip_simulacao = self.env['hr.payslip'].search(domain)
if payslip_simulacao:
payslip_simulacao_criada = payslip_simulacao
else:
payslip_simulacao_criada = self.gerar_simulacao(
'ferias', self.mes_do_ano,
self.ano, data_inicio,
data_fim, ferias_vencida=ferias_vencida,
periodo_aquisitivo=periodo
)
return self._buscar_valor_bruto_simulacao(
payslip_simulacao_criada, um_terco_ferias)
domain = [
('tipo_de_folha', '=', 'ferias'),
('is_simulacao', '=', True),
('periodo_aquisitivo', '=', periodo_id)
]
payslip_simulacao = self.env['hr.payslip'].search(domain)
if payslip_simulacao:
payslip_simulacao_criada = payslip_simulacao
else:
payslip_simulacao_criada = self.gerar_simulacao(
'ferias', self.mes_do_ano,
self.ano, data_inicio,
data_fim, ferias_vencida=ferias_vencida,
periodo_aquisitivo=periodo
)
return self._buscar_valor_bruto_simulacao(
payslip_simulacao_criada, um_terco_ferias)

def _simulacao_decimo_terceiro(self):

Expand Down Expand Up @@ -2246,6 +2247,9 @@ def _compute_set_dates(self):
datetime.strptime(str(mes) + '-' +
str(record.ano), '%m-%Y'))

days = (fields.Date.from_string(ultimo_dia_do_mes) -
fields.Date.from_string(primeiro_dia_do_mes)).days

record.date_from = primeiro_dia_do_mes
record.date_to = ultimo_dia_do_mes

Expand All @@ -2263,6 +2267,9 @@ def _compute_set_dates(self):
record.date_to = \
fields.Date.from_string(record.data_afastamento) - \
timedelta(days=1)
record.date_from = fields.Date.from_string(record.date_to) - \
timedelta(days=days)
record.mes_do_ano2 =fields.Date.from_string(record.date_to).month

@api.multi
def _buscar_holerites_periodo_aquisitivo(self):
Expand Down
4 changes: 3 additions & 1 deletion l10n_br_hr_payroll/views/hr_payslip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@
<field name="is_simulacao" invisible="1"/>
</field>
<field name="credit_note" position="after">
<field name="data_afastamento" attrs="{'invisible': [('tipo_de_folha', 'not in', ['rescisao'])]}"/>
<field name="data_afastamento"
attrs="{'invisible': [('tipo_de_folha', 'not in',['rescisao'])],
'required': [('tipo_de_folha', 'in',['rescisao'])]}"/>
<field name="data_pagamento_demissao" attrs="{'invisible': [('tipo_de_folha', 'not in', ['rescisao'])]}"/>
<field name="valor_saldo_fgts" attrs="{'invisible': [('tipo_de_folha', 'not in', ['rescisao'])]}"/>
<field name="valor_multa_fgts" attrs="{'invisible': [('tipo_de_folha', 'not in', ['rescisao'])]}"/>
Expand Down