From 0dd08bd148d6b2f74e8800ffe1b72b939876e214 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 20 Apr 2018 09:06:46 +0200 Subject: [PATCH 1/3] [FIX] mrp: change BOM - Create a MO for Product A with quantity to produce of 2 - Produce 1 - Open the associated BOM, and add a line to the bom - Go back to the MO and try to update the qty to produce to 1 Traceback: division by 0 opw-1838006 --- addons/mrp/models/mrp_production.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 16325a98500..5e3bb3a91bf 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -349,7 +349,7 @@ class MrpProduction(models.Model): source_location = routing.location_id else: source_location = self.location_src_id - original_quantity = self.product_qty - self.qty_produced + original_quantity = (self.product_qty - self.qty_produced) or 1.0 data = { 'sequence': bom_line.sequence, 'name': self.name, From 4d88e8e8223d04cff05e7f5b4fae2cef081707d9 Mon Sep 17 00:00:00 2001 From: Akim Juillerat Date: Thu, 19 Apr 2018 13:58:42 +0200 Subject: [PATCH 2/3] [FIX] hr_holidays: update _check_holidays constrains It was possible to edit a leave request in order to use a leave type which had no more days left. This was due to a missing field in the constrains call. Closes #24320 --- addons/hr_holidays/models/hr_holidays.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/models/hr_holidays.py b/addons/hr_holidays/models/hr_holidays.py index 469a60f0231..75ac11d3406 100644 --- a/addons/hr_holidays/models/hr_holidays.py +++ b/addons/hr_holidays/models/hr_holidays.py @@ -248,7 +248,7 @@ class Holidays(models.Model): if nholidays: raise ValidationError(_('You can not have 2 leaves that overlaps on same day!')) - @api.constrains('state', 'number_of_days_temp') + @api.constrains('state', 'number_of_days_temp', 'holiday_status_id') def _check_holidays(self): for holiday in self: if holiday.holiday_type != 'employee' or holiday.type != 'remove' or not holiday.employee_id or holiday.holiday_status_id.limit: From b16c4f50d43590f6eeef7b3812fe6ed16607974d Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Fri, 20 Apr 2018 15:57:46 +0200 Subject: [PATCH 3/3] [FIX] website_sale: avoid traceback when category don't exists In case the category is given in GET, ?category_id=xx, we cannot guarantee that the category exists This commit closes #24235 --- addons/website_sale/controllers/main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index eceb6a731c0..5a576083582 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -2,7 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. import json import logging -from werkzeug.exceptions import Forbidden +from werkzeug.exceptions import Forbidden, NotFound from odoo import http, tools, _ from odoo.http import request @@ -193,6 +193,11 @@ class WebsiteSale(http.Controller): else: ppg = PPG + if category: + category = request.env['product.public.category'].search([('id', '=', int(category))], limit=1) + if not category: + raise NotFound() + attrib_list = request.httprequest.args.getlist('attrib') attrib_values = [map(int, v.split("-")) for v in attrib_list if v] attributes_ids = set([v[0] for v in attrib_values]) @@ -213,9 +218,6 @@ class WebsiteSale(http.Controller): url = "/shop" if search: post["search"] = search - if category: - category = request.env['product.public.category'].browse(int(category)) - url = "/shop/category/%s" % slug(category) if attrib_list: post['attrib'] = attrib_list @@ -224,6 +226,7 @@ class WebsiteSale(http.Controller): parent_category_ids = [] if category: + url = "/shop/category/%s" % slug(category) parent_category_ids = [category.id] current_category = category while current_category.parent_id: