Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
5abad42e
Commit
5abad42e
authored
6 years ago
by
Bohdan Lisnenko
Committed by
Jeremy Kersten
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] website_sale_comparison: keep attributes order consistent
Backport of
9298c576
+ adapt for v11 closes odoo/odoo#30305
parent
1c6c5042
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addons/website_sale_comparison/controllers/main.py
+3
-2
3 additions, 2 deletions
addons/website_sale_comparison/controllers/main.py
addons/website_sale_comparison/models/website_sale_comparison.py
+1
-1
1 addition, 1 deletion
...website_sale_comparison/models/website_sale_comparison.py
with
4 additions
and
3 deletions
addons/website_sale_comparison/controllers/main.py
+
3
−
2
View file @
5abad42e
...
...
@@ -3,6 +3,7 @@ from odoo import http, _
from
odoo.http
import
request
from
odoo.addons.website_sale.controllers.main
import
WebsiteSale
import
json
from
collections
import
OrderedDict
class
WebsiteSaleProductComparison
(
WebsiteSale
):
...
...
@@ -19,12 +20,12 @@ class WebsiteSaleProductComparison(WebsiteSale):
res
=
{}
for
num
,
product
in
enumerate
(
products
):
for
var
in
product
.
attribute_line_ids
:
for
var
in
product
.
attribute_line_ids
.
sorted
(
lambda
x
:
x
.
attribute_id
.
sequence
)
:
cat_name
=
var
.
attribute_id
.
category_id
.
name
or
_
(
'
Uncategorized
'
)
att_name
=
var
.
attribute_id
.
name
if
not
product
.
attribute_value_ids
:
# create_variant = False
continue
res
.
setdefault
(
cat_name
,
{}
).
setdefault
(
att_name
,
[
'
-
'
]
*
len
(
products
))
res
.
setdefault
(
cat_name
,
OrderedDict
()
).
setdefault
(
att_name
,
[
'
-
'
]
*
len
(
products
))
val
=
product
.
attribute_value_ids
.
filtered
(
lambda
x
:
x
.
attribute_id
==
var
.
attribute_id
)
res
[
cat_name
][
att_name
][
num
]
=
val
[
0
].
name
values
[
'
specs
'
]
=
res
...
...
This diff is collapsed.
Click to expand it.
addons/website_sale_comparison/models/website_sale_comparison.py
+
1
−
1
View file @
5abad42e
...
...
@@ -26,6 +26,6 @@ class ProductTemplate(models.Model):
def
get_variant_groups
(
self
):
res
=
OrderedDict
()
for
var
in
self
.
attribute_line_ids
:
for
var
in
self
.
attribute_line_ids
.
sorted
(
lambda
x
:
x
.
attribute_id
.
sequence
)
:
res
.
setdefault
(
var
.
attribute_id
.
category_id
.
name
or
_
(
'
Uncategorized
'
),
[]).
append
(
var
)
return
res
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment