mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-26 12:52:03 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
from . import hr_job
|
||||
from . import hr_contract
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
from odoo import models
|
||||
|
||||
|
||||
class HrContract(models.Model):
|
||||
_inherit = "hr.contract"
|
||||
|
||||
def write(self, vals):
|
||||
res = super().write(vals)
|
||||
if "state" in vals:
|
||||
job_obj = self.job_id
|
||||
job_obj._compute_to_recruit()
|
||||
return res
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class HrJob(models.Model):
|
||||
_inherit = "hr.job"
|
||||
|
||||
@api.depends("no_of_recruitment")
|
||||
def _compute_to_recruit(self):
|
||||
contract_obj = self.env["hr.contract"]
|
||||
for rec in self:
|
||||
rec.to_recruit = rec.no_of_recruitment - contract_obj.search_count(
|
||||
[("job_id", "=", rec.id), ("state", "=", "open")]
|
||||
)
|
||||
if rec.to_recruit > 0:
|
||||
rec.website_published = True
|
||||
else:
|
||||
rec.website_published = False
|
||||
|
||||
to_recruit = fields.Integer(
|
||||
string="To be recruited", compute="_compute_to_recruit", store=True
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue