diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 640ac90249b..be41b06e346 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -1026,7 +1026,7 @@ class account_move_line(osv.osv):
if opening_reconciliation:
obj_move_rec.write(cr, uid, unlink_ids, {'opening_reconciliation': False})
obj_move_rec.unlink(cr, uid, unlink_ids)
- if all_moves:
+ if len(all_moves) >= 2:
obj_move_line.reconcile_partial(cr, uid, all_moves, 'auto',context=context)
return True
diff --git a/addons/auth_oauth/auth_oauth_view.xml b/addons/auth_oauth/auth_oauth_view.xml
index ffc39752ec6..5c889d3a686 100644
--- a/addons/auth_oauth/auth_oauth_view.xml
+++ b/addons/auth_oauth/auth_oauth_view.xml
@@ -11,6 +11,7 @@
+
diff --git a/addons/hr/hr.py b/addons/hr/hr.py
index 6d466204ed8..a47ec9269bb 100644
--- a/addons/hr/hr.py
+++ b/addons/hr/hr.py
@@ -226,7 +226,13 @@ class hr_employee(osv.osv):
'image': _get_default_image,
'color': 0,
}
-
+
+ def copy_data(self, cr, uid, ids, default=None, context=None):
+ if default is None:
+ default = {}
+ default.update({'child_ids': False})
+ return super(hr_employee, self).copy_data(cr, uid, ids, default, context=context)
+
def create(self, cr, uid, data, context=None):
if context is None:
context = {}
@@ -380,18 +386,23 @@ class hr_department(osv.osv):
res.append((record['id'], name))
return res
- def copy(self, cr, uid, ids, default=None, context=None):
+ def copy_data(self, cr, uid, ids, default=None, context=None):
if default is None:
default = {}
- default = default.copy()
default['member_ids'] = []
- return super(hr_department, self).copy(cr, uid, ids, default, context=context)
+ return super(hr_department, self).copy_data(cr, uid, ids, default, context=context)
class res_users(osv.osv):
_name = 'res.users'
_inherit = 'res.users'
+ def copy_data(self, cr, uid, ids, default=None, context=None):
+ if default is None:
+ default = {}
+ default.update({'employee_ids': False})
+ return super(res_users, self).copy_data(cr, uid, ids, default, context=context)
+
_columns = {
'employee_ids': fields.one2many('hr.employee', 'user_id', 'Related employees'),
}
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
index bb427680c05..83f74e463df 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
@@ -402,6 +402,9 @@ class hr_attendance(osv.osv):
employee = employee_obj.browse(cr, uid, employee_id, context=context)
tz = employee.user_id.partner_id.tz
+ if not date:
+ date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+
att_tz = timezone(tz or 'utc')
attendance_dt = datetime.strptime(date, DEFAULT_SERVER_DATETIME_FORMAT)
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index 43920ad56ce..fe960292344 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -420,14 +420,14 @@ class mail_thread(osv.AbstractModel):
fol_obj.unlink(cr, SUPERUSER_ID, fol_ids, context=context)
return res
- def copy(self, cr, uid, id, default=None, context=None):
+ def copy_data(self, cr, uid, id, default=None, context=None):
# avoid tracking multiple temporary changes during copy
context = dict(context or {}, mail_notrack=True)
default = default or {}
default['message_ids'] = []
default['message_follower_ids'] = []
- return super(mail_thread, self).copy(cr, uid, id, default=default, context=context)
+ return super(mail_thread, self).copy_data(cr, uid, id, default=default, context=context)
#------------------------------------------------------
# Automatically log tracked fields
diff --git a/addons/mail/res_config.py b/addons/mail/res_config.py
index c19eb4a38ee..2c94b432dc3 100644
--- a/addons/mail/res_config.py
+++ b/addons/mail/res_config.py
@@ -34,14 +34,14 @@ class project_configuration(osv.TransientModel):
}
def get_default_alias_domain(self, cr, uid, ids, context=None):
- alias_domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context)
- if not alias_domain:
+ alias_domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", default=None, context=context)
+ if alias_domain is None:
domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "web.base.url", context=context)
try:
alias_domain = urlparse.urlsplit(domain).netloc.split(':')[0]
except Exception:
pass
- return {'alias_domain': alias_domain}
+ return {'alias_domain': alias_domain or False}
def set_alias_domain(self, cr, uid, ids, context=None):
config_parameters = self.pool.get("ir.config_parameter")
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 5276e7f21e5..efb8582e9cb 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -2307,7 +2307,9 @@ class stock_move(osv.osv):
# if product is set to average price and a specific value was entered in the picking wizard,
# we use it
- if move.product_id.cost_method == 'average' and move.price_unit:
+ if move.location_dest_id.usage != 'internal' and move.product_id.cost_method == 'average':
+ reference_amount = qty * move.product_id.standard_price
+ elif move.product_id.cost_method == 'average' and move.price_unit:
reference_amount = qty * move.price_unit
reference_currency_id = move.price_currency_id.id or reference_currency_id
diff --git a/addons/warning/warning.py b/addons/warning/warning.py
index d582478113a..539316482d2 100644
--- a/addons/warning/warning.py
+++ b/addons/warning/warning.py
@@ -62,14 +62,14 @@ class sale_order(osv.osv):
message = False
partner = self.pool.get('res.partner').browse(cr, uid, part, context=context)
if partner.sale_warn != 'no-message':
- if partner.sale_warn == 'block':
- raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.sale_warn_msg)
title = _("Warning for %s") % partner.name
message = partner.sale_warn_msg
warning = {
'title': title,
'message': message,
}
+ if partner.sale_warn == 'block':
+ return {'value': {'partner_id': False}, 'warning': warning}
result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part, context=context)
@@ -90,14 +90,15 @@ class purchase_order(osv.osv):
message = False
partner = self.pool.get('res.partner').browse(cr, uid, part)
if partner.purchase_warn != 'no-message':
- if partner.purchase_warn == 'block':
- raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.purchase_warn_msg)
title = _("Warning for %s") % partner.name
message = partner.purchase_warn_msg
warning = {
'title': title,
'message': message
}
+ if partner.purchase_warn == 'block':
+ return {'value': {'partner_id': False}, 'warning': warning}
+
result = super(purchase_order, self).onchange_partner_id(cr, uid, ids, part)
if result.get('warning',False):
@@ -123,15 +124,16 @@ class account_invoice(osv.osv):
message = False
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
if partner.invoice_warn != 'no-message':
- if partner.invoice_warn == 'block':
- raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.invoice_warn_msg)
-
title = _("Warning for %s") % partner.name
message = partner.invoice_warn_msg
warning = {
'title': title,
'message': message
}
+
+ if partner.invoice_warn == 'block':
+ return {'value': {'partner_id': False}, 'warning': warning}
+
result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id,
date_invoice=date_invoice, payment_term=payment_term,
partner_bank_id=partner_bank_id, company_id=company_id)
@@ -154,14 +156,15 @@ class stock_picking(osv.osv):
title = False
message = False
if partner.picking_warn != 'no-message':
- if partner.picking_warn == 'block':
- raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.picking_warn_msg)
title = _("Warning for %s") % partner.name
message = partner.picking_warn_msg
warning = {
'title': title,
'message': message
}
+ if partner.picking_warn == 'block':
+ return {'value': {'partner_id': False}, 'warning': warning}
+
result = super(stock_picking, self).onchange_partner_in(cr, uid, ids, partner_id, context)
if result.get('warning',False):
warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
@@ -183,14 +186,15 @@ class stock_picking_in(osv.osv):
title = False
message = False
if partner.picking_warn != 'no-message':
- if partner.picking_warn == 'block':
- raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.picking_warn_msg)
title = _("Warning for %s") % partner.name
message = partner.picking_warn_msg
warning = {
'title': title,
'message': message
}
+ if partner.picking_warn == 'block':
+ return {'value': {'partner_id': False}, 'warning': warning}
+
result = super(stock_picking_in, self).onchange_partner_in(cr, uid, ids, partner_id, context)
if result.get('warning',False):
warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
@@ -209,14 +213,15 @@ class stock_picking_out(osv.osv):
title = False
message = False
if partner.picking_warn != 'no-message':
- if partner.picking_warn == 'block':
- raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.picking_warn_msg)
title = _("Warning for %s") % partner.name
message = partner.picking_warn_msg
warning = {
'title': title,
'message': message
}
+ if partner.picking_warn == 'block':
+ return {'value': {'partner_id': False}, 'warning': warning}
+
result = super(stock_picking_out, self).onchange_partner_in(cr, uid, ids, partner_id, context)
if result.get('warning',False):
warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
@@ -256,12 +261,12 @@ class sale_order_line(osv.osv):
message = False
if product_info.sale_line_warn != 'no-message':
- if product_info.sale_line_warn == 'block':
- raise osv.except_osv(_('Alert for %s!') % (product_info.name), product_info.sale_line_warn_msg)
title = _("Warning for %s") % product_info.name
message = product_info.sale_line_warn_msg
warning['title'] = title
warning['message'] = message
+ if product_info.sale_line_warn == 'block':
+ return {'value': {'product_id': False}, 'warning': warning}
result = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty,
uom, qty_uos, uos, name, partner_id,
@@ -288,12 +293,12 @@ class purchase_order_line(osv.osv):
message = False
if product_info.purchase_line_warn != 'no-message':
- if product_info.purchase_line_warn == 'block':
- raise osv.except_osv(_('Alert for %s!') % (product_info.name), product_info.purchase_line_warn_msg)
title = _("Warning for %s") % product_info.name
message = product_info.purchase_line_warn_msg
warning['title'] = title
warning['message'] = message
+ if product_info.purchase_line_warn == 'block':
+ return {'value': {'product_id': False}, 'warning': warning}
result = super(purchase_order_line, self).onchange_product_id(cr, uid, ids, pricelist, product, qty, uom,
partner_id, date_order, fiscal_position_id)