diff --git a/addons/mrp/wizard/change_production_qty.py b/addons/mrp/wizard/change_production_qty.py index e9588516a0c..3422edd8cb5 100644 --- a/addons/mrp/wizard/change_production_qty.py +++ b/addons/mrp/wizard/change_production_qty.py @@ -68,7 +68,7 @@ class ChangeProductionQty(models.TransientModel): cycle_number * operation.time_cycle * 100.0 / operation.workcenter_id.time_efficiency) quantity = wo.qty_production - wo.qty_produced if production.product_id.tracking == 'serial': - quantity = 1.0 if float_is_zero(quantity, precision_digits=precision) else 0.0 + quantity = 1.0 if not float_is_zero(quantity, precision_digits=precision) else 0.0 else: quantity = quantity if (quantity > 0) else 0 if float_is_zero(quantity, precision_digits=precision): diff --git a/odoo/models.py b/odoo/models.py index 8fb6cc01951..595250b54f2 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -1761,7 +1761,8 @@ class BaseModel(object): order = '"%s" %s' % (order_field, '' if len(order_split) == 1 else order_split[1]) orderby_terms.append(order) elif order_field in aggregated_fields: - orderby_terms.append(order_part) + order_split[0] = '"' + order_field + '"' + orderby_terms.append(' '.join(order_split)) else: # Cannot order by a field that will not appear in the results (needs to be grouped or aggregated) _logger.warn('%s: read_group order by `%s` ignored, cannot sort on empty columns (not grouped/aggregated)',