Skip to content

Commit

Permalink
[REF] Convert to better write
Browse files Browse the repository at this point in the history
  • Loading branch information
mileo committed Feb 22, 2017
1 parent 4ab3833 commit 7a57839
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 27 deletions.
4 changes: 3 additions & 1 deletion l10n_br_hr_payroll/models/hr_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,7 @@ def _salario_mes(self, data_inicio, data_fim):
company_id = fields.Many2one(
comodel_name='res.company',
string='Empresa',
required=True,
# required=True,
# default=lambda self: self.env['res.company']._company_default_get(
# 'hr.contract')
)
60 changes: 34 additions & 26 deletions l10n_br_hr_payroll/models/hr_payslip.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,32 +91,40 @@ def _valor_total_folha(self):
inss = line.total
elif codigo['IRPF']:
irpf = line.total
holerite.total_folha = total
holerite.total_proventos = total_proventos
holerite.total_descontos = total_descontos
holerite.base_fgts = base_fgts
holerite.base_inss = base_inss
holerite.base_irpf = base_irpf
holerite.fgts = fgts
holerite.inss = inss
holerite.irpf = irpf
# Formato
holerite.data_admissao_fmt =\
data.formata_data(holerite.contract_id.date_start)
holerite.salario_base_fmt =\
valor.formata_valor(holerite.contract_id.wage)
holerite.total_folha_fmt =\
valor.formata_valor(holerite.total_folha)
holerite.total_proventos_fmt =\
valor.formata_valor(holerite.total_proventos)
holerite.total_descontos_fmt =\
valor.formata_valor(holerite.total_descontos)
holerite.base_fgts_fmt = valor.formata_valor(holerite.base_fgts)
holerite.base_inss_fmt = valor.formata_valor(holerite.base_inss)
holerite.base_irpf_fmt = valor.formata_valor(holerite.base_irpf)
holerite.fgts_fmt = valor.formata_valor(holerite.fgts)
holerite.inss_fmt = valor.formata_valor(holerite.inss)
holerite.irpf_fmt = valor.formata_valor(holerite.irpf)
holerite.write({
'total_folha': total,
'total_proventos': total_proventos,
'total_descontos': total_descontos,
'base_fgts': base_fgts,
'base_inss': base_inss,
'base_irpf': base_irpf,
'fgts': fgts,
'inss': inss,
'irpf': irpf,
# Formato
'data_admissao_fmt': data.formata_data(
holerite.contract_id.date_start),
'salario_base_fmt': valor.formata_valor(
holerite.contract_id.wage),
'total_folha_fmt': valor.formata_valor(
holerite.total_folha),
'total_proventos_fmt': valor.formata_valor(
holerite.total_proventos),
'total_descontos_fmt': valor.formata_valor(
holerite.total_descontos),
'base_fgts_fmt': valor.formata_valor(
holerite.base_fgts),
'base_inss_fmt': valor.formata_valor(
holerite.base_inss),
'base_irpf_fmt': valor.formata_valor(
holerite.base_irpf),
'fgts_fmt': valor.formata_valor(
holerite.fgts),
'inss_fmt': valor.formata_valor(
holerite.inss),
'irpf_fmt': valor.formata_valor(
holerite.irpf),
})

employee_id_readonly = fields.Many2one(
string=u'Funcionário',
Expand Down

0 comments on commit 7a57839

Please sign in to comment.