From cee2b11da2de2f7ead795ebebbc47bf1fd23a10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 1 Apr 2020 14:28:48 +0000 Subject: [FIX] event_*: remove now unnecessary copy=True Commit 397872a07fe22afa7d83b3170e3b037be1ae607a remove most onchange in event related modules to replace them by computed r+w stored fields. At that time copy was by default set to False for computed fields as resulting of standard behavior. Since 4b274d3b4101fbae154a572cdf40d23838899773 this is not True anymore as we consider those fields are duplicable. We can therefore remove unnecessary copy=True on fields to clean their definitions. Task ID 2228189 Community PR odoo/odoo#48652 X-original-commit: c6b378987bd3351deba7770b51c2a5755f7ff341 --- addons/event/models/event_event.py | 11 +++++------ addons/event/models/event_registration.py | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'addons/event/models') diff --git a/addons/event/models/event_event.py b/addons/event/models/event_event.py index 89d31e3c8da..00ca45c62a7 100644 --- a/addons/event/models/event_event.py +++ b/addons/event/models/event_event.py @@ -37,7 +37,7 @@ class EventType(models.Model): has_seats_limitation = fields.Boolean('Limited Seats') seats_max = fields.Integer( 'Maximum Registrations', compute='_compute_default_registration', - copy=True, readonly=False, store=True, + readonly=False, store=True, help="It will select this default maximum value when you choose this event") auto_confirm = fields.Boolean( 'Automatically Confirm Registrations', default=True, @@ -139,10 +139,10 @@ class EventEvent(models.Model): # Seats and computation seats_max = fields.Integer( string='Maximum Attendees Number', - compute='_compute_from_event_type', copy=True, readonly=False, store=True, + compute='_compute_from_event_type', readonly=False, store=True, help="For each event you can define a maximum registration of seats(number of attendees), above this numbers the registrations are not accepted.") seats_limited = fields.Boolean('Maximum Attendees', required=True, compute='_compute_seats_limited', - copy=True, readonly=False, store=True) + readonly=False, store=True) seats_reserved = fields.Integer( string='Reserved Seats', store=True, readonly=True, compute='_compute_seats') @@ -160,8 +160,7 @@ class EventEvent(models.Model): compute_sudo=True, readonly=True, compute='_compute_seats') # Registration fields auto_confirm = fields.Boolean( - string='Autoconfirmation', - compute='_compute_from_event_type', copy=True, readonly=False, store=True, + string='Autoconfirmation', compute='_compute_from_event_type', readonly=False, store=True, help='Autoconfirm Registrations. Registrations will automatically be confirmed upon creation.') registration_ids = fields.One2many('event.registration', 'event_id', string='Attendees') event_ticket_ids = fields.One2many( @@ -179,7 +178,7 @@ class EventEvent(models.Model): # Date fields date_tz = fields.Selection( _tz_get, string='Timezone', required=True, - compute='_compute_date_tz', copy=True, readonly=False, store=True) + compute='_compute_date_tz', readonly=False, store=True) date_begin = fields.Datetime(string='Start Date', required=True, tracking=True) date_end = fields.Datetime(string='End Date', required=True, tracking=True) date_begin_located = fields.Char(string='Start Date Located', compute='_compute_date_begin_tz') diff --git a/addons/event/models/event_registration.py b/addons/event/models/event_registration.py index c5366c8acc9..3f13a2917c9 100644 --- a/addons/event/models/event_registration.py +++ b/addons/event/models/event_registration.py @@ -32,15 +32,15 @@ class EventRegistration(models.Model): states={'done': [('readonly', True)]}) name = fields.Char( string='Attendee Name', index=True, - compute='_compute_contact_info', copy=True, readonly=False, store=True, tracking=10) - email = fields.Char(string='Email', compute='_compute_contact_info', copy=True, readonly=False, store=True, tracking=11) - phone = fields.Char(string='Phone', compute='_compute_contact_info', copy=True, readonly=False, store=True, tracking=12) - mobile = fields.Char(string='Mobile', compute='_compute_contact_info', copy=True, readonly=False, store=True, tracking=13) + compute='_compute_contact_info', readonly=False, store=True, tracking=10) + email = fields.Char(string='Email', compute='_compute_contact_info', readonly=False, store=True, tracking=11) + phone = fields.Char(string='Phone', compute='_compute_contact_info', readonly=False, store=True, tracking=12) + mobile = fields.Char(string='Mobile', compute='_compute_contact_info', readonly=False, store=True, tracking=13) # organization date_open = fields.Datetime(string='Registration Date', readonly=True, default=lambda self: fields.Datetime.now()) # weird crash is directly now date_closed = fields.Datetime( string='Attended Date', compute='_compute_date_closed', - copy=True, readonly=False, store=True) + readonly=False, store=True) event_begin_date = fields.Datetime(string="Event Start Date", related='event_id.date_begin', readonly=True) event_end_date = fields.Datetime(string="Event End Date", related='event_id.date_end', readonly=True) company_id = fields.Many2one( -- cgit v1.2.3