summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2014-06-10 12:29:47 +0200
committerChristophe Simonis <chs@odoo.com>2014-06-10 12:29:47 +0200
commit6b8e9727e5ab2e7b841c307d4700934048af8d37 (patch)
tree771c742ebf5a550f9bd9c9389ce82a260ff71ac1
parent6eacf9167177b3809700b1ae96604fef03fb226b (diff)
parent4601d859440c7be464c670741e434a012e16d3b3 (diff)
[MERGE] forward port of branch saas-3 up to 4601d85
-rw-r--r--addons/account_analytic_analysis/account_analytic_analysis.py2
-rw-r--r--addons/account_analytic_analysis/account_analytic_analysis_view.xml3
-rw-r--r--addons/point_of_sale/wizard/pos_payment.py2
-rw-r--r--addons/project_timesheet/project_timesheet.py3
-rw-r--r--addons/report_webkit/webkit_report.py44
-rw-r--r--addons/stock/stock.py6
-rw-r--r--addons/web/static/src/js/view_form.js3
-rw-r--r--addons/web/static/src/xml/base.xml3
-rw-r--r--addons/web_kanban/static/src/css/kanban.css8
-rw-r--r--addons/web_kanban/static/src/css/kanban.sass8
-rw-r--r--addons/website/static/src/js/website.snippets.editor.js4
-rw-r--r--addons/website/views/website_templates.xml3
-rw-r--r--addons/website_event_track/views/website_event.xml4
-rw-r--r--openerp/addons/base/ir/ir_cron.py2
-rw-r--r--openerp/addons/base/ir/ir_model.py13
-rw-r--r--openerp/addons/base/module/module.py4
-rw-r--r--openerp/osv/fields.py12
-rw-r--r--openerp/osv/orm.py2
18 files changed, 72 insertions, 54 deletions
diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py
index 31927036a38..736a531cc66 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis.py
+++ b/addons/account_analytic_analysis/account_analytic_analysis.py
@@ -77,7 +77,7 @@ class account_analytic_invoice_line(osv.osv):
price = price_unit
elif pricelist_id:
price = res.price
- else:
+ if price is False:
price = res.list_price
if not name:
name = self.pool.get('product.product').name_get(cr, uid, [res.id], context=local_context)[0][1]
diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml
index af4caae608f..ba17a3c6a24 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml
+++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml
@@ -139,7 +139,8 @@
<group>
<field name="pricelist_id"
class="oe_inline"
- attrs="{'required': [('invoice_on_timesheets', '=', True)]}"/>
+ attrs="{'required': [('invoice_on_timesheets', '=', True)]}"
+ domain="[('type', '=', 'sale')]"/>
<field name="to_invoice"
class="oe_inline"
widget="selection"
diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py
index 02223153290..9ce9c2f4c87 100644
--- a/addons/point_of_sale/wizard/pos_payment.py
+++ b/addons/point_of_sale/wizard/pos_payment.py
@@ -124,7 +124,7 @@ class pos_make_payment(osv.osv_memory):
}
_defaults = {
'journal_id' : _default_journal,
- 'payment_date': time.strftime('%Y-%m-%d %H:%M:%S'),
+ 'payment_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'amount': _default_amount,
}
diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py
index 767cb4893b5..31a396369e2 100644
--- a/addons/project_timesheet/project_timesheet.py
+++ b/addons/project_timesheet/project_timesheet.py
@@ -198,7 +198,8 @@ class project_work(osv.osv):
if amount_unit and 'amount' in amount_unit.get('value',{}):
vals_line['amount'] = amount_unit['value']['amount']
- self.pool.get('hr.analytic.timesheet').write(cr, uid, [line_id.id], vals_line, context=context)
+ if vals_line:
+ self.pool.get('hr.analytic.timesheet').write(cr, uid, [line_id.id], vals_line, context=context)
return super(project_work,self).write(cr, uid, ids, vals, context)
diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py
index c442ea32549..53fe353f898 100644
--- a/addons/report_webkit/webkit_report.py
+++ b/addons/report_webkit/webkit_report.py
@@ -37,6 +37,7 @@ from openerp import report
import tempfile
import time
import logging
+from functools import partial
from report_helper import WebKitHelper
import openerp
@@ -119,7 +120,6 @@ class WebKitParser(report_sxw):
"""
def __init__(self, name, table, rml=False, parser=rml_parse,
header=True, store=False, register=True):
- self.parser_instance = False
self.localcontext = {}
report_sxw.__init__(self, name, table, rml, parser,
header, store, register=register)
@@ -230,16 +230,16 @@ class WebKitParser(report_sxw):
_logger.error('cannot remove file %s: %s', f_to_del, exc)
return pdf
- def translate_call(self, src):
+ def translate_call(self, parser_instance, src):
"""Translate String."""
ir_translation = self.pool['ir.translation']
name = self.tmpl and 'addons/' + self.tmpl or None
- res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid,
- name, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src)
+ res = ir_translation._get_source(parser_instance.cr, parser_instance.uid,
+ name, 'report', parser_instance.localcontext.get('lang', 'en_US'), src)
if res == src:
# no translation defined, fallback on None (backward compatibility)
- res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid,
- None, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src)
+ res = ir_translation._get_source(parser_instance.cr, parser_instance.uid,
+ None, 'report', parser_instance.localcontext.get('lang', 'en_US'), src)
if not res :
return src
return res
@@ -264,14 +264,14 @@ class WebKitParser(report_sxw):
if report_xml.report_type != 'webkit':
return super(WebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context)
- self.parser_instance = self.parser(cursor,
- uid,
- self.name2,
- context=context)
+ parser_instance = self.parser(cursor,
+ uid,
+ self.name2,
+ context=context)
self.pool = pool
objs = self.getObjects(cursor, uid, ids, context)
- self.parser_instance.set_context(objs, data, ids, report_xml.report_type)
+ parser_instance.set_context(objs, data, ids, report_xml.report_type)
template = False
@@ -299,21 +299,22 @@ class WebKitParser(report_sxw):
if not css :
css = ''
+ translate_call = partial(self.translate_call, parser_instance)
body_mako_tpl = mako_template(template)
helper = WebKitHelper(cursor, uid, report_xml.id, context)
- self.parser_instance.localcontext['helper'] = helper
- self.parser_instance.localcontext['css'] = css
- self.parser_instance.localcontext['_'] = self.translate_call
+ parser_instance.localcontext['helper'] = helper
+ parser_instance.localcontext['css'] = css
+ parser_instance.localcontext['_'] = translate_call
# apply extender functions
additional = {}
if xml_id in _extender_functions:
for fct in _extender_functions[xml_id]:
- fct(pool, cr, uid, self.parser_instance.localcontext, context)
+ fct(pool, cr, uid, parser_instance.localcontext, context)
if report_xml.precise_mode:
- ctx = dict(self.parser_instance.localcontext)
- for obj in self.parser_instance.localcontext['objects']:
+ ctx = dict(parser_instance.localcontext)
+ for obj in parser_instance.localcontext['objects']:
ctx['objects'] = [obj]
try :
html = body_mako_tpl.render(dict(ctx))
@@ -324,7 +325,7 @@ class WebKitParser(report_sxw):
raise except_osv(_('Webkit render!'), msg)
else:
try :
- html = body_mako_tpl.render(dict(self.parser_instance.localcontext))
+ html = body_mako_tpl.render(dict(parser_instance.localcontext))
htmls.append(html)
except Exception, e:
msg = u"%s" % e
@@ -332,22 +333,21 @@ class WebKitParser(report_sxw):
raise except_osv(_('Webkit render!'), msg)
head_mako_tpl = mako_template(header)
try :
- head = head_mako_tpl.render(dict(self.parser_instance.localcontext, _debug=False))
+ head = head_mako_tpl.render(dict(parser_instance.localcontext, _debug=False))
except Exception, e:
raise except_osv(_('Webkit render!'), u"%s" % e)
foot = False
if footer :
foot_mako_tpl = mako_template(footer)
try :
- foot = foot_mako_tpl.render(dict({},
- **self.parser_instance.localcontext))
+ foot = foot_mako_tpl.render(dict(parser_instance.localcontext))
except Exception, e:
msg = u"%s" % e
_logger.error(msg)
raise except_osv(_('Webkit render!'), msg)
if report_xml.webkit_debug :
try :
- deb = head_mako_tpl.render(dict(self.parser_instance.localcontext, _debug=tools.ustr("\n".join(htmls))))
+ deb = head_mako_tpl.render(dict(parser_instance.localcontext, _debug=tools.ustr("\n".join(htmls))))
except Exception, e:
msg = u"%s" % e
_logger.error(msg)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index c59fbc31da1..384bb3d362e 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -1126,13 +1126,13 @@ class stock_picking(osv.osv):
if not inv_type:
inv_type = self._get_invoice_type(picking)
+ invoice_vals = self._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context)
if group and partner.id in invoices_group:
invoice_id = invoices_group[partner.id]
invoice = invoice_obj.browse(cr, uid, invoice_id)
invoice_vals_group = self._prepare_invoice_group(cr, uid, picking, partner, invoice, context=context)
invoice_obj.write(cr, uid, [invoice_id], invoice_vals_group, context=context)
else:
- invoice_vals = self._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context)
invoice_id = invoice_obj.create(cr, uid, invoice_vals, context=context)
invoices_group[partner.id] = invoice_id
res[picking.id] = invoice_id
@@ -2188,12 +2188,12 @@ class stock_move(osv.osv):
done.append(move.id)
pickings[move.picking_id.id] = 1
r = res.pop(0)
- product_uos_qty = self.pool.get('stock.move').onchange_quantity(cr, uid, ids, move.product_id.id, r[0], move.product_id.uom_id.id, move.product_id.uos_id.id)['value']['product_uos_qty']
+ product_uos_qty = self.pool.get('stock.move').onchange_quantity(cr, uid, [move.id], move.product_id.id, r[0], move.product_id.uom_id.id, move.product_id.uos_id.id)['value']['product_uos_qty']
cr.execute('update stock_move set location_id=%s, product_qty=%s, product_uos_qty=%s where id=%s', (r[1], r[0],product_uos_qty, move.id))
while res:
r = res.pop(0)
- product_uos_qty = self.pool.get('stock.move').onchange_quantity(cr, uid, ids, move.product_id.id, r[0], move.product_id.uom_id.id, move.product_id.uos_id.id)['value']['product_uos_qty']
+ product_uos_qty = self.pool.get('stock.move').onchange_quantity(cr, uid, [move.id], move.product_id.id, r[0], move.product_id.uom_id.id, move.product_id.uos_id.id)['value']['product_uos_qty']
move_id = self.copy(cr, uid, move.id, {'product_uos_qty': product_uos_qty, 'product_qty': r[0], 'location_id': r[1]})
done.append(move_id)
if done:
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index dee685602ff..8bf948513a7 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -4732,7 +4732,8 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in
pop.select_element(
this.model,
{
- title: _t("Add: ") + this.m2m_field.string
+ title: _t("Add: ") + this.m2m_field.string,
+ no_create: this.m2m_field.options.no_create,
},
new instance.web.CompoundDomain(this.m2m_field.build_domain(), ["!", ["id", "in", this.m2m_field.dataset.ids]]),
this.m2m_field.build_context()
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 3a2f22e78a1..6017dcf2e50 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1472,8 +1472,9 @@
<t t-if="! widget.options.disable_multiple_selection">
<button type="button" class="oe_button oe_selectcreatepopup-search-select oe_highlight" disabled="disabled">Select</button>
</t>
+ <t t-if="!widget.options.no_create">
<button type="button" class="oe_button oe_selectcreatepopup-search-create">Create</button>
- or <a class="oe_selectcreatepopup-search-close oe_bold oe_form_button_cancel" href="javascript:void(0)">Cancel</a>
+ or </t><a class="oe_selectcreatepopup-search-close oe_bold oe_form_button_cancel" href="javascript:void(0)">Cancel</a>
</t>
<t t-name="AbstractFormPopup.buttons">
<t t-if="! readonly">
diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css
index db43cc00586..83562142643 100644
--- a/addons/web_kanban/static/src/css/kanban.css
+++ b/addons/web_kanban/static/src/css/kanban.css
@@ -95,6 +95,9 @@
.openerp .oe_kanban_view .oe_kanban_groups {
height: inherit;
}
+.openerp .oe_kanban_view .oe_kanban_groups_records {
+ height: 100%;
+}
.openerp .oe_kanban_view.oe_kanban_grouped_by_m2o .oe_kanban_group_title {
cursor: move;
}
@@ -162,10 +165,7 @@
padding: 0px;
background: white;
}
-.openerp .oe_kanban_view .oe_kanban_column, .openerp .oe_kanban_view .oe_kanban_column_cards {
- height: 100%;
-}
-.openerp .oe_kanban_view .oe_kanban_column, .openerp .oe_kanban_view .oe_kanban_column_cards {
+.openerp .oe_kanban_view.oe_kanban_grouped .oe_kanban_column, .openerp .oe_kanban_view.oe_kanban_grouped .oe_kanban_column_cards {
height: 100%;
}
.openerp .oe_kanban_view .oe_kanban_aggregates {
diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass
index 77533c1182e..8d2174bc22e 100644
--- a/addons/web_kanban/static/src/css/kanban.sass
+++ b/addons/web_kanban/static/src/css/kanban.sass
@@ -119,6 +119,8 @@
// KanbanGroups {{{
.oe_kanban_groups
height: inherit
+ .oe_kanban_groups_records
+ height: 100%
&.oe_kanban_grouped_by_m2o .oe_kanban_group_title
cursor: move
.oe_kanban_header
@@ -178,9 +180,9 @@
.oe_kanban_column
padding: 0px
background: #ffffff
-
- .oe_kanban_column, .oe_kanban_column_cards
- height: 100%
+ &.oe_kanban_grouped
+ .oe_kanban_column, .oe_kanban_column_cards
+ height: 100%
.oe_kanban_aggregates
padding: 0
margin: 0px
diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js
index 51e8bc3b991..94b170a0c59 100644
--- a/addons/website/static/src/js/website.snippets.editor.js
+++ b/addons/website/static/src/js/website.snippets.editor.js
@@ -973,7 +973,9 @@
},
clean_for_save: function () {
this._super();
- this.$target.find(".item").removeClass("next prev left right");
+ this.$target.find(".item").removeClass("next prev left right active");
+ this.$indicators.find('li').removeClass('active');
+ this.$indicators.find('li:first').addClass('active');
if(!this.$target.find(".item.active").length) {
this.$target.find(".item:first").addClass("active");
}
diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml
index f5051025117..2417ac154f4 100644
--- a/addons/website/views/website_templates.xml
+++ b/addons/website/views/website_templates.xml
@@ -209,7 +209,8 @@
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='//www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
- ga('create','<t t-esc="website.google_analytics_key"/>');ga('send','pageview');
+ ga('create',_.str.trim('<t t-esc="website.google_analytics_key"/>'));
+ ga('send','pageview');
</script>
</t>
</body>
diff --git a/addons/website_event_track/views/website_event.xml b/addons/website_event_track/views/website_event.xml
index 3cea1b35599..552033b5386 100644
--- a/addons/website_event_track/views/website_event.xml
+++ b/addons/website_event_track/views/website_event.xml
@@ -134,9 +134,7 @@
</h3>
<ul class="list-inline mb0">
<li t-if="track.speaker_ids" class="text-muted fa fa-user">
- <t t-foreach="track.speaker_ids" t-as="speaker">
- <t t-esc="speaker.name"/>,
- </t>
+ <t t-esc="', '.join([speaker.name for speaker in track.speaker_ids])"></t>
</li>
<li class="text-muted fa fa-calendar"> <span t-field="track.date" t-field-options='{"hide_seconds":"True"}'/></li>
<li class="text-muted fa fa-map-marker" t-if="track.location_id">
diff --git a/openerp/addons/base/ir/ir_cron.py b/openerp/addons/base/ir/ir_cron.py
index e5a5e5f024b..e0f6e38b5ba 100644
--- a/openerp/addons/base/ir/ir_cron.py
+++ b/openerp/addons/base/ir/ir_cron.py
@@ -238,7 +238,7 @@ class ir_cron(osv.osv):
locked_job = lock_cr.fetchone()
if not locked_job:
- # job was already executed by another parallel process/thread, skipping it.
+ _logger.debug("Job `%s` already executed by another process/thread. skipping it", job['name'])
continue
# Got the lock on the job row, run its code
_logger.debug('Starting job `%s`.', job['name'])
diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py
index 442dc0ce741..3101f52f2e0 100644
--- a/openerp/addons/base/ir/ir_model.py
+++ b/openerp/addons/base/ir/ir_model.py
@@ -1141,13 +1141,20 @@ class ir_model_data(osv.osv):
# Remove non-model records first, then model fields, and finish with models
unlink_if_refcount((model, res_id) for model, res_id in to_unlink
- if model not in ('ir.model','ir.model.fields'))
+ if model not in ('ir.model','ir.model.fields','ir.model.constraint'))
+ unlink_if_refcount((model, res_id) for model, res_id in to_unlink
+ if model == 'ir.model.constraint')
+
+ ir_module_module = self.pool['ir.module.module']
+ ir_model_constraint = self.pool['ir.model.constraint']
+ modules_to_remove_ids = ir_module_module.search(cr, uid, [('name', 'in', modules_to_remove)], context=context)
+ constraint_ids = ir_model_constraint.search(cr, uid, [('module', 'in', modules_to_remove_ids)], context=context)
+ ir_model_constraint._module_data_uninstall(cr, uid, constraint_ids, context)
+
unlink_if_refcount((model, res_id) for model, res_id in to_unlink
if model == 'ir.model.fields')
ir_model_relation = self.pool['ir.model.relation']
- ir_module_module = self.pool['ir.module.module']
- modules_to_remove_ids = ir_module_module.search(cr, uid, [('name', 'in', modules_to_remove)])
relation_ids = ir_model_relation.search(cr, uid, [('module', 'in', modules_to_remove_ids)])
ir_model_relation._module_data_uninstall(cr, uid, relation_ids, context)
diff --git a/openerp/addons/base/module/module.py b/openerp/addons/base/module/module.py
index b82e6b8242d..20091351343 100644
--- a/openerp/addons/base/module/module.py
+++ b/openerp/addons/base/module/module.py
@@ -436,11 +436,7 @@ class module(osv.osv):
including the deletion of all database structures created by the module:
tables, columns, constraints, etc."""
ir_model_data = self.pool.get('ir.model.data')
- ir_model_constraint = self.pool.get('ir.model.constraint')
modules_to_remove = [m.name for m in self.browse(cr, uid, ids, context)]
- modules_to_remove_ids = [m.id for m in self.browse(cr, uid, ids, context)]
- constraint_ids = ir_model_constraint.search(cr, uid, [('module', 'in', modules_to_remove_ids)])
- ir_model_constraint._module_data_uninstall(cr, uid, constraint_ids, context)
ir_model_data._module_data_uninstall(cr, uid, modules_to_remove, context)
self.write(cr, uid, ids, {'state': 'uninstalled'})
return True
diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py
index 439463b962a..a2bb213cbf6 100644
--- a/openerp/osv/fields.py
+++ b/openerp/osv/fields.py
@@ -1261,8 +1261,16 @@ class function(_column):
return new_values
def get(self, cr, obj, ids, name, uid=False, context=None, values=None):
- result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
- if self._multi:
+ multi = self._multi
+ # if we already have a value, don't recompute it.
+ # This happen if case of stored many2one fields
+ if values and not multi and name in values[0]:
+ result = {v['id']: v[name] for v in values}
+ elif values and multi and all(n in values[0] for n in name):
+ result = {v['id']: dict({n: v[n]} for n in name) for v in values}
+ else:
+ result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
+ if multi:
swap = {}
for rid, values in result.iteritems():
for f, v in values.iteritems():
diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py
index fdd39d4cb76..6796042922f 100644
--- a/openerp/osv/orm.py
+++ b/openerp/osv/orm.py
@@ -2816,7 +2816,7 @@ class BaseModel(object):
('numeric', 'float', get_pg_type(f)[1], '::'+get_pg_type(f)[1]),
('float8', 'float', get_pg_type(f)[1], '::'+get_pg_type(f)[1]),
]
- if f_pg_type == 'varchar' and f._type == 'char' and ((f.size is None and f_pg_size) or f_pg_size < f.size):
+ if f_pg_type == 'varchar' and f._type == 'char' and f_pg_size and (f.size is None or f_pg_size < f.size):
try:
with cr.savepoint():
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" TYPE %s' % (self._table, k, pg_varchar(f.size)))