class DHACalendar(models.Model):
_inherit = "resource.resource"
calendar_id = fields.Many2one(
"resource.calendar", string='Working Time',
default=None,
required=False,
help="Define the schedule of resource")
@api.model
def default_get(self, fields):
res = super(DHACalendar, self).default_get(fields)
if not res.get('calendar_id') and res.get('company_id'):
company = self.env['res.company'].browse(res['company_id'])
res['calendar_id'] = None
return res
@api.model
def create(self, values):
values["calendar_id"] = False
return super(DHACalendar, self).create(values)
@api.onchange('company_id')
def _onchange_company_id(self):
if self.company_id:
self.calendar_id = None
https://github.com/odoo/odoo/blob/11.0/addons/resource/models/resource.py#L655-L715
In odoo11alue - Resource, I want to not set default value. But it sets default.
How to Fix it?
Thanks.