Issue #1167 resolved

Multi-site "satchmo_rebuild_pricing" deletes pricing for other sites.

Patrick Kimber
created an issue

In a multi-site Satchmo shop, the "satchmo_rebuild_pricing" management command deletes prices for sites which have already been processed: The "satchmo_rebuild_pricing.py" management command iterates through the sites one at a time: http://bitbucket.org/chris1610/satchmo/src/tip/satchmo/apps/product/management/commands/satchmo_rebuild_pricing.py The command correctly creates the pricing for the first site, then moves onto the second site. As part of the routine, the old prices for a product are deleted: http://bitbucket.org/chris1610/satchmo/src/2e0e9d76af4b/satchmo/apps/product/models.py#cl-1267 The problem is, the "delete_for_product" method removes all pricing for a product slug without filtering by the site ID:

{{{ def delete_for_product(self, product): for obj in self.filter(productslug=product.slug): obj.delete() }}}

  • To solve the problem, I think we should add a site filter to the "delete_for_product" method i.e:

{{{ def delete_for_product(self, product): for obj in self.filter(productslug=product.slug, siteid=product.site.id): obj.delete() }}}

Comments (2)

  1. Log in to comment