Skip to content

[IMP] rma_sale: manually link RMAs to sale orders#585

Open
sbejaoui wants to merge 1 commit into
OCA:16.0from
acsone:16.0-rma_sale-sbj
Open

[IMP] rma_sale: manually link RMAs to sale orders#585
sbejaoui wants to merge 1 commit into
OCA:16.0from
acsone:16.0-rma_sale-sbj

Conversation

@sbejaoui
Copy link
Copy Markdown
Contributor

In some cases, RMAs need to be created before the related sale order is known. This commit allows manually linking the RMA to a sale order afterward to improve traceability

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @pedrobaeza,
some modules you are maintaining are being modified, check this out!

In some cases, RMAs need to be created before the related sale
order is known. This commit allows manually linking
the RMA to a sale order afterward to improve traceability
@sbejaoui sbejaoui force-pushed the 16.0-rma_sale-sbj branch from 221cff1 to 7a0a726 Compare May 15, 2026 14:28
@sbejaoui sbejaoui changed the title [ADD] rma_sale: manually link RMAs to sale orders [IMP] rma_sale: manually link RMAs to sale orders May 15, 2026
@pedrobaeza pedrobaeza added this to the 16.0 milestone May 15, 2026
@pedrobaeza pedrobaeza requested a review from victoralmau May 15, 2026 14:30
name="action_link_to_sale_order"
type="object"
string="Link to sale order"
attrs="{'invisible': [('move_id', '!=', False)]}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
attrs="{'invisible': [('move_id', '!=', False)]}"
attrs="{'invisible': ['|', ('id', '=', False),('order_id', '!=', False)]}"


rma_id = fields.Many2one(comodel_name="rma")
partner_id = fields.Many2one(related="rma_id.partner_id")
sale_order_id = fields.Many2one(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, the best approach would be to select sales order lines (by filtering by product) and, within the action_link_rma_to_sale_order() method, also define the appropriate move_id to ensure that all data is consistent.

<field name="arch" type="xml">
<header position="inside">
<button
name="action_link_to_sale_order"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name="action_link_to_sale_order"
name="action_link_to_sale_order"
groups="sales_team.group_sale_salesman"

<!-- Copyright 2026 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +27 to +29



Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Copy Markdown

@phschmidt phschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional tests and review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants