Commit Graph
92 Commits
Author SHA1 Message Date
Horacio Tellez 5badb3fca8 [IMP] payment(_*): normalize logs across all acquirers
The logs for payments contain the transaction reference whenever possible.
Before logs for transactions contained the reference or the id of the
transaction in an inconsitent way. No transactions are identified by
reference whenever possible.

The logs for payments for the same function on different acquirers should
have the same format. Same flow step for different acquirers had
information passed in different formats. Now at each step of a transaction
flow log messages have the same format regardless of the acquirer.

Overall the payment logs should have an uniform format. Hopefully
understanding log messages related to transactions should be easier, as
now log format is independent of the acquirer and transaction are easily
identified by reference.

Task - 2545450

closes odoo/odoo#79547

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2021-11-29 15:40:54 +00:00
Nicolas (vin) f7b45aa032 [FIX] payment: suitable payment token and acquirer fix
Fix two issues:

The search of suitable payment token was searching on the journal_id
field of the payment acquirer that is no longer stored.
Change it to now search on the acquirer_id directly, since we have
this information.

The _inverse_journal_id method on payment acquirers would create
new payment line with the manual payment method when no provider
are given to an acquirer, or no payment method is existing for
a given provider. This would cause issues with the creation of
multiple line with the same name on a same journal, which would
trigger the constrains blocking that.

closes odoo/odoo#74990

X-original-commit: a3a2fcb0b299fafbf359ec9015da5c85cdb57b3a
Related: odoo/enterprise#20193
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-08-12 07:56:16 +00:00
Nicolas (vin) 04522f01e6 [IMP] account: allows multiple payment acquirers on a journal.
Users may want to be able to have transactions coming from multiple
payment acquirers to be registered in the same journal.

This will allows that.

Task id #2414749

closes odoo/odoo#67331

Related: odoo/upgrade#2500
Related: odoo/enterprise#17258
Signed-off-by: William André (wan) <wan@odoo.com>
2021-06-03 10:00:26 +00:00
Romain Derie 92175d3341 [IMP] *: replace web.base.url ICP by helper method
Previous commit introduce an helper to get the most suited URL for a record
instead of always using the ICP, which is not correct in a website context.

This commit replaces calls to ICP by the helper method.

Community: https://github.com/odoo/odoo/pull/68201
Enterprise: https://github.com/odoo/enterprise/pull/17538
Upgrade: https://github.com/odoo/upgrade/pull/2372

task-2476101
2021-06-02 10:04:29 +00:00
Antoine Vandevenne (anv) c902e02317 [FIX] payment(_*), account_payment: fix post-refactoring issues
account_payment:
  - Processing fees computation was done based on the wrong country.
payment:
  - The acquirer's cancel message was missing from the
    /payment/confirmation page.
  - `redirect_form_view_id` field was declared with attribute 'name'
    instead of 'string'.
  - Uninstalling a payment acquirer would fail with a traceback.
  - The first acquirer was not automatically selected if it was the only
    selectable payment option of a 'manage' payment form.
  - Specifying a preferred acquirer to the /payment/pay page would show
    not acquirer at all if the preferred option was incompatible with
    the constraints, rather than falling back on showing all acquirers.
payment_adyen:
  - When the value of the API URL fields is malformed (e.g., missing the
    "https://"), clicking on the confirm button raised a traceback.
payment_ogone:
  - There was a typo in the return route.
payment_paypal:
  - PayPal acquirers were not filtered out if the currency was not not
    supported.
  - Returning to the webshop without paying would raise a traceback.

task-2494916

closes odoo/odoo#69996

X-original-commit: 4f7e463fb8b13506caa8aff0beeef5eb0720bf00
Related: odoo/enterprise#17997
Signed-off-by: Antoine Vandevenne (anv) <AntoineVDV@users.noreply.github.com>
2021-04-28 11:39:26 +00:00
7b165cd555 [REF] payment_paypal: migrate PayPal to the new payment API
See the merge commit for more details.

task-2333036

Co-authored-by: Antoine Vandevenne <anv@odoo.com>
Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-03-30 09:25:51 +02:00
Goffin Simon 1d995c1fe8 [FIX] payment_alipay, payment_paypal: Online payment with public user
Steps to reproduce the bug:

1) Enable Paypal on the Payment Acquirers and select "BE Company CoA" on the company
2) fill the email and enable the "Add Extra Fees"
3) create an invoice on the company "BE Company CoA"
4) preview it as a public user

Bug:
An access error was raised:

Due to security restrictions, you are not allowed to access 'Companies' (res.company) records.

opw:2439896

closes odoo/odoo#65507

X-original-commit: 6b23ff3bdd1d5a3f34a431e2301db5984e0f761a
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-02-04 07:53:12 +00:00
Goffin SimonandAdrienHorgnies eb8beffbe9 [FIX] payment_paypal: Paypal Acquirer fees
The variable fee (Var) and fixed fee (Fix) indicated by paypal must be subtracted from the transaction amount (Am).

So let's consider that Am = 100€, Var = 2.9% and Fix = 0.3€

Total fee = 100€ * (2.9/100) + 0.3€ = 3.20€

So in this case, the merchant will get 96.80€ and Paypal will get 3.20€

This computation can be verified with the simulator here:  https://salecalc.com/paypal?p=100&l=us&r=0&e=0&f=0&m=2&c=0.

So the idea here is to compute Am such that the merchant will get 100€ if he set his price to 100€

fees = amount_fees_included * percentage / 100 + fixed
fees = (amount + fees) * percentage / 100 + fixed
fees = (amount * percentage / 100 + fixed) / (1 - percentage / 100)

if the merchant needs to keep 100€, Am will be equal to 103.30€.
That way, paypal takes 103.30 * 2.9% + 0.30 = 3.30 and the merchant takes 103.30 - 3.30 = 100

opw:2369557

X-original-commit: 6850e638dfa652ab3fe8065ea09e23cb07648d7a
Co-authored-by: AdrienHorgnies <aho@odoo.com>
2020-11-15 23:08:46 +00:00
Martin Trigaux d9287caf94 [IMP] *: convert to private methods
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id

Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
2020-05-14 13:59:10 +02:00
Adrian Torres 1daf8eb127 [FIX] *: set ondelete policy of required Selection fields
With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.

This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.

closes odoo/odoo#46325

Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-30 13:42:04 +00:00
Thibault Delavallée 3d86a29aeb [MOV] mail, various: move replace_local_links to render mixin
PURPOSE

Move links shortening tools on mail.render.mixin to have rendering and
post procesing tools available on that mixin.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:24:44 +00:00
alt-odoo 8e98d71f36 [FIX] payment_paypal: missing parentheses in mc_gross computation
This is a small fixup of previous commit 581020c733044b52cacd0d41a6a8eb8708671d0d.

closes odoo/odoo#47127

X-original-commit: e1e224bbf880718bcfb8d3874bad003aef5e8a27
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
2020-03-06 17:45:16 +00:00
Goffin Simon 0d8836f7e1 [FIX] payment: Wrong extra fees with payment acquier
Steps to reproduce the bug:

- Install Sales
- Configure Paypal payment acquier
- Add extra fees such as 10€ of domestic fee
- Create a customer C with an email E and with no country
- Create a quotation Q of 100€ for C and send it by email to C
- Go in the email box of E and click on the link
- Click on 'Sign and Pay' button
- Sign Q and click on 'Pay'
- Choose Paypal as payment acquier
- Process the payment with Paypal

Bug:

An error log was displayed saying:

Paypal incorrect data:
mc_gross received 100 instead of 110

PS: the domestic fee was not counted because the partner_country_id
was not set in function render defined in model payment.acquirer

Inspired from function create defined in model payment.transaction
(addons/payment/models/payment_acquirer.py +961) where the domestic fee
is counted.

opw:2167104

closes odoo/odoo#43265

X-original-commit: 581020c733044b52cacd0d41a6a8eb8708671d0d
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-01-14 10:41:09 +00:00
jev-odoo b308a173a6 [FIX] payment_paypal: Less confusing transaction logs
Before this commit, the log displayed "set as done"
before actually trying to put the transaction in done.
If an error then occurred in the'_set_transaction_done'
function and the transaction could not be processed,
this could lead to a misinterpretation of these logs.

This log is therefore moved after the transaction is
processed and is only displayed if it is actually successful.

This is valid for'done','pending' and'cancel'.

closes odoo/odoo#42089

X-original-commit: dd7552b1a48020f3f48cd40a5fc1cbc4c38a7f90
Signed-off-by: jev <jev-odoo@users.noreply.github.com>
2019-12-18 07:06:31 +00:00
Thibault Delavallée 1838191eec [REF] mail, various: improve mail creation calls, notably author and email from default computation
Purpose of this commit is to correctly compute author_id and email_from
in mail_message and mail_mail as they depends from each other. Moreover it
is a good idea in various flows to specify email and author when giving
creation values to avoid default computation that is not always guaranteed to
be accurate notably when involving super user.

Mail message creation could lead to desynchronized values between author
and email_from. This is improved with this commit by correctly inheriting
from default_get and computing both of them at the same time instead of having
two default values. Indeed they depend on each other.

Same thing is done for mail composer. Mail Thread offers a tool method to
find email_from / author_id based on having one of those values or current
user and it is called whenever necessary.

Some calls to mail template send_mail are also cleaned.

Task ID 1853147
PR #32243
2019-11-29 13:35:14 +00:00
Jorge Pinna Puissant 6d2d30d6f5 [FIX] payment_*: multiwebsite base_url
Fine-tunning of 937b5c076e7175bec664ed0cf4b77505e342f1e2

Have a multiwebsite setup
have a payment installed for one of the two websites

Make an order on that website and try to pay

Before this commit, the transaction doesn't come back to odoo's
payment success controller
This was because the return url was set to the web base url ICP

After this commit, the payment success page is opened as we took
the request's url as the return url

opw-2080352

closes odoo/odoo#39643

X-original-commit: a9fb15b33fd041ee420581a5ba450017db06e0c7
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2019-10-31 12:33:56 +00:00
Julien Castiaux 33354f71e1 [FIX] payment_paypal: external tests
All dates in the backend must be naive (=in utc, without timezone)

closes odoo/odoo#36230

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-08-29 12:21:54 +00:00
Victor Feyens 9de0bc1107 [FIX] payment_paypal : take correct email at onboarding.
Don't set all acquirers with OdooBot email as paypal email :P.
2019-08-12 08:45:50 +00:00
Victor Feyens f0e059e601 [REF] payment* : state based publishing
Replace website_published and environment by a generic state on
payment.acquirer

Payment acquirers aren't enabled by default.  When setting their state to 'enabled' or 'test', it is verified the required fields for the provider are set.
2019-08-12 08:45:50 +00:00
Nikunj Ladava cd76c0b23e [IMP] payment_paypal: remove deprecated fields
task- 34668

closes odoo/odoo#20053

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-07-17 05:06:47 +00:00
Nikunj Ladava 55051a1dd7 [IMP] payment_paypal: onboarding checkout
Accept payment on Paypal without having a merchant account
The merchant only need an email address to accept payment from Paypal
Paypal will send email to the merchant to create an account with the details
Odoo will send mail to the merchant to fill all the credentials after creating an account

Note: why used rm? - If IPN is disabled in the profile (case for the new user), the default action to call the return_url is a GET. This means that if your return_url is a script, you must set rm = 2 in order to have the IPN variable POSTed to that URL

task- 34668
2019-07-17 05:06:47 +00:00
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
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-17 14:13:12 +02:00
Goffin Simon 74706e9e03 [FIX]payment_paypal: wrong fees computation
Steps to reproduce the bug:
- Create a product P with price=100€
- Configure payment aquier Paypal with fees_int_fixed = 1€ and fees_int_var = 1%
- Set Paypal to be available in the website
- Go to the web shop and add P in the cart
- Choose to pay with Paypal

Bug:

The amout to pay was 102.02€ instead of 102.01€

Before the fix, the fees was computed as followed:

fees = (percentage / 100.0 * amount + fixed) / (1 - percentage / 100.0)
Where fees_dom_fixed = fixed and fees_int_var = percentage

With this computation, the percentage was applied twice.
If for example, we had fixed = 0 then

fees = (percentage / 100.0 * amount) / (1 - percentage / 100.0)

In this case, it's easy to see that the percentage is applied twice.

opw:1981784

closes odoo/odoo#33830

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-06-04 07:24:34 +00:00
Toufik Benjaa 6ed44181d0 [IMP] payment_*: payment acquirers error handling
This commit aims to improve the user experience when using payment acquirers. There currently are no error feedback with some acquirers, which leaves the user wondering what is going on and what is the real status of its payment.
In some cases, the user is currently being redirected to the home page even though the payment has failed. We want to make it more obvious to the user that something unexpected has happened by redirecting to an intermediate page that will provide good feedback on payments status.

Another goal of this commit is to order acquirers by sequence instead of by flow and to select the first acquirer by default. This feature was already implmented in commit fe294fd43e521bd2d339e962f43acf46c3d4cb97, some UI adaptations were needed though.

Related to task #36680
Closes #26958
2018-09-19 18:25:32 +02:00
qdp-odoo 01216345e2 [REF] account,payment(_*),sale*: downgrade transactions into debug items
It was very confusing for the user to distinct account.payment and payment.transaction. From now on, the transactions are
technical objects and, in the backend, we only refer to it in log messages (Front end will be adapted in the same fashion
later on). They are hidden in debug mode in accounting\configuration\payments as their purpose is now purely technical/log

This commit also aims to reduce the gap between the accounting app and the transactions: account.payment objects are
created/validated upon completion of transaction.

To ease the capture/voiding of pending transactions, the related buttons are now displayed directly on the SO/invoice
instead of the transactions.

Was task: https://www.odoo.com/web#id=35857&view_type=form&model=project.task&action=333&active_id=967&menu_id=4720
Was PR #24043

[FIX] add domain based on journal to payment tokens

Was opw: https://www.odoo.com/web?debug#id=1828206&view_type=form&model=project.task&menu_id=5200
2018-05-23 15:44:55 +02:00
Xavier Morel 01e3514147 [FIX] P3: urllib, urllib2 and urlparse
In Python 3, all of these were "consolidated" under urllib(.request,
.parse, .errors) which is inconvenient.

Since we already have hard dependencies on requests and
werkzeug(.urls, which is a backport of Python 3's unicode-aware
urllib.parse) migrate *everything* to that.

A sticking point is urllib2.URLError, those were (mostly) replaced by
the slightly more general IOError which URLError extends.
2017-05-15 12:26:30 +02:00
fka-odoo 25411cfbd0 [IMP] payment_paypal: finally add a field to store PDT token instead of hidden configuration parameter 2017-05-10 13:57:02 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Nicolas Martinelli 100077f035 [FIX] payment_paypal: correctly parse payment_date
Paypal formats the payment date in this specific format:
`HH:MM:SS Mmm DD, YYYY PDT`.

Source: https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNandPDTVariables/

opw-693574
2017-01-06 14:27:17 +01:00
Nicolas Martinelli 756449cfe1 [FIX] payment_paypal: fields.Datetime
Obviously, it should be `fields.Datetime`, although it luckily works
with `fields.datetime.now()`.

opw-693574
2017-01-06 14:27:17 +01:00
Christophe Simonis 298e2032ea [MERGE] forward port branch saas-12 up to 9f28139 2016-09-09 18:13:31 +02:00
Christophe Simonis 7a02b90e17 [MERGE] forward port branch saas-11 up to dc4d6b6 2016-09-09 15:43:06 +02:00
Christophe Simonis dc4d6b6a7a [MERGE] forward port branch saas-10 up to e1bd405 2016-09-09 15:14:39 +02:00
Christophe Simonis af87c57e51 [MERGE] forward port branch saas-6 up to f98665f 2016-09-09 11:26:15 +02:00
Christophe Simonis f98665f9b6 [MERGE] forward port branch 8.0 up to b17b2a2 2016-09-09 10:52:34 +02:00
Ravi Gohil b226510840 [IMP] payment_*: avoid access error on provider model
As provider model is intended to be used internally restricting the read of
some private fields to the employee group avoid creating access issues.
2016-09-06 10:20:41 +02:00
Christophe Simonis 1a77d9d02a [MERGE] forward port branch saas-12 up to 476cb5a0 2016-09-03 23:57:57 +02:00
Nicolas Martinelli cf4cda2bca [FIX] payment_paypal: set Paypal if not website installed
Since commit 2ab68047, the Paypal link can be sent in an invoice as it
was the case before. However, in order to be able to save the Paypal
account in the accounting settings, the Paypal account must be
website-published. If the module `website_payments` is not installed,
this is not possible.

We remove this condition, since it should be possible tu use the Paypal
payment method without installing the whole website.

opw-686216
2016-09-02 11:56:00 +02:00
Damien Bouvy ffd527d027 [IMP] payment, payment_*: add/improve tokenization support
This commit improves the tokenization process, allowing users
to set the acquirer to save payment data never, always or letting
the customer decide (only implemented in ecommerce for now).

Support for tokenization is improved for Ogone and Authorize.net

This commits also factorizes advanced payment features support
(authorization, tokenization, fees computation) in a generic method
overriden by every provider to specifiy which features are supported.
This process can be used in views to hide/show fields depending on
feature support or in constraint checks.
2016-09-01 15:58:41 +02:00
Christophe Simonis 74ff1a50fa Revert "[FIX] payment_paypal: missing Paypal link"
Since 85bcd6fdd8, the field `paypal_account`
has been removed. The field `paypal_url` cannot be computed correctly
anymore.

This reverts commit 2ab68047c1.
2016-09-01 15:36:55 +02:00
Christophe Simonis 198c080b35 [FIX] payment_paypal: do not compute field paypal_url
Since 85bcd6fdd8, the field `paypal_account`
has been removed. The field `paypal_url` cannot be computed correctly
anymore. Convert it to a dummy field.
2016-09-01 15:31:18 +02:00
Christophe Simonis f4738e7bb5 [MERGE] forward port branch saas-12 up to 78e9c7f 2016-08-26 18:06:17 +02:00
Christophe Simonis de0d503421 [MERGE] forward port branch saas-11 up to f0c8224 2016-08-26 16:59:45 +02:00
Christophe Simonis 717a4a51a5 [MERGE] forward port branch saas-10 up to 7a4116c 2016-08-26 14:57:43 +02:00
Nicolas Martinelli 2ab68047c1 [FIX] payment_paypal: missing Paypal link
When an invoice is sent by email, the Paypal link is not included,
although it is in the template.

This is because the `paypal_url` field has gone missing after Accounting
refactoring.

opw-686216
2016-08-22 14:28:10 +02:00
Christophe Simonis 523d3af131 [MERGE] forward port branch saas-12 up to 16d65a8 2016-07-29 17:55:21 +02:00
Christophe Simonis f670b3b1df [MERGE] forward port branch saas-11 up to 3aea814 2016-07-29 15:33:51 +02:00
Christophe Simonis 529f88dbd3 [MERGE] forward port branch saas-10 up to 4ca04fd 2016-07-29 13:01:29 +02:00
Christophe Simonis d35f4250cc [MERGE] forward port branch saas-6 up to 7079a0b 2016-07-28 12:22:03 +02:00
Christophe Simonis 7079a0be30 [MERGE] forward port branch 8.0 up to 8ceb943 2016-07-27 18:13:51 +02:00