Skip to content

Conversation

@ivantodorovich
Copy link
Contributor

@ivantodorovich ivantodorovich commented May 20, 2022

We've done a huge refactoring to this module in order to support core features found in regular events, but also for sessions.

Some highlights:

  • Dropped the event_mail dependency, make it work with core mail schedulers instead.
  • Support core voucher / badge reports for sessions.
  • Now event.session inherits from event.event (like product.product and product.template)
  • Make it easier to add more sessions to an event (refactored wizard, using recurrency-like rules)
  • Play nice with regular events (events that don't use sessions) -- it's possible to have both kinds at the same time
  • Implement (or attempt to) all core event features with sessions, but nothing more.

(and naturally there's also the event_sale_session module, and some others to implement them in website and pos)

@chienandalu I understand you're using this module in previous versions, and such a big change may not be welcomed. Consider this a RFC rather than a migration PR, to see if we can join forces

chienandalu and others added 30 commits May 20, 2022 15:53
* Rename 'date' to 'date_begin' for being homogeneous with event fields
* Split tests
* Remove 'start_time' and 'end_time' as no needed
* Convert hours to UTC for avoiding timezone issues
- Fix tz in calculated name
- Fix tests
- Add event sessions count to reports
- Fixes computing update of stored value
- Fixes views and reports
- Fixes generator not creating last day sessions
- Totalizations in session tree view
- Security config
- Adds es_ES translations
- Fixes seats limits on sessions
- Fix report query
- Adds progress bar to sessions tree view
- Improves tests
- Fixes seats limit check
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: event-12.0/event-12.0-event_session
Translate-URL: https://translation.odoo-community.org/projects/event-12-0/event-12-0-event_session/
The big issue with this kind of code is that if you have a user with a
certain locale being used, it will override the locale system wide and
the next request on the server may have the dates formatted with
strftime in a different language than expected...

The other issue is that some systems do not provide a set of actual
locales so on a server running in docker without manually modifying
a dockerfile to install a set of locales, it may fail to switch
the locale to a non existing one. It will just fail to compute the field.

Babel is already a dependency of odoo and it's a bit strange to not use it.

Get the locale the same way ir.qweb.fields do

This commit use the same method as ir.qweb.fields to get the locale
to use to translate a date. The previous code didn't took into account
a case where the lang is undefined and this case also use the same
default language as defined in odoo en_US.

As a result, the behaviour of event_session is more in line with
the current behaviour in odoo which is to default to en_US if locale
is undefined. With the global locale setting, the default locale
would be the system one so it may give different result or strange
behaviours or simply prevent correctly working without manual
intervention on the host.. While babel is already supported and used
by odoo.

Modified the test to actually test correctly the date formatted

As the default lang is en_US the format of a date is the following:

- month/day/year

And time format is on 12 hours so not 22:00 to 23:00 but 10:00 PM to 11:00 PM

With those changes, setting the locale to en_UK,en_CA will render the correct date using

- day/month/year and hours on 24h.

Added tests to confirm the translations work correctly on some locales

Check case when locale=None should default to en_US
Check that lang change is correctly taken into account.
Check that it works with languages returning unicode text (Russian)
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: event-12.0/event-12.0-event_session
Translate-URL: https://translation.odoo-community.org/projects/event-12-0/event-12-0-event_session/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: event-12.0/event-12.0-event_session
Translate-URL: https://translation.odoo-community.org/projects/event-12-0/event-12-0-event_session/
When we create a session with seats_max = 0, we get an error when we try
to view it.

Doing this changes we achieve to avoid None values on the fields
seats_available and seats_available_pc
Attendee count is failing because records are being accumulated without taking into account possible changes in event.registration

With these changes, it is possible to correctly calculate the count of attendees.

TT29930
@ivantodorovich ivantodorovich force-pushed the 15.0-mig-event-session branch from 764c088 to 68ff7c1 Compare July 29, 2022 14:46
@ivantodorovich ivantodorovich force-pushed the 15.0-mig-event-session branch from 68ff7c1 to d6d0d05 Compare August 5, 2022 17:41
ivantodorovich and others added 2 commits August 5, 2022 15:04
* Dropped the event_mail dependency, make it work with core mail schedulers instead.
* Support core voucher / badge reports for sessions.
* Now event.session inherits from event.event (like product.product and product.template)
* Make it easier to add more sessions to an event (refactored wizard, using recurrency-like rules)
* Play nice with regular events (events that don't use sessions) -- it's possible to have both kinds at the same time
* Several UX improvements
* Added more tests cases
@ivantodorovich ivantodorovich force-pushed the 15.0-mig-event-session branch from d6d0d05 to c385298 Compare August 5, 2022 18:04
@github-actions
Copy link

github-actions bot commented Dec 4, 2022

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Dec 4, 2022
@pedrobaeza pedrobaeza removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Dec 6, 2022
@pedrobaeza
Copy link
Member

@chienandalu can you please review this?

@rafaelbn
Copy link
Member

rafaelbn commented Dec 9, 2022

/ocabot migration event_session

@OCA-git-bot OCA-git-bot added this to the 15.0 milestone Dec 9, 2022
@OCA-git-bot OCA-git-bot mentioned this pull request Dec 9, 2022
16 tasks
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@pedrobaeza
Copy link
Member

@chienandalu is it OK for you this refactoring?

@chienandalu
Copy link
Member

Looks good (thanks for the work @ivantodorovich !), but I have to do an in depth review

@ivantodorovich
Copy link
Contributor Author

Thanks a lot @chienandalu :)

@pedrobaeza
Copy link
Member

Should we merge then, @chienandalu, or are you going to do the review before the merge?

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 15.0-ocabot-merge-pr-275-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 4cef6e1 into OCA:15.0 Mar 5, 2023
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at df44210. Thanks a lot for contributing to OCA. ❤️

@ivantodorovich ivantodorovich deleted the 15.0-mig-event-session branch March 6, 2023 11:59
@ivantodorovich ivantodorovich restored the 15.0-mig-event-session branch March 6, 2023 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.