AH-Yussef eefc83d5ca [FIX] website_sale: make invoice website_id depend on originating SO instead of partner
Steps to Reproduce
- Install E-Commerce app
- Add Demo payment provider in Test mode
- Go to Settings > Website > Invoicing and activate Automatic Invoice
- Go to Settings > Website and set the domain for:
	- My Website -we'll refer to it as website_1- as http://[IP_address]:[port] such as http://127.0.0.1:8069
	- My Website 2 -we'll refer to it as website_2- as http://[IP_address]:[port] such as http://127.0.0.2:8069
- Create a new product with Invoicing Policy as Ordered quantities
- Go to website_2 and add the new product to the cart and checkout
- With Debug mode on, Check the Emails sent via Settings > Technical > Email > Emails

Current Behavior
Two emails are automatically sent:
- An SO email that opens website_2 when clicking on View Sales Order button which is correct as we purchased the product through website_2
- An Invoice email that opens website_1 when clicking one View Invoice button which is WRONG as it should follow its originating SO and opens website_2 as well

Expected Behavior
Both SO and invoice emails should refer to the website where the SO was created -website_2 in our use case-

Observations
The automatic invoice always refer to website_1 regardless of the website where the SO was originally created.

Investigation
The website_id of the invoice is decided by the corresponding field https://github.com/odoo/odoo/blob/322889ea0a24c5eff2e3289502a2f606cb4048d0/addons/website_sale/models/account_move.py#L10-L13
- As noticed it's a related field to the partner_id.website_id which is False
- That's why the invoice website_id is also False leading to the preview button to fall back to website_1
- The partner_id.website_id is always False unless you manually added the field to the view and then set the website_id. Our case will work correctly if you set the website_id for the user/customer to website_2
- I also tried to sign up at website_2 to see if the website_id will be set accordingly but it stayed as False

Proposed Solution
make the invoice website_id relates to the originating SO instead of the partner

opw-3685742

closes odoo/odoo#154376

X-original-commit: 361e8f68af9c9656764906c8a44d22e1fed090a8
Signed-off-by: Ali Hassan Youssef (alhy) <alhy@odoo.com>
2024-02-21 12:59:05 +00:00
2024-02-21 11:28:04 +00:00
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%