mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Initial commit of hr_expense_recruitment for 11.0
This commit is contained in:
2
hr_expense_recruitment/models/__init__.py
Normal file
2
hr_expense_recruitment/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import hr_expense_job
|
||||
from . import hr_job
|
||||
7
hr_expense_recruitment/models/hr_expense_job.py
Normal file
7
hr_expense_recruitment/models/hr_expense_job.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class HRExpenseJob(models.Model):
|
||||
_inherit = 'hr.expense'
|
||||
|
||||
job_id = fields.Many2one('hr.job', string='Job')
|
||||
18
hr_expense_recruitment/models/hr_job.py
Normal file
18
hr_expense_recruitment/models/hr_job.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class HRJob(models.Model):
|
||||
_inherit = 'hr.job'
|
||||
|
||||
company_currency = fields.Many2one('res.currency', string='Currency',
|
||||
related='company_id.currency_id', readonly=True)
|
||||
expense_total_amount = fields.Float(string='Expenses Total',
|
||||
compute='_compute_expense_total_amount',
|
||||
compute_sudo=True)
|
||||
expense_ids = fields.One2many('hr.expense', 'job_id', string='Expenses')
|
||||
|
||||
@api.multi
|
||||
@api.depends('expense_ids.total_amount')
|
||||
def _compute_expense_total_amount(self):
|
||||
for job in self:
|
||||
job.expense_total_amount = sum(job.expense_ids.mapped('total_amount'))
|
||||
Reference in New Issue
Block a user