Commit Graph
52 Commits
Author SHA1 Message Date
Thibault Delavallée faea658382 [IMP] website_quote: use generic portal signature widget
Online quote can now use the generic signature widget already used on
the standard sale customer portal. We therefore remove the custom
widget build in website_quote.

A route already exists to sign quotes; the old route is removed. The
existing route is overridden so that quotations with template requiring
payment cannot be signed. This is the expected behavior.
2017-09-06 10:40:32 +02:00
qsm-odoo 2972976962 [REF] web_editor, website, *: complete refactoring
* mass_mailing, payment, point_of_sale, portal, survey, web, web_tour,
  website_blog, website_crm_partner_assign, website_event,
  website_event_questions, website_form, website_forum, website_gengo,
  website_hr_recruitment, website_links, website_mail,
  website_mail_channel, website_mass_mailing, website_quote,
  website_sale, website_sale_options, website_slides, website_twitter

This commit reviews the whole "JS side" of the web_editor and website
apps. This is a first step to be able to improve them with new and
better functionnalities; this commit is not supposed to change any
visual behavior.

The main goal was to achieve a structure similar to the backend one.
Now, the frontend side also has a root widget (like the WebClient)
and all other widgets are attached to it one way or another. This allows
the benefits of using the 'trigger_up' functionnality for example.

As RPC are now mainly done with the `this._rpc` functionnality (being
possible thanks to the parent hierarchy), the frontend will also be
possible to test thanks to QUnit in a future update (besides the "text"
editor side which still requires a refactoring to be able to do that).

---

Here are some of the changes:

(-) conventions and documentation

The code has been updated to follow JS conventions and a lot of code has
been commented (around +2000 lines of comment). This also means that
lots of functions have been renamed to use camelCase or simply to make
their name understandable.
See https://github.com/odoo/odoo/wiki/Javascript-coding-guidelines.

(-) deprecated: web_editor.base

The "web_editor.base" module has been split and does not force the
modules which require it to wait for DOM ready anymore. This was indeed
slowing loading times, but also prevented to use some modules in some
contexts (see the LESS editor use in web_studio which is the subject of
another task).
Now the "editor context" can be got thanks to the "web_editor.context"
JS module with its "get" function.
The "web_editor.base" module should probably not be used anymore (see
its code and recent updates).

(-) new: web.dom_ready

If a JS module should wait for the DOM to be ready to be executed, a
new JS module has been created: "web.dom_ready". This should always
be used in a module which only want to instantiate stuff. Do not
extend (or worst, include) classes after DOM ready.

(-) website.website

The "website.website" module has been split. "website.website" does not
return anything useful anymore, it just initialize some miscellaneous
stuff, without waiting for the DOM to be ready. You might want to check
"website.utils", "website.content.compatibility" or `WebsiteRoot`. Also
`website.form` has been deleted (use `this._rpc`), so has been
`website.error`. `website.prompt` will be removed in a future update to
be replaced by `Dialog.prompt`.

(-) widgets are great

Many classes which were not widgets are now widgets. This allows them to
use the 'events', the 'xmlDependencies' and the 'this._rpc' features for
example. Here are some of the main ones:

- Snippet options: these were classes with a `$el` for the menu element
    and `$target` for the customized element. This is still the case
    but following standard `Widget` structure (one exception: using
    `this.$(...)` searches in the `$target` as before this update).

- Snippet animations: instead of class instances with a `$target`
    element which can be `start` and `stop`, these are now standard
    widgets which can be `start` and `destroy`. `this.$target` is
    an alias to `this.$el` for ease of compatibility.

- Snippet editors: instead of class instances in charge of an editor
    overlay, these are now widgets. Each "child" snippet editor is
    properly attached as a "child", which allows editors to communicate
    and to be properly destroyed.

(-) root widgets and website navbar

The frontend is different of the backend. In the backend, the page has
an empty <body/> element and all the components are instantiated from
parent to children (i.e. the `WebClient` is instantiated and is in
charge of instantiating the `ControlPanel`, etc). The frontend cannot
work like that on page loadings as they are way more frequent than in
the backend and we do not want them to flicker. A frontend page is
loaded as a <body/> element which already contains the website navbar
and its menus and the whole content page. JS code has to be "attached"
to these existing elements. This is possible thanks to the `RootWidget`
instances and the specialized `WebsiteRoot`, `IframeRoot` and
`WebsiteNavbar` (see code for details).

(-) lazy loading

No more (or at least a lot less) XML/JS has to be loaded on page
loading, thanks to the use of the `Widget.xmlDependencies` feature.
XML which have to be lazy loaded is loaded only on related Widget
instantiation if necessary, which allows to execute a lot of JS code
before the DOM is ready and to start many widgets on DOM ready (not
later). A visual benefit of this is clicking on the 'edit' button as
soon as it is possible: before this commit, this was sometimes not
doing anything as event handlers were not binded yet.

Still a possible exception: loading the session and locales. This may
be asynchronous stuff which is still required before widget
instantiations but this will be the subject of another task.

(-) deprecated code and code location

More than reviewing code and organizing it, many apparent dead code was
removed. More importantly, mislocated code was put in the right app.
This is the case for snippet animations which is a concept for website
apps but was defined in the web_editor app, or some translation concepts
which were part of website but should have been part of web_editor.

---

There are probably more things to say about this commit but I will let
the comments speak for those.
2017-08-16 11:04:14 +02:00
Christophe Simonis fa3e89064a [MERGE] forward port branch saas-16 up to 104dfe3c07 2017-07-20 11:48:49 +02:00
Christophe Simonis b31cd558e5 [MERGE] forward port branch saas-14 up to b857fd4c90 2017-07-19 17:04:28 +02:00
Christophe Simonis 11270336fa [MERGE] forward port branch saas-11 up to f07ca36b9b 2017-07-19 16:18:40 +02:00
Christophe Simonis f07ca36b9b [MERGE] forward port branch 9.0 up to 41433debdb 2017-07-19 16:16:57 +02:00
qsm-odoo 9494161e23 [FIX] website_quote: increase robustess of menu generation
On online quotations, a left menu is automatically generated on page
load by searching for the <h1/> and <h2/> elements in the page. This
also considered the empty ones which do not make sense and were
breaking the menu's layout. Ideally, there should not be any empty
title in the page.

opw-752764
2017-07-19 09:25:11 +02:00
Thibault Delavallée ef2d828463 [REF] website_quote: use new sale_payment module
Online quote now uses JS code from payment module in order to make online
payments. Front-end template is updated to use o_payment_acquirer_button
generic class for payments and data is added to be managed by payment.js.
This allows to remove some strange code parsing the url to find the order
ID and token instead of using rendered values.

A payment controller is removed because it was only a shortcut to another
one. In transaction controller token parameter is renamed to access_token
to avoid confusion with payment token and match the payment and website
sale naming.

Online Quote controller now uses tools method from sale_payment module
like website_sale. This way it is now standardized and moved out of
controllers that should not perform so much model-level computation.
2017-06-06 11:05:25 +02:00
abh 718290a530 [IMP] website_quote: applied padding on the title hidden in the navagitaion bar 2017-01-09 15:55:30 +01:00
Christophe Simonis 235ed4b2c1 [MERGE] forward port branch saas-12 up to 9ad5f26 2016-08-20 18:08:19 +02:00
Christophe Simonis 3a2147d95c [MERGE] forward port branch saas-10 up to bc1a0a3 2016-08-20 16:57:36 +02:00
qsm-odoo 3363facfe4 [IMP] website_quote: use affix to block the sidebar when scrolling
Sometimes, the sidebar on quotation previews can overflow the footer
if the window height is too small. To prevent that, the position of
the sidebar is blocked before overflowing, thanks to affix.
2016-08-04 17:33:11 +02:00
qsm-odoo 566e0a2706 [FIX] website_quote: set correct fixed sidebar width
The sidebar on the left of the quotation previews was placed with
position fixed in a col-md-3. Position fixed elements have their
width computed according to the window dimensions which is why it
cannot be 100% to fit the col-md-3. To achieve that, the old solution
was to set the width in pixel according to the viewport dimension (and
the size a col-md-3 has in each of this dimension). This was too easily
breakable. Indeed in the avantgarde theme, the .container is set to
smaller dimensions. So the col-md-3 is smaller too and then the fixed
width sidebar overflows.

To achieve the desired behaviour, javascript is needed. In CSS, the
position is set to "relative" and the width to "100%" so that the
sidebar fits the col-md-3 width no matter what. Then on page load and
on window resize, the sidebar is set to position "fixed" and to a
px-based width which equals its current and default 100%-width.
2016-08-04 11:04:12 +02:00
Christophe Simonis 6c8141a1df [MERGE] forward port of branch saas-10 up to 2483327 2016-04-01 16:15:35 +02:00
David Monjoie f280bfe8a1 [IMP] website_quote: use new pagebreak mechanism 2016-03-25 11:34:26 +01:00
Damien Bouvy 7682760dca [FIX] website_sale,website_quote: form must be in dom to be submitted
Revision 15f27b2 introduced a dynamic form submission to
avoid some payment transaction problems.

It so happens that form submission in jquery necessitates
said form to actually be in the dom (at least for Firefox
and some version of MSIE); this revision ensures that the
form is updated in the dom by the rpc call then properly
submitted.
2016-03-23 16:38:57 +01:00
Denis Ledoux 15f27b2614 [FIX] website_sale: always re-render the pay now button
Before this revision,
when a user tried to pay his cart with a first acquirer
e.g. Ogone
then came back to the shop (using the browser back button)
then chose another acquirer
e.g. Paypal
a new transaction is created, due to the change of acquirer
(following revision cb9d798)
and therefore, the transaction has a new reference compared
to the last payment transaction attempt (e.g. the ogone one)
but, the old reference is still referenced within
the `Pay now` form values, because the page wasn't re-rendered,
because the user pressed the browser back button, and this
doesn't refresh/re-render the page, and, therefore,
the old reference was still referenced within the `Pay Now`
form values.

Therefore, the wrong reference was sent to the acquirer
(e.g. paypal) and this prevented the payment validation
at the payment feedback, as the new reference was expected
in the feedback information, while we receive the older one.

This revision makes sure to always re-render the `Pay now`
form, so the transaction reference, as well as the other
possible changes in the values, are correctly set,
before sending the information to the acquirer.
2016-03-21 10:30:03 +01:00
Christophe Simonis 0a2300318a [MERGE] forward port of branch saas-6 up to 12d9a34 2016-01-18 10:44:50 +01:00
Nicolas Lempereur de336c0ab8 [FIX] website_quote: don't unescape menu title
If we take content with $().text(), to insert it in another node we have to
used $().text(value) also. If like before this commit, we would use $().html()
the content would be unescaped one time too much.

note: equivalent of 8.0's 37ed5ce and 7ad626f commits
2016-01-12 20:10:29 +01:00
Nicolas Martinelli afa28f075a [FIX] website_quote: message if SO not confirmed
Commit 486cd3309 was not correctly forward ported. We also add a
specific message if the quotation is in state 'draft'.

Fixes #9226
2015-12-09 11:35:14 +01:00
Martin Trigaux a9ec2894de [MERGE] forward port of branch saas-6 up to 19fe77b 2015-12-01 08:41:52 +01:00
qsm-odoo fc731ff4ad [FIX] website_quote: signature color
When signing an online quotation the pen color depended on the theme
that was installed (white when theme graphene was installed).
2015-11-27 13:56:45 +01:00
Nicolas Martinelli de8f3f70fd [FIX] website_quote: support of 2 routes to accept quote
Complement of commit d9c2d03. We should still support the old route, in
case users do not update the template.
2015-10-28 14:33:07 +01:00
Denis Ledoux c8d6b36632 [MERGE] forward port of branch saas-6 up to a0c64bebe6 2015-10-28 12:01:30 +01:00
Nicolas Martinelli d9c2d03532 [FIX] website_quote: fix Sign & Confirm
Commit 7636b51 modifies the route from JSON to HTTP by mistake. Indeed,
the route /quote/accept is called from an ajax.jsonRpc request, not from
the `method="POST" t-attf-action="/quote/accept` which can be found in
website_quotation.xml.

The t-attf-action is actually only used to recover the order_id and the
token in website_quotation.js.

opw-652874
Closes #9227
Fixes #9226
2015-10-28 08:02:24 +01:00
Denis Ledoux a0c64bebe6 [MERGE] forward port of branch 8.0 up to 8209368 2015-10-14 12:28:22 +02:00
Damien Bouvy 156b33c89a [IMP] website_quote: prevent double clicking on the confirm button
Double clicking on the confirm button was actually possible and could confirm the orders multiple times (which could be problematic if some action are linked to the so confirmation)
2015-10-12 14:39:41 +02:00
Damien Bouvy 486cd33091 [FIX] website_quote: prevent modifying the quote state if it's already been processed
Before this fix, it was possible to validate then cancel a quote (or the other way around) simply by using two tabs in your browser. From now on, we only validate/cancel a quote if it's the 'sent' state and advise the customer of the situation if he tries to abuse the process.
2015-10-12 10:43:46 +02:00
Nicolas Martinelli dda5eb7dff [FIX] website_quote: remove loading attribute if missing data
In commit bc43417b, a loading attribute is set on any submit button. The
problem is that this attribute is the first thing to be set. Therefore,
we cannot prevent its propagation.

Since Bootstrap sets this 'loading' attribute in a setTimeout, we need
to remove it in a setTimeout as well.
2015-10-01 17:01:23 +02:00
Damien Bouvy 8998b03b82 [FIX] website_quote: missing deps in website_quotation.js 2015-07-28 14:33:47 +02:00
Christophe Simonis 2cf91d16a5 [MERGE] forward port of branch saas-6 up to 63e92cb 2015-07-22 16:17:54 +02:00
Christophe Matthieu 71732dceb6 [IMP] web: module can be asynchronous loaded if it return a deferred
Each module can return a deferred. In that case, the module is marked as loaded
only when the deferred is resolved, and its value is equal to the resolved value.
The module can be rejected (unloaded). This will be logged in the console as info.

Remove if_dom_contains from the website, the modules return a rejected deferred if
the DOM doesn't contains the seleted values.
2015-07-22 12:15:24 +02:00
Christophe Simonis 6c64869de1 [FIX] website{,_quote,_sale}: do not use undefined variable openerp 2015-07-08 15:21:07 +02:00
Damien Bouvy 298b66129c [FIX] website_quote: acquirer button is not always a div, can be a span or smthg else 2015-07-03 08:58:42 +02:00
Damien Bouvy 32c7f1e48d [FIX] website_quote: the confirm button is not necessarly in that specific div 2015-06-26 17:33:41 +02:00
Christophe Simonis a304194936 [MERGE] forward port of branch saas-6 up to 81b5c60 2015-06-25 00:26:31 +02:00
Damien Bouvy de8d90e12e [IMP] website_quote: add payment management
Until now, you could only sign and confirm a sale order from the frontend.

From now on, you can also pay sale orders if the 'Immediate Payment'
option is checked on the sale order.
2015-06-15 14:57:16 +02:00
Damien Bouvy 5047f4ecad [IMP] website_quote: UOM onchange, respect pricelists on SO, layout fixes
* add on_change_uom behaviour to quote templates lines
* fixes frontend layout issues
* use action_button_confirm instead of signal_workflow
  when confirming the quote in the frontend to trigger
  all events properly
* adapt prices using pricelist on onchange_template_id
   on sale orders
2015-05-28 19:04:13 +02:00
Christophe Simonis fe2b5f35a4 [MERGE] forward port of branch saas-6 up to bf1e999 2015-05-28 14:27:38 +02:00
Christophe Simonis 0da722aa6a [MERGE] forward port of branch 8.0 up to bff6dff 2015-05-11 15:12:24 +02:00
Nicolas Lempereur 4237207000 [FIX] website_quote: css issue for mobile view
When seen from a mobile, the shortcut menu was over the content of the
quote and hid it.

This fix sets the menu inline in the page when he has no place to be on a
column on its own.

opw-633890
2015-05-06 13:24:50 +02:00
Géry Debongnie 4fdf74fe21 [IMP] web+addons: improvement to module system
The module system needs to know the dependencies of a given module
before executing the function.  This is why the dependencies were
defined once in an array, and then were described one more times in the
call to require.

But a trick can simplify this: the boot function can parse the string
representation of the module and extract the calls to require from it.
It is more work for the processor, but it leads to simpler module
definitions.
2015-03-18 09:23:37 +01:00
Géry Debongnie f05d9aea0a [REF] website_quote: update to the new module system 2015-03-18 09:23:36 +01:00
Nandan Jani 6ffef2b053 [IMP] website_quote: improve navspy tracking, make history work and cleanup
Backport of master commit 742acbb454
2015-03-13 17:03:05 +01:00
Nandan Jani 742acbb454 [IMP] website_quote : make history work and clean the template and refactor js. Improved update quote button when quotation is accepted it will display back to sale order button, and updated Edit Template link. 2015-03-10 15:29:19 +01:00
Christophe Simonis 4eb385fc0b [MERGE] forward port of branch 8.0 up to 0ec3c75 2015-01-23 14:57:07 +01:00
Aaron Bohy 3cae676619 [FIX] Use local copies of png instead of fetching them from websites
Debian does not allow fetching data from external website at runtime.
This fixes the privacy-breach-generic lintian warnings for Debian packaging.
The removed youtube url was a dead link...
2015-01-23 11:23:04 +01:00
Mahendra barad bf92a5b2fa [IMP] website_quote: onboarding
Views and labels improvements
2014-10-13 09:20:31 +02:00
Fabien Meghazi 8d08e06758 [FIX] Bundlification remains (Fixes #2463) 2014-09-17 14:50:12 +02:00
Christophe Matthieu 009cc5278e [FIX] website_quote: scroll spy is crazy if the user change quote template. Must remove id created by the javascript of scroll spy. 2014-08-07 18:39:35 +02:00