Skip to content
Permalink
Browse files

[MERGE] forward port branch 12.0 up to 385342b

  • Loading branch information...
KangOl committed Apr 12, 2019
2 parents 4df0201 + 385342b commit efa90f78e552a980abb54fe70160aac441a0a788
@@ -703,7 +703,7 @@ def message_new(self, msg_dict, custom_values=None):
# Subscribe internal users on the newly created bill
partners = self.env['res.partner'].browse(seen_partner_ids)
is_internal = lambda p: (p.user_ids and
all(p.user_ids.mapped(lambda u: u.user_has_groups('base.group_user'))))
all(p.user_ids.mapped(lambda u: u.has_group('base.group_user'))))
partners_to_subscribe = partners.filtered(is_internal)
if partners_to_subscribe:
invoice.message_subscribe([p.id for p in partners_to_subscribe])
@@ -9,7 +9,7 @@
function longpolling() {
$.ajax({
type: 'POST',
url: 'http://'+window.location.host+'/point_of_sale/get_serialized_order',
url: window.location.origin+'/point_of_sale/get_serialized_order',
dataType: 'json',
beforeSend: function(xhr){xhr.setRequestHeader('Content-Type', 'application/json');},
data: JSON.stringify({jsonrpc: '2.0'}),
@@ -47,11 +47,14 @@
foreign_js();
}
}
if (!stop_longpolling) {
longpolling();
}
},

complete: function(jqXHR,err) {
error: function (jqXHR, status, err) {
if (!stop_longpolling) {
longpolling();
setTimeout(longpolling, 5000);
}
},

@@ -1035,7 +1035,13 @@ var FieldFloatToggle = AbstractField.extend({
* @returns {float} The current formatted value
*/
_getDisplayedValue: function () {
return parseFloat(this._formatValue(this.value));
// this.value is a plain float
// Matches what is in Database
var usrFormatValue = this._formatValue(this.value);
// usrFormatValue is string
// contains a float represented in a user specific format
// the float is the fraction by [this.factor] of this.value
return field_utils.parse['float'](usrFormatValue);
},
/**
* Formats the HTML input tag for edit mode and stores selection status.
@@ -1062,7 +1068,7 @@ var FieldFloatToggle = AbstractField.extend({
* one is not in the range, the next value of the closest one will be chosen.
*
* @private
* @returns {number} The next formatted value in the range
* @returns {number} The next value in the range
*/
_nextValue: function () {
var range = this.nodeOptions.range;
@@ -1091,7 +1097,8 @@ var FieldFloatToggle = AbstractField.extend({
if (this.mode === 'edit') {
ev.stopPropagation(); // only stop propagation in edit mode
var next_val = this._nextValue();
this._setValue(next_val.toString()); // will be parsed in _setValue
next_val = field_utils.format['float'](next_val);
this._setValue(next_val); // will be parsed in _setValue
}
},

@@ -2,4 +2,5 @@

from . import im_livechat
from . import website
from . import res_config_settings
from . import res_config_settings
from . import ir_http
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import api, fields, models
from odoo.osv import expression


class IrHttp(models.AbstractModel):
_inherit = 'ir.http'

@classmethod
def _get_translation_frontend_modules_domain(cls):
domain = super(IrHttp, cls)._get_translation_frontend_modules_domain()
return expression.OR([domain, [('name', '=', 'im_livechat')]])

@@ -234,8 +234,9 @@ def shop(self, page=0, category=None, search='', ppg=False, **post):

Category = request.env['product.public.category']
search_categories = False
search_product = Product.search(domain)
if search:
categories = Product.search(domain).mapped('public_categ_ids')
categories = search_product.mapped('public_categ_ids')
search_categories = Category.search([('id', 'parent_of', categories.ids)] + request.website.website_domain())
categs = search_categories.filtered(lambda c: not c.parent_id)
else:
@@ -250,15 +251,14 @@ def shop(self, page=0, category=None, search='', ppg=False, **post):
parent_category_ids.append(current_category.parent_id.id)
current_category = current_category.parent_id

product_count = Product.search_count(domain)
product_count = len(search_product)
pager = request.website.pager(url=url, total=product_count, page=page, step=ppg, scope=7, url_args=post)
products = Product.search(domain, limit=ppg, offset=pager['offset'], order=self._get_search_order(post))

ProductAttribute = request.env['product.attribute']
if products:
# get all products without limit
selected_products = Product.search(domain, limit=False)
attributes = ProductAttribute.search([('attribute_line_ids.value_ids', '!=', False), ('attribute_line_ids.product_tmpl_id', 'in', selected_products.ids)])
attributes = ProductAttribute.search([('attribute_line_ids.value_ids', '!=', False), ('attribute_line_ids.product_tmpl_id', 'in', search_product.ids)])
else:
attributes = ProductAttribute.browse(attributes_ids)

0 comments on commit efa90f7

Please sign in to comment.
You can’t perform that action at this time.