From 6dec0bc308616fb4c5818470c7fed112bde2517c Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 18 Sep 2018 10:26:43 +0200 Subject: [PATCH 1/4] [FIX] calendar: compare display_name for empty recordset When sorting by a many2many fields (e.g. partner_ids) with one of the record having an empty value on the sorted field, the comparison method used to compare and empty record (e.g. res.partner()) and a name_get result (e.g. "Agrolait"). This is because the sort_field was initialized with the result of self[field] but never assigned a new value below. Fallback on an empty string when no record is found Fixes #26908 --- addons/calendar/models/calendar.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index 0653621ed96..629f4bb00c7 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -997,9 +997,8 @@ class Meeting(models.Model): else: sort_fields[field] = self[field] if isinstance(self[field], models.BaseModel): - name_get = self[field].name_get() - if len(name_get) and len(name_get[0]) >= 2: - sort_fields[field] = name_get[0][1] + name_get = self[field].mapped('display_name') + sort_fields[field] = name_get and name_get[0] or '' if r_date: sort_fields['sort_start'] = r_date.strftime(VIRTUALID_DATETIME_FORMAT) else: From 29b3b21ad24f7b912db381cc0dc9d59d6b6db5e9 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Wed, 16 May 2018 15:37:53 +0200 Subject: [PATCH 2/4] [FIX] website_sale: website_order_line becomes computed field Fix on sale_coupon (enterprise) https://github.com/odoo/enterprise/pull/2224 needs this change to be able to merge SO lines when a program generates multiple discount lines on different taxes. Closes #24971 task-1866977 task-1832967 task-1857843 --- addons/website_sale/models/sale_order.py | 9 +++++++-- addons/website_sale_delivery/models/sale_order.py | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index e7ca966e329..a6e180bf6c3 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -14,8 +14,9 @@ class SaleOrder(models.Model): _inherit = "sale.order" website_order_line = fields.One2many( - 'sale.order.line', 'order_id', - string='Order Lines displayed on Website', readonly=True, + 'sale.order.line', + compute='_compute_website_order_line', + string='Order Lines displayed on Website', help='Order Lines to be displayed on the website. They should not be used for computation purpose.', ) cart_quantity = fields.Integer(compute='_compute_cart_info', string='Cart Quantity') @@ -23,6 +24,10 @@ class SaleOrder(models.Model): payment_tx_id = fields.Many2one('payment.transaction', string='Transaction', copy=False) only_services = fields.Boolean(compute='_compute_cart_info', string='Only Services') + @api.one + def _compute_website_order_line(self): + self.website_order_line = self.order_line + @api.multi @api.depends('website_order_line.product_uom_qty', 'website_order_line.product_id') def _compute_cart_info(self): diff --git a/addons/website_sale_delivery/models/sale_order.py b/addons/website_sale_delivery/models/sale_order.py index 43aa2f63d86..73b5dc6a52b 100644 --- a/addons/website_sale_delivery/models/sale_order.py +++ b/addons/website_sale_delivery/models/sale_order.py @@ -18,11 +18,11 @@ class SaleOrder(models.Model): has_delivery = fields.Boolean( compute='_compute_has_delivery', string='Has delivery', help="Has an order line set for delivery", store=True) - website_order_line = fields.One2many( - 'sale.order.line', 'order_id', - string='Order Lines displayed on Website', readonly=True, - domain=[('is_delivery', '=', False)], - help='Order Lines to be displayed on the website. They should not be used for computation purpose.') + + @api.one + def _compute_website_order_line(self): + super(SaleOrder, self)._compute_website_order_line() + self.website_order_line = self.website_order_line.filtered(lambda l: not l.is_delivery) @api.depends('order_line.price_unit', 'order_line.tax_id', 'order_line.discount', 'order_line.product_uom_qty') def _compute_amount_delivery(self): From 05f1a7886c21b5c88a3f13b3c07398b72a3a5334 Mon Sep 17 00:00:00 2001 From: SimoRubi Date: Mon, 17 Sep 2018 18:06:43 +0200 Subject: [PATCH 3/4] [FIX] project: project does not have hierarchical structure anymore The action is not used anywhere but was not working Closes #27034 --- addons/project/views/project_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index dd183bd13af..3f9a5bb5b36 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -588,7 +588,7 @@ action = model.activate_sample_project() Project's tasks form tree,form,calendar,graph,kanban - [('project_id', 'child_of', [active_id])] + [('project_id', '=', active_id)] {'project_id':active_id} From cda1bec3e0017fb3403cf895f863c4c53932e761 Mon Sep 17 00:00:00 2001 From: zeroheure Date: Thu, 18 Jan 2018 00:29:14 +0100 Subject: [PATCH 4/4] [DOC] cmdline: proper default for limit-memory The default values for --limit-memory-(soft|hard) had been changed in Odoo v8.0, but this change wasn't reflected in the cmdline --help. Closes #22315 --- doc/reference/cmdline.rst | 4 ++-- odoo/tools/config.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/reference/cmdline.rst b/doc/reference/cmdline.rst index 21f5b80ba6d..fa57319e4f9 100644 --- a/doc/reference/cmdline.rst +++ b/doc/reference/cmdline.rst @@ -54,7 +54,7 @@ Running the server Maximum allowed virtual memory per worker. If the limit is exceeded, the worker is killed and recycled at the end of the current request. - Defaults to 2048MB. + Defaults to 2048MiB. .. option:: --limit-memory-hard @@ -62,7 +62,7 @@ Running the server immediately killed without waiting for the end of the current request processing. - Defaults to 2560MB. + Defaults to 2560MiB. .. option:: --limit-time-cpu diff --git a/odoo/tools/config.py b/odoo/tools/config.py index 2bf198cc585..475f959a025 100644 --- a/odoo/tools/config.py +++ b/odoo/tools/config.py @@ -266,10 +266,12 @@ class configmanager(object): help="Specify the number of workers, 0 disable prefork mode.", type="int") group.add_option("--limit-memory-soft", dest="limit_memory_soft", my_default=2048 * 1024 * 1024, - help="Maximum allowed virtual memory per worker, when reached the worker be reset after the current request (default 671088640 aka 640MB).", + help="Maximum allowed virtual memory per worker, when reached the worker be " + "reset after the current request (default 2048MiB).", type="int") group.add_option("--limit-memory-hard", dest="limit_memory_hard", my_default=2560 * 1024 * 1024, - help="Maximum allowed virtual memory per worker, when reached, any memory allocation will fail (default 805306368 aka 768MB).", + help="Maximum allowed virtual memory per worker, when reached, any memory " + "allocation will fail (default 2560MiB).", type="int") group.add_option("--limit-time-cpu", dest="limit_time_cpu", my_default=60, help="Maximum allowed CPU time per request (default 60).",