[MERGE] forward port branch saas-14 up to 69d342f54c
This commit is contained in:
@@ -1487,7 +1487,22 @@ var ReceiptScreenWidget = ScreenWidget.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
print_web: function() {
|
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;
|
this.pos.get_order()._printed = true;
|
||||||
},
|
},
|
||||||
print_xml: function() {
|
print_xml: function() {
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ class ReportIntrastat(models.Model):
|
|||||||
else 0
|
else 0
|
||||||
end) as value,
|
end) as value,
|
||||||
sum(
|
sum(
|
||||||
case when uom.category_id != puom.category_id then (pt.weight * inv_line.quantity)
|
case when uom.category_id != puom.category_id then (coalesce(nullif(pp.weight, 0), pt.weight) * inv_line.quantity)
|
||||||
else (pt.weight * inv_line.quantity * uom.factor) end
|
else (coalesce(nullif(pp.weight, 0), pt.weight) * inv_line.quantity * uom.factor) end
|
||||||
) as weight,
|
) as weight,
|
||||||
sum(
|
sum(
|
||||||
case when uom.category_id != puom.category_id then inv_line.quantity
|
case when uom.category_id != puom.category_id then inv_line.quantity
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
from odoo import api, fields, models, tools, _
|
from odoo import api, fields, models, tools, _
|
||||||
import odoo.addons.decimal_precision as dp
|
import odoo.addons.decimal_precision as dp
|
||||||
from odoo.tools.translate import html_translate
|
from odoo.tools.translate import html_translate
|
||||||
from odoo.tools import float_is_zero
|
from odoo.tools import float_compare
|
||||||
|
|
||||||
|
|
||||||
class ProductStyle(models.Model):
|
class ProductStyle(models.Model):
|
||||||
@@ -208,8 +208,14 @@ class Product(models.Model):
|
|||||||
for p, p2 in zip(self, self2):
|
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))
|
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]
|
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]
|
# We must convert the price_without_pricelist in the same currency than the
|
||||||
p.website_price_difference = False if float_is_zero(price_without_pricelist - p.website_price, precision_rounding=pricelist.currency_id.rounding) else True
|
# 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]
|
p.website_public_price = taxes.compute_all(p2.lst_price, quantity=qty, product=p2, partner=partner)[ret]
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ odoo.define('website_sale.website_sale', function (require) {
|
|||||||
var product_ids = [];
|
var product_ids = [];
|
||||||
var product_dom = $(".js_product .js_add_cart_variants[data-attribute_value_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();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
_.each(product_dom, function (prod) {
|
_.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 () {
|
$(oe_website_sale).on("change", ".oe_cart input.js_quantity[data-product-id]", function () {
|
||||||
var $input = $(this);
|
var $input = $(this);
|
||||||
if ($input.data('update_change')) {
|
if ($input.data('update_change') || $('body').hasClass('editor_enable')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var value = parseInt($input.val() || 0, 10);
|
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
|
// hack to add and remove from cart with json
|
||||||
$(oe_website_sale).on('click', 'a.js_add_cart_json', function (ev) {
|
$(oe_website_sale).on('click', 'a.js_add_cart_json', function (ev) {
|
||||||
|
if ($('body').hasClass('editor_enable')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
var $link = $(ev.currentTarget);
|
var $link = $(ev.currentTarget);
|
||||||
var $input = $link.parent().find("input");
|
var $input = $link.parent().find("input");
|
||||||
|
|||||||
Reference in New Issue
Block a user