[FIX] event_*: remove now unnecessary copy=True

Commit 397872a07f 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
This commit is contained in:
Thibault Delavallée
2020-04-03 11:07:56 +00:00
parent bc1b5e134b
commit cee2b11da2
6 changed files with 22 additions and 23 deletions
+5 -6
View File
@@ -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')
+5 -5
View File
@@ -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(
@@ -12,9 +12,9 @@ class EventRegistration(models.Model):
# TDE FIXME: maybe add an onchange on sale_order_id
sale_order_id = fields.Many2one('sale.order', string='Source Sales Order', ondelete='cascade')
sale_order_line_id = fields.Many2one('sale.order.line', string='Sales Order Line', ondelete='cascade')
utm_campaign_id = fields.Many2one(compute='_compute_utm_campaign_id', copy=True, readonly=False, store=True)
utm_source_id = fields.Many2one(compute='_compute_utm_source_id', copy=True, readonly=False, store=True)
utm_medium_id = fields.Many2one(compute='_compute_utm_medium_id', copy=True, readonly=False, store=True)
utm_campaign_id = fields.Many2one(compute='_compute_utm_campaign_id', readonly=False, store=True)
utm_source_id = fields.Many2one(compute='_compute_utm_source_id', readonly=False, store=True)
utm_medium_id = fields.Many2one(compute='_compute_utm_medium_id', readonly=False, store=True)
@api.depends('sale_order_id')
def _compute_utm_campaign_id(self):
+2 -2
View File
@@ -14,14 +14,14 @@ class EventTemplateTicket(models.Model):
def _default_product_id(self):
return self.env.ref('event_sale.product_product_event', raise_if_not_found=False)
description = fields.Text(compute='_compute_description', copy=True, readonly=False, store=True)
description = fields.Text(compute='_compute_description', readonly=False, store=True)
# product
product_id = fields.Many2one(
'product.product', string='Product', required=True,
domain=[("event_ok", "=", True)], default=_default_product_id)
price = fields.Float(
string='Price', compute='_compute_price',
digits='Product Price', copy=True, readonly=False, store=True)
digits='Product Price', readonly=False, store=True)
price_reduce = fields.Float(
string="Price Reduce", compute="_compute_price_reduce",
digits='Product Price')
@@ -10,10 +10,10 @@ class EventType(models.Model):
website_track = fields.Boolean(
string='Tracks on Website', compute='_compute_website_menu_data',
copy=True, readonly=False, store=True)
readonly=False, store=True)
website_track_proposal = fields.Boolean(
string='Tracks Proposals on Website', compute='_compute_website_menu_data',
copy=True, readonly=False, store=True)
readonly=False, store=True)
@api.depends('website_menu')
def _compute_website_menu_data(self):
@@ -32,10 +32,10 @@ class Event(models.Model):
sponsor_count = fields.Integer('Sponsor Count', compute='_compute_sponsor_count')
website_track = fields.Boolean(
'Tracks on Website', compute='_compute_website_track',
copy=True, readonly=False, store=True)
readonly=False, store=True)
website_track_proposal = fields.Boolean(
'Proposals on Website', compute='_compute_website_track_proposal',
copy=True, readonly=False, store=True)
readonly=False, store=True)
track_menu_ids = fields.One2many('website.event.menu', 'event_id', string='Event Tracks Menus', domain=[('menu_type', '=', 'track')])
track_proposal_menu_ids = fields.One2many('website.event.menu', 'event_id', string='Event Proposals Menus', domain=[('menu_type', '=', 'track_proposal')])
allowed_track_tag_ids = fields.Many2many('event.track.tag', relation='event_allowed_track_tags_rel', string='Available Track Tags')
@@ -45,13 +45,13 @@ class Track(models.Model):
partner_id = fields.Many2one('res.partner', 'Speaker')
partner_name = fields.Char(
string='Name', compute='_compute_partner_info',
copy=True, readonly=False, store=True, tracking=10)
readonly=False, store=True, tracking=10)
partner_email = fields.Char(
string='Email', compute='_compute_partner_info',
copy=True, readonly=False, store=True, tracking=20)
readonly=False, store=True, tracking=20)
partner_phone = fields.Char(
string='Phone', compute='_compute_partner_info',
copy=True, readonly=False, store=True, tracking=30)
readonly=False, store=True, tracking=30)
partner_biography = fields.Html(string='Biography')
tag_ids = fields.Many2many('event.track.tag', string='Tags')
stage_id = fields.Many2one(