From a5ca064dc2c821844bfafb767be67d6885e31a71 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 23 Jul 2019 12:32:48 +0000 Subject: [PATCH] [FIX] website_sale: frontend billing address is partner's address Have a partner Partner (A1) / \ Shipping Addr (A2) Invoice Addr (A3) Give portal access to A1 Make a webshop order with A1 Make it possible for the front end user to edit his billing address (by having forgotten "country" on A1) Note that the address being choosen as Billing is A1, NOT A3 Save In the backend check the order. The customer is A1 The shipping address is A2 Before this commit though, the invoice address is A3, which is plain wrong usability-wise since at no point in the flow the front end user chose that address After this commit, the billing address stays A1, and A3 is just ignored This goes with the spirit of https://github.com/odoo/odoo/commit/6e69de67071f2618e00856a74716d861b7f47391 Also, something smarter is possible if we let the user choose the billing address just like we let him choose the shipping address OPW 2034976 closes odoo/odoo#35105 Signed-off-by: Lucas Perais (lpe) --- addons/website_sale/controllers/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 725c0423afb..0d11c1856d9 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -681,6 +681,8 @@ class WebsiteSale(ProductConfiguratorController): if mode[1] == 'billing': order.partner_id = partner_id order.onchange_partner_id() + # This is the *only* thing that the front end user will see/edit anyway when choosing billing address + order.partner_invoice_id = partner_id if not kw.get('use_same'): kw['callback'] = kw.get('callback') or \ (not order.only_services and (mode[0] == 'edit' and '/shop/checkout' or '/shop/address'))