Skip to content

Commit

Permalink
[MIG] website_sale_product_attachment: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ernesto-garcia-tecnativa committed Aug 21, 2023
1 parent d639ea6 commit 6c02d87
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 41 deletions.
2 changes: 1 addition & 1 deletion website_sale_product_attachment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "eCommerce product attachments",
"summary": "Let visitors download attachments from a product page",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"development_status": "Beta",
"category": "Website",
"website": "https://github.com/OCA/e-commerce",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ odoo.define("website_sale_product_attachment.tour", function (require) {
trigger: "a:contains('Customizable Desk')",
},
{
trigger: ".btn:contains('Product downloads')",
trigger: "a:contains('Product downloads')",
},
]
);
Expand Down
69 changes: 36 additions & 33 deletions website_sale_product_attachment/templates/product_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
<xpath expr="//*[@id='product_details']">
<t t-if="product.website_attachment_ids">
<hr />
<div class="card o_not_editable" id="product_attachments">
<div class="card-header" id="product_attachments_header">
<button
class="btn btn-block text-left"
type="button"
data-toggle="collapse"
data-target="#product_attachments_body"
aria-expanded="true"
aria-controls="product_attachments_body"
<div id="product_attachments" class="accordion" role="tablist">
<div class="card bg-white" data-name="Item">
<a
href="#"
role="tab"
data-bs-toggle="collapse"
aria-expanded="false"
class="card-header o_default_snippet_text collapsed"
data-bs-target="#product_attachments_body"
>
<div class="row justify-content-between">
<div class="col-auto">
Expand All @@ -31,31 +31,34 @@
<i class="fa fa-caret-down" />
</div>
</div>
</button>
</div>
<div
id="product_attachments_body"
class="collapse"
aria-labelledby="product_attachments_header"
>
<ul class="list-group list-group-flush">
<t
t-foreach="product.website_attachment_ids.sudo().sorted(lambda x: x.website_name or x.name)"
t-as="attachment"
>
<li class="list-group-item">
<a
class="d-flex justify-content-start align-items-center"
target="_new"
t-att-href="attachment.local_url"
</a>
<div
class="collapse"
role="tabpanel"
id="product_attachments_body"
style=""
>
<div class="card-body">
<ul class="list-group list-group-flush">
<t
t-foreach="product.website_attachment_ids.sudo().sorted(lambda x: x.website_name or x.name)"
t-as="attachment"
>
<span
t-esc="attachment.website_name or attachment.name"
/>
</a>
</li>
</t>
</ul>
<li class="list-group-item">
<a
class="d-flex justify-content-start align-items-center"
target="_new"
t-att-href="attachment.local_url"
>
<span
t-esc="attachment.website_name or attachment.name"
/>
</a>
</li>
</t>
</ul>
</div>
</div>
</div>
</div>
</t>
Expand Down
14 changes: 8 additions & 6 deletions website_sale_product_attachment/tests/test_tour.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)
# Copyright 2021 Tecnativa - Víctor Martínez

from odoo.tests import common
import odoo.tests


class TestWebsiteSaleProductAttachmentTourl(common.HttpCase):
def setUp(self):
super().setUp()
attachment = self.env.ref("website.library_image_11")
product = self.env.ref("product.product_product_4_product_template")
@odoo.tests.tagged("post_install", "-at_install")
class TestWebsiteSaleProductAttachmentTourl(odoo.tests.HttpCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
attachment = cls.env.ref("website.library_image_11")
product = cls.env.ref("product.product_product_4_product_template")
product.website_attachment_ids = [(6, 0, [attachment.id])]

def test_tour(self):
Expand Down

0 comments on commit 6c02d87

Please sign in to comment.