Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Remaining leave shouldn't be carried over to the next year, can it start over?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
leavehuman_resourceholidayallocation
1 Respondre
9485 Vistes
Avatar
Kong Sreyneth

In our company, the leave allocation are the same for every employee. But the remaining leave can't be carried over to next year. If the employee takes all the leave allowed by the company, it is fine. The problem is when there are remaining leaves, I want to reset the remaining legal leave to zero so that I do the allocation only once and for all at the beginning of the year. 

In odoo, it is not easy to the understand the leave analysis. Because when new allocation is made, it will be added to the remaining leave which is the not the case that we want. We want the report to show the new allocation for particular employee, not to add the past and the new together. I want to start over, so how can I achieve this kind of scenario in ODOO? 

2
Avatar
Descartar
Avatar
Barış Erdoğan
Best Answer

Hello,

I'm faced with a similar scenario. But I need to move staff leave to the next year.

So, I wrote a scheduled action for this situation based on start dates and ages. But I'm not sure of the accuracy, maybe it can give you an idea.

I created two fields in hr.employee object : 

class HrEmployee(models.Model):

    _inherit = 'hr.employee'

    age = fields.Char(string='Yaş')

    annual_leave_calc_number = fields.Integer(string="Annual Leave Calculation Number")

    annual_leave_calc_date = fields.Datetime(string="Annual Leave Calculation Date")

After , method for ir_cron  

    @api.model

    def _cron_employee_remaining_leaves(self):

      for employee in self.search([('active', '=', True)]):

            _emp_leave_right = 0

            _emp_age = employee.age

            _emp_date_job_start = datetime.strptime(employee.ise_giris_tarihi, '%Y-%m-%d').date()

            _current_date = datetime.now().date()

            if int(_emp_age) >= 15:

               .... (some calculations )

                #After:

                temp_start_date = _emp_date_job_start

                if employee.annual_leave_calculation_number > 0:

                    temp_start_date = employee.annual_leave_calculation_date

                while _current_date == self.addYears(temp_start_date, 1):

                    employee.remaining_leaves += _emp_leave_right

                    employee.annual_leave_calc_date = _current_date

                    employee.annual_leave_calc_number += 1

            else:

                _logger.info('15 yaşından küçük personel çalıştıramazsınız ve izin hakkı yoktur.')

   

    

    # This method for getting next year or years from the starting date 

    def addYears(self, date_start, years):

        try:

            return date_start.replace(year=date_start.year + years)

        except ValueError:

            return date_start + (date(date_start.year + years, 1, 1) - date(date_start.year, 1, 1))

0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
[RESOLVED] - [Odoo13][Community] - Automatic allocation by month Solved
automatic leave allocation
Avatar
Avatar
2
de gen. 23
11183
What is the difference bewteen "Leave" and Allocation? Solved
hr attendance leave allocation
Avatar
Avatar
Avatar
2
d’ag. 25
32834
Creating automatic leave allocation based on confirmation date
employee leave allocation ValidationError
Avatar
Avatar
1
de gen. 24
3320
how to make 2 level approval of leave requests?
hr leave human_resource human resource
Avatar
Avatar
1
de jul. 17
14293
Is there a way to have a manager view only their own employees in v7?
manager user leave human_resource user_management
Avatar
1
de març 15
7667
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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