mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-26 11:52:05 +02:00
19.0 vanilla
This commit is contained in:
parent
a1137a1456
commit
e1d89e11e3
2789 changed files with 1093187 additions and 605897 deletions
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
|
@ -7,10 +6,11 @@ from odoo import fields, models
|
|||
class HrDepartment(models.Model):
|
||||
_inherit = 'hr.department'
|
||||
|
||||
def _compute_expense_sheets_to_approve(self):
|
||||
expense_sheet_data = self.env['hr.expense.sheet']._read_group([('department_id', 'in', self.ids), ('state', '=', 'submit')], ['department_id'], ['department_id'])
|
||||
result = dict((data['department_id'][0], data['department_id_count']) for data in expense_sheet_data)
|
||||
for department in self:
|
||||
department.expense_sheets_to_approve_count = result.get(department.id, 0)
|
||||
expenses_to_approve_count = fields.Integer(compute='_compute_expenses_to_approve_count', string='Expenses to Approve')
|
||||
|
||||
def _compute_expenses_to_approve_count(self):
|
||||
expense_data = self.env['hr.expense']._read_group([('department_id', 'in', self.ids), ('state', '=', 'submitted')], ['department_id'], ['__count'])
|
||||
result = {department.id: count for department, count in expense_data}
|
||||
for department in self:
|
||||
department.expenses_to_approve_count = result.get(department.id, 0)
|
||||
|
||||
expense_sheets_to_approve_count = fields.Integer(compute='_compute_expense_sheets_to_approve', string='Expenses Reports to Approve')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue