Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Can someone help me with my code? I want to compute Late, Overtime, Undertime using "Other Inputs"

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
payrollattendancepayslip
5307 Vizualizări
Imagine profil
paolo
  1. The code will compare if the dates from attendance fit the date_to and date_from of payslip and sum their lates, undertime and overtime.
  2.  
  3. class awb_hr_payslip_extension(osv.osv):
  4.     _name = 'hr.payslip'
  5.     _inherit = 'hr.payslip'
  6.     
  7.     def create(self, cr, uid, vals, context=None):
  8.         # get other input model
  9.         attendance_model = self.pool.get('hr.attendance')
  10.         payslip_model = self.pool.get('hr.payslip')
  11.         #payslip = payslip_model.browse(cr, uid, vals['payslip_id'].id, context=context)
  12.         
  13.         # convert date_to
  14.         date_to = vals['date_to'] + " 23:59:59"
  15.         # filtering / get records depending on filter: name, date from, date to
  16.         # 'name' is datetime field from attendance model
  17.         # vals['field name from hr.payslip']
  18.         attendance_ids = attendance_model.search(cr, uid, [('employee_id', '=', vals['employee_id']), ('name', '>=', vals['date_from']), ('name', "<=", date_to)], count=False)
  19.         
  20.         records_list = attendance_model.browse(cr, uid, attendance_ids)
  21.         total_late = 0
  22.         total_undertime = 0
  23.         total_overtime = 0
  24.         for record in records_list:
  25.             total_late = total_late + record.late
  26.             total_undertime = total_undertime + record.undertime
  27.             total_overtime = total_overtime + record.overtime
  28.         # insert to Other Inputs
  29.         other_input_model = self.pool.get('hr.payslip.input')    
  30.         other_input_model.create(cr, uid, ['name': 'Total Late'], 'code': 'late_deduction', 'amount': total_late, 'contract_id': vals['contract_id']}, context=None)
  31.         other_input.create(cr, uid, {'name': 'Total Undertime', 'code' : 'undertime_deduction', 'amount': total_undertime, 'contract_id': vals['contract_id']}, context=None)
  32.         other_input.create(cr, uid, {'name': 'Total Overtime', 'code': 'overtime_pay', 'amount': total_overtime, 'contract_id': vals['contract_id']}, context=None)
  33.         
  34.         return super(awb_hr_payslip_extension, self).create(cr, uid, vals, context=context)
  35. awb_hr_payslip_extension()

 

this is my error from this code:(

Integrity Error

The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set

[object with reference: payslip_id - payslip.id]

1
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Capturing actual work days and hours in payroll app
payroll attendance payslip
Imagine profil
Imagine profil
Imagine profil
3
nov. 22
6951
Attendance integration with Payslip
hr payroll attendance payslip
Imagine profil
Imagine profil
Imagine profil
3
apr. 18
8118
How can I improve the performance of payslip.run?
payroll payslip
Imagine profil
Imagine profil
Imagine profil
2
iul. 25
4552
Performance issue while processing Payroll in Odoo community v12
payroll payslip
Imagine profil
Imagine profil
1
iul. 25
3627
how to access datetime in payslip salary rule?
payroll payslip
Imagine profil
0
dec. 24
2332
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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