Skip to content

Commit ecc80e5

Browse files
committed
[MIG] product_alias: Migration to 18.0
1 parent 5542301 commit ecc80e5

8 files changed

Lines changed: 24 additions & 23 deletions

File tree

product_alias/README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
=========================
2-
Shopinvader Product Alias
3-
=========================
1+
=============
2+
Product Alias
3+
=============
44

55
..
66
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -29,7 +29,7 @@ Shopinvader Product Alias
2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

3131
This module allows to add url aliases from the product template for each
32-
selectected variants (or attribute values's combinaison)
32+
selectected variants (or attribute values's combinaison).
3333

3434
**Table of contents**
3535

product_alias/__manifest__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
44

55
{
6-
"name": "Shopinvader Product Alias",
6+
"name": "Product Alias",
77
"summary": "Alias for each product attribute values's configuration",
8-
"version": "14.0.1.0.0",
8+
"version": "18.0.1.0.0",
99
"category": "Shopinvader",
1010
"website": "https://github.com/OCA/e-commerce",
1111
"author": "Akretion, Odoo Community Association (OCA)",
@@ -14,7 +14,7 @@
1414
"application": False,
1515
"installable": True,
1616
"depends": [
17-
"shopinvader",
17+
"product",
1818
],
1919
"data": [
2020
"views/product_template.xml",

product_alias/models/product_alias.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
class ProductAlias(models.Model):
99
_name = "product.alias"
10+
_description = "Product Alias"
1011

1112
product_tmpl_id = fields.Many2one(
1213
"product.template",
1314
required=True,
1415
)
1516

1617
name = fields.Char(
17-
string="Name",
1818
required=True,
1919
)
2020

product_alias/models/product_product.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def _get_matching_alias(self):
1818
values = self.product_template_attribute_value_ids.product_attribute_value_id
1919
for alias in self.product_alias_ids:
2020
attrs = alias.attribute_value_ids.attribute_id
21-
variant_values = values.filtered(lambda s: s.attribute_id in attrs)
21+
variant_values = values.filtered(
22+
lambda s, attrs=attrs: s.attribute_id in attrs
23+
)
2224
if variant_values and not (variant_values - alias.attribute_value_ids):
2325
match |= alias
2426
if len(match) > 1:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
This module allows to add url aliases from the product template for each
2-
selectected variants (or attribute values's combinaison)
2+
selectected variants (or attribute values's combinaison).

product_alias/static/description/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>Shopinvader Product Alias</title>
6+
<title>Product Alias</title>
77
<style type="text/css">
88

99
/*
@@ -360,8 +360,8 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document" id="shopinvader-product-alias">
364-
<h1 class="title">Shopinvader Product Alias</h1>
363+
<div class="document" id="product-alias">
364+
<h1 class="title">Product Alias</h1>
365365

366366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367367
!! This file is generated by oca-gen-addon-readme !!
@@ -371,7 +371,7 @@ <h1 class="title">Shopinvader Product Alias</h1>
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372372
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/e-commerce/tree/18.0/product_alias"><img alt="OCA/e-commerce" src="https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-product_alias"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>This module allows to add url aliases from the product template for each
374-
selectected variants (or attribute values’s combinaison)</p>
374+
selectected variants (or attribute values’s combinaison).</p>
375375
<p><strong>Table of contents</strong></p>
376376
<div class="contents local topic" id="contents">
377377
<ul class="simple">

product_alias/tests/test_product.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# @author Sébastien BEAU <sebastien.beau@akretion.com>
33
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
44

5-
65
from odoo.exceptions import UserError
7-
from odoo.tests import SavepointCase
6+
from odoo.tests import TransactionCase
87

98

10-
class TestProduct(SavepointCase):
9+
class TestProduct(TransactionCase):
1110
@classmethod
1211
def setUpClass(cls):
1312
super().setUpClass()
13+
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
1414
cls.tmpl = cls.env.ref("product.product_product_4_product_template")
1515
cls.product_sw = cls.env.ref("product.product_product_4") # steel, white
1616
cls.product_sb = cls.env.ref("product.product_product_4b") # steel, black
@@ -70,4 +70,4 @@ def test_product_alias_raise(self):
7070
"attribute_value_ids": [(6, 0, [self.attr_a.id])],
7171
}
7272
)
73-
self.env["product.alias"].flush()
73+
self.env["product.alias"].flush_model()

product_alias/views/product_template.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8" ?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<!-- Copyright (C) 2023 Akretion (<http://www.akretion.com>).
33
@author Kévin Roche <kevin.roche@akretion.com>
44
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
@@ -11,17 +11,16 @@
1111
<page
1212
name="Alias"
1313
string="Alias"
14-
attrs="{'invisible': [('product_variant_count', '&lt;=', 1)]}"
14+
invisible="product_variant_count &lt;= 1"
1515
>
1616
<field
1717
name="product_alias_ids"
1818
context="{'default_product_tmpl_id': id}"
1919
>
20-
<tree editable="bottom">
20+
<list editable="bottom">
2121
<field name="name" />
2222
<field name="attribute_value_ids" widget="many2many_tags" />
23-
<field name="available_attribute_value_ids" invisible="1" />
24-
</tree>
23+
</list>
2524
</field>
2625
</page>
2726
</xpath>

0 commit comments

Comments
 (0)