[MERGE] forward port branch 9.0 up to 0997a1cf6d

This commit is contained in:
Christophe Simonis
2017-01-23 13:39:09 +01:00
12 changed files with 62 additions and 23 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ class Board(Controller):
# Retrieve the 'My Dashboard' action from its xmlid
action = request.env['ir.model.data'].get_object('board', 'open_board_my_dash_action')
if action and action['res_model'] == 'board.board' and action['views'][0][1] == 'form':
if action and action['res_model'] == 'board.board' and action['views'][0][1] == 'form' and action_id:
# Maybe should check the content instead of model board.board ?
view_id = action['views'][0][0]
board = request.env[action['res_model']].fields_view_get(view_id, 'form')
+1 -1
View File
@@ -409,7 +409,7 @@ FavoriteMenu.include({
name = self.$add_dashboard_input.val();
return self.rpc('/board/add_to_dashboard', {
action_id: self.action_id,
action_id: self.action_id || false,
context_to_save: c,
domain: d,
view_mode: self.view_manager.active_view.type,
@@ -26,15 +26,22 @@ class wizard_valuation_history(osv.osv_memory):
ctx['history_date'] = data['date']
ctx['search_default_group_by_product'] = True
ctx['search_default_group_by_location'] = True
return {
'domain': "[('date', '<=', '" + data['date'] + "')]",
'name': _('Stock Value At Date'),
'view_type': 'form',
'view_mode': 'tree',
'res_model': 'stock.history',
'type': 'ir.actions.act_window',
'context': ctx,
}
action = self.pool.get('ir.model.data').xmlid_to_object(cr, uid, 'stock_account.action_stock_history', context=context)
if not action:
action = {
'view_type': 'form',
'view_mode': 'tree,graph,pivot',
'res_model': 'stock.history',
'type': 'ir.actions.act_window',
}
else:
action = action[0].read()[0]
action['domain'] = "[('date', '<=', '" + data['date'] + "')]"
action['name'] = _('Stock Value At Date')
action['context'] = ctx
return action
class stock_history(osv.osv):
@@ -92,6 +92,11 @@
</search>
</field>
</record>
<record id="action_stock_history" model="ir.actions.act_window">
<field name="name">Stock History</field>
<field name="res_model">stock.history</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph,pivot</field>
</record>
</data>
</openerp>
@@ -161,26 +161,30 @@ function parse_value (value, descriptor, value_if_empty) {
return parse_value(value, {type: "float"});
case 'datetime':
var datetime = moment(value, [date_pattern + ' ' + time_pattern, date_pattern_wo_zero + ' ' + time_pattern_wo_zero, moment.ISO_8601], true);
if (datetime.isValid())
if (datetime.isValid() && datetime.year() >= 1900)
return time.datetime_to_str(datetime.toDate());
datetime = moment(value, [date_pattern + ' ' + time_pattern, date_pattern_wo_zero + ' ' + time_pattern_wo_zero, moment.ISO_8601]);
if (datetime.isValid()) {
if (datetime.year() === 0) {
datetime.year(moment.utc().year());
}
return time.datetime_to_str(datetime.toDate());
if (datetime.year() >= 1900) {
return time.datetime_to_str(datetime.toDate());
}
}
throw new Error(_.str.sprintf(_t("'%s' is not a correct datetime"), value));
case 'date':
var date = moment(value, [date_pattern, date_pattern_wo_zero, moment.ISO_8601], true);
if (date.isValid())
if (date.isValid() && date.year() >= 1900)
return time.date_to_str(date.toDate());
date = moment(value, [date_pattern, date_pattern_wo_zero, moment.ISO_8601]);
if (date.isValid()) {
if (date.year() === 0) {
date.year(moment.utc().year());
}
return time.date_to_str(date.toDate());
if (date.year() >= 1900) {
return time.date_to_str(date.toDate());
}
}
throw new Error(_.str.sprintf(_t("'%s' is not a correct date"), value));
case 'time':
@@ -1061,8 +1061,10 @@ var One2ManyListView = X2ManyListView.extend({
this._dataset_changed = false;
});
this.on('warning', this, function(e) { // In case of a one2many, we do not want any warning which comes from the editor
e.stop_propagation();
this.on('warning', this, function(e) { // In case of editable list view, we do not want any warning which comes from the editor
if (this.editable()) {
e.stop_propagation();
}
});
},
do_add_record: function () {
+1 -1
View File
@@ -42,7 +42,7 @@ class WebsiteCustomer(http.Controller):
if tag_id:
tag_id = unslug(tag_id)[1] or 0
domain += [('tag_ids', 'in', tag_id)]
domain += [('website_tag_ids', 'in', tag_id)]
# group by country, based on customers found with the search(domain)
countries = partner_obj.read_group(
@@ -255,7 +255,7 @@ $('.oe_website_sale').each(function () {
var precision = 2;
if ($(".decimal_precision").length) {
precision = parseInt($(".decimal_precision").first().data('precision'));
precision = parseInt($(".decimal_precision").last().data('precision'));
}
var formatted = _.str.sprintf('%.' + precision + 'f', price).split('.');
formatted[0] = utils.insert_thousand_seps(formatted[0]);
+1 -2
View File
@@ -422,8 +422,7 @@
<template id="product_price">
<div itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer" class="product_price mt16">
<h4 class="oe_price_h4 css_editable_mode_hidden decimal_precision"
t-att-data-precision="user_id.partner_id.property_product_pricelist.currency_id.rounding">
<h4 class="oe_price_h4 css_editable_mode_hidden">
<span class="text-danger oe_default_price" style="text-decoration: line-through; white-space: nowrap;"
t-field="product.lst_price"
t-field-options='{
+11
View File
@@ -0,0 +1,11 @@
The Czech Republic, 18.01.2017
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Jiri Zatloukal zatloukal@apitea.com https://github.com/jirizatloukal
+11
View File
@@ -0,0 +1,11 @@
Algeria, 18/01/2017
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Zakria Makrelouf z.makrelouf@gmail.com https://github.com/zakiuu
+1 -1
View File
@@ -214,7 +214,7 @@ def image_colorize(original, randomize=True, color=(255, 255, 255)):
# generate the background color, past it as background
if randomize:
color = (randrange(32, 224, 24), randrange(32, 224, 24), randrange(32, 224, 24))
image.paste(color)
image.paste(color, box=(0, 0) + original.size)
image.paste(original, mask=original)
# return the new image
buffer = StringIO.StringIO()