Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] website_attribute_set: add a module to show custom attributes in website #202

Open
wants to merge 12 commits into
base: 18.0
Choose a base branch
from

Conversation

kobros-tech
Copy link

@kobros-tech kobros-tech commented Feb 24, 2025

This new module is based on pim module and attribute_set and product_attribute_set

By default it is based on website, website_sale as we will display our OCA additional attributes in e-commerce website app.

We plan to optimize it so user can filter, search and choose products based on OCA attributes there.

Dependencies:

@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch from 34ee1f1 to 4916642 Compare February 24, 2025 20:42
@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch from 4916642 to de1886c Compare February 25, 2025 00:43
@kobros-tech kobros-tech marked this pull request as draft February 25, 2025 00:46
@kobros-tech
Copy link
Author

kobros-tech commented Feb 25, 2025

  • Add a boolean field to choose whether we can show attribute in website or no
  • Create a method to return a record set specific for attributes of type select or multiselect to enable user to choose from
  • Update the method get_attributes that works for websited we shall make it filter the attributes for website only
  • Add JS class with its JS code to check if attributes combination is present or no
  • Filter and Search functionality
  • Watch out assigning attributes their values and append them in hash arguments in URL
  • Add test cases to the module

@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch from 4a50584 to 5d11aa0 Compare February 26, 2025 19:11
@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch from 5d11aa0 to 8189fb9 Compare February 26, 2025 19:24
@kobros-tech
Copy link
Author

kobros-tech commented Feb 26, 2025

To show additional attributes in product page:

Screenshot from 2025-02-28 01-28-11

@kobros-tech
Copy link
Author

kobros-tech commented Feb 27, 2025

To show addtional attributes that can be filtered and searched:

Screenshot from 2025-03-02 13-28-33

@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch from ba36246 to 2e125eb Compare March 2, 2025 10:27
@kobros-tech
Copy link
Author

kobros-tech commented Mar 2, 2025

To filter results based on choosen attributes including the addtional ones:

Screenshot from 2025-03-02 13-29-06

@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch from 1007f1a to c5d3d1f Compare March 2, 2025 17:49
@kobros-tech
Copy link
Author

To search results based on choosen attributes including the addtional ones:

Screenshot from 2025-03-02 20-57-41

@kobros-tech kobros-tech marked this pull request as ready for review March 2, 2025 18:05
@kobros-tech kobros-tech changed the title [DEV][ADD] website_attribute_set: add a module to show custom attributes in website [ADD] website_attribute_set: add a module to show custom attributes in website Mar 2, 2025
@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch 2 times, most recently from 80cfe16 to b790f1f Compare March 3, 2025 00:20
@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch from b790f1f to 0177c34 Compare March 3, 2025 04:00
Copy link
Member

@mymage mymage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested on Runbot an it seems not working inside product: attributes are always visible; on the list view it is ok.
Maybe I'm doing something wrong.
ed: I filled my lack, all goes well

@kobros-tech
Copy link
Author

@mymage

did you use pim before?

@mymage
Copy link
Member

mymage commented Mar 3, 2025

@mymage

did you use pim before?

No

@kobros-tech
Copy link
Author

@mymage
did you use pim before?

No

watch this video
https://youtu.be/36u13vFuzcc?si=6fsxxtlJJxZVdpmS

@kobros-tech
Copy link
Author

To show additional attributes in products comparison:

Screenshot from 2025-03-04 22-10-21

@mymage
Copy link
Member

mymage commented Mar 5, 2025

@mymage
did you use pim before?

No

watch this video https://youtu.be/36u13vFuzcc?si=6fsxxtlJJxZVdpmS

Thanks, now I see the option.

Copy link
Member

@mymage mymage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional test LGTM

@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch from bfa83c1 to bd26740 Compare March 6, 2025 12:31
@kobros-tech
Copy link
Author

@rvalyi
@ovnicraft

can we review this new module?

@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch from bd26740 to d7c80aa Compare March 9, 2025 00:41
extra_domain = [(attribute.name, "ilike", float(search_term))]
extra_domains.append(extra_domain)
except ValueError as e:
_logger.info(f"{e}")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_logger.info(f"{e}")
_logger.warning(f"{e}")

This is an error value that should be warning instead of logged as information.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember it iw a website, and website users must do mistakes but we must ignore their mistakes as we expect and handle properly it should be our job in the background

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am even thinking of not logging the error in production as it can come from the seach function in website which should be not important to log

SequenceMatcher(None, attribute.field_description, search_term).ratio()
* 100
)
if similarity > 80:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if similarity > 80:
if similarity > 80:

What do we base this number (80) on and should we hard code it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a percentage of similarity like 80% alike

groups[attribute.attribute_group_id][attribute][product] = (
values.mapped("name")
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

remove empty line in a function

@rvalyi
Copy link
Member

rvalyi commented Mar 14, 2025

@rvalyi @ovnicraft

can we review this new module?

Hello @kobros-tech. As you see I'm making some efforts to help merging a few more basic odoo-pim PRs you made as I'm interested in that too. However I'm afraid, I'm not sure I'll be able to get as far as this website module in the time window you need, but I might try,

To give you some context, I'm the guy who made the early odoo PIM prototype 15 years ago when the OCA was still incubating on Launchpad. I'm also the Akretion founder. Initially we made these modules to offer the same kind of product attributes flexibility you get with the Magento "EAV" model, but with a decent no-SQL design for performance. Then I also push and prototyped Shopinvader which is our open source e-commerce solution at Akretion for 10 years now.

Indeed 10 years ago, the Odoo e-commerce was a big joke to say the least and Shopinvader allowed us to support the big customers that were using Magento initially. There would also be a lot to be told about Odoo security the way it was 10 years ago to give arbitrary ecommerce users permissions to try hacking into your ERP (extremly large attack surface).

That being said, 10 years ago Odoo started to actively "canibalize" its initial beloved "partners" to please its investors and turn OpenERP into a license and SaaS business. In that context, we in Brazil had to advance what is just the most complex localization in the world like crazy to keep up with the Odoo marketing starting to sell Odoo as a turnkey ERP and not as an ERP framework anymore (OpenERP). I had to give up a bit on Shopinvader and the PIM modules to make miracles in OCA/l10n-brazil (the biggest OCA repo).

As for now, the Odoo ecommerce starts to be decent and Shopinvader, while extremely scalable, has a much higher entry barrier. For the kind of companies, that are broke and are not technology aware, we usually deal with in Brazil, the native Odoo e-commerce seems finally like a viable option.

So I'm extremely happy to see guys like you bringing these Shopinvader features to the native Odoo ecommerce stack. I also recently told @sebastienbeau I think it would be cool if Shopinvader could have a simple mode were it could simply reuse the Odoo cart and cookie system which seems finally scalable and decent so eventually more things could be shared between the two stacks and shopinvader could be just a set of extra modules you would add when you need psycopath scalability or want to design your shop frontend using the latest sexiest "full stack" framework, possibly with the AI tools popping all over the place.

Also Postgres starts to compete a bit with Elastic and Elastic went to the dark side of the open source. With Odoo now starting to support hitting Postgres replicae for its website, the line with hitting the Elastic store is becoming blurred, so that's one more reason to reconsider using more of the Odoo ecommerce stack.

cc @sbidoul @lmignon @simahawk @hparfr @pedrobaeza @JordiBForgeFlow

@kobros-tech
Copy link
Author

kobros-tech commented Mar 14, 2025

Thanks @rvalyi very much, it's my pleasure to support my work.

I know you and your very good work, that is included within shopinvader.

I hade little talk with @lmignon, but it was not successful.

I could fix some issues with his fs_storage a year a ago, and it was my beginning at OCA.

Now, I did contribution in most of OCA projects and going to upgrade them and optimise.

Thanks to @kencove and MR. Don who pushed me fast forward and he is my employer now.

I dare to say that a business man like him and an ambitious guy like me with the team of Kencove made this, so our work here is business bearing work.

When I was alone I tried to contact you to upgrade Shopinvader forward but didn't succeed as I mentioned above.

I think it is a great opportunity to cooperate all of us as OCA members and entities to create positive projects that are striking and business attractive.

we still are working on that module and I guess MR. Don does not mind if we share ideas and contributions in this module or any coming ones.

I admit that we depend on your work of fastapi and file storage and we plan to test case all modules that still need test cases and of course migrations, I guess @pedrobaeza @lmignon @sbidoul and of course @JordiBForgeFlow interacted with me while I am doing fixing and migration.

In brief I was waiting for a moment when we as a community help eachother for personal sake and all of us as I alone cannot build all of this alone and that is why we have a community like OCA. 💚

@xaviedoanhduy
Copy link

doesn't look very user friendly. would be nice if special type fields like select and multisect would also show widget if available

image

@kobros-tech
Copy link
Author

doesn't look very user friendly. would be nice if special type fields like select and multisect would also show widget if available

image

if you have a nice default template for these components that looks attractive we don't mind

@kobros-tech
Copy link
Author

doesn't look very user friendly. would be nice if special type fields like select and multisect would also show widget if available

image

Here is the update:

Screenshot from 2025-03-18 23-37-54

@xaviedoanhduy
@dnplkndll

@kobros-tech
Copy link
Author

kobros-tech commented Mar 18, 2025

Add attributes in Specification:

Screenshot from 2025-03-19 01-20-12

@kobros-tech kobros-tech force-pushed the 18.0-add-website_attribute_set branch from 59be8e8 to 699e3a8 Compare March 18, 2025 22:19
Copy link

@xaviedoanhduy xaviedoanhduy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odoo native is using this template to display the attributes (ref). the current change is fine for me, thanks for your effort.
LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants