Skip to content
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

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

sbejaoui
Copy link
Contributor

@sbejaoui sbejaoui commented Aug 29, 2024

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

@OCA-git-bot
Copy link
Contributor

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

@sbejaoui sbejaoui force-pushed the 16.0-rma_procurement_group-sbj branch from a4ae789 to 702a7d1 Compare August 29, 2024 16:12
Comment on lines -166 to -177

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
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pedrobaeza ,

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.

@sbejaoui sbejaoui force-pushed the 16.0-rma_procurement_group-sbj branch from 702a7d1 to 634bdba Compare August 29, 2024 16:30
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.
@sbejaoui sbejaoui force-pushed the 16.0-rma_procurement_group-sbj branch from 634bdba to 81e6ff8 Compare September 3, 2024 10:37
)
if not rmas:
rmas = self.browse().concat(*list(rmas))
if not rmas or len(rmas.procurement_group_id) == 1:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants