Skip to content

[18.0][ADD] repair_sale_multi#110

Open
AaronHForgeFlow wants to merge 1 commit intoOCA:18.0from
ForgeFlow:18.0-add-repair_sale_multi
Open

[18.0][ADD] repair_sale_multi#110
AaronHForgeFlow wants to merge 1 commit intoOCA:18.0from
ForgeFlow:18.0-add-repair_sale_multi

Conversation

@AaronHForgeFlow
Copy link
Contributor

Odoo base repair module already allows to have one quotation for multiple repairs, but it is not possible for a user to do this. I am repairing several devices for the customer and the customer just want one single quotation for them all.

@AaronHForgeFlow AaronHForgeFlow force-pushed the 18.0-add-repair_sale_multi branch from 3d92f90 to 6e4e287 Compare July 21, 2025 10:47
@AaronHForgeFlow
Copy link
Contributor Author

Tests failing are not due to the changes proposed here: #111

@AaronHForgeFlow AaronHForgeFlow force-pushed the 18.0-add-repair_sale_multi branch from 6e4e287 to 3c447eb Compare July 24, 2025 09:07
Comment on lines +37 to +48
self.env["sale.order"].create(
{
"company_id": self.company_id.id,
"partner_id": partners.id,
"warehouse_id": picking_types.warehouse_id.id,
"repair_order_ids": [Command.link(ro.id) for ro in self],
}
)

Choose a reason for hiding this comment

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

just for future usage, we could add a hook here to pass values to be used to create the SO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! :)

@AaronHForgeFlow AaronHForgeFlow force-pushed the 18.0-add-repair_sale_multi branch from 3c447eb to 7a02fd5 Compare August 4, 2025 15:42
Copy link

@JordiMForgeFlow JordiMForgeFlow left a comment

Choose a reason for hiding this comment

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

code review 👍🏼

@AaronHForgeFlow AaronHForgeFlow force-pushed the 18.0-add-repair_sale_multi branch 3 times, most recently from 18db9bf to a29b2a0 Compare August 8, 2025 13:01
@AaronHForgeFlow AaronHForgeFlow force-pushed the 18.0-add-repair_sale_multi branch from a29b2a0 to 8ff60e9 Compare August 13, 2025 10:15
@AaronHForgeFlow AaronHForgeFlow force-pushed the 18.0-add-repair_sale_multi branch from 8ff60e9 to e867812 Compare September 9, 2025 13:28
@AaronHForgeFlow AaronHForgeFlow force-pushed the 18.0-add-repair_sale_multi branch from e867812 to e7fbf35 Compare September 12, 2025 06:45
ref_str = "\n".join(ro.name for ro in already_linked)
error_msg = (
"You cannot create a quotation for repair orders already linked to "
f"a sale order:\n{ref_str}"
Copy link
Contributor

Choose a reason for hiding this comment

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

You can't interpolate a string before it's translated, the dynamic translation term won't ever be matched.

Please use the built-in string interpolation self.env._("This is something: %s", something)

)
raise UserError(self.env._(error_msg))
picking_types = self.mapped("picking_type_id")
if not picking_types or len(picking_types) != 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if not picking_types or len(picking_types) != 1:
if len(picking_types) != 1:

redundant

)

partners = self.mapped("partner_id")
if not partners or len(partners) != 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if not partners or len(partners) != 1:
if len(partners) != 1:

redundant

Comment on lines +17 to +18
if move.repair_id.sale_order_id
else False,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if move.repair_id.sale_order_id
else False,

redundant. move.repair_id.sale_order_id.id will be False if any recordset in the chain is empty

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps you can avoid the whole thing if the move.repair_id.sale_order_id is empty. Cause it makes no sense to do the search in this case

@github-actions
Copy link

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 Feb 15, 2026
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.

3 participants