Commit Graph
52 Commits
Author SHA1 Message Date
qsm-odoo 97aa0a8dec [REF] *: convert less content to scss content
Convert content so that the assets compile on app installation. The
style is still broken after this as the variables/mixins/... are not
defined in the right order (as it did not matter in LESS but does in
SCSS).

This commit basically changes:
- Variables: @​var_hello -> $var-hello
- Mixins: .mixin_world() {} -> @​mixin mixin-world {}
- Classes used as mixin: .my_class() -> @​extend .my_class
    - Here there were no other solution than to convert the use of
      a mixin call by the use of an extend as a first approximation
- LESS functions -> SCSS functions (e.g. fade -> rgba)
- Move first variable definition before the variable is used
    - Still need to make sure last variable definition is at the
      right place
2018-04-18 15:59:16 +02:00
qsm-odoo b04dec4025 [REF] *: rename all LESS files to SCSS
This is a simple renaming without adaptation.
2018-04-18 15:59:15 +02:00
Christophe Simonis 5f2d080cf8 [MERGE] forward port branch 11.0 up to ad825b673b 2018-04-16 18:34:56 +02:00
Romain Derie 0879cb88fe [FIX] payment: make the error handler works for non s2s acquirer
Before this commit, error handling would not work for non s2s payment acquirer
since it would always check for `o_payment_add_token_acq_[id]` in the DOM but
this is only present for s2s acquirer.
Non s2s acquirer got `o_payment_form_acq_[id]` in the DOM.

Now, we retrieve the correct DOM element depending if s2s is enabled for this
payment acquirer or not.

task-1825701
2018-04-10 16:10:59 +02:00
Christophe Simonis e0345a4a3f [MERGE] forward port branch 11.0 up to 2835d29979 2018-03-20 11:45:11 +01:00
Goffin Simon 8df915da05 [FIX] payment: Payment integration with Authorized.net making double transactions
When making a payment with authorize.net by clicking on "Pay Now" in the shop, it was
possible to send several transactions for the same SO because the button "Pay Now"
was enabled before being redirected.

opw:1819588
2018-03-14 14:50:14 +01:00
Christophe Simonis 9a84ba5533 [MERGE] forward port branch saas-11.1 up to e750bb6e11 2018-02-22 10:39:15 +01:00
Christophe Simonis ae6a65753e [MERGE] forward port branch 11.0 up to dbb713c2f8 2018-02-21 20:19:26 +01:00
tbe-odoo 14081b848f [FIX] payment: Payment form not implemented on /website_payment/pay
The generic payment form introduced in 11.0 has changed the way we collect payment and so does the code.
The route /website_payment/pay hasn't been changed to support the new payment form.
This commit fixes this.

It also fixes a bug for when a customer tries to create two transactions with the same reference.
2018-02-20 15:36:56 +01:00
qsm-odoo b3c5392b6a [REF] *: convert sass content to less content
* note, payment, sales_team, website_forum, website_sale(_options)

(prepare for all less -> scss conversion)
2018-01-29 15:37:28 +01:00
qsm-odoo 6bdb979b39 [REF] *: rename sass files to less files
* note, payment, website_forum, website_sale(_options)

This is a simple renaming of sass files to less files. The real
convertion will be done in the commit that follows.
2018-01-29 15:37:28 +01:00
Christophe Simonis cb50970f3f [MERGE] forward port branch 11.0 up to eefe879a37 2018-01-25 15:41:45 +01:00
fda-odoo 9ba1cc46c5 [FIX] payment: save the token if the option is checked in the form mode of the related acquirer.
The function was searching for the wrong acquirer in the page, so check the option was without effect
2018-01-24 15:38:54 +01:00
fda-odoo 2a59f2804f [FIX] payment: display a better button for "add new card"
it removes the + while the rotating spin is showing and display the + icon after the loading
2018-01-24 15:38:02 +01:00
jpr-odoo 480eaf460a [FIX] payment: reduce margins to have same height then options without payment icons) and label align centered on the vertical axis 2018-01-24 15:33:19 +01:00
jpr-odoo 1f712532a3 [FIX] payment: fix card brand type icon position into s2s form if s2s form not in bootstrap_formatting
up the number of brand cards displayed by default too.
2018-01-24 15:31:51 +01:00
fda-odoo daf6ab1c87 [FIX] Payment, payment_authorize: show an error if customer doesn't have a complete profil on authorize.net payment.
If the user has no Zip code, country or city, authorize refuse the payment, but Odoo doens't show any error.
The commit invite the user to log in in this case or to fill his missing information
2018-01-24 15:28:53 +01:00
fda-odoo 50beec7fa0 [FIX] payment: improve invalid input management on payment form
The different fields weren't correctly checked on a payment form. This commit improve the error messages and display it for each field. It adds too a verification on the fields in the case of the field are filled automatically by Firefox on a refresh (F5).
2018-01-24 15:28:32 +01:00
Christophe Simonis 362f0489d0 [MERGE] forward port branch 11.0 up to fe22a0f9ca 2018-01-03 12:28:52 +01:00
qsm-odoo 506e45e73f [FIX] payment: consider the "Save my payment data" option
Before this commit, the option was ignored. Indeed "checked" is a
DOMElement property, not a jQueryElement's one.

See https://github.com/odoo/odoo/issues/21321
2017-12-19 10:46:22 +01:00
qsm-odoo 91b3a4fa8c [FIX] payment: properly allow PaymentForm extensions
Commit https://github.com/odoo/odoo/commit/be650c5979d6d427ad79bc23f0edc1d10290f881#diff-b448c1be5e302f4819079161e4fe3de9L369
added a `require` in the middle of a file, making the whole file
require the DOM to be ready.

This was not really a problem as the module did not return anything...
until https://github.com/odoo/odoo/commit/d2815c474d7ab24a06f5365d967a602119252b95

Proper way to fix this would be to split the module in two parts, one
requiring the DOM to be ready and not the other one. However, this
commit chose to do a fix as stable as possible.

See https://github.com/odoo/odoo/issues/21702
(and https://github.com/odoo/odoo/issues/21321)
2017-12-19 10:46:22 +01:00
Christophe Simonis 8ef7af6afe [MERGE] forward port branch 11.0 up to f96a797fe6 2017-12-06 12:02:58 +01:00
Géry Debongnie d2815c474d [FIX] payment: return widget reference
This file, like many others, does not return a reference to its main
widget, which implies that it cannot be modified/extended.  This may be
fine for Odoo itself, but some other may (and do) need to extend/include
this widget.
2017-12-04 09:18:04 +01:00
Atchuthan f03437ae00 [FIX] payment: display error message
The error message was not displayed as out of the paragraph block

Closes #21342
2017-12-01 15:33:08 +01:00
Christophe Simonis 29590a61cd [MERGE] forward port branch 11.0 up to 8fb25e185b 2017-11-28 16:57:58 +01:00
Goffin Simon f414b4227a [FIX] payment: Cannot add a new card from My Account portal
Steps to reproduce the bug:

Setup Authorize.net test account, then go to My Account from portal
and select "Manage your Payment Methods" and add a new card.

Bug:

It raised "Please fill all the inputs required."

opw:782716
2017-11-22 13:39:23 +01:00
Christophe Simonis c703a2a0c3 [MERGE] forward port branch 11.0 up to d279a3e6d5 2017-11-16 17:55:37 +01:00
jpr-odoo fb7e1ed238 [FIX] payment: correctly display additional payment icons when clicking on "and more" in payment form
Instead of being redirected to the top of the page. Which is probably not
good uzabilitiouaïze.
2017-11-14 17:00:42 +01:00
Christophe Simonis a54c60b45a [MERGE] forward port branch 11.0 up to e918271f76 2017-10-27 14:30:33 +02:00
tbe-odoo 7c639be4aa [FIX] payment_stripe: fix stripe payment form
- Before this patch, stripe doesn't get displayed.
    It was a bug related to the fact that stripe doesn't respect how the generic payment form works.
    So to make it work, we were relying on small hacks that got broke by changes on the payment form.
    To fix the bug we are no longer adding an event to the pay button of the payment form, instead
    we listen all the changes made to the DOM and detect if a form with an attribute 'provider' set to
    'stripe' is added.
    If so, we open up the Stripe payment form.
- Fix ACL issue when trying to pay with Stripe on eCommerce without being logged.

Closes #20202
opw-776200
2017-10-27 11:45:25 +02:00
Khoi Nguyen 3f962dbe63 [FIX] web,*: replace core.debug by config.debug 2017-10-18 16:52:41 +02:00
qsm-odoo 93bf26abc1 [FIX] web, *: review kanban record sizes
* account, maintenance, mrp, payment, point_of_sale, sales_team

Previous system was:
- `flex: 1 1 300px;` on kanban records
- If a specific record needs a different size, add custom style to
  either change the `flex` rule or set a `min-width` for >=SM screens

Now:
- `flex: 1 1 auto;` and `width: 300px;` on kanban records
- If a specific record needs a different size, add custom style to
  change the `width` rule.

This allows some standardization of the way to customize the suited
width and also allow lesser LESS code (as the previous version required
either the use of the flex mixin or the use of a media query).

Note:
- Also remove useless app record rule
- Also fix MRP Work Centers record width

Note2:
This system should be improved for version 12.0.
2017-09-20 16:57:50 +02:00
Thibault Delavallée 06fe263a15 [IMP] payment: add new explicit parameters to the payment widget
Purpose of this commit is to ease the use of the payment widget and
avoid having to perform too much custom code in the various routes used
when doing payments :

 * when instantiating the widget give him its parent element data so
   that parameters given when calling the payment form template are
   automatically present in the widget options;
 * support more parameters when calling the route for form-based acquirers
   including access_token, URLs and callback method;
 * when doing a form-based payment a call to a JSON route returning the
   rendered form is done. Payment widget now uses all data from that
   form including the URL of the acquirer website. This way form-based
   acquirers are really dynamic and values update is easier;
 * remove hidden display of form-based acquirers as all data come now
   from the called JSON route that returns the form;
 * add a warning about partner-id not being set as it is an issue some
   people may encounter;
2017-09-06 10:40:46 +02:00
Thibault Delavallée e986f0986e [CLN] payment: lint newly-introduced payment form
This commit performs just some linting in order to ease code reading and
prepare future updates.

 * extract duplicate variable computation;
 * link spaces and indentation;
 * light renaming to ease code understanding;
2017-09-04 14:09:58 +02:00
Thibault Delavallée dae6178a0a [FIX] payment: fix issue about required fields in payment form
It seems like even a correctly-filled field triggers an empty input
error because variable about empty error is always True.
2017-08-31 10:20:51 +02:00
tbe-odoo be650c5979 [IMP] Fixing the code to fit the reviews 2017-08-29 17:16:42 +02:00
tbe-odoo ad095e492f [IMP] payment,website_payment: Change payment.option model name to payment.icon 2017-08-29 17:16:42 +02:00
tbe-odoo 7419661247 [IMP] payment_stripe: Compatible with the new payment form
- Stripe checkout form is now compatible with the new payment form.
- Fixed a typo on a currency code.
2017-08-29 17:15:00 +02:00
tbe-odoo 83fdc63b68 [IMP] payment: Fix crash on install
- Fixed a crash when installing payment module.
- Set a more specific css selector to display error on payment form where required input are empty
2017-08-29 17:13:58 +02:00
tbe-odoo f74111f79f [IMP] payment: Display error when input are empty
- Required fields are now checked, if they are empty then we make their border red and display an error dialog.
2017-08-29 17:13:58 +02:00
tbe-odoo 6b38cd8b85 [IMP] payment: UI changes & Fix 500 errors
- Fixed 500 errors when trying to display payment form because of variables partner_id/acquirer_id missing.
- Accepted credit cards are now display next to the acquirer name on the payment form
2017-08-29 17:13:58 +02:00
tbe-odoo 5882cacb90 [FIX] payment: Some input were not set
- e-commerce and website_quote create a transaction with its reference when the user click on Pay.
So we need to render the inputs when the user click on pay and submit the form with the values
2017-08-29 17:13:15 +02:00
tbe-odoo 194d52e8fd [IMP] website_quote/sale,payment: Support of the new payment form
- Online quotation and e-commerce now use the new payment form.
- Added the ability to chose on an acquirer if it uses only form/s2s or both.
(Still need some code cleaning)
2017-08-29 17:11:23 +02:00
tbe-odoo 3c062d9345 [IMP] website_sale: Added S2S payment with new payment form
- Added the support of form payment.
- Fixed payment form's errors not being displayed.
- Fixed a crash when paying on e-commerce with a saved token.
(dev commit, need to clean the code)
2017-08-29 17:11:23 +02:00
Denis Ledoux 22f7b79221 [MERGE] forward port of branch saas-17 up to b970bf865a 2017-08-18 10:44:22 +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
tbe-odoo 2df9c22d80 [IMP] Payments & subscriptions: Improved Payments
- When registering a payment token, validating it using a payment of a small amount (~1.50€) followed by a refund allows ensuring
    that the payment method is valid (i.e. checksumming the card number simple ensure the number is valid but not that the card exists).
    This commit introduces a generic approach that must be implemented for each acquirer that has tokenization support.
    This commit also introduces a generic payment token registration/usage template that can be adapted according to one's need.
- Introducing a new payment form that handles payment, deletion and adding payment method (only for server2server for the moment).
- On /my/payment_method, changed strings 'Payment Acquirers' to 'Payment Methods' which is more clear.
- Stripe can now be used to pay subscriptions.
2017-08-14 08:30:59 +02:00
Thibault Delavallée 79f362d067 [MOV] (website_)payment: move customer portal for payments to payment
Customer portal controller and templates contained in website_payment
module are moved to payment. This module now uses the customer portal
defined in portal module and most of website_payment code is moved
to payment.

website_payment now contain code really related to website, such as
payment acquirers configuration for website.
2017-08-08 15:38:04 +02:00
Thibault Delavallée dee9b5cf3c [REF] payment, website_sale: make payment_transaction js code generic
JS code managing transaction creation through acquirer 'Pay Now' form
button is improved in order to be less website-sale dependant. It now
takes parameters for access token and URL to call in Json. Class used
to bind JS is now o_payment_acquirer_button in order to be more generic.

eCommerce module is updated accordingly. Future commits will probably
make Online Quote (website_quote) use it.
2017-06-06 11:04:34 +02:00
Thibault Delavallée 8911be11d1 [MOV][ADD] sale_payment: bridge module between sales and payment
Move sale and payment bridge code into its own module. This commit mainly
moves (and reorganizes without changes) code from website_sale related
to payment and SO confirmation.

Only change is that payment_acquirer_id field on sale order is now a
related on transaction.acquirer_id . Indeed in website_sale and
website_quote both values were written but only managing transactions
and getting its acquirer is more efficient and ensure values are coherent.

JS part controlling payment form management is moved directly into
payment to reuse later on in future commits. Probably.
2017-06-02 17:30:28 +02:00