Master gaurav 05072018

This commit is contained in:
Gaurav Patel 2018-07-13 09:30:51 +00:00 committed by Parthiv Patel
parent 89863abf7d
commit 0ed7edd58a
20 changed files with 102 additions and 50 deletions

View File

@ -497,7 +497,6 @@ class Import(models.TransientModel):
'headers_type': header_types or False,
'preview': preview,
'options': options,
'advanced_mode': any([len(models.fix_import_export_id_paths(col)) > 1 for col in headers or []]),
'debug': self.user_has_groups('base.group_no_one'),
}
except Exception as error:

View File

@ -301,7 +301,6 @@ var DataImport = Widget.extend(ControlPanelMixin, {
this.$buttons.filter('.o_import_button').add(this.$('.oe_import_file_reload'))
.prop('disabled', false);
this.$el.addClass('oe_import_preview');
this.$('input.oe_import_advanced_mode').prop('checked', result.advanced_mode);
this.$('.oe_import_grid').html(QWeb.render('ImportView.preview', result));
if (result.headers.length === 1) {

View File

@ -76,7 +76,7 @@
id="oe_import_has_header" checked="checked"/>
<label for="oe_import_has_header">The first row
contains the label of the column</label>
<input type="checkbox" class="oe_import_advanced_mode" disabled="disabled"
<input type="checkbox" class="oe_import_advanced_mode" checked="checked"
id="oe_import_advanced_mode"/>
<label for="oe_import_advanced_mode">Show fields of relation fields (advanced)</label>
<p class="oe_import_noheaders">If the file contains

View File

@ -258,7 +258,7 @@ class TestPreview(TransactionCase):
['qux', '5', '6'],
])
# Ensure we only have the response fields we expect
self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'advanced_mode', 'debug'])
self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'debug'])
@unittest.skipUnless(can_import('xlrd'), "XLRD module not available")
def test_xls_success(self):
@ -288,7 +288,7 @@ class TestPreview(TransactionCase):
['qux', '5', '6'],
])
# Ensure we only have the response fields we expect
self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'advanced_mode', 'debug'])
self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'debug'])
@unittest.skipUnless(can_import('xlrd.xlsx'), "XLRD/XLSX not available")
def test_xlsx_success(self):
@ -318,7 +318,7 @@ class TestPreview(TransactionCase):
['qux', '5', '6'],
])
# Ensure we only have the response fields we expect
self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options','advanced_mode', 'debug'])
self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'debug'])
@unittest.skipUnless(can_import('odf'), "ODFPY not available")
def test_ods_success(self):
@ -348,7 +348,7 @@ class TestPreview(TransactionCase):
['aux', '5', '6'],
])
# Ensure we only have the response fields we expect
self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'advanced_mode', 'debug'])
self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'debug'])
class test_convert_import_data(TransactionCase):

View File

@ -24,6 +24,13 @@ class IrModule(models.Model):
imported = fields.Boolean(string="Imported Module")
@api.depends('name')
def _get_latest_version(self):
imported_modules = self.filtered(lambda m: m.imported and m.latest_version)
for module in imported_modules:
module.installed_version = module.latest_version
super(IrModule, self - imported_modules)._get_latest_version()
@api.multi
def _import_module(self, module, path, force=False):
known_mods = self.search([])
@ -32,6 +39,8 @@ class IrModule(models.Model):
terp = load_information_from_description_file(module, mod_path=path)
values = self.get_values_from_terp(terp)
if 'version' in terp:
values['latest_version'] = terp['version']
unmet_dependencies = set(terp['depends']).difference(installed_mods)

View File

@ -32,14 +32,14 @@ class AccountChartTemplate(models.Model):
for element in in_ids.with_context(lang=None):
if value[element.id]:
#copy Translation from Source to Destination object
xlat_obj.create({
'name': out_ids._name + ',' + in_field,
'type': 'model',
'res_id': out_ids[counter].id,
'lang': lang,
'src': element[in_field],
'value': value[element.id],
})
xlat_obj._set_ids(
out_ids._name + ',' + in_field,
'model',
lang,
out_ids[counter].ids,
value[element.id],
element[in_field]
)
else:
_logger.info('Language: %s. Translation from template: there is no translation available for %s!' % (lang, element[in_field]))
counter += 1

View File

@ -178,7 +178,7 @@ class WebsiteEventController(http.Controller):
'event': event,
'main_object': event,
'range': range,
'registrable': event._is_event_registrable()
'registrable': event.sudo()._is_event_registrable()
}
return request.render("website_event.event_description_full", values)
@ -264,6 +264,6 @@ class WebsiteEventController(http.Controller):
Attendees._prepare_attendee_values(registration))
return request.render("website_event.registration_complete", {
'attendees': Attendees,
'attendees': Attendees.sudo(),
'event': event,
})

View File

@ -132,7 +132,7 @@
<li>Participants preferably have a functional knowledge of our software (see Functional Training).</li>
</ul><p></p>
<p>To get more information, visit the <a target="_blank" href="http://flectra.com/">Flectra Official Website</a>.</p>
<p>To get more information, visit the <a target="_blank" href="http://flectrahq.com/">Flectra Official Website</a>.</p>
</div>
</div>
</div>
@ -291,7 +291,7 @@
<li>Participants preferably have a functional knowledge of our software (see Functional Training).</li>
</ul><p></p>
<p>To get more information, visit the <a target="_blank" href="http://flectra.com/">Flectra Official Website</a>.</p>
<p>To get more information, visit the <a target="_blank" href="http://flectrahq.com/">Flectra Official Website</a>.</p>
</div>
</div>
</div>
@ -463,7 +463,7 @@
<li>Participants preferably have a functional knowledge of our software (see Functional Training).</li>
</ul><p></p>
<p>To get more information, visit the <a target="_blank" href="https://www.flectra.com/">Flectra Official Website</a>.</p>
<p>To get more information, visit the <a target="_blank" href="https://www.flectrahq.com/">Flectra Official Website</a>.</p>
</div>
</div>
</div>

View File

@ -20,8 +20,11 @@ return instance.appendTo($form).then(function () {
flectra.define('website_event.website_event', function (require) {
var ajax = require('web.ajax');
var core = require('web.core');
var Widget = require('web.Widget');
var _t = core._t;
// Catch registration form event, because of JS for attendee details
var EventRegistrationForm = Widget.extend({
start: function () {
@ -31,7 +34,6 @@ var EventRegistrationForm = Widget.extend({
.off('click')
.removeClass('a-submit')
.click(function (ev) {
$(this).attr('disabled', true);
self.on_click(ev);
});
});
@ -41,22 +43,31 @@ var EventRegistrationForm = Widget.extend({
ev.preventDefault();
ev.stopPropagation();
var $form = $(ev.currentTarget).closest('form');
var $button = $(ev.currentTarget).closest('[type="submit"]');
var post = {};
$('#registration_form table').siblings('.alert').remove();
$('#registration_form select').each(function () {
post[$(this).attr('name')] = $(this).val();
});
var tickets_ordered = _.some(_.map(post, function (value, key) { return parseInt(value); }));
if (!tickets_ordered) {
return $('#registration_form table').after(
'<div class="alert alert-info">Please select at least one ticket.</div>'
);
$('<div class="alert alert-info"/>')
.text(_t('Please select at least one ticket.'))
.insertAfter('#registration_form table');
return $.Deferred();
} else {
$button.attr('disabled', true);
return ajax.jsonRpc($form.attr('action'), 'call', post).then(function (modal) {
var $modal = $(modal);
$modal.modal({backdrop: 'static', keyboard: false});
$modal.find('.modal-body > div').removeClass('container'); // retrocompatibility - REMOVE ME in master / saas-19
$modal.after($form).modal();
$modal.insertAfter($form).modal();
$modal.on('click', '.js_goto_event', function () {
$modal.modal('hide');
$button.prop('disabled', false);
});
$modal.on('click', '.close', function () {
$button.prop('disabled', false);
});
});
}

View File

@ -480,7 +480,7 @@
<t t-if="event.state != 'draft'" itemprop="availability" content="http://schema.org/Discontinued">
Event registration is closed.
</t>
<t t-if="uid">
<t t-if="request.env.user.has_group('event.group_event_manager')">
<a t-attf-href="/web#id=#{event.id}&amp;view_type=form&amp;model=event.event">
<i class="fa fa-plus-circle"></i>
<em>Configure and Launch Event Registration</em>

View File

@ -61,6 +61,9 @@ var ProductComparison = Widget.extend({
}
prod = parseInt(prod, 10);
}
if (!prod) {
return;
}
self.add_new_products(prod);
website_sale_utils.animate_clone($('#comparelist .o_product_panel_header'), $(this).closest('form'), -50, 10);
} else {

View File

@ -50,5 +50,9 @@
margin-right: 8px;
}
}
div.css_not_available .o_add_compare_dyn {
display: none;
}
}

View File

@ -57,7 +57,7 @@
<template id='recommended_product' inherit_id="website_sale.recommended_products" name="Alternative Products">
<xpath expr="//h3" position="replace">
<t t-set="ids" t-value="str(product.id) + ','+ ','.join([str(a) for a in product.alternative_product_ids.ids])"></t>
<t t-set="ids" t-value="str(product.product_variant_id.id) + ','+ ','.join([str(a) for a in product.alternative_product_ids.mapped('product_variant_id.id')])"/>
<div><span class='h3'>Suggested alternatives: </span><a class="btn btn-primary" t-attf-href="/shop/compare/?products=#{ids}"><i class="fa fa-exchange"></i> Compare</a></div>
</xpath>
</template>

View File

@ -36,14 +36,15 @@ class ProductWishlist(models.Model):
@api.model
def current(self):
"""Get all wishlist items that belong to current user or session."""
return self.search([
"""Get all wishlist items that belong to current user or session,
filter products that are unpublished."""
return self.sudo().search([
"|",
("partner_id", "=", self.env.user.partner_id.id),
"&",
("partner_id", "=", False),
("session", "=", self.env.user.current_session),
])
]).filtered('product_id.product_tmpl_id.website_published')
@api.model
def _add_to_wishlist(self, pricelist_id, currency_id, website_id, price, product_id, partner_id=False, session=False):

View File

@ -28,7 +28,12 @@ var ProductWishlist = Widget.extend({
if ($('.wishlist-section').length) {
$('.wishlist-section a.o_wish_rm').on('click', function (e){ self.wishlist_rm(e, false); });
$('.wishlist-section a.o_wish_add').on('click', function (e){ self.wishlist_add_or_mv(e); });
$('.wishlist-section a.o_wish_add').on('click', function (e){
$('.wishlist-section a.o_wish_add').addClass('disabled');
self.wishlist_add_or_mv(e).then(function(o) {
$('.wishlist-section a.o_wish_add').removeClass('disabled');
});
});
}
$('.oe_website_sale').on('change', 'input.js_variant_change, select.js_variant_change, ul[data-attribute_value_ids]', function(ev) {
@ -75,7 +80,7 @@ var ProductWishlist = Widget.extend({
if (!product_id && e.currentTarget.classList.contains('o_add_wishlist_dyn')) {
product_id = parseInt($el.parent().find('.product_id').val());
}
if (!_.contains(self.wishlist_product_ids, product_id)) {
if (product_id && !_.contains(self.wishlist_product_ids, product_id)) {
return ajax.jsonRpc('/shop/wishlist/add', 'call', {
'product_id': product_id
}).then(function () {
@ -133,7 +138,7 @@ var ProductWishlist = Widget.extend({
// can be hidden if empty
$('#my_cart').removeClass('hidden');
website_sale_utils.animate_clone($('#my_cart'), tr, 25, 40);
this.add_to_cart(product, tr.find('qty').val() || 1);
return this.add_to_cart(product, tr.find('qty').val() || 1);
},
wishlist_mv: function(e){
var tr = $(e.currentTarget).parents('tr');
@ -143,6 +148,7 @@ var ProductWishlist = Widget.extend({
website_sale_utils.animate_clone($('#my_cart'), tr, 25, 40);
var adding_deffered = this.add_to_cart(product, tr.find('qty').val() || 1);
this.wishlist_rm(e, adding_deffered);
return adding_deffered;
},
add_to_cart: function(product_id, qty_id) {
var add_to_cart = ajax.jsonRpc("/shop/cart/update_json", 'call', {

View File

@ -2,6 +2,10 @@
.td-wish-btn {
width: 140px;
}
div.css_not_available .o_add_wishlist_dyn {
display: none;
}
}
// XS size

View File

@ -186,8 +186,9 @@ class WebsiteSlides(http.Controller):
response.mimetype = 'application/pdf'
return response
@http.route('''/slides/slide/<model("slide.slide"):slide>/download''', type='http', auth="public", website=True)
def slide_download(self, slide, sitemap=False):
@http.route('''/slides/slide/<model("slide.slide"):slide>/download''', type='http', auth="public", website=True, sitemap=False)
def slide_download(self, slide, **kw):
slide = slide.sudo()
if slide.download_security == 'public' or (slide.download_security == 'user' and request.session.uid):
filecontent = base64.b64decode(slide.datas)
disposition = 'attachment; filename=%s.pdf' % werkzeug.urls.url_quote(slide.name)
@ -197,7 +198,7 @@ class WebsiteSlides(http.Controller):
('Content-Length', len(filecontent)),
('Content-Disposition', disposition)])
elif not request.session.uid and slide.download_security == 'user':
return werkzeug.utils.redirect('/web?redirect=/slides/slide/%s' % (slide.id))
return request.redirect('/web/login?redirect=/slides/slide/%s' % (slide.id))
return request.render("website.403")
@http.route('''/slides/slide/<model("slide.slide"):slide>/promote''', type='http', auth='user', website=True)

View File

@ -37,9 +37,9 @@
<field name="image" type="base64" file="website_slides/data/demo-thumbnails/QtIU0p8daAo.jpg"/>
<field name="description">Discover how you can integrate MRP, PLM, Quality and Maintenance in a single application to maximize the efficiency of your manufacturing operations.
Read more about the features at: https://www.flectra.com/page/manufacturing-features
Read more about the features at: https://www.flectrahq.com/manufacturing
Discover Flectra MRP: https://www.flectra.com/page/manufacturing</field>
Discover Flectra MRP: https://www.flectrahq.com/manufacturing</field>
</record>
<record id="slide_1" model="slide.slide">
<field name="name">Flectra CRM</field>
@ -51,7 +51,7 @@ Discover Flectra MRP: https://www.flectra.com/page/manufacturing</field>
<field name="website_published" eval="True"/>
<field name="tag_ids" eval="[(4, ref('tag1'))]"/>
<field name="image" type="base64" file="website_slides/data/demo-thumbnails/fgdz8MH2YHY.jpg"/>
<field name="description">Discover the CRM sales people love https://www.flectra.com/page/crm</field>
<field name="description">Discover the CRM sales people love https://www.flectrahq.com/crm</field>
</record>
<record id="slide_2" model="slide.slide">
<field name="name">Flectra All-in-One Software Demonstration</field>
@ -65,7 +65,7 @@ Discover Flectra MRP: https://www.flectra.com/page/manufacturing</field>
<field name="image" type="base64" file="website_slides/data/demo-thumbnails/tUx39vAENy0.jpg"/>
<field name="description">Discover the all-in-one business management software solution that fits any business size and use case.
Learn more at https://flectra.com</field>
Learn more at https://flectrahq.com</field>
</record>
<record id="slide_3" model="slide.slide">
<field name="name">Flectra Sign Demonstration</field>
@ -79,7 +79,7 @@ Learn more at https://flectra.com</field>
<field name="image" type="base64" file="website_slides/data/demo-thumbnails/8DBabYQ1nUE.jpg"/>
<field name="description">Stop doing manual printing and scanning. Move to electronic signature with Flectra Sign!
Discover more at https://www.flectra.com/page/sign</field>
Discover more at https://www.flectrahq.com/sign</field>
</record>
<record id="slide_5" model="slide.slide">
<field name="name">Awesome Timesheet by Flectra</field>
@ -120,7 +120,7 @@ iOS: http://bit.ly/1ZUZsZD</field>
<field name="image" type="base64" file="website_slides/data/demo-thumbnails/Vp5xqQOWLzE.jpg"/>
<field name="description">Warehouse management software for the 21st century.
Discover Flectra Inventory: https://www.flectra.com/page/warehouse</field>
Discover Flectra Inventory: https://www.flectrahq.com/warehouse</field>
</record>
<record id="slide_8" model="slide.slide">
<field name="name">Flectra Sales</field>
@ -132,7 +132,7 @@ Discover Flectra Inventory: https://www.flectra.com/page/warehouse</field>
<field name="website_published" eval="True"/>
<field name="tag_ids" eval="[(4, ref('tag1')), (4, ref('tag2'))]"/>
<field name="image" type="base64" file="website_slides/data/demo-thumbnails/VMuCr5_arsY.jpg"/>
<field name="description">Learn more at https://www.flectra.com/page/sales</field>
<field name="description">Learn more at https://www.flectrahq.com/sales</field>
</record>
<record id="slide_9" model="slide.slide">
@ -162,7 +162,7 @@ Discover Flectra Inventory: https://www.flectra.com/page/warehouse</field>
</record>
<record id="slide_11" model="slide.slide">
<field name="name">OpenSource CMS, A performance comparison - Mantavya Gajjar</field>
<field name="name">OpenSource CMS, A performance comparison</field>
<field name="datas" type="base64" file="website_slides/static/src/img/flectra-cms-comparision.pdf"/>
<field name="image" type="base64" file="website_slides/static/src/img/flectra-cms-comparision.png"/>
<field name="slide_type">presentation</field>
@ -171,7 +171,7 @@ Discover Flectra Inventory: https://www.flectra.com/page/warehouse</field>
<field name="website_published" eval="True"/>
<field name="likes">10</field>
<field name="slide_views">4718</field>
<field name="index_content">1. Open Source CMS A performance comparision Mantavya Gajjar Managining Director, Flectra India
<field name="index_content">1. Open Source CMS A performance comparision
2. Topics 1 2 3 4 5 o Introduction Products to Compare Test Environment o Test Cases (home, catalogue, product pages) Performance ● Google PageSpeed Inside ● Speed Test using Pingdom Scalability ● Load Test using Blitz Maintainability ● Source Code cloc ● Community to maintain the source code W3C Markup Validations o Conclusion
3. Introduction
4. Introduction Open Source Products, compared with Flectra
@ -240,7 +240,7 @@ Discover Flectra Inventory: https://www.flectra.com/page/warehouse</field>
67. Conclusion
68. Conclusion Performance : o Flectra is 3x times faster than the Drupal o Flectra is 6x times faster than the Magento o Flectra is 2x times faster than the Prestashop Scalability : o Flectra timeout at 198 users o Drupal timeout at 125 users o Magento timeout at 148 users o Prestashop timeout at 104 users Maintainability : o 1.3x times smaller then the drupal o 5.5x times smaller then the magento o 1.9x times smaller then the prestashop
69. Questions ?
70. Flectra sales@flectra.com +32 (0) 2 290 34 90 www.flectra.com R&amp;D and services offce Chaussée de Namur 40 B-1367 Grand Rosière Sales offce Avenue Van Nieuwenhuyse 6 B-1160 Brussels Thank You</field>
70. Flectra sales@flectrahq.com +32 (0) 2 290 34 90 www.flectrahq.com R&amp;D and services offce Chaussée de Namur 40 B-1367 Grand Rosière Sales offce Avenue Van Nieuwenhuyse 6 B-1160 Brussels Thank You</field>
</record>
<record model="slide.channel" id="channel_public">

View File

@ -16,6 +16,8 @@ from flectra.addons.http_routing.models.ir_http import slug
from flectra.tools import image
from flectra.tools.translate import html_translate
from flectra.exceptions import Warning
from flectra.http import request
from flectra.addons.http_routing.models.ir_http import url_for
class Channel(models.Model):
@ -368,10 +370,13 @@ class Slide(models.Model):
embed_code = fields.Text('Embed Code', readonly=True, compute='_get_embed_code')
def _get_embed_code(self):
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
base_url = request and request.httprequest.url_root or self.env['ir.config_parameter'].sudo().get_param('web.base.url')
if base_url[-1] == '/':
base_url = base_url[:-1]
for record in self:
if record.datas and (not record.document_id or record.slide_type in ['document', 'presentation']):
record.embed_code = '<iframe src="%s/slides/embed/%s?page=1" class="o_wslides_iframe_viewer" allowFullScreen="true" height="%s" width="%s" frameborder="0"></iframe>' % (base_url, record.id, 315, 420)
slide_url = base_url + url_for('/slides/embed/%s?page=1' % record.id)
record.embed_code = '<iframe src="%s" class="o_wslides_iframe_viewer" allowFullScreen="true" height="%s" width="%s" frameborder="0"></iframe>' % (slide_url, 315, 420)
elif record.slide_type == 'video' and record.document_id:
if not record.mime_type:
# embed youtube video

View File

@ -147,12 +147,22 @@ var PDFSlidesViewer = (function(){
PDFSlidesViewer.prototype.toggleFullScreenFooter = function(){
if(document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) {
$('div#PDFViewer > div.navbar-fixed-bottom').toggleClass('oe_show_footer');
var $navBarFooter = $('div#PDFViewer > div.navbar-fixed-bottom');
$navBarFooter.toggleClass('oe_show_footer');
if ($navBarFooter.css('display') === 'none') {
$navBarFooter.css('display', 'block');
$('div#PDFViewer').css('padding-bottom', '50px');
} else {
$navBarFooter.css('display', 'none');
$('div#PDFViewer').css('padding-bottom', '0');
}
}
}
PDFSlidesViewer.prototype.toggleFullScreen = function(){
var el = this.canvas.parentNode;
// The canvas and the navigation bar needs to be fullscreened
var el = this.canvas.parentNode.parentNode;
var isFullscreenAvailable = document.fullscreenEnabled || document.mozFullScreenEnabled || document.webkitFullscreenEnabled || document.msFullscreenEnabled || false;
if(isFullscreenAvailable){ // Full screen supported