-
-
Notifications
You must be signed in to change notification settings - Fork 59
[18.0][ADD] repair_sale_multi #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Conversation
3d92f90 to
6e4e287
Compare
|
Tests failing are not due to the changes proposed here: #111 |
6e4e287 to
3c447eb
Compare
| 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], | ||
| } | ||
| ) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! :)
3c447eb to
7a02fd5
Compare
JordiMForgeFlow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code review 👍🏼
18db9bf to
a29b2a0
Compare
a29b2a0 to
8ff60e9
Compare
8ff60e9 to
e867812
Compare
e867812 to
e7fbf35
Compare
| 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}" |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if not partners or len(partners) != 1: | |
| if len(partners) != 1: |
redundant
| if move.repair_id.sale_order_id | ||
| else False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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
There was a problem hiding this comment.
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
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.