Files
odoo_source/addons/hr/models/hr_work_location.py
T
Kevin Baptiste 3d5e912da7 [IMP] hr: add a model for work locations
The work location of an employee was previously a fields.Char. That was
changed to a Many2one field to a the new model called work.location.
That had some consequences in other modules that had to be slightly
adjusted.  The modules impacted were hr, hr_appraisal, hr_payroll.

Task id: 2335646

closes odoo/odoo#63192

Related: odoo/enterprise#15235
Related: odoo/upgrade#2020
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-02-05 13:00:09 +00:00

16 lines
624 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class WorkLocation(models.Model):
_name = "hr.work.location"
_description = "Work Location"
_order = 'name'
active = fields.Boolean(default=True)
name = fields.Char(string="Work Location", required=True)
company_id = fields.Many2one('res.company', required=True, default=lambda self: self.env.company)
address_id = fields.Many2one('res.partner', required=True, string="Work Address", domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")