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

[8.0][base_multi_image][product_multi_image] Multi images for products split in abstract and concrete models #112

Closed
wants to merge 19 commits into from

Conversation

yajo
Copy link
Member

@yajo yajo commented Nov 19, 2015

According to OdooCommunityWidgets/website_multi_image#34 (comment), I'm pushing this PR that continues job from #57 to discuss about design, but it is a WIP right now.

@pedrobaeza
Copy link
Member

The name should be base_multi_image and I'm not sure if the repo target should be this or server-tools, and let product_multi_image for here. Anway, this is a WIP and we can let here the discussion.


To develop a module based on this one:

* See module ``multi_image_product`` as an example.
Copy link
Member

Choose a reason for hiding this comment

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

product_multi_image: always first the name of the "area".

Choose a reason for hiding this comment

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

product_image_multi?

@yajo
Copy link
Member Author

yajo commented Feb 1, 2016

I refactored most code to make it easier to inherit, and moving as much as possible to the base module, following the method learned with OCA/server-tools#313. It fixed some bugs by the way, but there is one remaining that I'd thank help:

  • Create a product.
  • Go to images tab.
  • Add one.
  • That image gets set as the product's image.

Now the reverse way does not work:

  • Create a product.
  • Set it an image.
  • No multi_image record is created, but the product gets the image!

It takes care of moving images from the main model to the gallery
submodel, making the first image in the set always the main one. It's
implemented in
:meth:`~.multi_image_base.hooks.post_init_hook_for_submodules` for
better reusability across submodules.
@yajo
Copy link
Member Author

yajo commented Feb 3, 2016

Finally it works (I hope). Ready to review!

@rafaelbn
Copy link
Member

rafaelbn commented Feb 3, 2016

Travis fails

@dreispt dreispt added this to the 8.0 milestone Feb 13, 2016
@yajo
Copy link
Member Author

yajo commented Feb 15, 2016

The name is alright because odoo names for modules are <section>_<functionality>. In this case base indicates the functionality of the multi_image section, not the other way around.

Also I kept both modules in 1 PR because one does nothing without the another. I understand the base one should go to server-tools, but please review this and when I have enough 👍 I will split it before merging, so you can test now in runbot and so.

@pedrobaeza
Copy link
Member

@yajo, you can say what you want, but the name is not correct. All is prefixed with base, not suffixed. If not, I challenge you to show me one 8.0 standard module with the base word at the end. Please stop debating all the reviews you receive and accept humbly the suggestions made by the reviewers.

@yajo
Copy link
Member Author

yajo commented Feb 15, 2016

Hmm you are right, I did not know that exception. About the website dependency it's about the usage of assets_frontend view.

@yajo yajo changed the title [8.0][multi_image_base][product_multi_image] Multi images for products split in abstract and concrete models [8.0][base_multi_image][product_multi_image] Multi images for products split in abstract and concrete models Feb 15, 2016
@dreispt
Copy link
Sponsor Member

dreispt commented Feb 16, 2016

The multi_image module is a generic feature, not specifically linked to products.
So I insist it should go in OCA/server-tools.

@dreispt
Copy link
Sponsor Member

dreispt commented Feb 16, 2016

The website dependency is not needed then: you can add the assets to web instead of website.

@yajo
Copy link
Member Author

yajo commented Feb 17, 2016

@dreispt

The multi_image module is a generic feature, not specifically linked to products.
So I insist it should go in OCA/server-tools.

I agree. But could you (and others) please test and conditionally approve this before I split? It's just because one module without the other don't make too much sense and will break bots.

The website dependency is not needed then: you can add the assets to web instead of website.

I'm afraid the assets_frontend view is defined in website. Anyway, it's not too common to want to have an image gallery for something you don't want to show up in your website, don't you think? This is another case of perfect vs practical. I think a module that just adds that template would be an overkill.

@pedrobaeza
Copy link
Member

I don't agree about the website part, @yajo. You can have multiple images because you synchronize Prestashop/Magento products, and you only want to maintain them. For that, you don't need website.

@yajo
Copy link
Member Author

yajo commented Feb 19, 2016

Do you want 2 modules then?

@dreispt
Copy link
Sponsor Member

dreispt commented Feb 19, 2016

@yajo you mean 3?

@yajo
Copy link
Member Author

yajo commented Feb 19, 2016

yes, sorry.

@dreispt
Copy link
Sponsor Member

dreispt commented Feb 19, 2016

Can't you just replace the website dependency by a web one?

<openerp>
<data>

<template id="assets_frontend" inherit_id="website.assets_frontend">
Copy link
Member Author

Choose a reason for hiding this comment

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

@dreispt Here's why I need website (or split module).

@dreispt
Copy link
Sponsor Member

dreispt commented Feb 19, 2016

<data>

<!-- Call this template in your owner's website page to get a carousel.
It needs a `multi_image_owner` variable set. -->
Copy link
Member Author

Choose a reason for hiding this comment

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

@dreispt These templates are to reuse in frontend website, not backend, so assets must go in frontend.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Since this is a base module, it provides tools to reuse in submodules, like these templates. These templates are useless without the attached CSS, and you cannot attach it without the website module. I hope you understand the dependency is required, so either I split the module or it stays there.

@dreispt
Copy link
Sponsor Member

dreispt commented Feb 19, 2016

I don't understand we we need frontend features in a backend module. Confusing...
Front end features should go in their own modules and use a prefix website_

@rafaelbn
Copy link
Member

Hi @yajo , please which is the state of this PR, please could you give a resume? Thanks

@dreispt we don't need here front-end features, this module is done to provide base functionalities to future modules as product_multi_image, event_multi_image, .... always in back-end. Of course when we will have such modules as event_multi_image (which depend on this one) we will do website_event_multi_image to show this multi images in front-end.

Note: like this module OCA has more base_* modules like https://github.com/OCA/partner-contact/tree/8.0/base_contact, .... I think idea is clear.

@yajo
Copy link
Member Author

yajo commented Feb 24, 2016

Well after confusions have been cleared, let me split this into 3 modules and PR. Thanks everyone!

@yajo
Copy link
Member Author

yajo commented Feb 24, 2016

Thanks everyone! 😉 This is now properly split. Please review: OCA/server-tools#374, OCA/website#171, #135, OCA/event#31, OCA/event#33.

@dreispt
Copy link
Sponsor Member

dreispt commented Feb 25, 2016

@yajo Shoudn't there be a PR for OCA/product-attribute also?

@yajo
Copy link
Member Author

yajo commented Feb 25, 2016

True, I forgot to say it: #135

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

Successfully merging this pull request may close these issues.

None yet

7 participants