Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

salary rule for unpaid leaves based on number of days of months

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
python2.7odooodoo10
2 Respuestas
9464 Vistas
Avatar
SSS

Hello,

I am trying to deduct salary for unpaid leaves based on number of days of month. 

​In hr.payslip following line is added.

day =  datetime.strptime(date_to,"%Y-%m-%d").day

res['value'].update({
'day': day,
})

'day' give me last day of month. For salary rule I have try:

result=(contract.wage/payslip.day)*worked_days.Unpaid.number_of_days

But Following error occur:

res['value'].update({
TypeError: list indices must be integers, not str 

I understand error, also try for integer list but nothing will happen.Any suggestion

For above I refer following link:

https://www.odoo.com/forum/help-1/question/unpaid-leaves-deduction-not-working-16131

​and also I want to define organisation holiday. For organisation holiday salary not deduct for that I want add salary rule.

1
Avatar
Descartar
Avatar
Hilar Andikkadavath
Mejor respuesta

The calculations you defined here are entirely wrong. How can u make sure your to-date in payslip is the last day of the month. One more thing to be checked here is if you put the salary for two months then which day you gonna take. 

In case of a payslip period in a single month.

Total days in a month can be calculated using this formula.

import calendar
day_from = fields.Date.from_string(from_date) #TO date object
calendar.monthrange(day_from.year, day_from.month)[1] # will be 31 | 30, For FEB 28|29
Payslip period for more than a month.
for this case I can suggest you two logics. 
1. You can predefine the the total days like 30 | 31.
2. result will be the sum of total of all months.
eg: result = result + (contract.wage/payslip.day of nth month)*worked_days.Unpaid.number_of_days
To do that, you can either split the Worked day lines according to the months or you can hard code in salary rules.
4
Avatar
Descartar
SSS
Autor

I want payslip only for one month not for more than month that's the reason I am consider to_date as a last date of month. But the problem is that when adding result=(contract.wage/payslip.day)*worked_days.Unpaid.number_of_days into the salary rule. gives me error "float division by zero" means payslip.day not contain 30 | 31. I dont understand why this happen. I am also tried your suggestion for one month payslip but not work.

Hilar Andikkadavath

Your payslip.day is zero, that's why. Properly update value to payslip.day

Hilar Andikkadavath

I don't know how you are updating payslip.day, but I can suggest you keep that as a computed field. I think you are updating the value wrongly.

SSS
Autor

Firstly i inherit hr.payslip with get_worked_day_lines method in that I have try this code

day_from = fields.Date.from_string(date_from)

day = calendar.monthrange(day_from.year, day_from.month)[1]

res1.append(day)

return res1[0]

I think I am inheriting wrong method that's the reason payslip.day

SSS
Autor

I think I am inheriting wrong method that's the reason payslip.day contain zero.

Hilar Andikkadavath

okay, make your field as computed and in the computed function, do the tweak

SSS
Autor

Thanks @Hilar AK for your time and suggestion. My problem is solved.

Avatar
Niyas Raphy (Walnut Software Solutions)
Mejor respuesta

Hi,

Please check whether this helps,

1. Deduct Employee Salary When Taking Leaves In Odoo Payroll

2. How To Set Public Holidays/Global Leaves In Odoo

Thanks

2
Avatar
Descartar
SSS
Autor

Thanks @Niyas Paphy for your time and suggestion.links given by you also helpfull.

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
How can i call my method after create new object in odoo 10?
python2.7 odoo odoo10
Avatar
Avatar
Avatar
2
ago 22
12431
[SOLVED] How to Hide or Delete Trash Icon in One2many field Resuelto
python python2.7 odoo odoo10
Avatar
Avatar
2
ago 25
12909
Filter value 2 field of Many2one
python python2.7 odoo odoo10
Avatar
Avatar
Avatar
5
sept 20
6956
Filter field domain one2many to many2one Resuelto
python python2.7 odoo odoo10
Avatar
Avatar
1
dic 19
10328
How to open direct list view instead of select "Search More.." in Many2one field for Odoo10
python2.7 many2one_list odoo odoo10
Avatar
Avatar
1
feb 24
7189
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now