Skip to content
Snippets Groups Projects
Commit 5dde19c9 authored by Nasreddin (bon)'s avatar Nasreddin (bon)
Browse files

[FIX] portal: display discounts on quotation pdf for portal user


Issue

	- Install "Sale" app
	- Acivate "Discounts" feature in settings
	- Create a quotation to a portal user (ex: Joel Willis)
	- Add a product with a discount then send
	- Logout then login as 'Joel Willis'
	- Go to 'My account' then 'Quotations'
	- Select the quotation just created and print it

	Discount not display in pdf file.

Cause

	The current env.user when rendering pdf is the portal user.
	To display discount, current env.user must have group
	'product.group_discount_per_so_line' who is not the case
	even when using sudo() on report template.

Solution

	Since Odoo 13.0, the sudo() function does not return the
	superuser by default but instead the current user
	with a bypass on access rights.
	Therefore, must add `.with_user(SUPERUSER_ID)` on report.

opw-2501337

closes odoo/odoo#69143

Signed-off-by: default avatarbon-odoo <nboulif@users.noreply.github.com>
parent 76c9ba9d
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment