Odoo18-Base/addons/sale_stock/models/res_users.py
2025-01-06 10:57:38 +07:00

24 lines
752 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class Users(models.Model):
_inherit = ['res.users']
property_warehouse_id = fields.Many2one('stock.warehouse', string='Default Warehouse', company_dependent=True, check_company=True)
def _get_default_warehouse_id(self):
if self.property_warehouse_id:
return self.property_warehouse_id
return super()._get_default_warehouse_id()
@property
def SELF_READABLE_FIELDS(self):
return super().SELF_READABLE_FIELDS + ['property_warehouse_id']
@property
def SELF_WRITEABLE_FIELDS(self):
return super().SELF_WRITEABLE_FIELDS + ['property_warehouse_id']