Skip to content

Commit 68ed0f3

Browse files
victoralmaumiguel-S73
authored andcommitted
[MIG] website_sale_product_attachment: Migration to 13.0
1 parent 3f345cb commit 68ed0f3

File tree

15 files changed

+74
-43
lines changed

15 files changed

+74
-43
lines changed

website_sale_product_attachment/README.rst

-5
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ Once you set up the product attachments, public users will be able to download t
8989
.. figure:: https://raw.githubusercontent.com/OCA/e-commerce/12.0/website_sale_product_attachment/static/description/frontend-download.gif
9090
:alt: Attachments view in backend
9191

92-
Known issues / Roadmap
93-
======================
94-
95-
* Add tests.
96-
9792
Bug Tracker
9893
===========
9994

Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
from . import controllers
21
from . import models
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
# Copyright 2020 Tecnativa - Jairo Llopis
2+
# Copyright 2021 Tecnativa - Víctor Martínez
23
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
34
{
45
"name": "eCommerce product attachments",
56
"summary": "Let visitors download attachments from a product page",
6-
"version": "12.0.1.1.1",
7+
"version": "13.0.1.0.0",
78
"development_status": "Beta",
89
"category": "Website",
910
"website": "https://github.com/OCA/e-commerce",
1011
"author": "Tecnativa, Odoo Community Association (OCA)",
1112
"maintainers": ["Yajo"],
1213
"license": "LGPL-3",
1314
"installable": True,
14-
"depends": ["website_sale",],
15+
"depends": ["website_sale"],
1516
"data": [
1617
"templates/product_template.xml",
1718
"views/ir_attachment.xml",
1819
"views/product_template.xml",
1920
],
21+
"demo": ["demo/assets.xml"],
2022
}

website_sale_product_attachment/controllers/__init__.py

-1
This file was deleted.

website_sale_product_attachment/controllers/main.py

-28
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!-- License AGPL-3.0 (http://www.gnu.org/licenses/agpl.html). -->
3+
<odoo>
4+
<template
5+
id="website_sale_product_attachment_frontend_demo"
6+
inherit_id="web.assets_frontend"
7+
>
8+
<xpath expr="//script[last()]" position="after">
9+
<script
10+
type="text/javascript"
11+
src="/website_sale_product_attachment/static/src/js/website_tour.js"
12+
/>
13+
</xpath>
14+
</template>
15+
</odoo>

website_sale_product_attachment/models/product_template.py

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ def _domain_website_attachment_ids(self):
2727
("public", "=", True),
2828
# Exclude Odoo asset files to avoid confusing the user
2929
"!",
30+
("name", "=ilike", "%.assets%.js"),
31+
"!",
32+
("name", "=ilike", "%.assets%.css"),
33+
"!",
34+
("name", "=ilike", "web_editor%"),
35+
"!",
3036
("name", "=ilike", "/web/content/%.assets%.js"),
3137
"!",
3238
("name", "=ilike", "/web/content/%.assets%.css"),

website_sale_product_attachment/readme/CONFIGURE.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Instead of configuring attachments per product, to configure products per attach
55
#. Go to *Settings > Technical > Database Structure > Attachments*.
66
#. Pick or create one.
77
#. Enable *Attached To > Is public document*.
8-
#. Use the field *Attached in product templates* to choose the products.
8+
#. Use the field *Attached in products* to choose the products.
99

1010
.. figure:: ../static/description/backend-attachment.png
1111
:alt: Attachments view in backend
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
* Jairo Llopis (`Tecnativa <https://www.tecnativa.com/>`_)
1+
* `Tecnativa <https://www.tecnativa.com>`_:
2+
3+
* Jairo Llopis
4+
* Víctor Martínez

website_sale_product_attachment/readme/ROADMAP.rst

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
odoo.define("website_sale_product_attachment.tour", function(require) {
2+
"use strict";
3+
4+
var tour = require("web_tour.tour");
5+
6+
tour.register(
7+
"website_sale_product_attachment_tour",
8+
{
9+
url: "/shop",
10+
test: true,
11+
},
12+
[
13+
{
14+
trigger: "a:contains('Customizable Desk')",
15+
},
16+
{
17+
trigger: ".btn:contains('Product downloads')",
18+
},
19+
]
20+
);
21+
return {};
22+
});

website_sale_product_attachment/templates/product_template.xml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<!-- Copyright 2020 Tecnativa - Jairo Llopis
3+
Copyright 2021 Tecnativa - Víctor Martínez
34
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -->
45
<data>
56
<template
@@ -9,7 +10,7 @@
910
customize_show="True"
1011
>
1112
<xpath expr="//*[@id='product_details']">
12-
<t t-if="product_attachments">
13+
<t t-if="product.website_attachment_ids">
1314
<hr />
1415
<div class="card o_not_editable" id="product_attachments">
1516
<div class="card-header" id="product_attachments_header">
@@ -38,7 +39,10 @@
3839
aria-labelledby="product_attachments_header"
3940
>
4041
<ul class="list-group list-group-flush">
41-
<t t-foreach="product_attachments" t-as="attachment">
42+
<t
43+
t-foreach="product.website_attachment_ids"
44+
t-as="attachment"
45+
>
4246
<li class="list-group-item">
4347
<a
4448
class="d-flex justify-content-start align-items-center"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import test_tour
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)
2+
# Copyright 2021 Tecnativa - Víctor Martínez
3+
4+
from odoo.tests import common
5+
6+
7+
class TestWebsiteSaleProductAttachmentTourl(common.HttpCase):
8+
def setUp(self):
9+
super().setUp()
10+
attachment = self.env.ref("website.library_image_11")
11+
product = self.env.ref("product.product_product_4_product_template")
12+
product.website_attachment_ids = [(6, 0, [attachment.id])]
13+
14+
def test_tour(self):
15+
self.start_tour("/", "website_sale_product_attachment_tour", login="demo")

website_sale_product_attachment/views/product_template.xml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<field name="website_attachment_ids" nolabel="1">
1919
<tree>
2020
<field name="name" />
21-
<field name="datas_fname" />
2221
<field
2322
name="website_id"
2423
groups="website.group_multi_website"

0 commit comments

Comments
 (0)