[MERGE] forward port of branch 7.0 up to 6fdb783
This commit is contained in:
commit
4601d85944
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -4572,7 +4572,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()
|
||||
|
|
|
@ -1418,8 +1418,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">
|
||||
|
|
|
@ -93,6 +93,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;
|
||||
}
|
||||
|
@ -160,10 +163,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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -225,12 +225,21 @@ class ir_cron(osv.osv):
|
|||
lock_cr = db.cursor()
|
||||
try:
|
||||
# Try to grab an exclusive lock on the job row from within the task transaction
|
||||
# Restrict to the same conditions as for the search since the job may have already
|
||||
# been run by an other thread when cron is running in multi thread
|
||||
lock_cr.execute("""SELECT *
|
||||
FROM ir_cron
|
||||
WHERE id=%s
|
||||
WHERE numbercall != 0
|
||||
AND active
|
||||
AND nextcall <= (now() at time zone 'UTC')
|
||||
AND id=%s
|
||||
FOR UPDATE NOWAIT""",
|
||||
(job['id'],), log_exceptions=False)
|
||||
|
||||
locked_job = lock_cr.fetchone()
|
||||
if not locked_job:
|
||||
_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'])
|
||||
job_cr = db.cursor()
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -435,11 +435,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
|
||||
|
|
|
@ -1219,9 +1219,17 @@ class function(_column):
|
|||
return result
|
||||
|
||||
def get(self, cr, obj, ids, name, uid=False, context=None, values=None):
|
||||
result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
|
||||
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)
|
||||
for id in ids:
|
||||
if self._multi and id in result:
|
||||
if multi and id in result:
|
||||
for field, value in result[id].iteritems():
|
||||
if value:
|
||||
result[id][field] = self.postprocess(cr, uid, obj, field, value, context)
|
||||
|
|
|
@ -2769,7 +2769,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)))
|
||||
|
|
Loading…
Reference in New Issue