Commit Graph
402 Commits
Author SHA1 Message Date
Christophe Simonis 49c3264ce0 [MERGE] forward port branch saas-11.3 up to 4850fb0838 2018-09-07 14:43:48 +02:00
Christophe Simonis 21a186dadd [MERGE] forward port branch 11.0 up to 737ca0eb42 2018-09-06 18:13:56 +02:00
Pedro M. Baeza 89c1555096 [FIX] website: Unlink several website.page records
Avoid singleton error

This commit closes #26825

Partial backport of saas-15 - multiwebsite commit
2018-09-06 13:57:18 +02:00
Christophe Simonis 7717f082c0 [MERGE] forward port branch saas-11.3 up to af35aea6b0 2018-08-09 19:33:32 +02:00
Christophe Simonis 9cb97a8c2d [MERGE] forward port branch saas-11.2 up to 499af66727 2018-08-09 15:06:31 +02:00
Christophe Simonis efe2dcd7ae [MERGE] forward port branch 11.0 up to ced9156a97 2018-08-07 19:08:07 +02:00
Swapnesh Shah 174bd3a7ac [FIX] website: remove unnecessary ensure_one
The write works on multiple records

Closes #26033
2018-08-07 17:47:57 +02:00
Christophe Simonis c8bb02141d [MERGE] forward port branch saas-11.3 up to 3cdcbce93c 2018-06-28 19:01:52 +02:00
Christophe Simonis 40836194c2 [MERGE] forward port branch saas-11.2 up to 12ddec3a76 2018-06-27 13:41:00 +02:00
Christophe Simonis 68326b15f9 [MERGE] forward port branch 11.0 up to c5ed372970 2018-06-21 12:18:40 +02:00
Christophe Matthieu 9cd982bcc8 [FIX] qweb: use cdn for asset files
Refactoring of qweb to call _post_processing_att for each nodes. This
change remove the crappy ovewrite in website module. The website overwrite
only the _post_processing_att to add the cdn parameters.

The static node (without t- attributes) can stay static (remove overwrite
of _is_static_node), the cdn is applied at the compile time for this
nodes instead of at the running time like the dynamic node.
2018-06-15 08:42:15 +02:00
Christophe Simonis f36e6917bd [MERGE] forward port branch saas-11.3 up to 37eed7c509 2018-05-29 17:34:43 +02:00
Christophe Simonis 5a751fa200 [MERGE] forward port branch saas-11.2 up to aae54ecc15 2018-05-09 15:45:20 +02:00
Romain Derie b65cb86697 [IMP] website: remove page creation in menu manager + menu container
This commit:
1. removed the possibility to create page from the menu manager.
   The usability of this feature wasn't great since create menu as a new page
   would redirect to that newly created page without saving the menu manager
   state.
   Plus, there is already the 'NEW' button on the navbar to create a new page,
   the menu manager should, as its name hint, only manage menus.
2. Handle a new case (officially at least) of menu: menu container.
   Those menu are simply menus with '#' as URL. It will be usefull to create a
   menu as a dropdown list container.
   Note: We should take care of a menu's URL being updated to '#' to avoid the
         menu's page URL to be also edited to '#'.

opw-1825883 & opw-1824263
2018-05-09 15:38:58 +02:00
Christophe Simonis eeae2b80ea [MERGE] forward port branch 11.0 up to b793e23ae5 2018-05-09 13:55:27 +02:00
Romain Derie 665fcb62cf [FIX] website: always show menu if its a container with visible menus
Before this commit:
1. If a menu was used as a container (dropdown) and had an unpublished page_id
   (website.page), we would never show that menu (and so its submenus) even if
   it has visible submenu.
   Some users are stuck with this since they:
   a) create a new page 'A' (unpublished by default) included in menu.
   b) create a new page 'B' (unpublished by default) included in menu.
   c) set 'B' as a submenu of 'A' in the menu manager
   d) decide to publish the website.page linked to menu 'B'
   Then, since menu 'A' is linked to an unpublished page, the menu 'A' and 'B'
   are never visible.
2. If a menu is being created with an URL that match a website.page URL, the
   m2o relation will automatically be set (website.menu.page_id).
   Still, if the user type the URL without the leading slash, the m2o won't be
   set.
   This could be misleading since on the page property in the page manager the
   URL is being shown without the leading slash even if it is stored in DB.

Now:
1. We always show menu container if they contains visible submenu, even if the
   container menu is linked to an unpublished page
2. The page URL search is more clever and will match URL even if the only
   difference is the leading slash.

This closes #24635
2018-05-09 11:02:16 +02:00
Christophe Simonis 3a537c789a [MERGE] forward port branch saas-11.2 up to 55a14f9ce8 2018-03-27 19:41:30 +02:00
Christophe Simonis 87a0f4dc4c [MERGE] forward port branch 11.0 up to b33d5af4a7 2018-03-27 18:22:18 +02:00
Nicolas Lempereur bae7e32e4b [FIX] website: see versionning changes
Website Versioning module (website_version) is applied when displaying
views by interfering when doing the "render the view of this `key`" and
showing the view with the same `key` but of the currently displayed
version.

The website.page model when directly rendering a page would directly
specify its `id`, thus website version was bypassed and just the master
page was displayed.

With this commit website.page has a "get_view_identifier" that can be
overrided in website_version and has the same previous behavior
otherwise.

This changeset also solves a conflict (`website().get_current_website`
also modify `request.context`) when modifying the context which also
disabled versions.

opw-1824957
closes #23847
2018-03-26 10:53:23 +02:00
Christophe Simonis 0f57bdba72 [MERGE] forward port branch saas-11.2 up to 42659dc70c 2018-03-09 16:25:58 +01:00
Christophe Simonis a0aa939d9b [MERGE] forward port branch 11.0 up to fcb48b7241 2018-03-08 19:00:04 +01:00
Romain Derie 247f7db088 [FIX] website: use absolute href location after page url change
Before this commit:
When editing a page URL through page properties it would redirect to that new
url afterward. If the url was not starting with '/' and had multiple level
before and after edition (eg: page/action to page/realaction) it would then
redirect to a wrong relative URL.

Now, we ensure that we redirect to the correct URL: the one slugified and
cleaned in the backend.

Step to reproduce:
  - Create a page '/page/action'
  - Go to that page and open Page Properties
  - Edit the URL to 'page/someaction'
  - You will be redirected to the incorrect relative URL /page/page/someaction
2018-03-08 16:25:50 +01:00
Christophe Simonis 7d66953d17 [MERGE] forward port branch 11.0 up to bfe88c50e2 2018-03-08 14:06:54 +01:00
Jeremy Kersten b4f8ca0a34 [FIX] base: fix dev mode for inherits view
Before this commit, model that create ir_ui_view via _inheritS was ignored in --dev xml
The arch_fs was not set. Because it was not ir.ui.view, and because xml_id was suffixed by _ir_ui_view.

Now we manage the case of inherits. So if model model.name inherits ir_ui_view

class MyClass(models.Model):
    _name = 'model.name'
    _inherits = {'ir.ui.view': 'view_id'}

    view_id = fields.Many2one('ir.ui.view', string='View', required=True, ondelete="cascade")
    ...

<record name='model.name' xmlid='pok'>
    <field name='arch' type='xml'>content</field>
</record>

will be read from xml in dev mode.

parsing the xml file for xml_id pok_ir_ui_view and pok.
The orm by default will add this suffix.

The 'dynamic' view created when we update the groups is a special case, which we don't want the arch_fs
for dev mode because the xml only contains by default and an empty container and btw the imd was wrong
since we had the res.group model a xml_id into the _inverse_arch.

The page create via a template (method new_page) will automatically remove the arch_fs since we don't
want to see the empty container if we are in dev_mode.
2018-03-08 10:22:21 +01:00
Jeremy Kersten 68e9d5504c [IMP] website: make website.redirect fields required
Before this commit, it was possible to create redirect with empty values.
Now, for new db, that will be required.

Fix usability according to first feedback
   - Redirect / menu should be visible without debug mode
     because user need it when they start their website and
     dont know at the beginning how to enable it (fgi)
   - fa icon in page manager was for blind people
   - missing widget on sequence field
2018-03-02 18:03:01 +01:00
Raphael Collet e724858d50 [REF] models: use parent_path to implement parent_store
This replaces the former modified preorder tree traversal (MPTT) with the
fields `parent_left`/`parent_right`.  Each record is associated to a string
`parent_path`, that represents the path from its root node to itself.  The path
is made of the node ids suffixed with a slash:

              a                 node | id | parent_path
             / \                  a  | 42 | 42/
           ...  b                 b  | 63 | 42/63/
               / \                c  | 84 | 42/63/84/
              c   d               d  | 85 | 42/63/85/

This field provides an efficient implementation for parent_of/child_of queries:
the nodes in the subtree of record are the ones where `parent_path` starts with
the `parent_path` of record.  It is also more efficient to maintain than the
MPTT fields, and less sensitive to concurrent updates, because the value of
`parent_path` does not depend on sibling nodes.
2018-02-28 10:33:44 +01:00
Christophe Simonis a0d7763e09 [MERGE] forward port branch saas-11.2 up to 932e641be1 2018-02-23 17:20:52 +01:00
Christophe Simonis 9a84ba5533 [MERGE] forward port branch saas-11.1 up to e750bb6e11 2018-02-22 10:39:15 +01:00
Romain Derie 96a10815ab [FIX] website: Editing the URL of a menu with an already existing URL
Before this commit:
If you changed the URL of a menu linked (m2o) to a website page and the new URL
was already taken by another page, it would edit the menu.url and the
menu.page.url resulting in the menu's page having the same URL than the already
existing one.

Now, if you edit the URL of a menu linked to a page and the URL is already
taken by another page, we will simply change the menu/page m2o relationship
without writing on the menu's initial page's URL.
2018-02-19 17:38:38 +01:00
Martin Trigaux a2e76bb7e3 [FIX] website: correct typo 2018-02-19 15:48:11 +01:00
Romain Derie 4f418c26d5 [FIX] website: sitemap.xml incorrect domain
Before this commit, the domain use to retrieve pages in enumerate_pages was
wrong (mainly used for sitemap.xml). It would only show website.page that:
1. are published
2. are indexed
3. have a publishing date (whatever date, future or past).
Last point was incorrect

Now, we correctly retrieve pages that:
1. are published
2. are indexed
3. have no publishing date or a publishing date in the past
2018-02-15 23:13:50 +01:00
qdp-odoo 4a3df5256a [FIX] *: fixed decorators on copy() 2018-02-09 10:32:23 +01:00
Christophe Simonis b42b9c936b [MERGE] forward port branch saas-16 up to 3b7bf3a4b8 2018-01-12 18:15:23 +01:00
Christophe Simonis 3b7bf3a4b8 [MERGE] forward port branch saas-15 up to 8962b8ecc2 2018-01-12 17:23:10 +01:00
Christophe Simonis 8962b8ecc2 [MERGE] forward port branch saas-14 up to d35a76ee17 2018-01-12 16:47:12 +01:00
Christophe Simonis d35a76ee17 [MERGE] forward port branch 10.0 up to d76237e038 2018-01-12 16:16:51 +01:00
Christophe Simonis 4eaef03df3 [MERGE] forward port branch 9.0 up to 330f84f211 2018-01-12 11:25:58 +01:00
Romain Derie 0474de44c0 [FIX] website: unpublished homepage read error + first menu fallback
Before this commit:
1. If the website's homepage is unpublished and a public user naviguate on it,
it will log an access read error in the server. The user won't see the error
though.

2. If the user can't access '/', we serve the first menu's page instead.
This first menu's page can be an unpublished page, resulting in a 403, which is
not convenient.

3. Menus are sorted by sequence, then the ORM sort them by write_date.
Menu with same sequence will be sorted differently every time you edit one of
them. (This issue get hidden/solved if user edit and save the menus with
"Edit Menu" since it will recompute every sequence.)
  - Create 3 pages 'A', 'B', 'C', with 'Add page in menu' enabled
  - Menu is now 'A B C'
  - Edit website.page B (in property dialog), it will write on the page's menu
    aswell
  - Menu is now 'A C B'

Now:
1. We prevent this error by ensuring the page is published and so can be read
by anyone before accessing its properties.

2. We serve the first menu's page that is published

3. We sort menu by id after sequence to keep original order

This closes #21259
2018-01-11 13:33:30 +01:00
Romain Derie bf8519853f [FIX] website: hide menu if related to an unpublished page
Before this commit, if there was a menu entry linked to an unpublished
website.page, the menu would be shown. For restricted users, they would land on
a 403 forbidden.

Now, we dont show website.page's menu if user can't access it.

This closes #21328
2018-01-11 13:30:12 +01:00
Romain Derie 32701aa512 [FIX] website: menus with null URL would throw an error on display
Before this commit, if a website.menu had a URL set to null, it would throw an
error when displaying that menu.
It is normally not possible to do so in v11 but after a migration, menus can be
empty. (eg: Using an empty menu to display a divider in a dropdown menu)

Now we return an empty url instead of an error
2018-01-11 12:49:18 +01:00
Paul Catinean eded3cfda8 [FIX] website: check that website.user_id is not falsy
This field should be required.

This commits closes #21997

@kangol: diff in addons/website/models/ir_http.py is for existing db
It can be ignored in master because required will be apply
2018-01-10 13:09:32 +01:00
Romain Derie 9d2d9a3528 [FIX] website: edit website.page's menu URL not saving
Before this commit, editing a website.menu (linked to a website.page (m2o))
would not save the URL on the website.page record but only on the
website.menu.
But since the URL retrieved to display the website navbar is:
  1. The website.page url if the menu has a page_id
  2. The website.menu url otherwise
It would never get the edited URL stored on website.menu
2017-12-12 17:50:41 +01:00
rde a91a3a5633 [IMP] website: warn user about key change when editing special file name
The idea is to warn user if he created a special file (website.page with
supported extension) and he wants to change the file's name, which will at the
end also change the key).
If this special file has been t-called elsewhere, they t-call wont work anymore
This is why warning user is needed.

Note that this is different than the already existing page_search_dependencies
that is just checking if the URL is present in menus, templates, blog or pages.
This is about checking if the key is present somewhere. (we assume that if the
key is present, it is surely about a t-call.

Technically, the flow is:
1. Get supported extension
2. Get key dependencies
3. Check if user modify name
4. If name changed and it is/was a supported extension (special file) and it
   has dependencies (surely t-call) then warn user these call wont work anymore

--

search_page_dependencies is also improved by returning links to be clickable
(on delete dialog eg) and splitting template/page results.

it also refactor dependencies warning that was creating HTML in javascript into
using XML template
2017-10-12 16:20:42 +02:00
rde 53920fae31 [FIX] website: key from page's view was not unique in every cases
Before this commit, if you created a page with the same name as another one
(which is allowed) it would set the same key for that second page.
Indeed, the code was setting correctly the path uniqueness but it was then
setting the key based on the name and not on the unique url we found free.

Now, the key is correctly uniquely set and even better, it is now completely
independant from the url and has its own 'find unique' method to be sure it is
correctly working.
It was not clever to have key & url being linked.

To be more clear:
1. Create page 'aboutus'
	key  is 'website.aboutus'
	name is 'aboutus'
	url  is '/aboutus'
2. Create page 'aboutus' ->
	key  is 'website.aboutus'
	name is 'aboutus'
	url  is '/aboutus-1'
Problem: key should be unique (for t-call for specific files & website_version)
Cause: key is set based on name which is not checking for uniqueness like url.
Two possible solutions:
	1. Set key based on url (which is being checked for uniqueness)
	2. Create & Use a specific method to get unique key
Fixed with solution 2 which is more clean.

--

It also fix an invisible 'bug':
Saving a page being in menu would cause the menu's URL to get it's trailing '/'
to be removed. It was only a problem when you were getting the warning about
dependencies (the menu wouldn't be recognized as dependencies because of the
removed '/')
2017-10-12 16:20:42 +02:00
rde 7692f52ad5 [FIX] website: page url were not checked anymore for uniqueness
Before this commit, if you created 2 pages with the same name/url it could
create both the pages with the same url.

Now, like before, it is correctly adding a suffix (eg '-1') when you create a
page with an URL already taken
2017-10-12 16:20:42 +02:00
rde 3549078ef4 [REF] website: function inverse on computed field is_homepage
Before this commit, we were using data[] array from json call to write on
website model accordingly of is_homepage value.

Now, we use the newly created inverse function of the computed field to handle
that to make it more clear
2017-10-12 16:20:42 +02:00
Jeremy Kersten 48fa000bb2 [FIX] website: don't force a maxlength for key
That seems useless and break some code like the 'website menu' feature from website_event

This fix closes odoo/odoo#20023
2017-10-11 13:37:12 +02:00
rde 727d461e1d [IMP] website: create special extension page redirect backend + own template
Before this commit:
1. You could create a page with supported extension in the path (eg: myfile.js)
You would then be redirected to the webeditor (myfile.js?enable_editor..)
But in this case, it would just redirect you to a plain text page without odoo
layout because supported extension are rendered with a specific mimetype.
(is it is a .js page, it will just render the page content as a js file)
2. These kind of page would still call t-layout that you should be removed in
backend in order to make it work

Now:
1. You will be automatically redirected to the back end to edit your file
instead of landing on a text-only page.
2. Supported extension now have their own template (eg: .js file now have
<script text=..> tag added automatically in their content)
2017-09-30 16:11:48 +02:00
rde c837eaca9f [FIX] website: edit menu not showing url & mailto prefix with '/'
Before this commit:
1. you could not edit a menu URL because the input was hidden.
   This was due to radio options being switched (new page is now selected choice)
   when you create a menu.
   But when you edit, there is no choice and the input should be shown.
2. if you set a menu url to an email address, the display link would be prefixed
   by a / and so it would open mysite.com/mailto:XXX instead of just the mailto

Now:
1. Input is now hidden only when you add a new menu, not when editing a menu.
2. mailto link now works as expected: it will open your desktop mail software
2017-09-30 12:21:27 +02:00
Jeremy Kersten 29dec43ce8 [IMP] website_sale: replace signup by 'Sign In' in checkout
+ add link in confirmation page to propose the signup in b2c
2017-09-30 12:21:27 +02:00