diff --git a/addons/event/event.py b/addons/event/event.py index 1d5bb35a83f..52cca514f7b 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -203,7 +203,7 @@ class event_event(osv.osv): 'email_confirmation_id' : fields.many2one('email.template','Event Confirmation Email', help="If you set an email template, each participant will receive this email announcing the confirmation of the event."), 'reply_to': fields.char('Reply-To Email', size=64, readonly=False, states={'done': [('readonly', True)]}, help="The email address of the organizer is likely to be put here, with the effect to be in the 'Reply-To' of the mails sent automatically at event or registrations confirmation. You can also put the email address of your mail gateway if you use one."), 'main_speaker_id': fields.many2one('res.partner','Main Speaker', readonly=False, states={'done': [('readonly', True)]}, help="Speaker who will be giving speech at the event."), - 'address_id': fields.many2one('res.partner','Location Address', readonly=False, states={'done': [('readonly', True)]}), + 'address_id': fields.many2one('res.partner','Location', readonly=False, states={'done': [('readonly', True)]}), 'street': fields.related('address_id','street',type='char',string='Street'), 'street2': fields.related('address_id','street2',type='char',string='Street2'), 'state_id': fields.related('address_id','state_id',type='many2one', relation="res.country.state", string='State'), diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index a9831720abf..82992388498 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -80,18 +80,7 @@ - diff --git a/addons/website/__openerp__.py b/addons/website/__openerp__.py index d1a258d171d..3cdb3230e5d 100644 --- a/addons/website/__openerp__.py +++ b/addons/website/__openerp__.py @@ -8,7 +8,7 @@ OpenERP Website CMS """, 'author': 'OpenERP SA', - 'depends': ['base'], + 'depends': ['web'], 'installable': True, 'data': [ 'views/views.xml', diff --git a/addons/website/static/description/index.html b/addons/website/static/description/index.html new file mode 100644 index 00000000000..b0c9a52569e --- /dev/null +++ b/addons/website/static/description/index.html @@ -0,0 +1,166 @@ +
+
+
+

Enterprise Website Builder

+

Get an awesome website. Customize easily.

+
+
+
+ + + + +
+
+
+

+Create enterprise-grade website with our super easy builder; no backend, everything +is editable inline. Benefit from out-of-the-box business features; shop, events, blogs, +jobs announces, "our team" pages, etc. +

+ +
+
+
+ +
+
+

Edit Anything Inline

+

What You See Is What You Get. Really!

+
+

+ Create websites with no technical knowledge. OpenERP's unique + 'edit inline' approach makes website creation + surprisingly easy. No more complex backend with menu managers, + page editors, banner manager, ... Just click anywhere to any + content. +

+ "Want to change the price of a product? or put it in bold? Want to + change a blog title?" just click and change. What you see is what + you get. Really. +

+
+
+
+ +
+
+
+
+ +
+
+

Awsome. Astonishingly Beautiful.

+

Professional themes and building blocks

+
+ +
+
+

+ OpenERP's building block feature and inline edition approach + allows to design modern website that are not possible with + traditional WYSIWYG page editors. +

+ Whether it's for products descriptions, blogs or static pages, + you don't need to be a professioanl designer to create modern + and clean web pages. +

+
+
+
+ +
+
+

Enterprise-Ready, out-of-the-box

+

Install professional features without effort.

+
+

+ Activate ready-to-use enterprise features in just a click; + ecommerce, call-to-actions, jobs announces, events, customer + references, "our team" page, blogs, newsletters, etc. +

+ Traditional eCommerce and CMS have poor backends as it's not their + core focus. The OpenERP integration allows you to benefit from the + best management software to follow-up on your orders, your jobs + applicants, your leads, etc. +

+ You don't need anymore to synchronize your management software and + your ecommerce. +

+
+
+ +
+
+
+ +
+
+

Multi-languages Without Pain

+

Automate updates and transaltions easily

+
+
+ +
+
+
+

+ Get your website translated in multiple languages with no effort. + OpenERP proposes and propagates translations automatically + across pages. +

+ Our translation "on demand" features allows you to benefit from + professional translators to translate all your changes + automatically. Just change any part of your website (a new blog + post, a new pages, updated products, ...) and the translated + versions are updated automatically in around 32 hours. +

+
+
+
+ +
+
+

Designer-Friendly Themes

+

Designers love working on OpenERP

+
+

+ Themes are awesome and easy to design. You don't need to develop + to create new pages, themes or building blocks. We use a clean + HTML structure, a bootstrap + CSS and our modularity allows to distribute your themes easily. +

+ The building block approach allows the website to remain clean + after the end-users start creating new contents. +

+
+
+
+ +
+
+
+
+ +
+
+

Optimize your online presence efficiently

+

SEO tools at your finger tips

+
+

+ SEO tools are ready to use, with no configuration required. + OpenERP suggests keywords according to Google most searched + terms, Google Analytics tracks your shopping cart events, + sitemap and structuered content are created automatically for + Google indexation, etc. +

+
+
+
+ +
+
+
+
diff --git a/addons/website/static/lib/ckeditor.sharedspace/plugin.js b/addons/website/static/lib/ckeditor.sharedspace/plugin.js new file mode 100644 index 00000000000..ae8ddc79eb4 --- /dev/null +++ b/addons/website/static/lib/ckeditor.sharedspace/plugin.js @@ -0,0 +1,124 @@ +/** + * @license Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or http://ckeditor.com/license + */ + +(function() { + + 'use strict'; + + var containerTpl = CKEDITOR.addTemplate( 'sharedcontainer', '' + + '
' + + '' + + '
' + + '' ); + + CKEDITOR.plugins.add( 'sharedspace', { + afterInit: function( editor ) { + var spaces = editor.config.sharedSpaces; + + if ( spaces ) { + for ( var spaceName in spaces ) { + create( editor, spaceName, spaces[ spaceName ] ); + } + } + } + }); + + function create( editor, spaceName, targetId ) { + var target = CKEDITOR.document.getById( targetId ), + innerHtml, space; + + if ( target ) { + // Have other plugins filling the space. + innerHtml = editor.fire( 'uiSpace', { space: spaceName, html: '' } ).html; + + if ( innerHtml ) { + // Block the uiSpace handling by others (e.g. themed-ui). + editor.on( 'uiSpace', function( ev ) { + if ( ev.data.space == spaceName ) + ev.cancel(); + }, null, null, 1 ); // Hi-priority + + // Inject the space into the target. + space = target.append( CKEDITOR.dom.element.createFromHtml( containerTpl.output({ + id: editor.id, + name: editor.name, + langDir: editor.lang.dir, + langCode: editor.langCode, + space: spaceName, + spaceId: editor.ui.spaceId( spaceName ), + content: innerHtml + }))); + + // Only the first container starts visible. Others get hidden. + if ( target.getCustomData( 'cke_hasshared' ) ) + space.hide(); + else + target.setCustomData( 'cke_hasshared', 1 ); + + // There's no need for the space to be selectable. + space.unselectable(); + + // Prevent clicking on non-buttons area of the space from blurring editor. + space.on( 'mousedown', function( evt ) { + evt = evt.data; + if ( !evt.getTarget().hasAscendant( 'a', 1 ) ) + evt.preventDefault(); + }); + + // Register this UI space to the focus manager. + editor.focusManager.add( space, 1 ); + + // When the editor gets focus, show the space container, hiding others. + editor.on( 'focus', function() { + for ( var i = 0, sibling, children = target.getChildren(); ( sibling = children.getItem( i ) ); i++ ) { + if ( sibling.type == CKEDITOR.NODE_ELEMENT && + !sibling.equals( space ) && + sibling.hasClass( 'cke_shared' ) ) { + sibling.hide(); + } + } + + space.show(); + }); + + editor.on( 'destroy', function() { + space.remove(); + }); + } + } + } +})(); + +/** + * Makes it possible to place some of the editor UI blocks, like the toolbar + * and the elements path, into any element in the page. + * + * The elements used to hold the UI blocks can be shared among several editor + * instances. In that case, only the blocks of the active editor instance will + * display. + * + * // Place the toolbar inside the element with ID "someElementId" and the + * // elements path into the element with ID "anotherId". + * config.sharedSpaces = { + * top: 'someElementId', + * bottom: 'anotherId' + * }; + * + * // Place the toolbar inside the element with ID "someElementId". The + * // elements path will remain attached to the editor UI. + * config.sharedSpaces = { + * top: 'someElementId' + * }; + * + * @cfg {Object} [sharedSpaces] + * @member CKEDITOR.config + */ diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css index 7cd68099e2c..246d62b62be 100644 --- a/addons/website/static/src/css/editor.css +++ b/addons/website/static/src/css/editor.css @@ -1,3 +1,4 @@ +@charset "utf-8"; .oe_website_editorbar { position: fixed; top: 0; @@ -43,5 +44,13 @@ } .oe_editable:focus { - outline: #80b5f2 solid 5px !important; + outline: none !important; +} + +.oe_carousel_options { + cursor: pointer; + position: absolute; + white-space: nowrap; + z-index: 1; + display: none; } diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass index f1208ca2a80..24a549f1d05 100644 --- a/addons/website/static/src/css/editor.sass +++ b/addons/website/static/src/css/editor.sass @@ -39,4 +39,11 @@ padding-left: 6px .oe_editable:focus - outline: #80B5F2 solid 5px !important + outline: none !important + +.oe_carousel_options + cursor: pointer + position: absolute + white-space: nowrap + z-index: 1 + display: none diff --git a/addons/website/static/src/css/website.css b/addons/website/static/src/css/website.css index 0ff1d410de7..f47daad8c83 100644 --- a/addons/website/static/src/css/website.css +++ b/addons/website/static/src/css/website.css @@ -1,3 +1,11 @@ +/* THIS CSS FILE IS FOR WEBSITE THEMING CUSTOMIZATION ONLY + * + * css for editor buttons, openerp widget included in the website and other + * stuff must go to the editor.css + * + */ +/* ----- GENERIC LAYOUTING HELPERS ---- */ +/* Vertical Spacing */ .mt128 { margin-top: 128px !important; } @@ -34,6 +42,88 @@ margin-top: 0px !important; } +.mb128 { + margin-bottom: 128px !important; +} + +.mb92 { + margin-bottom: 92px !important; +} + +.mb64 { + margin-bottom: 64px !important; +} + +.mb48 { + margin-bottom: 48px !important; +} + +.mb32 { + margin-bottom: 32px !important; +} + +.mb16 { + margin-bottom: 16px !important; +} + +.mb8 { + margin-bottom: 8px !important; +} + +.mb4 { + margin-bottom: 4px !important; +} + +.mb0 { + margin-bottom: 0px !important; +} + +/* Grid of unequally tall elements */ +.grid > [class*="span"] { + display: inline-block; + float: none; + vertical-align: top; + margin-right: -4px; + box-sizing: border-box; +} +.grid > [class*="span"].grid-align-top > [class*="span"] { + vertical-align: top; +} +.grid > [class*="span"].grid-align-middle > [class*="span"] { + vertical-align: middle; +} +.grid > [class*="span"].grid-align-bottom > [class*="span"] { + vertical-align: bottom; +} + +/* Table with two collumns aligned on the center */ +.table-equalized { + width: 100%; +} +.table-equalized td:first-child { + width: 50%; + text-align: right; + padding-right: 1em; + vertical-align: bottom; +} +.table-equalized td:last-child { + width: 50%; + text-align: left; + vertical-align: bottom; +} + +/* Theming pagination inside navbar */ +.navbar-inner > .pagination { + margin: 6px 0; +} +.navbar-inner > .pagination ul { + position: relative; + top: 2px; + border: solid 2px rgba(0, 0, 0, 0.05); + border-radius: 8px; +} + +/* ----- BOOTSTRAP HACK FOR STICKY FOOTER ----- */ html, body { height: 100%; box-sizing: border-box; @@ -57,6 +147,7 @@ footer { padding-bottom: 64px; } +/* ---- HOMEPAGE THEME CUSTOMIZATION ---- */ .subheader { letter-spacing: 3px; font-weight: 300; @@ -75,10 +166,20 @@ h5 { font-weight: bold; } +#myCarousel .item { + min-height: 300px; + color: white; +} + .nav > .pull-right { float: right !important; } +.thumbnail { + background: white; +} + +/* ---- HACK FOR COVERING UP CK EDITOR BOGUS P INSERTION --- */ .navbar .nav > li > p { margin-bottom: 0px; } @@ -98,16 +199,3 @@ h5 { .nav > li a { display: block; } - -#myCarousel .item { - min-height: 300px; - color: white; -} - -.carousel > .css_carousel_options { - cursor: pointer; - position: absolute; - white-space: nowrap; - z-index: 1; - display: none; -} \ No newline at end of file diff --git a/addons/website/static/src/css/website.sass b/addons/website/static/src/css/website.sass index 08848fb0346..c5e45aa288f 100644 --- a/addons/website/static/src/css/website.sass +++ b/addons/website/static/src/css/website.sass @@ -1,5 +1,16 @@ @charset "utf-8" +/* + * THIS CSS FILE IS FOR WEBSITE THEMING CUSTOMIZATION ONLY + * + * css for editor buttons, openerp widget included in the website and other + * stuff must go to the editor.css + * + */ + +/* ----- GENERIC LAYOUTING HELPERS ---- */ + +/* Vertical Spacing */ .mt128 margin-top: 128px !important .mt92 @@ -19,6 +30,62 @@ .mt0 margin-top: 0px !important +.mb128 + margin-bottom: 128px !important +.mb92 + margin-bottom: 92px !important +.mb64 + margin-bottom: 64px !important +.mb48 + margin-bottom: 48px !important +.mb32 + margin-bottom: 32px !important +.mb16 + margin-bottom: 16px !important +.mb8 + margin-bottom: 8px !important +.mb4 + margin-bottom: 4px !important +.mb0 + margin-bottom: 0px !important + +/* Grid of unequally tall elements */ +.grid > [class*="span"] + display: inline-block + float: none + vertical-align: top + margin-right: -4px + box-sizing: border-box + &.grid-align-top > [class*="span"] + vertical-align: top + &.grid-align-middle > [class*="span"] + vertical-align: middle + &.grid-align-bottom > [class*="span"] + vertical-align: bottom + +/* Table with two collumns aligned on the center */ +.table-equalized + width: 100% + td:first-child + width: 50% + text-align: right + padding-right: 1em + vertical-align: bottom + td:last-child + width: 50% + text-align: left + vertical-align: bottom + +/* Theming pagination inside navbar */ +.navbar-inner > .pagination + margin: 6px 0 + ul + position: relative + top: 2px + border: solid 2px rgba(0,0,0,0.05) + border-radius: 8px + +/* ----- BOOTSTRAP HACK FOR STICKY FOOTER ----- */ html,body height: 100% @@ -39,8 +106,8 @@ footer background: rgb(239, 248, 248) // rgb(221, 235, 227) padding-top: 64px padding-bottom: 64px - //* - color: #1abc9c !important + +/* ---- HOMEPAGE THEME CUSTOMIZATION ---- */ .subheader letter-spacing: 3px @@ -56,9 +123,19 @@ header.navbar-fixed-top h5 font-weight: bold +#myCarousel .item + min-height: 300px + color: white + + .nav > .pull-right float: right !important //bugfix for flatly theme +.thumbnail + background: white + +/* ---- HACK FOR COVERING UP CK EDITOR BOGUS P INSERTION --- */ + .navbar .nav > li > p margin-bottom: 0px @@ -75,13 +152,3 @@ h5 .nav > li a display: block -#myCarousel .item - min-height: 300px - color: white - -.carousel > .css_carousel_options - cursor: pointer - position: absolute - white-space: nowrap - z-index: 1 - display: none \ No newline at end of file diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index bec4a35637a..ba662288aae 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -159,157 +159,16 @@ instance.website.EditorBar = instance.web.Widget.extend({ }, }); -instance.website.Action = instance.web.Widget.extend({ - tagName: 'button', - attributes: { - type: 'button', - }, - events: { click: 'perform' }, - init: function (parent, name) { - this._super(parent); - this.name = name; - }, - start: function () { - this.$el.text(this.name); - return this._super(); - }, - /** - * Executes action - */ - perform: null, - toggle: function (to) { - this.$el.prop('disabled', !to); - }, -}); -var Style = instance.website.Style = instance.website.Action.extend({ - init: function (parent, name, style) { - this._super(parent, name); - this.style = style; - }, - perform: function () { - this.getParent().with_editor(function (editor) { - editor.applyStyle(new CKEDITOR.style(this.style)) - }.bind(this)); - }, -}); -var Command = instance.website.Command = instance.website.Action.extend({ - init: function (parent, name, command) { - this._super(parent, name); - this.command = command; - }, - perform: function () { - this.getParent().with_editor(function (editor) { - switch (typeof this.command) { - case 'string': editor.execCommand(this.command); break; - case 'function': this.command(editor); break; - } - }.bind(this)); - }, -}); -var Group = instance.website.ActionGroup = instance.website.Action.extend({ - template: 'Website.ActionGroup', - events: { 'click > button': 'perform' }, - instances: [], - init: function (parent, name, actions) { - this._super(parent, name); - this.actions = _(actions).map(this.getParent().proxy('init_command')); - }, - start: function () { - this.instances.push(this); - var $ul = this.$('ul'); - return $.when.apply(null, _(this.actions).map(function (action) { - var $li = $('
  • ').appendTo($ul); - return action.appendTo($li); - })); - }, - destroy: function () { - this.instances = _(this.instances).without(this); - return this._super(); - }, - perform: function () { - this.getParent().with_editor(function () { - _(this.instances).chain() - .without(this) - .pluck('$el') - .invoke('removeClass', 'open'); - // JS part of bootstrap dropdown does really weird stuff which - // interacts quite badly with the RTE thing, so bypass it - this.$el.toggleClass('open'); - }.bind(this), false); - return false; - }, - toggle: function (to) { - this.$('> button').prop('disabled', !to); - }, -}); - instance.website.RTE = instance.web.Widget.extend({ tagName: 'li', + id: 'oe_rte_toolbar', className: 'oe_right oe_rte_toolbar', - commands: [ - [Command, "\uf032", 'bold'], - [Command, "\uf033", 'italic'], - [Command, "\uf0cd", 'underline'], - [Command, "\uf0cc", 'strike'], - [Command, "\uf12b", 'superscript'], - [Command, "\uf12c", 'subscript'], - [Command, "\uf0c1", 'link'], - [Command, "\uf127", 'unlink'], - [Command, "\uf10d", 'blockquote'], - // 'image' uses either filebrowserImageUploadUrl or - // filebrowserUploadUrl, and provides a `link` tab. imagebutton only - // uses filebrowserImageUploadUrl and does not provide a `link` tab to - // hotlink an image from the internets. - [Command, "\uf03e", 'image'], - // [Command, "\uf030", 'imagebutton'], - [Group, "\uf0ca", [ - [Command, "\uf0ca", 'bulletedlist'], - [Command, "\uf0cb", 'numberedlist'], - [Command, "\uf03b", 'outdent'], - [Command, "\uf03c", 'indent'] - ]], - [Group, _lt("Heading"), [ - [Style, _lt('H1'), { element: 'h1' }], - [Style, _lt('H2'), { element: 'h2', }], - [Style, _lt('H3'), { element: 'h3', }], - [Style, _lt('H4'), { element: 'h4', }], - [Style, _lt('H5'), { element: 'h5', }], - [Style, _lt('H6'), { element: 'h6', }] - ]], - [Group, "\uf039", [ - [Command, "\uf039", 'justifyblock'], - [Command, "\uf036", 'justifyleft'], - [Command, "\uf038", 'justifyright'], - [Command, "\uf037", 'justifycenter'] - ]] - ], // editor.ui.items -> possible commands &al // editor.applyStyle(new CKEDITOR.style({element: "span",styles: {color: "#(color)"},overrides: [{element: "font",attributes: {color: null}}]}, {color: '#ff0000'})); - start: function () { - this.$el.hide(); - return $.when.apply( - null, _(this.commands).map(this.proxy('start_command'))); - }, - init_command: function (command) { - var type = command[0], args = command.slice(1); - args.unshift(this); - var F = function (args) { - return type.apply(this, args); - }; - F.prototype = type.prototype; - - return new F(args); - }, - start_command: function (command) { - return this.init_command(command).appendTo(this.$el); - }, start_edition: function ($elements) { var self = this; - this.$el.show(); - this.disable(); this.snippet_carousel(); - CKEDITOR.on('currentInstance', this.proxy('_change_focused_editor')); $elements .not('span, [data-oe-type]') .each(function () { @@ -321,48 +180,17 @@ instance.website.RTE = instance.web.Widget.extend({ }); }, - /** - * @param {Function} fn - * @param {Boolean} [snapshot=true] - * @returns {$.Deferred} - */ - with_editor: function (fn, snapshot) { - var editor = this._current_editor(); - if (snapshot !== false) { editor.fire('saveSnapshot'); } - return $.when(fn(editor)).then(function () { - if (snapshot !== false) { editor.fire('saveSnapshot'); } - editor.focus(); - }); - }, - - - toggle: function (to) { - _(this.getChildren()).chain() - .filter(function (child) { return child instanceof instance.website.Action }) - .invoke('toggle', to); - }, - disable: function () { - this.toggle(false); - }, - _current_editor: function () { return CKEDITOR.currentInstance; }, - _change_focused_editor: function () { - this.toggle(!!CKEDITOR.currentInstance); - }, _config: function () { var removed_plugins = [ - // remove toolbar entirely - 'toolbar,elementspath,resize', // remove custom context menu 'contextmenu,tabletools,liststyle', // magicline captures mousein/mouseout => draggable does not work 'magicline' ]; return { - // Don't load ckeditor's style rules - stylesSet: [], removePlugins: removed_plugins.join(','), uiColor: '', // Ensure no config file is loaded @@ -372,6 +200,31 @@ instance.website.RTE = instance.web.Widget.extend({ // Don't insert paragraphs around content in e.g.
  • autoParagraph: false, filebrowserImageUploadUrl: "/website/attach", + // Support for sharedSpaces in 4.x + extraPlugins: 'sharedspace', + // Place toolbar in controlled location + sharedSpaces: { top: 'oe_rte_toolbar' }, + toolbar: [ + {name: 'items', items: [ + "Bold", "Italic", "Underline", "Strike", "Subscript", + "Superscript", "TextColor", "BGColor", "RemoveFormat", + "Link", "Unlink", "Blockquote", "BulletedList", + "NumberedList", "Image", "Indent", "Outdent", + "JustifyLeft", "JustifyCenter", "JustifyRight", + "JustifyBlock", "Table", "Font", "FontSize", "Format", + "Styles" + ]} + ], + // styles dropdown in toolbar + stylesSet: [ + // emphasis + {name: "Muted", element: 'span', attributes: {'class': 'text-muted'}}, + {name: "Primary", element: 'span', attributes: {'class': 'text-primary'}}, + {name: "Warning", element: 'span', attributes: {'class': 'text-warning'}}, + {name: "Danger", element: 'span', attributes: {'class': 'text-danger'}}, + {name: "Success", element: 'span', attributes: {'class': 'text-success'}}, + {name: "Info", element: 'span', attributes: {'class': 'text-info'}} + ], }; }, // TODO clean diff --git a/addons/website/views/views.xml b/addons/website/views/views.xml index 237e04a674f..80802bd673f 100644 --- a/addons/website/views/views.xml +++ b/addons/website/views/views.xml @@ -53,8 +53,9 @@ <t t-esc="res_company.name"/> - + + ' % i for i in main.manifest_list('js', db=request.db, debug=debug)]), 'css': "\n".join('' % i for i in main.manifest_list('css', db=request.db, debug=debug)) @@ -48,7 +52,7 @@ class website(osv.osv): return values def render(self, template, values={}): - # context = { - # 'inherit_branding': values['editable'], - # } - return request.registry.get("ir.ui.view").render(request.cr, request.uid, template, values) + context = { + 'inherit_branding': values.get('editable', False), + } + return request.registry.get("ir.ui.view").render(request.cr, request.uid, template, values, context=context) diff --git a/addons/website_event/__openerp__.py b/addons/website_event/__openerp__.py index ad615c092d8..100175e6eee 100644 --- a/addons/website_event/__openerp__.py +++ b/addons/website_event/__openerp__.py @@ -8,7 +8,7 @@ OpenERP Blog """, 'author': 'OpenERP SA', - 'depends': ['website', 'event', 'website_sale'], + 'depends': ['website', 'event_sale', 'website_sale'], 'data': [ 'views/website_event.xml', 'security/ir.model.access.csv', diff --git a/addons/website_event/controllers/main.py b/addons/website_event/controllers/main.py index cca132dca36..adc4342b7d5 100644 --- a/addons/website_event/controllers/main.py +++ b/addons/website_event/controllers/main.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +from openerp import SUPERUSER_ID from openerp.addons.web import http from openerp.addons.web.http import request from openerp.tools.translate import _ @@ -61,11 +62,10 @@ class website_event(http.Controller): domain_search["country"] = [("country_id", "=", int(searches.get("country")))] def dom_without(without): - domain = [(1, "=", 1)] + domain = SUPERUSER_ID != request.uid and [('website_published', '=', True)] or [(1, "=", 1)] for key, search in domain_search.items(): if key != without: domain += search - print domain return domain # count by domains without self search @@ -96,7 +96,7 @@ class website_event(http.Controller): @http.route(['/event/'], type='http', auth="public") def event(self, event_id=None, **post): website = request.registry['website'] - event = request.registry['event.event'].browse(request.cr, request.uid, event_id) + event = request.registry['event.event'].browse(request.cr, request.uid, event_id, {'show_address': 1}) values = website.get_rendering_context({ 'event_id': event, 'google_map_url': "http://maps.googleapis.com/maps/api/staticmap?center=%s&sensor=false&zoom=12&size=298x298" % urllib.quote_plus('%s, %s %s, %s' % (event.street, event.city, event.zip, event.country_id and event.country_id.name_get()[0][1] or '')) diff --git a/addons/website_event/event.py b/addons/website_event/event.py index 72ad35a4210..65a8034951f 100644 --- a/addons/website_event/event.py +++ b/addons/website_event/event.py @@ -8,16 +8,29 @@ class event(osv.osv): _columns = { 'website_published': fields.boolean('Available in the website'), 'description_website': fields.html('Description for the website'), - 'product_ids': fields.one2many('event.event.product', "event_id", "Event"), + 'event_product_ids': fields.one2many('event.event.product', "event_id", "Event"), + 'organizer_id': fields.many2one('res.partner', "Orgonizer"), + 'phone': fields.related('orgonizer_id', 'phone', type='char', string='Phone'), + 'email': fields.related('orgonizer_id', 'email', type='char', string='Email'), } class event_product(osv.osv): _name = 'event.event.product' _columns = { + 'deadline': fields.date("Sales End"), 'event_id': fields.many2one('event.event', "Event"), - 'product_id': fields.many2one('product.product', 'Product'), + 'product_id': fields.many2one('product.product', 'Product', domain=[("event_type_id", "!=", False)]), 'price': fields.float('Price'), 'qty': fields.integer('Current Registrations', readonly=True), 'max_qty': fields.integer('Maximum Registrations'), } + def onchange_product_id(self, cr, uid, ids, product_id=False, context=None): + return {'value': {'price': self.pool.get("product.product").browse(cr, uid, product_id).list_price or 0}} + + +class product(osv.osv): + _inherit = 'product.product' + _columns = { + 'event_product_ids': fields.one2many('event.event.product', 'product_id', 'Linked event product'), + } diff --git a/addons/website_event/security/ir.model.access.csv b/addons/website_event/security/ir.model.access.csv index 6bc81d1794d..430fced34b5 100644 --- a/addons/website_event/security/ir.model.access.csv +++ b/addons/website_event/security/ir.model.access.csv @@ -1,2 +1,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_event_event_public,event.event.public,event.model_event_event,base.group_public,1,0,0,0 \ No newline at end of file +access_event_event_public,event.event.public,event.model_event_event,base.group_public,1,0,0,0 +access_event_event_product_public,event.event.product.public,website_event.model_event_event_product,base.group_public,1,0,0,0 +access_event_product_product_public,event.product.product.public,product.model_product_product,base.group_public,1,0,0,0 \ No newline at end of file diff --git a/addons/website_event/security/website_event.xml b/addons/website_event/security/website_event.xml index 05014176217..6c571eb4875 100644 --- a/addons/website_event/security/website_event.xml +++ b/addons/website_event/security/website_event.xml @@ -11,5 +11,25 @@ + + event product: Public + + [('event_id.website_published', '=', True)] + + + + + + + + Product linked to event: Public + + [("event_type_id", "!=", False), ('event_product_ids.event_id.website_published', '=', True)] + + + + + + diff --git a/addons/website_event/views/website_event.xml b/addons/website_event/views/website_event.xml index 125bec739a1..65ff07fa9dd 100644 --- a/addons/website_event/views/website_event.xml +++ b/addons/website_event/views/website_event.xml @@ -10,17 +10,19 @@ - - - - - - - - - + + + + + + + + + + + @@ -51,19 +53,7 @@ - - +