summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-01-16 15:32:10 +0100
committerChristophe Simonis <chs@odoo.com>2018-01-16 15:32:10 +0100
commitf05b2b120029da64679fc8dd9cd1f3f8b3c6abeb (patch)
tree67a3c1ae1e1bee4c2b43a5fc16c711fed675a39b /addons
parentaa8a39fc4f2dab278a0cf42a58656527ce1efe19 (diff)
parent5e474bb3f91650efd184f32c7f4f23e555aee3ec (diff)
[MERGE] forward port branch saas-15 up to 5e474bb3f91
Diffstat (limited to 'addons')
-rw-r--r--addons/purchase/models/account_invoice.py4
-rw-r--r--addons/stock_landed_costs/models/stock_landed_cost.py6
-rw-r--r--addons/website/static/src/js/website.js3
-rw-r--r--addons/website_slides/static/src/js/slides.js28
4 files changed, 25 insertions, 16 deletions
diff --git a/addons/purchase/models/account_invoice.py b/addons/purchase/models/account_invoice.py
index ec35351ddd0..b6b9553a875 100644
--- a/addons/purchase/models/account_invoice.py
+++ b/addons/purchase/models/account_invoice.py
@@ -91,7 +91,9 @@ class AccountInvoice(models.Model):
def _onchange_currency_id(self):
if self.currency_id:
for line in self.invoice_line_ids.filtered(lambda r: r.purchase_line_id):
- line.price_unit = line.purchase_id.currency_id.with_context(date=self.date_invoice).compute(line.purchase_line_id.price_unit, self.currency_id, round=False)
+ if line.purchase_id.currency_id != self.currency_id:
+ line.price_unit = line.purchase_id.currency_id.with_context(date=self.date_invoice)\
+ .compute(line.purchase_line_id.price_unit, self.currency_id, round=False)
@api.onchange('invoice_line_ids')
def _onchange_origin(self):
diff --git a/addons/stock_landed_costs/models/stock_landed_cost.py b/addons/stock_landed_costs/models/stock_landed_cost.py
index 12134cc0f0f..c4a6beaf307 100644
--- a/addons/stock_landed_costs/models/stock_landed_cost.py
+++ b/addons/stock_landed_costs/models/stock_landed_cost.py
@@ -191,9 +191,13 @@ class LandedCost(models.Model):
val_line_values.update({'cost_id': cost.id, 'cost_line_id': cost_line.id})
self.env['stock.valuation.adjustment.lines'].create(val_line_values)
total_qty += val_line_values.get('quantity', 0.0)
- total_cost += val_line_values.get('former_cost', 0.0)
total_weight += val_line_values.get('weight', 0.0)
total_volume += val_line_values.get('volume', 0.0)
+
+ former_cost = val_line_values.get('former_cost', 0.0)
+ # round this because former_cost on the valuation lines is also rounded
+ total_cost += tools.float_round(former_cost, precision_digits=digits[1]) if digits else former_cost
+
total_line += 1
for line in cost.cost_lines:
diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js
index 3c063ba60dc..d9d3943dcc1 100644
--- a/addons/website/static/src/js/website.js
+++ b/addons/website/static/src/js/website.js
@@ -241,7 +241,7 @@ odoo.define('website.website', function (require) {
/* Load localizations */
var lang = utils.get_cookie('website_lang') || $('html').attr('lang') || 'en_US';
- ajax.loadJS('/web/webclient/locale/' + lang.replace('-', '_'));
+ var localeDef = ajax.loadJS('/web/webclient/locale/' + lang.replace('-', '_'));
/**
* Object who contains all method and bind for the top bar, the template is create server side.
@@ -291,6 +291,7 @@ odoo.define('website.website', function (require) {
console.warn("website.ready is deprecated: Please use require('web_editor.base').ready()");
return base.ready();
},
+ localeDef: localeDef,
};
return data;
});
diff --git a/addons/website_slides/static/src/js/slides.js b/addons/website_slides/static/src/js/slides.js
index c4df6643f99..93ff942ab83 100644
--- a/addons/website_slides/static/src/js/slides.js
+++ b/addons/website_slides/static/src/js/slides.js
@@ -7,6 +7,7 @@ var core = require('web.core');
var time = require('web.time');
var Widget = require('web.Widget');
var local_storage = require('web.local_storage');
+var website = require('website.website');
var _t = core._t;
var page_widgets = {};
@@ -15,19 +16,20 @@ $(document).ready(function () {
var widget_parent = $('body');
-
- $("timeago.timeago").each(function (index, el) {
- var datetime = $(el).attr('datetime'),
- datetime_obj = time.str_to_datetime(datetime),
- // if presentation 7 days, 24 hours, 60 min, 60 second, 1000 millis old(one week)
- // then return fix formate string else timeago
- display_str = "";
- if (datetime_obj && new Date().getTime() - datetime_obj.getTime() > 7 * 24 * 60 * 60 * 1000) {
- display_str = datetime_obj.toDateString();
- } else {
- display_str = moment(datetime_obj).fromNow();
- }
- $(el).text(display_str);
+ website.localeDef.then(function () {
+ $("timeago.timeago").each(function (index, el) {
+ var datetime = $(el).attr('datetime'),
+ datetime_obj = time.str_to_datetime(datetime),
+ // if presentation 7 days, 24 hours, 60 min, 60 second, 1000 millis old(one week)
+ // then return fix formate string else timeago
+ display_str = "";
+ if (datetime_obj && new Date().getTime() - datetime_obj.getTime() > 7 * 24 * 60 * 60 * 1000) {
+ display_str = moment(datetime_obj).format('ll');
+ } else {
+ display_str = moment(datetime_obj).fromNow();
+ }
+ $(el).text(display_str);
+ });
});
// To prevent showing channel settings alert box once user closed it.