-
-
Notifications
You must be signed in to change notification settings - Fork 684
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
[WIP] 9.0 website_base_multi_image #252
Changes from 1 commit
850e460
ae9103a
52c1e0b
e70a9c4
ee2d903
4ff4a7a
233dcf2
2ebdc95
9c55698
67f1d36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,30 +7,34 @@ Website Base Multi-Image | |
======================== | ||
|
||
This module extends the functionality of 'base_multi_image' module | ||
to show winery data in website | ||
to show images gallery in website | ||
|
||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Go to ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔥 |
||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/{id} | ||
:target: https://runbot.odoo-community.org/runbot/186/website | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/xxx/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback | ||
`here <https://github.com/OCA/website/issues/new?body=module:%mypopwine_website_portal_purchase_winery%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/website/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Carlos Dauden <carlos.dauden@tecnativa.com> | ||
* Sergio Teruel <sergio.teruel@tecnativa.com> | ||
|
||
Maintainer | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- © 2016 Sergio Teruel <sergio.teruel@tecnativa.com> | ||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> | ||
<odoo> | ||
|
||
<template id="demo_page" page="True" name="Website Base Multi Image"> | ||
<t t-call="website.layout"> | ||
<div id="wrap" class="oe_structure oe_empty"> | ||
<section> | ||
<div class="container readable mt32 mb32"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<h1 class="text-center">Image Gallery</h1> | ||
<h3 class="text-muted text-center"> | ||
Test here the image gallery | ||
</h3> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<t t-call="website_base_multi_image.base_multi_image_carousel"> | ||
<t t-set="owner_model" t-value="'res.partner'"/> | ||
<t t-set="owner_id" t-value="1"/> | ||
<t t-set="edit_action" t-value="False"/> | ||
</t> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
</t> | ||
</template> | ||
|
||
<record id="demo_page_link" model="website.menu"> | ||
<field name="name">Website multi image demo</field> | ||
<field name="url">/page/website_base_multi_image.demo_page</field> | ||
<field name="parent_id" ref="website.main_menu" /> | ||
<field name="sequence" type="int">50</field> | ||
</record> | ||
|
||
</odoo> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<data noupdate="0"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
<!-- | ||
Resource: base_multi_image.image | ||
--> | ||
|
||
<record id="partner_image_1" model="base_multi_image.image"> | ||
<field name="name">Partner Image 1</field> | ||
<field name="owner_id">1</field> | ||
<field name="owner_model">res.partner</field> | ||
<field name="storage">db</field> | ||
<field name="file_db_store" | ||
type="base64" | ||
file="website_base_multi_image/static/src/img/partner_image_1.jpg"/> | ||
</record> | ||
|
||
<record id="partner_image_2" model="base_multi_image.image"> | ||
<field name="name">Partner Image 2</field> | ||
<field name="owner_id">1</field> | ||
<field name="owner_model">res.partner</field> | ||
<field name="storage">db</field> | ||
<field name="file_db_store" | ||
type="base64" | ||
file="website_base_multi_image/static/src/img/partner_image_2.jpg"/> | ||
</record> | ||
|
||
</data> | ||
</odoo> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) | ||
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> | ||
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
# © 2016 Sergio Teruel <sergio.teruel@tecnativa.com> | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
import base64 | ||
from openerp import api, models | ||
|
@@ -19,12 +17,12 @@ def get_images_to_add(self, post, model_name): | |
@return: List of images to add | ||
""" | ||
images_to_add = [] | ||
for key in post.keys(): | ||
if 'new_image_' in key: | ||
if isinstance(post[key], list): | ||
new_image = post[key][0] | ||
for key, image in post.iteritems(): | ||
if key.startswith('new_image_'): | ||
if isinstance(image, list): | ||
new_image = image[0] | ||
else: | ||
new_image = post[key] | ||
new_image = image | ||
images_to_add.append((0, 0, { | ||
'storage': 'db', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could get this from context ( |
||
'file_db_store': base64.encodestring(new_image.read()), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_portal_supplier_base_multi_image,access_portal_supplier_base_multi_image,base_multi_image.model_base_multi_image_image,base.group_portal,1,1,1,0 | ||
access_portal_base_multi_image,access_portal_base_multi_image,base_multi_image.model_base_multi_image_image,base.group_portal,1,0,0,0 | ||
access_public_base_multi_image,access_public_base_multi_image,base_multi_image.model_base_multi_image_image,base.group_public,1,0,0,0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could use a single rule for this, with no group. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are still giving access to public and portal users to every image in the database. As this is right now, this is a 👎 blocking security issue. I think the best fix you could apply is something similar to what I do here for That IMP should go direclty into |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,19 +44,8 @@ | |
background-size: cover; | ||
} | ||
|
||
#base_multi_image .carousel-indicators .active { | ||
/*display: none;*/ | ||
|
||
} | ||
|
||
#base_multi_image .existing-attachment-cell{ | ||
height: 0px; | ||
width: 110px; | ||
margin-left: 5px; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All this line would become more readable/reusable if written into less/sass. Not blocking 😉 |
||
|
||
/*#base_multi_image .thumb-container{ | ||
width: 130px; | ||
float: left; | ||
margin-top: 5px; | ||
}*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usage instructions? Don't know what to test...