Skip to content

[19.0][ADD] portal_address_copy_on_edit - #1217

Open
MarcGForgeFlow wants to merge 1 commit into
OCA:19.0from
ForgeFlow:19.0-add-portal_address_copy_on_edit
Open

[19.0][ADD] portal_address_copy_on_edit#1217
MarcGForgeFlow wants to merge 1 commit into
OCA:19.0from
ForgeFlow:19.0-add-portal_address_copy_on_edit

Conversation

@MarcGForgeFlow

Copy link
Copy Markdown

When a portal customer edits one of their invoice or delivery addresses, core rewrites the partner in place. The documents already issued with that address - confirmed sale orders, posted invoices, delivery notes - then display an address they were never issued with, and the previous value is lost.

This module creates a new address instead, and leaves the edited one untouched. It hooks into CustomerPortal._create_or_update_address() and drops the partner being edited, so core follows its own creation path: the address is completed and attached to the commercial partner by _complete_address_values(), and website_sale repoints the cart to the record returned by the call. No core logic is duplicated.

Two cases are deliberately left alone. The customer's own contact record is edited in place, since it is not an invoice or delivery address but their own data, and replacing it would detach them from their own documents. A form saved without changes is not copied either, so opening an address and saving it untouched leaves no duplicate behind.

The superseded address is kept rather than archived. Whether an address is still wanted is a business decision, and it is noted in the ROADMAP together with the only_services cart limitation.

To reproduce, as a portal user in My Account > Addresses, edit a delivery or billing address that a confirmed order already uses and save it. Without the module the order shows the edited address; with it, both addresses are listed and the order still points at the original.

Tested with 5 tests on a database with only portal and its dependencies installed.

Create a new address when a portal customer edits one of their invoice or
delivery addresses, instead of rewriting the address the documents already
issued were issued with. The edited address is kept, not archived.
@OCA-git-bot OCA-git-bot added series:19.0 mod:portal_address_copy_on_edit Module portal_address_copy_on_edit labels Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:portal_address_copy_on_edit Module portal_address_copy_on_edit series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants