summaryrefslogtreecommitdiff
path: root/addons/website_blog/models
AgeCommit message (Collapse)Author
2021-02-04[FIX] website_blog: Traceback on archived blogGoffin Simon
Steps to reproduce the bug: - Create a blogpost in the the blog 'travel - Archive the blog 'travel' - Open the blogpost Bug: A traceback was raised opw:2444406 closes odoo/odoo#65204 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-01-06[FIX] mail: send notification mail with right access link when using mail.threadAchraf (abz)
PURPOSE Notification may be sent using a generic mail.thread record, notably when sending user notifications. In that case links to view document are incorrect. HOW TO REPRODUCE Issue - Install "Approvals" - Submit new approval with you as "Request Owner" - Click on "View Approval Request" in your mailbox The link redirects to a 505 error Cause The model is not the correct one and the res_id is undefined Solution Specify the model and the res_id to _notify_get_action_link when creating the link with kwargs SPECIFICATIONS Propagate message value through various notification sub methods. That way we can rely on them if model seems void. Also limit values given as URL parameters to some white listed values. LINKS opw-2358846 Task ID-2379766 Followup of odoo/odoo#60998 Followup of odoo/odoo#61545 Closes odoo/odoo#63292 Closes odoo/enterprise#15585 closes odoo/odoo#64170 X-original-commit: 2b6d2b71f6c60bcf64db440473c88d1dc335acbf Related: odoo/enterprise#15588 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Co-authored-by: Achraf Ben Azzouz <abz@odoo.com> Co-authored-by: Thibault Delavallée <tde@odoo.com>
2020-07-22[IMP] website_[blog/shop/forum]: rename routes to remove 'useless' partJeremy Kersten
Url for a product become: /shop/productname-id instead of /shop/product/productname-id Url for a blog post become: /blog/blogname-1/blogpost-1 instead of /blog/blogname-1/post/blogpost-1 Url for a question on forum become: /forum/forumname-1/title-1 instead of /forum/forumname-1/question/title-1 task-2295016
2020-06-18[IMP] *: replace to new _() syntaxMartin Trigaux
Using a few regex like \((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\) ($1, $3)) Old syntax is still compatible but starts the migration to the new syntax that catches error.
2020-05-01[IMP] website: simplify website menuDramixDw
Some apps, once installed, automatically create a menuitem in website. What complexify the UI and create useless menu withtout plusvalue. It is not because you install livechat to make support online, that you want a link in your menu to show stats e.g. Now we remove the default menu created, and help user to find it when he create a link. The autocomplete suggest most of the main App's controllers task-2189613 closes odoo/odoo#49081 Related: odoo/enterprise#9733 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-04-27[IMP] website_blog: perf - related author name avoid query res.partnerJeremy Kersten
We use `author_id` (res.partner record) to instanciate our frontend widget address so it can be changed through left panel in a searchable list. This require a read on res.partner to get his name, even for visitors. Using a related will have the same result for visitors while it won't need to query res.partner table. task-2211013 Co-authored-by: Romain Derie <rde@odoo.com> Co-authored-by: Jeremy Kersten <jke@odoo.com>
2020-04-27[IMP] website_blog: perf - store related website_idJeremy Kersten
Without this commit, a simple search like: `env['blog.tag'].search([('website_id', 'in', (1, False))])` would generate 4 SQL queries instead of 1. 3 requests would be done on `blog.blog`, see `right_ids` at ORM level. task-2211013 Co-authored-by: Romain Derie <rde@odoo.com> Co-authored-by: Jeremy Kersten <jke@odoo.com>
2020-03-19[FIX] website_blog, website_event: prevent wrong meta og:image URLRomain Derie
Without this commit, if the cover properties's background-image contains single quotes in the `url()`, that will lead to 404 image in SEO dialog. It will also lead to wrong og:image in the DOM. Before: `<meta property="og:image" content="'website_blog/static/src/img/cover_1.jpg'"/>` Now: `<meta property="og:image" content="http://localhost:8069/website_blog/static/src/img/cover_1.jpg"/>` This is the case for all our demo data. closes odoo/odoo#47994 X-original-commit: 2338f8ecc8c21299774e288ab07bb084a58cc7ab Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com> Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2020-03-17[IMP] website_blog: clean blog.post codeOkan SUMER (osu)
This commit modify code to adjust or add small features : - Add '(copy)' at the end of a duplicate blog.post - Create a field that count the number of blog.post and adding it in the blog.blog tree view - Add author_id column in blog.blog tree view - Disable the modification of the number of comments and the is_published red label in the frontend - Create a link anchor to the comments section on the number of comments (In blog.post frontend view) - Redirect to the comment section of the current blog.post if logging in from the button in this same area Part of https://github.com/odoo/odoo/pull/46242 task-2201675 closes odoo/odoo#46242 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-04[IMP] website_blog, *: review latest posts snippetSamuel Degueldre
* website This commit reviews the latest post snippet(s). It fixes the list style option and renames it to "Hover effects", most of the css for those effects were broken, since the XML had been altered in bb0cdec and the css had not been adapted, resulting in most rules being unable to target anything. The number of posts option has been removed in favor of a fixed number that depends on the screen size so that the layout looks good on all devices (3x1, 2x2 1x3), this makes the layout more responsive and prevents having a select with 10 options where most choices would result in a poor layout. The list, big picture and horizontal layouts of this snippet have been fused, and the layout is now an option on the snippet. A new 'cards' layout similar to the one on odoo.com/blog has been added as well. Lastly, a new option has been added to choose which posts are displayed: most recent or most viewed. task-2152188 PR: odoo/odoo#42466
2020-02-04[IMP] website: make cover_properties a mixin fieldRomain Derie
Next commit will add new cover properties entries for the bg color. Still, we want a default `bg-primary` class. Instead of addind 3 new default value in existing cover_property fields, the chance is taken to make a mixin out of that field to avoid code duplication. task-2144335
2020-02-04[REM] website(_blog/_event): remove filtercolor option on coverRomain Derie
task-2144335
2020-02-03[IMP] website(_blog/_slides): show a toaster when a record is publishedRomain Derie
This commit shows a toaster when publishing a record through the toggle in the topbar. The `_description` field is used to do that, as it is supposed to contains a 'business oriented' descriptive name, see task-37311. Indeed, this field is used in studio and in mail templates. task-2144335
2020-01-08[IMP] website, *: add full height option and scroll down buttonSamuel Degueldre
*: website_blog, website_event This commit adds a "Height" option to sections, allowing them to have a minimum height of the user's choosing (either full screen height or half screen height, similar to blog covers). Enabling the full screen option also allows the user to add a "scroll down button" that will scroll down to the next section, also similar to blog covers. As such, the classes doing the corresponding things in website_blog and website_event have been renamed to reuse the same code. task-2155710 closes odoo/odoo#41623 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-12-02[REF] mail, various: rename subtype parameter of message_post to subtype_xmlidThibault Delavallée
PURPOSE Clean posting process and improve mail.message definition and comprehension. SPECIFICATIONS In order to be more explicit subtype parameter is renamed to subtype_xmlid. It therefore clearly indicates it should be a valid subtype Xml ID. Support of ill formatted Xml IDs is removed because there is no reason to try to add some random prefix. Give something that exists or go to hell, punk ! LINKS Task ID 2071556 PR #38692
2019-10-02[IMP] mail: enforce kw args for message_{post/notify/log}Stéphane Bidoul (ACSONE)
Since there are message_post overrides using the form `def message_post(self, **kwargs)` in some modules, this method is intended to be invoked with keyword arguments only. This commit enforces this behavior. Calls such as `message_post("body")` will fail regardless of which addon is installed, forcing users to use `message_post(body="body")`. It also fixes a message_post override in hr, and applies the same mechanism to message_notify, and _message_log. closes odoo/odoo#33306 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-09-19[IMP] *: remove image_64 and clean viewsSébastien Theys
There are too many image sizes. Since they are stored resized this takes time to generate when saving a new image, it's more rows on the attachment table, more files on the disk, ... 64px is close enough to 128px that it can be removed without a big impact on download size. It will even reduce download and number of requests when both images are displayed because now only one has to be downloaded and then benefit from cache. The difference between the two is typically around 1.5kB which is negligible these days, especially when the request overhead is around 0.5kB already, not even taking into account other factors such as latency. If a 64px image must absolutely be returned, it is still possible to pass the size parameters to the image route. But the current guideline is to handle resizing in the views when necessary. Views ===== - remove width and height attributes when existing CSS rules are overriding them (eg. `.oe_kanban_avatar` in the right context) - add CSS rules instead of width and height attributes when possible - use `object-fit: cover;` where width and height are forced to avoid distortion of non-square images - for products, use `object-fit: contain;` instead, keep ratio but without crop - add new CSS rules where the expected size was max 64px*64px before due to the image size itself - remove `img-fluid` where using size classes to avoid conflicting rules task-2060865 closes odoo/odoo#36147 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2019-08-28[FIX] website_blog: remove ranking computed fieldJeremy Kersten
No more used closes odoo/odoo#36188 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-26[IMP] website_blog: improve layout with latest specsJeremy Kersten
- Hide first post when latest not in full width mode - Hide navigation Blogs when only 1, else always shown - Compress image - Show blog name when in one blog index, show latest when in all blogs - Merge 2 controllers in one /blog and /blog/<record> - ... task-2057433 closes odoo/odoo#36091 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-20[IMP] website_blog: refactoring python code for new layoutJeremy Kersten
task-1973902 + use of img locally + last PO review: + show latest in the list + remove underline + force same height if blog or not + ... closes odoo/odoo#34609 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-20[REF] website_blog: new blog layoutsri-odoo
task-1973902
2019-08-16[IMP] website_blog: set blog posts as articles with extra SEO tagsYenthe666
closes odoo/odoo#35060 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-03[IMP] *: correctly read/write website_publishedRomain Derie
The `website_published` field from the website's mixins is basically a readonly from `is_published` field. On read, this field will simply read `is_published` and check if the record's website_id is accessible (only for the multi mixin). On write, it will always write on `is_published`. This commit improves a few things: - A lot of code was writting on website_published which was just then writting on is_published. Writting directly on is_published makes more sense. - Some backend fields would still reference `website_published` instead of `is_published` which would just go through the related for no reason. Plus, using `is_published` will make the field tooltip more accurate as we are not in a website context ('Visible on current website' to 'Is Published') - Filter and search on tree view were still using the `website_published` related field, which is just a readonly when we are not in a frontend context. - Some create and write function would have security check on `website_published` value but that was wrong as the user could bypass that by simply writting on `is_published`. For the write method, check `is_published` is more accurate as it will cover both case since `website_published` will then call the write method on `is_published`
2019-08-02[IMP] *: rename image fieldsSébastien Theys
image_original => image_1920 (now resized to 1920) image_big => image_1024 image_large => image_256 image_medium => image_128 image_small => image_64 image replaced by image_1920 (when writing) or by image_1024 (when displaying what was previously the big size) + add new intermediate format: image_512 PR: #34925
2019-07-17[REM] *: calls to @api.multiAdrian Torres
Multi is the default api for methods, it is not necessary to explicitly decorate methods with it, adds clutter and most people use it because they see that the rest of the code uses it. Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-12[IMP] mail: prepare new SMS model by updating mail.notificationThibault Delavallée
This commit prepares SMS refactoring by updating some mail models. Purpose is to be able to store SMS notification information inside existing mail flow and models. Main changes * mail.notification: define a notification_type field to store the medium used to notify people. In mail two ways exist: inbox and email. It will ease introduction of SMS notification mechanism. This field replaces the is_email boolean field; * mail.notification: make res_partner_id field not required. This means notifications could be linked to something else than a partner. An SMS for example. For Inbox and email notifications partner is still required and a constraint is added accordingly; * mail.thread: let notification methods handle the creation and update of their notification instead of creating them in _notify_thread and tweaking them in sub notification methods; * mail.thread: clearly move inbox-style notification in its own method like notify by email; Some lighter code changes * propagate message_type to notification recipient computation. It will allow for example to be more precise when computing a notification type depending on the message_type. For example, send a notification by SMS when the message_type is SMS; * ease inheritance of ``_notify_thread`` by returning computed recipients data. It will allow to work on it without having to re-compute it; * propagate kwargs from message_post and message_notify to notify methods. This allow to avoid depending on context and set explicit parameters. Drawback is that message_post and notify must separate kwargs used to create a message and those that are propagated to notification methods; * update various notification check to ensure they work on email notifications, notably the resend and cancel wizards; One side effect of this commit is that notifications are created by the relevant notification method. Previously all notifications were created by writing on needaction_partner_ids fields then updated according to the notification process. Notably there could be too much notification created when sending emails due to _notify_customize_recipients not being correctly synchronized with notification. This issue is now solved as only really sent emails create notifications. Migration tips * notification_type: notification.is_email and 'email' else 'inbox'; * remove is_email; Related to task 1922163 Linked to PR #33510
2019-05-29[IMP] mail: reduce message_post query count and clean codeXavier-Do
Purpose of this commit is to improve performance of post and notify through various code improvements. Containing * making of _notify_customize_recipients a mail.thread method; * _message_auto_subscribe_followers optimized; * renaming and optimisation of _notify_partners; * message_post_attachements optization; * remove unused mail_post_autofollow_partner_ids context key; * minimize message create queries; * only check record related access right for thread messages not in pending moderation; * get attachements from values instead of db; * storing lang in ctx from the beginning; * don't track on write on attachments; Related to task 1943901 Linked to PR #32404
2019-05-29[REF] mail: simplify notification codeXavier-Do
Purpose of this commit is to clean notification process: calls, methods API, method name, variable propagation. Contains notably * simplify API of methods used to group recipients when sending notification emails; * improve and rename methods used in email notification process; * move some methods on model itself as non mail thread records could be mass-mailed and _notify_email_headers could be called on other records; Related to task 1943901 Linked to PR #32404
2019-04-05[IMP] website: improvements in SEO dialogParth Choksi
In this commit, we have changed behaviour of SEO dialog. Now when you keep title and description fields empty, then the page will use default title and description. We have added default_title and default_description to render the preview with default values when title and description fields are empty in SEO dialog. Task ID:1949636 closes odoo/odoo#32449 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2018-09-27[REF] *: adapt code to new related default behaviourAdrian Torres
This commit adapts the business code to changes introduced by the parent commit in order to keep the same behaviour as before. All readonly=False fields will have to be checked afterwards to confirm that the business case requires write access to the source field.
2018-08-23[FIX] *: decorator `returns` on `message_post`Raphael Collet
2018-08-22[IMP] website_blog: Remove meta from website_blog template.Kishan Gajjar
add default meta tags into product page by override '_default_website_meta' in 'blog.post'
2018-08-13[IMP] website_[blog|event|forum|sale|slide]: make website specificJeremy Kersten
Set up env & tools for module website multiwebsite (blog, event, sale..) website_id in modelConverter and ir_rule add _compute_domain_keys to have a different cache per website or rules would not be correctly website_dependant eg: blog 1 on website 1, blog 2 on website 2 access blog 1 from website 1 => can access -> normal access blog 1 from website 2 => can access -> should crash because (ir rule) split mixing website.published.mixin and website.published.multi.mixin to have website_id only on last one. multi mixing will: - override website_published compute to take current_website into account (not in backend) - force website when clicking on published in backend - website blog, website_sale, website_event, website_forum, website_slides are now multi website Co-authored-by: Derie Romain <rde@odoo.com> Co-authored-by: Kersten Jérémy <jke@odoo.com>
2018-08-07[REF] mail: propagate recipient data through notification processThibault Delavallée
Purpose of this commit is to avoid browsing and prefetching data about recipients when notifying a message to partners and channels. Mail message _notify computes all necessary data in a single query. This commit allow to re-use this data by propagating it through the call chain. Addons inheriting from classification methods used when sending notification emails are updated accordingly to the API and data update. This commit is linked to task ID 47934 and PR #24033. No functional change should occur with this commit.
2018-08-06[REF] *: use native date/datetime for Date/Datetime fieldsRaphael Collet
From this commit onwards, Date fields will return datetime.date objects and Datetime fields will return datetime.datetime objects, this implies a number of things that are clearly explained both in the ORM API for master. This commit also introduces a number of helper functions for dates and datetimes that are exposed in tools.date_utils and fields.Date[time], explained in the documentation as well. Task-ID: 47189
2018-07-27[REF] *: BS4, adapt col-related classesqsm-odoo
col-lg-* -> col-xl-* col-md-* -> col-lg-* col-sm-* -> col-md-* col-xs-* -> col-* col-lg-offset-* -> offset-xl-* col-md-offset-* -> offset-lg-* col-sm-offset-* -> offset-md-* col-xs-offset-* -> offset-* col-lg-pull-* -> order-xl-1 col-md-pull-* -> order-lg-1 col-sm-pull-* -> order-md-1 col-xs-pull-* -> order-1 col-lg-push-* -> order-xl-2 col-md-push-* -> order-lg-2 col-sm-push-* -> order-md-2 col-xs-push-* -> order-2
2018-07-13[MERGE] forward port branch saas-11.2 up to 87dadc5bc83Christophe Simonis
2018-07-13[MERGE] forward port branch 11.0 up to 6e6e3d4c964Christophe Simonis
2018-07-06[FIX] website_blog: fix typo in 83bfdb0d212a99d808fa4d0dc9d3ebe3ce469a18Olivier Dony
2018-04-16[MERGE] forward port branch saas-11.2 up to 90f8f17fb4fChristophe Simonis
2018-04-09[IMP] website_blog: Add category to blog tags, Archives collapsedAkash Bhavsar
This commit allow to sort blog tag by category. And display archives by default folded to avoid 5 years x 12 months => 65 list items open Task-34417
2018-04-06[MERGE] forward port branch 11.0 up to d277adf4d59Christophe Simonis
2018-04-06[MERGE] forward port branch saas-15 up to 97a70c2d8e4Christophe Simonis
2018-04-06[MERGE] forward port branch saas-14 up to 5eb6e14e85fChristophe Simonis
2018-04-05[MERGE] forward port branch 10.0 up to a93a5c6824eChristophe Simonis
2018-04-05[FIX] website_blog: cut teaser after 150 charsMartin Trigaux
Space as word separator does not work in some non-latin languages like Japanese. Cut arbitrarily after 150 chars Closes #23219
2018-02-26[REF] various: clean override of _notify_get_groupsThibault Delavallée
Overrides of _notify_get_groups are used to add some buttons in notification emails and control the display of "Access document" button. This commit cleans some overrides : * accounting: portal users that are not the customer have no access to the invoice and should not have the access button; * project: remove unnecessary override on project model and consider portal users have access to the document through customer portal; * sale: portal users that are not the customer have no access to the sale order and should not have the access button; * website_blog: display access button to everyone only if the post is published; otherwise keep standard behavior; * website_forum: display access button to everyone only if the post has not been closed or deactivated; otherwise keep standard behavior; * website_slides: display access button to everyone only if the slides has been published; otherwise keep standard behavior;
2018-02-26[REF] mail: rename notification methods related to recipientsThibault Delavallée
This commit renames some internal mail.thread methods linked to the notification process. This is the next commit of a series aiming at improving code readability and method finding through prefixes. See notably cae1c3977ff2777dcb77e4c2a51deb72ee57db22, cdfe479e2e92b8bfc4e4d5bb32c1db8ad5c431d6 and fc1348dd3d73c2a5fbcc043f75b00272fedd6b20. This commit does not change any functional feature. It does only rename notification-related methods, using the _notify prefix to ensure they are private and to mark they are part of the notification process.
2018-02-01[MERGE] forward port branch saas-11.1 up to 7e469eb77aaChristophe Simonis
2018-01-29[MERGE] forward port branch saas-16 up to 0b188b58046Christophe Simonis