diff options
| author | nie <nie@odoo.com> | 2021-02-05 10:40:40 +0000 |
|---|---|---|
| committer | nie <nie@odoo.com> | 2021-02-11 08:44:04 +0000 |
| commit | 5d9ed8b52b8f771b6f6a04aa4ec3ac7dbc6ffc42 (patch) | |
| tree | c93e9f6ccfd77e8b245a691b98069b881d971601 /addons/payment/wizards/payment_link_wizard.py | |
| parent | 885932ae8e31905e08b79141a445933b6afc9f15 (diff) | |
[FIX] payment,sale: Use record website domain in links
Steps:
- Go to Settings > Users & Companies > Companies
- Create a new company (1)
- Install a payment acquirer and Website
- Go to Website > Configuration > Settings:
- Select "My Website 2"
- Assign it to company (1)
- Add a custom domain
- Save
- Switch to company (1)
- Go to Invoicing
- Create a new Invoice:
- Add a product line
- Post it
- Click Action > Generate a Payment Link
Bug:
The base domain is used instead of the domain of the website linked to
the invoicing company.
Explanation:
The app only uses the URL on which the user has logged in to generate a
payment link. If the user has multiple companies, this can confuse
customers if they land on another domain than the one they are used to.
This commit makes the app use the domain of the website of the record
linked to the payment if it has one.
opw:2440251
closes odoo/odoo#65922
X-original-commit: 700dba53843e71f5f34c86305cc658d9273914aa
Signed-off-by: backspac <backspac@users.noreply.github.com>
Diffstat (limited to 'addons/payment/wizards/payment_link_wizard.py')
| -rw-r--r-- | addons/payment/wizards/payment_link_wizard.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/payment/wizards/payment_link_wizard.py b/addons/payment/wizards/payment_link_wizard.py index 54de9a31d96..53ca40e8762 100644 --- a/addons/payment/wizards/payment_link_wizard.py +++ b/addons/payment/wizards/payment_link_wizard.py @@ -67,11 +67,11 @@ class PaymentLinkWizard(models.TransientModel): link.company_id = record.company_id if 'company_id' in record else False def _generate_link(self): - base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') for payment_link in self: + record = self.env[payment_link.res_model].browse(payment_link.res_id) link = ('%s/website_payment/pay?reference=%s&amount=%s¤cy_id=%s' '&partner_id=%s&access_token=%s') % ( - base_url, + record.get_base_url(), urls.url_quote(payment_link.description), payment_link.amount, payment_link.currency_id.id, |
