diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 8b1b001c340..7c1cb9559a6 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1487,7 +1487,22 @@ var ReceiptScreenWidget = ScreenWidget.extend({ } }, print_web: function() { - window.print(); + if ($.browser.safari) { + document.execCommand('print', false, null); + } else { + try { + window.print(); + } catch(err) { + if (navigator.userAgent.toLowerCase().indexOf("android") > -1) { + this.gui.show_popup('error',{ + 'title':_t('Printing is not supported on some android browsers'), + 'body': _t('Printing is not supported on some android browsers due to no default printing protocol is available. It is possible to print your tickets by making use of an IoT Box.'), + }); + } else { + throw err; + } + } + } this.pos.get_order()._printed = true; }, print_xml: function() { diff --git a/addons/report_intrastat/report/report_intrastat_report.py b/addons/report_intrastat/report/report_intrastat_report.py index 3ff63b4a4f6..1ca5dfb4bec 100644 --- a/addons/report_intrastat/report/report_intrastat_report.py +++ b/addons/report_intrastat/report/report_intrastat_report.py @@ -40,8 +40,8 @@ class ReportIntrastat(models.Model): else 0 end) as value, sum( - case when uom.category_id != puom.category_id then (pt.weight * inv_line.quantity) - else (pt.weight * inv_line.quantity * uom.factor) end + case when uom.category_id != puom.category_id then (coalesce(nullif(pp.weight, 0), pt.weight) * inv_line.quantity) + else (coalesce(nullif(pp.weight, 0), pt.weight) * inv_line.quantity * uom.factor) end ) as weight, sum( case when uom.category_id != puom.category_id then inv_line.quantity diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index 8d33629e927..8b254139a77 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -3,7 +3,7 @@ from odoo import api, fields, models, tools, _ import odoo.addons.decimal_precision as dp from odoo.tools.translate import html_translate -from odoo.tools import float_is_zero +from odoo.tools import float_compare class ProductStyle(models.Model): @@ -208,8 +208,14 @@ class Product(models.Model): for p, p2 in zip(self, self2): taxes = partner.property_account_position_id.map_tax(p.taxes_id.sudo().filtered(lambda x: x.company_id == company_id)) p.website_price = taxes.compute_all(p2.price, pricelist.currency_id, quantity=qty, product=p2, partner=partner)[ret] - price_without_pricelist = taxes.compute_all(p.list_price, pricelist.currency_id)[ret] - p.website_price_difference = False if float_is_zero(price_without_pricelist - p.website_price, precision_rounding=pricelist.currency_id.rounding) else True + # We must convert the price_without_pricelist in the same currency than the + # website_price, otherwise the comparison doesn't make sense. Moreover, we show a price + # difference only if the website price is lower + price_without_pricelist = p.list_price + if company_id.currency_id != pricelist.currency_id: + price_without_pricelist = company_id.currency_id.compute(price_without_pricelist, pricelist.currency_id) + price_without_pricelist = taxes.compute_all(price_without_pricelist, pricelist.currency_id)[ret] + p.website_price_difference = True if float_compare(price_without_pricelist, p.website_price, precision_rounding=pricelist.currency_id.rounding) > 0 else False p.website_public_price = taxes.compute_all(p2.lst_price, quantity=qty, product=p2, partner=partner)[ret] @api.multi diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js index d699c351db9..4892beef7d1 100644 --- a/addons/website_sale/static/src/js/website_sale.js +++ b/addons/website_sale/static/src/js/website_sale.js @@ -88,7 +88,7 @@ odoo.define('website_sale.website_sale', function (require) { var product_ids = []; var product_dom = $(".js_product .js_add_cart_variants[data-attribute_value_ids]"); var qty = $(event.target).closest('form').find('input[name="add_qty"]').val(); - if (!product_dom.length) { + if (!product_dom.length || $('body').hasClass('editor_enable')) { return; } _.each(product_dom, function (prod) { @@ -129,7 +129,7 @@ odoo.define('website_sale.website_sale', function (require) { $(oe_website_sale).on("change", ".oe_cart input.js_quantity[data-product-id]", function () { var $input = $(this); - if ($input.data('update_change')) { + if ($input.data('update_change') || $('body').hasClass('editor_enable')) { return; } var value = parseInt($input.val() || 0, 10); @@ -198,6 +198,9 @@ odoo.define('website_sale.website_sale', function (require) { // hack to add and remove from cart with json $(oe_website_sale).on('click', 'a.js_add_cart_json', function (ev) { + if ($('body').hasClass('editor_enable')) { + return; + } ev.preventDefault(); var $link = $(ev.currentTarget); var $input = $link.parent().find("input");