diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-01-28 15:38:46 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-01-30 15:18:08 +0000 |
| commit | ec121565ccc5b9ab42bf381db15a08c98e76afba (patch) | |
| tree | 7aa39ceca2ae206f29bac541c204e018fd0deff9 /addons/website_event | |
| parent | 623a226beb3f432446e4373e39e5511eec7401a7 (diff) | |
[IMP] event: clean code about synchronizing partner / sale order line
PURPOSE
This commit is part of ticket model support directly in event application.
SPECIFICATIONS
In this commit we make a quixotic attempt to clean call chain implied by
making registrations online, either in event frontend (website_event) or
with eCommerce inclusion (website_event_sale). Purpose is to get rid of some
preparation and data management methods to handle most of the code directly
at CRUD level whenever it makes sense.
We notably
* move at create and write level support of partner_id update: updating
its name / email / phone / mobile;
* move at create and write level support of sale_order-id update: updating
event, ticket, partner;
Using that and some code cleaning some methods are removed and call chain
is a bit reduced.
LINKS
Task ID 2177281
Community PR #43488
Diffstat (limited to 'addons/website_event')
| -rw-r--r-- | addons/website_event/controllers/main.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/addons/website_event/controllers/main.py b/addons/website_event/controllers/main.py index 15c83004bb2..d4d8e7f06ca 100644 --- a/addons/website_event/controllers/main.py +++ b/addons/website_event/controllers/main.py @@ -290,10 +290,11 @@ class WebsiteEventController(http.Controller): Attendees = request.env['event.registration'] registrations = self._process_registration_details(post) - for registration in registrations: - registration['event_id'] = event - Attendees += Attendees.sudo().create( - Attendees._prepare_attendee_values(registration)) + for registration_vals in registrations: + registration_vals['event_id'] = event.id + if not registration_vals.get('partner_id'): + registration_vals['partner_id'] = request.env.user.partner_id.id + Attendees += Attendees.sudo().create(registration_vals) urls = event._get_event_resource_urls() return request.render("website_event.registration_complete", { |
