[MERGE] forward port branch 10.0 up to ef8cd11a6b
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user