Skip to content

[16.0][MIG] sale_mrp_link: Migration to 16.0 (from 12.0)#3339

Closed
legalsylvain wants to merge 28 commits intoOCA:16.0from
grap:16.0-mig-sale_mrp_link
Closed

[16.0][MIG] sale_mrp_link: Migration to 16.0 (from 12.0)#3339
legalsylvain wants to merge 28 commits intoOCA:16.0from
grap:16.0-mig-sale_mrp_link

Conversation

@legalsylvain
Copy link
Copy Markdown
Contributor

No description provided.

@yvaucher
Copy link
Copy Markdown
Member

yvaucher commented Oct 1, 2024

/ocabot migration sale_mrp_link

@OCA-git-bot OCA-git-bot added this to the 16.0 milestone Oct 1, 2024
Comment on lines +17 to +33
if "origin" in values:
# Checking first if this comes from a 'sale.order'
sale_id = self.env["sale.order"].search(
[("name", "=", values["origin"])], limit=1
)
if sale_id:
values["sale_order_id"] = sale_id.id
if sale_id.client_order_ref:
values["origin"] = sale_id.client_order_ref
else:
# Checking if this production comes from a route
production_id = self.env["mrp.production"].search(
[("name", "=", values["origin"])]
)
# If so, use the 'sale_order_id' from the parent production
values["sale_order_id"] = production_id.sale_order_id.id

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sale_order_id should not be overridden if already set (by third-party module)

Maybe add a check before:
if "origin" in values and not values.get("sale_order_id"):

Or browse the sale_id first and keep existing code:

if "origin" in values:
    # Checking first if this comes from a 'sale.order'
    sale_id = self.env["sale.order"].browse(values.get("sale_order_id"))
    if not sale_id:
        sale_id = self.env["sale.order"].search(
            [("name", "=", values["origin"])], limit=1
        )

@rousseldenis
Copy link
Copy Markdown
Contributor

@legalsylvain What's the status of this ?

@legalsylvain
Copy link
Copy Markdown
Contributor Author

Not sure to know how to finish this work. I didn't developped the module at the beginning, and I'm not sure to know how to address @ypapouin remark, as it is about code I didn't written.

feel free to finish !

@ypapouin
Copy link
Copy Markdown
Contributor

ypapouin commented Oct 6, 2025

@legalsylvain , just replacing if "origin" in values: with if "origin" in values and not values.get("sale_order_id") should be enough.

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 15, 2026
achaussende and others added 20 commits March 19, 2026 09:38
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-12.0/sale-workflow-12.0-sale_mrp_link
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_mrp_link/
As mrp.production already has a Many2one field pointing to sale.order it makes sense to have a One2many on the "other side".
This adds multiple benefits:
- Easier to open linked production with the smart button action
- Simpler production count computing (also now can store the result)
- Dependent modules can use the One2many field for other purposes
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-12.0/sale-workflow-12.0-sale_mrp_link
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_mrp_link/
Currently translated at 100.0% (5 of 5 strings)

Translation: sale-workflow-12.0/sale-workflow-12.0-sale_mrp_link
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_mrp_link/fr/
Currently translated at 100.0% (5 of 5 strings)

Translation: sale-workflow-12.0/sale-workflow-12.0-sale_mrp_link
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_mrp_link/es/
Currently translated at 100.0% (5 of 5 strings)

Translation: sale-workflow-12.0/sale-workflow-12.0-sale_mrp_link
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_mrp_link/ca/
@legalsylvain legalsylvain force-pushed the 16.0-mig-sale_mrp_link branch from f07d426 to 7f928a4 Compare March 19, 2026 08:41
@legalsylvain
Copy link
Copy Markdown
Contributor Author

legalsylvain commented Mar 19, 2026

Hi @ypapouin and @rousseldenis.

Sorry for the late. PR finished and rebased.
just two new commits to review :

Could you finish your review ?

Updated : tests are failing. no need to review for the time being.

thanks !

@legalsylvain legalsylvain marked this pull request as ready for review March 19, 2026 08:45
@legalsylvain legalsylvain marked this pull request as draft March 19, 2026 09:06
@legalsylvain
Copy link
Copy Markdown
Contributor Author

legalsylvain commented Mar 19, 2026

In fact, the feature is now native. closing.

odoo/odoo#43366
odoo/odoo@e1b3a17

you can review This OpenUpgrade PR : OCA/OpenUpgrade#5562

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

Labels

stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.