[FIX] website_sale: fix re-order feature on SO portal page
SO portal page may have `[Order Again]` button. It's visible when there is at
least one line with a product that might be reordered ("Added to cart"). This
check fails with error "Expected singleton: product.product()" if first line is
a section name or a note.
Fix it by excluding such lines from `any(...)` check.
STEPS:
* Activate "Re-order From Portal"
* Create and confirm order that has section (or a note) as a first line
* Click `Customer Preview` smart button
Call stack:
https://github.com/odoo/odoo/blob/c4b90db77705139333bdf5faf26b12fc120d1661/addons/website_sale/views/templates.xml#L2466-L2471
https://github.com/odoo/odoo/blob/c4b90db77705139333bdf5faf26b12fc120d1661/addons/website_sale/models/sale_order.py#L420-L422
https://github.com/odoo/odoo/blob/c4b90db77705139333bdf5faf26b12fc120d1661/addons/website_sale/models/sale_order_line.py#L62-L64
https://github.com/odoo/odoo/blob/c4b90db77705139333bdf5faf26b12fc120d1661/addons/website_sale/models/product_product.py#L95-L97
Original commit that introduces re-order feature:
https://github.com/odoo/odoo/commit/fef332bec4447b7ce8d789af8773c56688f4958a
opw-3141929
closes odoo/odoo#112788
X-original-commit: 7fa388e3394af624b3dd69fbf9a8b8b992d655fb
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit is contained in:
@@ -434,7 +434,7 @@ class SaleOrder(models.Model):
|
||||
|
||||
def _is_reorder_allowed(self):
|
||||
self.ensure_one()
|
||||
return self.state == 'sale' and any(line._is_reorder_allowed() for line in self.order_line)
|
||||
return self.state == 'sale' and any(line._is_reorder_allowed() for line in self.order_line if not line.display_type)
|
||||
|
||||
def _filter_can_send_abandoned_cart_mail(self):
|
||||
self.website_id.ensure_one()
|
||||
|
||||
Reference in New Issue
Block a user