diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 4f1de653ae1..63ca07ac00b 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -219,7 +219,7 @@ class account_analytic_account(osv.osv): res['value']['description'] = template.description return res - def on_change_partner_id(self, cr, uid, ids,partner_id, name, context={}): + def on_change_partner_id(self, cr, uid, ids,partner_id, name, context=None): res={} if partner_id: partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 932a290b4a1..b6b95427db1 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -90,6 +90,11 @@ class hr_holidays_status(osv.osv): } def name_get(self, cr, uid, ids, context=None): + + if not context.get('employee_id',False): + # leave counts is based on employee_id, would be inaccurate if not based on correct employee + return super(hr_holidays_status, self).name_get(cr, uid, ids, context=context) + res = [] for record in self.browse(cr, uid, ids, context=context): name = record.name diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index d4b84bab012..2c1772405ca 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -83,7 +83,7 @@ - + diff --git a/addons/product/product.py b/addons/product/product.py index 523aae8b076..8496245ea91 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -833,14 +833,10 @@ class product_product(osv.osv): return res def copy(self, cr, uid, id, default=None, context=None): - context = context or {} - default = dict(default or {}) + if context is None: + context={} - # Craft our own ` (copy)` in en_US (self.copy_translation() - # will do the other languages). - context_wo_lang = dict(context or {}) - context_wo_lang.pop('lang', None) - product = self.browse(cr, uid, id, context_wo_lang) + product = self.browse(cr, uid, id, context) if context.get('variant'): # if we copy a variant or create one, we keep the same template default['product_tmpl_id'] = product.product_tmpl_id.id diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index bdd5ac9fd6f..a7f7bbfc869 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -622,13 +622,13 @@ class sale_order_line(osv.osv): res_packing = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context) res['value'].update(res_packing.get('value', {})) warning_msgs = res_packing.get('warning') and res_packing['warning']['message'] or '' - compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, precision_rounding=product_obj.uom_id.rounding) + compare_qty = float_compare(product_obj.virtual_available, qty, precision_rounding=uom2.rounding) if (product_obj.type=='product') and int(compare_qty) == -1 \ - and (product_obj.procure_method=='make_to_stock'): + and (product_obj.procure_method=='make_to_stock'): warn_msg = _('You plan to sell %.2f %s but you only have %.2f %s available !\nThe real stock is %.2f %s. (without reservations)') % \ - (qty, uom2 and uom2.name or product_obj.uom_id.name, - max(0,product_obj.virtual_available), product_obj.uom_id.name, - max(0,product_obj.qty_available), product_obj.uom_id.name) + (qty, uom2.name, + max(0,product_obj.virtual_available), uom2.name, + max(0,product_obj.qty_available), uom2.name) warning_msgs += _("Not enough stock ! : ") + warn_msg + "\n\n" #update of warning messages