[MERGE] forward port branch saas-11.3 up to 132e38beef

This commit is contained in:
Christophe Simonis
2019-06-19 14:41:36 +02:00
5 changed files with 18 additions and 3 deletions
+2 -1
View File
@@ -28,7 +28,8 @@ class report_product_pricelist(models.AbstractModel):
}
def _get_quantity(self, data):
return sorted([data['form'][key] for key in data['form'] if key.startswith('qty') and data['form'][key]])
form = data and data.get('form') or {}
return sorted([form[key] for key in form if key.startswith('qty') and form[key]])
def _get_categories(self, pricelist, products, quantities):
categ_data = []
@@ -1,6 +1,7 @@
odoo.define('website_sale_comparison.comparison', function (require) {
'use strict';
var concurrency = require('web.concurrency');
var core = require('web.core');
var utils = require('web.utils');
var Widget = require('web.Widget');
@@ -31,6 +32,7 @@ var ProductComparison = Widget.extend(ProductConfiguratorMixin, {
this.product_data = {};
this.comparelist_product_ids = JSON.parse(utils.get_cookie('comparelist_product_ids') || '[]');
this.product_compare_limit = 4;
this.guard = new concurrency.Mutex();
},
/**
* @override
@@ -157,6 +159,9 @@ var ProductComparison = Widget.extend(ProductConfiguratorMixin, {
* @private
*/
_addNewProducts: function (product_id) {
this.guard.exec(this._addNewProductsImpl.bind(this, product_id));
},
_addNewProductsImpl: function (product_id) {
var self = this;
$('.o_product_feature_panel').addClass('d-md-block');
if (!_.contains(self.comparelist_product_ids, product_id)) {
@@ -164,8 +169,9 @@ var ProductComparison = Widget.extend(ProductConfiguratorMixin, {
if (_.has(self.product_data, product_id)){
self._updateContent();
} else {
self._loadProducts([product_id]).then(function () {
return self._loadProducts([product_id]).then(function () {
self._updateContent();
self._updateCookie();
});
}
}
@@ -192,6 +198,9 @@ var ProductComparison = Widget.extend(ProductConfiguratorMixin, {
* @private
*/
_removeFromComparelist: function (e) {
this.guard.exec(this._removeFromComparelistImpl.bind(this, e));
},
_removeFromComparelistImpl: function (e) {
this.comparelist_product_ids = _.without(this.comparelist_product_ids, $(e.currentTarget).data('product_product_id'));
$(e.currentTarget).parents('.o_product_row').remove();
this._updateCookie();
@@ -222,6 +222,7 @@
<field name="symbol">¥</field>
<field name="rounding">1.00</field>
<field name="active" eval="False"/>
<field name="position">before</field>
<field name="currency_unit_label">Yen</field>
<field name="currency_subunit_label">Cen</field>
</record>
+4 -1
View File
@@ -248,7 +248,10 @@ class IrActionsActWindow(models.Model):
existing = self.filtered(lambda rec: rec.id in ids)
if len(existing) < len(self):
# mark missing records in cache with a failed value
exc = MissingError(_("Record does not exist or has been deleted."))
exc = MissingError(
_("Record does not exist or has been deleted.")
+ '\n\n({} {}, {} {})'.format(_('Records:'), (self - existing).ids[:6], _('User:'), self._uid)
)
for record in (self - existing):
record._cache.set_failed(self._fields, exc)
return existing
+1
View File
@@ -1267,6 +1267,7 @@ class IrModelAccess(models.Model):
else:
msg_tail = _("Please contact your system administrator if you think this is an error.") + "\n\n(" + _("Document model") + ": %s)"
msg_params = (model,)
msg_tail += ' - ({} {}, {} {})'.format(_('Operation:'), mode, _('User:'), self._uid)
_logger.info('Access Denied by ACLs for operation: %s, uid: %s, model: %s', mode, self._uid, model)
msg = '%s %s' % (msg_heads[mode], msg_tail)
raise AccessError(msg % msg_params)