[FIX] event: convert related country_id field to compute field
To avoid being able to change the country of the address (res.partner) from this field
This commit is contained in:
parent
75dfa9a356
commit
99c44334f1
|
@ -139,6 +139,11 @@ class event_event(models.Model):
|
|||
else:
|
||||
self.date_end_located = False
|
||||
|
||||
@api.one
|
||||
@api.depends('address_id')
|
||||
def _compute_country(self):
|
||||
self.country_id = self.address_id.country_id
|
||||
|
||||
date_begin_located = fields.Datetime(string='Start Date Located', compute='_compute_date_begin_tz')
|
||||
date_end_located = fields.Datetime(string='End Date Located', compute='_compute_date_end_tz')
|
||||
|
||||
|
@ -163,8 +168,8 @@ class event_event(models.Model):
|
|||
address_id = fields.Many2one('res.partner', string='Location',
|
||||
default=lambda self: self.env.user.company_id.partner_id,
|
||||
readonly=False, states={'done': [('readonly', True)]})
|
||||
country_id = fields.Many2one('res.country', string='Country', related='address_id.country_id',
|
||||
store=True, readonly=False, states={'done': [('readonly', True)]})
|
||||
country_id = fields.Many2one('res.country', string='Country',
|
||||
store=True, compute='_compute_country')
|
||||
description = fields.Html(string='Description', oldname='note', translate=True,
|
||||
readonly=False, states={'done': [('readonly', True)]})
|
||||
company_id = fields.Many2one('res.company', string='Company', change_default=True,
|
||||
|
|
Loading…
Reference in New Issue