-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
[16.0][FIX] rma: same procurement group for reception and delivery #421
base: 16.0
Are you sure you want to change the base?
Conversation
Hi @chienandalu, @pedrobaeza, |
a4ae789
to
702a7d1
Compare
|
||
def _prepare_procurement_group_vals(self): | ||
vals = super()._prepare_procurement_group_vals() | ||
if not self.env.context.get("ignore_rma_sale_order") and self.order_id: | ||
vals["sale_id"] = self.order_id.id | ||
return vals | ||
|
||
def _prepare_delivery_procurements(self, scheduled_date=None, qty=None, uom=None): | ||
self = self.with_context(ignore_rma_sale_order=True) | ||
return super()._prepare_delivery_procurements( | ||
scheduled_date=scheduled_date, qty=qty, uom=uom | ||
) |
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.
I am not aware of the history behind this code, but I believe it was implemented this way to avoid linking the rma delivery pickings to the sales order, as in recent versions, this linkage creates a sales line if the procurement group is associated to a sale order without an existing line.
This approach has led to:
- Duplication of procurement groups, one for the reception and another for the deliveries.
- In the sales order, the RMA reception picking appears among the sales order pickings, but the delivery pickings do not.
- This unclear usage of context keys.
I propose to completely cut the link between the RMA procurement group and the sales order, maintaining a single procurement group for all RMA pickings.
In #417, I am working on a different approach to establish this link between the RMA stock moves and the sales line, allowing standard refunding to be configurable based on the operation.
702a7d1
to
634bdba
Compare
The procurement group created for reception was not being correctly assigned to the RMA, resulting in a different group being generated for the delivery. This fix ensures that the same procurement group is used for both operations.
634bdba
to
81e6ff8
Compare
) | ||
if not rmas: | ||
rmas = self.browse().concat(*list(rmas)) | ||
if not rmas or len(rmas.procurement_group_id) == 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.
But if some rma in the group don't have a procurement group, then you don't give them one anymore. I don't think you need to change the test
The procurement group created for reception was not being correctly assigned to the RMA, resulting in a different group being generated for the delivery.
This fix ensures that the same procurement group is used for both operations.
cc/ @jbaudoux , @lmignon , @rousseldenis