mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-24 12:12:07 +02:00
19.0 vanilla
This commit is contained in:
parent
e1d89e11e3
commit
a1f02d8cc7
225 changed files with 2335 additions and 775 deletions
|
|
@ -217,11 +217,12 @@ class HrVersion(models.Model):
|
|||
|
||||
@api.depends("private_country_id")
|
||||
def _compute_allowed_country_state_ids(self):
|
||||
states = self.env["res.country.state"].search([])
|
||||
for version in self:
|
||||
if version.private_country_id:
|
||||
version.allowed_country_state_ids = version.private_country_id.state_ids
|
||||
else:
|
||||
versions_with_countries = self.filtered("private_country_id")
|
||||
for version in versions_with_countries:
|
||||
version.allowed_country_state_ids = version.private_country_id.state_ids
|
||||
if versions_without_countries := (self - versions_with_countries):
|
||||
states = self.env["res.country.state"].search([])
|
||||
for version in versions_without_countries:
|
||||
version.allowed_country_state_ids = states
|
||||
|
||||
@api.constrains('employee_id', 'contract_date_start', 'contract_date_end')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue